diff --git a/0_Framework/Application/Version.cs b/0_Framework/Application/Version.cs index a3bd952a..1e4f922c 100644 --- a/0_Framework/Application/Version.cs +++ b/0_Framework/Application/Version.cs @@ -10,8 +10,8 @@ public static class Version { static Version() { - StyleVersion = "2.12.12"; - AdminVersion = "2.5.32"; + StyleVersion = "2.12.14"; + AdminVersion = "2.5.34"; CameraVersion = "1.0.7"; } diff --git a/Company.Domain/RollCallEmployeeAgg/IRollCallEmployeeRepository.cs b/Company.Domain/RollCallEmployeeAgg/IRollCallEmployeeRepository.cs index 781a5126..c957839e 100644 --- a/Company.Domain/RollCallEmployeeAgg/IRollCallEmployeeRepository.cs +++ b/Company.Domain/RollCallEmployeeAgg/IRollCallEmployeeRepository.cs @@ -9,7 +9,7 @@ public interface IRollCallEmployeeRepository : IRepository GetByWorkshopId(long workshopId); EditRollCallEmployee GetDetails(long id); RollCallEmployeeViewModel GetByEmployeeIdAndWorkshopId(long employeeId, long workshopId); - List GetPersonnelRollCallListPaginate(long workshopId, int pageIndex); + List GetPersonnelRollCallListPaginate(RollCallEmployeeSearchModel command); //rollcallEmployeeIncludeStatus RollCallEmployee GetWithRollCallStatus(long id); int activedPerson(long workshopId); diff --git a/Company.Domain/RollCallEmployeeStatusAgg/IRollCallEmployeeStatusRepository.cs b/Company.Domain/RollCallEmployeeStatusAgg/IRollCallEmployeeStatusRepository.cs index bc2bd54c..d525da41 100644 --- a/Company.Domain/RollCallEmployeeStatusAgg/IRollCallEmployeeStatusRepository.cs +++ b/Company.Domain/RollCallEmployeeStatusAgg/IRollCallEmployeeStatusRepository.cs @@ -1,4 +1,5 @@ using _0_Framework.Domain; +using CompanyManagment.App.Contracts.RollCallEmployee; using CompanyManagment.App.Contracts.RollCallEmployeeStatus; using System.Collections.Generic; @@ -7,5 +8,6 @@ namespace Company.Domain.RollCallEmployeeStatusAgg public interface IRollCallEmployeeStatusRepository : IRepository { List GetAll(); + void AdjustRollCallStatusEndDates(List command); } } diff --git a/CompanyManagment.App.Contracts/RollCallEmployee/AdjustRollCallEmployeesWithEmployeeLeftWork.cs b/CompanyManagment.App.Contracts/RollCallEmployee/AdjustRollCallEmployeesWithEmployeeLeftWork.cs new file mode 100644 index 00000000..2995b7d1 --- /dev/null +++ b/CompanyManagment.App.Contracts/RollCallEmployee/AdjustRollCallEmployeesWithEmployeeLeftWork.cs @@ -0,0 +1,10 @@ +using System; + +namespace CompanyManagment.App.Contracts.RollCallEmployee +{ + public class AdjustRollCallEmployeesWithEmployeeLeftWork + { + public long RollCallEmployeeId { get; set; } + public DateTime LeaveDate { get; set; } + } +} diff --git a/CompanyManagment.App.Contracts/RollCallEmployee/IRollCallEmployeeApplication.cs b/CompanyManagment.App.Contracts/RollCallEmployee/IRollCallEmployeeApplication.cs index 3a7086a0..66c51008 100644 --- a/CompanyManagment.App.Contracts/RollCallEmployee/IRollCallEmployeeApplication.cs +++ b/CompanyManagment.App.Contracts/RollCallEmployee/IRollCallEmployeeApplication.cs @@ -12,7 +12,7 @@ public interface IRollCallEmployeeApplication List GetByWorkshopId(long workshopId); EditRollCallEmployee GetDetails(long id); RollCallEmployeeViewModel GetByEmployeeIdAndWorkshopId(long employeeId, long workshopId); - List GetPersonnelRollCallListPaginate(long workshopId, int pageIndex); + List GetPersonnelRollCallListPaginate(RollCallEmployeeSearchModel command); List GetActivePersonnelByWorkshopId(long workshopId); bool IsEmployeeRollCallActive(long employeeId, long workshopId); int activedPerson(long workshopId); diff --git a/CompanyManagment.App.Contracts/RollCallEmployee/RollCallEmployeeSearchModel.cs b/CompanyManagment.App.Contracts/RollCallEmployee/RollCallEmployeeSearchModel.cs index 67d3c719..3b95d980 100644 --- a/CompanyManagment.App.Contracts/RollCallEmployee/RollCallEmployeeSearchModel.cs +++ b/CompanyManagment.App.Contracts/RollCallEmployee/RollCallEmployeeSearchModel.cs @@ -2,8 +2,9 @@ public class RollCallEmployeeSearchModel : EditRollCallEmployee { - - public string FullName { get; set; } + public long WorkshopId { get; set; } + public long EmployeeId { get; set; } + public string Name { get; set; } public string NationalCode { get; set; } - public string MaritalStatus { get; set; } + public int PageIndex { get; set; } } \ No newline at end of file diff --git a/CompanyManagment.Application/LeftWorkApplication.cs b/CompanyManagment.Application/LeftWorkApplication.cs index 041e1a8a..94559962 100644 --- a/CompanyManagment.Application/LeftWorkApplication.cs +++ b/CompanyManagment.Application/LeftWorkApplication.cs @@ -6,10 +6,13 @@ using _0_Framework.Application; using Company.Domain.ContractAgg; using Company.Domain.EmployeeAgg; using Company.Domain.LeftWorkAgg; +using Company.Domain.RollCallEmployeeAgg; +using Company.Domain.RollCallEmployeeStatusAgg; using Company.Domain.WorkshopAgg; using CompanyManagment.App.Contracts.Contract; using CompanyManagment.App.Contracts.LeftWork; using CompanyManagment.App.Contracts.PersonnleCode; +using CompanyManagment.App.Contracts.RollCallEmployee; using CompanyManagment.App.Contracts.WorkingHours; using CompanyManagment.App.Contracts.WorkingHoursItems; using PersianTools.Core; @@ -25,12 +28,14 @@ public class LeftWorkApplication : ILeftWorkApplication private readonly IWorkingHoursItemsApplication _workingHoursItemsApplication; private readonly IEmployeeRepository _employeeRepository; private readonly IWorkshopRepository _workshopRepository; + private readonly IRollCallEmployeeRepository _rollCallEmployeeRepository; + private readonly IRollCallEmployeeStatusRepository _rollCallEmployeeStatusRepository; - public LeftWorkApplication(ILeftWorkRepository leftWorkRepository, IContractRepository contractRepository, + public LeftWorkApplication(ILeftWorkRepository leftWorkRepository, IContractRepository contractRepository, IContractApplication contractApplication, IWorkingHoursApplication workingHoursApplication, IWorkingHoursItemsApplication workingHoursItemsApplication, IEmployeeRepository employeeRepository, - IWorkshopRepository workshopRepository) + IWorkshopRepository workshopRepository, IRollCallEmployeeStatusRepository rollCallEmployeeStatusRepository, IRollCallEmployeeRepository rollCallEmployeeRepository) { _leftWorkRepository = leftWorkRepository; _contractRepository = contractRepository; @@ -39,6 +44,8 @@ public class LeftWorkApplication : ILeftWorkApplication _workingHoursItemsApplication = workingHoursItemsApplication; _employeeRepository = employeeRepository; _workshopRepository = workshopRepository; + _rollCallEmployeeStatusRepository = rollCallEmployeeStatusRepository; + _rollCallEmployeeRepository = rollCallEmployeeRepository; } public OperationResult Create(CreateLeftWork command) @@ -111,8 +118,9 @@ public class LeftWorkApplication : ILeftWorkApplication command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay,workshop.ComputeOptions,workshop.BonusesOptions); _leftWorkRepository.Create(leftWork); _leftWorkRepository.SaveChanges(); + IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(command.EmployeeId); - return operation.Succcedded(); + return operation.Succcedded(); } //public OperationResult Create(CreateLeftWork command) @@ -184,7 +192,8 @@ public class LeftWorkApplication : ILeftWorkApplication command.EmployeeId, command.JobId, command.IncludeStatus, command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay); _leftWorkRepository.SaveChanges(); - return operation.Succcedded(); + IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(command.EmployeeId); + return operation.Succcedded(); } public EditLeftWork GetDetails(long id) @@ -527,8 +536,10 @@ public class LeftWorkApplication : ILeftWorkApplication } } - return _leftWorkRepository.CreateLeftWork(informationLeftwork); - } + operation = _leftWorkRepository.CreateLeftWork(informationLeftwork); + if (informationLeftwork != null && operation.IsSuccedded) IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(informationLeftwork.EmployeeId); + return operation; + } public OperationResult CreateLeftWorkByLeftWorkGroups(string employeeFullName, long commandEmployeeId, List commandPersonnelCode, List leftWorkGroups) { @@ -566,8 +577,10 @@ public class LeftWorkApplication : ILeftWorkApplication } } - return _leftWorkRepository.CreateLeftWorkByLeftWorkGroups(employeeFullName, commandEmployeeId, commandPersonnelCode, leftWorkGroups); - } + operation = _leftWorkRepository.CreateLeftWorkByLeftWorkGroups(employeeFullName, commandEmployeeId, commandPersonnelCode, leftWorkGroups); + if (operation.IsSuccedded) IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(commandEmployeeId); + return operation; + } public OperationResult CheckDeleteLeftWork(long workshopId, long employeeId, string date, int type) { @@ -578,4 +591,50 @@ public class LeftWorkApplication : ILeftWorkApplication { return _leftWorkRepository.CheckEditLeftWork(workshopId, employeeId, date.ToGeorgianDateTime(), type); } + + #region Pooya + //این متد ترک کار های کارمند را با فعالیت حضور غیاب یکپارچه می کند + private void IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(long employeeId) + { + + //get all leftworks for employee + var leftWorks = _leftWorkRepository.search(new LeftWorkSearchModel() { EmployeeId = employeeId }).GroupBy(x=>x.WorkshopId).Select(x=> + { + var leftwork = x.MaxBy(y => y.StartWorkDateGr); + return new LeftWorkViewModel() + { + EmployeeId = employeeId, + WorkshopId = x.Key, + LeftWorkDateGr = leftwork.LeftWorkDateGr, + StartWorkDateGr = leftwork.StartWorkDateGr + }; + }); + + //get rollCallEmployee associated with those leftworks which have a higher end date than leftworkDate + var rollCallsEmployee = _rollCallEmployeeRepository.GetByEmployeeIdWithStatuses(employeeId).GroupBy(x=>x.WorkshopId).Select( + x => + { + var maxRollCall = x.MaxBy(y => y.Statuses); + return new RollCallEmployeeViewModel() + { + WorkshopId = x.Key, + EmployeeId = employeeId, + Id=maxRollCall.Id, + Statuses = maxRollCall.Statuses + }; + }) + .Where(x => leftWorks.Any(y => y.WorkshopId == x.WorkshopId && x.Statuses.Any(z => z.StartDateGr < y.LeftWorkDateGr && z.EndDateGr > y.LeftWorkDateGr))); + + //shaping up the list to send as parameter to repository + var newRollCallRecords = rollCallsEmployee.Select(x => new AdjustRollCallEmployeesWithEmployeeLeftWork() + { + LeaveDate = leftWorks.FirstOrDefault(y => y.WorkshopId == x.WorkshopId && y.EmployeeId == x.EmployeeId)!.LeftWorkDateGr, + RollCallEmployeeId = x.Id + }).ToList(); + + + _rollCallEmployeeStatusRepository.AdjustRollCallStatusEndDates(newRollCallRecords); + } + + #endregion } \ No newline at end of file diff --git a/CompanyManagment.Application/RollCallEmployeeApplication.cs b/CompanyManagment.Application/RollCallEmployeeApplication.cs index 255df1c1..3f53d7db 100644 --- a/CompanyManagment.Application/RollCallEmployeeApplication.cs +++ b/CompanyManagment.Application/RollCallEmployeeApplication.cs @@ -8,6 +8,7 @@ using CompanyManagment.App.Contracts.RollCallEmployeeStatus; using System; using System.Collections.Generic; using System.Linq; +using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database; namespace CompanyManagment.Application; @@ -113,10 +114,10 @@ public class RollCallEmployeeApplication : IRollCallEmployeeApplication return _rollCallEmployeeRepository.GetByEmployeeIdAndWorkshopId(employeeId, workshopId); } - public List GetPersonnelRollCallListPaginate(long workshopId, int pageIndex) + public List GetPersonnelRollCallListPaginate(RollCallEmployeeSearchModel command) { - return _rollCallEmployeeRepository.GetPersonnelRollCallListPaginate(workshopId, pageIndex); - } + return _rollCallEmployeeRepository.GetPersonnelRollCallListPaginate(command); + } public int activedPerson(long workshopId) { diff --git a/CompanyManagment.Application/RollCallEmployeeStatusApplication.cs b/CompanyManagment.Application/RollCallEmployeeStatusApplication.cs index fb3ec617..5b7b7356 100644 --- a/CompanyManagment.Application/RollCallEmployeeStatusApplication.cs +++ b/CompanyManagment.Application/RollCallEmployeeStatusApplication.cs @@ -49,7 +49,7 @@ namespace CompanyManagment.Application return false; return _employeeRollCallStatusRepository.Exists(x => x.RollCallEmployeeId == rollCallEmployee.Id && - x.StartDate.Date < contractStart.Date && + x.StartDate.Date <= contractStart.Date && x.EndDate.Date > contractEnd.Date); } public OperationResult Deactivate(long id) diff --git a/CompanyManagment.EFCore/Repository/RollCallEmployeeRepository.cs b/CompanyManagment.EFCore/Repository/RollCallEmployeeRepository.cs index 861a65de..fad629b0 100644 --- a/CompanyManagment.EFCore/Repository/RollCallEmployeeRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallEmployeeRepository.cs @@ -66,36 +66,38 @@ public class RollCallEmployeeRepository : RepositoryBase }).FirstOrDefault(); } - public List GetPersonnelRollCallListPaginate(long workshopId, int pageIndex) + public List GetPersonnelRollCallListPaginate(RollCallEmployeeSearchModel command) { - var dateNow = DateTime.Now; - var f = _context.Employees.Include(x => x.LeftWorks).Include(x => x.LeftWorkInsurances) - .Where(x => x.LeftWorks.Any(y => y.WorkshopId == workshopId && y.StartWorkDate <= dateNow && y.LeftWorkDate > dateNow) || - x.LeftWorkInsurances.Any(y => y.WorkshopId == workshopId && y.StartWorkDate <= dateNow && - (y.LeftWorkDate > dateNow || y.LeftWorkDate == null))).ToList(); + var dateNow = DateTime.Now; + var rawQuery = _context.Employees.Include(x => x.LeftWorks).Include(x => x.LeftWorkInsurances) + .Where(x => x.LeftWorks.Any(y => y.WorkshopId == command.WorkshopId && y.StartWorkDate <= dateNow && y.LeftWorkDate > dateNow) || + x.LeftWorkInsurances.Any(y => y.WorkshopId == command.WorkshopId && y.StartWorkDate <= dateNow && + (y.LeftWorkDate > dateNow || y.LeftWorkDate == null))); + if (!string.IsNullOrWhiteSpace(command.Name)) + rawQuery = rawQuery.Where(x => (x.FName + " " + x.LName).Contains(command.Name)); + var list = rawQuery.ToList(); + var res = list.Select(x => new RollCallEmployeeViewModel + { + WorkshopId = command.WorkshopId, + EmployeeId = x.id, + Id = _context.RollCallEmployees.Any(r => r.EmployeeId == x.id && r.WorkshopId == command.WorkshopId) ? + _context.RollCallEmployees.FirstOrDefault(r => r.EmployeeId == x.id && r.WorkshopId == command.WorkshopId)!.id : 0, + EmployeeFullName = $"{x.FName} {x.LName}", + EmployeeSlug = _passwordHasher.SlugHasher(x.id), + NationalCode = _context.Employees.FirstOrDefault(e => e.id == x.id)?.NationalCode, + IsActiveString = _context.RollCallEmployees.Any(r => r.EmployeeId == x.id && r.WorkshopId == command.WorkshopId && r.IsActiveString == "true") ? "true" : "false", + HasUploadedImage = _context.RollCallEmployees.Any(r => r.EmployeeId == x.id && r.WorkshopId == command.WorkshopId && r.HasUploadedImage == "true") ? "true" : "false", + ImagePath = (System.IO.File.Exists(Path.Combine(_webHostEnvironment.ContentRootPath, "Faces", command.WorkshopId.ToString(), x.id.ToString(), "1.jpg"))) + ? Tools.ResizeImage(Path.Combine(_webHostEnvironment.ContentRootPath, "Faces", command.WorkshopId.ToString(), x.id.ToString(), "1.jpg"), 150, 150) + : "", + }).OrderBy(x => x.PersonelCode) + .Skip(command.PageIndex) + .Take(30) + .ToList(); - var res = f.Select(x => new RollCallEmployeeViewModel - { - WorkshopId = workshopId, - EmployeeId = x.id, - Id = _context.RollCallEmployees.Any(r => r.EmployeeId == x.id && r.WorkshopId == workshopId) ? - _context.RollCallEmployees.FirstOrDefault(r => r.EmployeeId == x.id && r.WorkshopId == workshopId)!.id : 0, - EmployeeFullName = $"{x.FName} {x.LName}", - EmployeeSlug = _passwordHasher.SlugHasher(x.id), - NationalCode = _context.Employees.FirstOrDefault(e => e.id == x.id).NationalCode, - IsActiveString = _context.RollCallEmployees.Any(r => r.EmployeeId == x.id && r.WorkshopId == workshopId && r.IsActiveString == "true") ? "true" : "false", - HasUploadedImage = _context.RollCallEmployees.Any(r => r.EmployeeId == x.id && r.WorkshopId == workshopId && r.HasUploadedImage == "true") ? "true" : "false", - ImagePath = (System.IO.File.Exists(Path.Combine(_webHostEnvironment.ContentRootPath, "Faces", workshopId.ToString(), x.id.ToString(), "1.jpg"))) - ? Tools.ResizeImage(Path.Combine(_webHostEnvironment.ContentRootPath, "Faces", workshopId.ToString(), x.id.ToString(), "1.jpg"), 150, 150) - : "", - }).OrderBy(x => x.PersonelCode) - .Skip(pageIndex) - .Take(30) - .ToList(); - - return res; - } + return res; + } public RollCallEmployee GetWithRollCallStatus(long id) { diff --git a/CompanyManagment.EFCore/Repository/RollCallEmployeeStatusRepository.cs b/CompanyManagment.EFCore/Repository/RollCallEmployeeStatusRepository.cs index 7d108fc8..c54c867e 100644 --- a/CompanyManagment.EFCore/Repository/RollCallEmployeeStatusRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallEmployeeStatusRepository.cs @@ -5,6 +5,7 @@ using CompanyManagment.App.Contracts.RollCallEmployeeStatus; using System; using System.Collections.Generic; using System.Linq; +using CompanyManagment.App.Contracts.RollCallEmployee; namespace CompanyManagment.EFCore.Repository { @@ -18,7 +19,8 @@ namespace CompanyManagment.EFCore.Repository - public List GetAll() + #region Pooya + public List GetAll() { return _context.RollCallEmployeesStatus.Select(x => new RollCallEmployeeStatusViewModel() { @@ -28,5 +30,25 @@ namespace CompanyManagment.EFCore.Repository }).ToList(); } + public void AdjustRollCallStatusEndDates(List command) + { + var rollCallEmployeeIds = command.Select(y => y.RollCallEmployeeId); + + var list = _context.RollCallEmployeesStatus.Where(x =>rollCallEmployeeIds.Any(y =>y == x.RollCallEmployeeId)) + .GroupBy(x => x.RollCallEmployeeId).AsEnumerable().Select(x=> new RollCallEmployeeStatusViewModel() + { + Id = x.MaxBy(c=>c.StartDate).id, + + + }).Select(c=>c.Id); + + var finalList = _context.RollCallEmployeesStatus.Where(x => list.Contains(x.id)).AsEnumerable(); + finalList.Where(x => command.Any(y => !y.LeaveDate.IsDateUndefined() && y.LeaveDate < x.EndDate)).ToList().ForEach(x => + x.Edit(x.StartDate, command.FirstOrDefault(y => y.RollCallEmployeeId == x.RollCallEmployeeId)!.LeaveDate) + ); + + _context.SaveChanges(); + } + #endregion } } diff --git a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs index 0cc4b3a6..802b1db1 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs +++ b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs @@ -1680,15 +1680,15 @@ public class IndexModel : PageModel var serachModel = new LeaveSearchModel() { EmployeeId = command.EmployeeId, - WorkshopId = command.WorkshopId, + WorkshopId = command.WorkshopId, PaidLeaveType = "روزانه", - + StartLeave = command.ContarctStart, EndLeave = command.ContractEnd, IsAccepted = true, }; var leavList = _leaveApplication.search(serachModel); - + var serachModel2 = new LeaveSearchModel() { EmployeeId = command.EmployeeId, @@ -1723,6 +1723,7 @@ public class IndexModel : PageModel } } + #region entityes var Notholiday = string.Empty; @@ -1816,7 +1817,8 @@ public class IndexModel : PageModel var conStartGr = command.ContarctStart.ToGeorgianDateTime(); var conEndGr = command.ContractEnd.ToGeorgianDateTime(); - int fridays= 0; + int fridays = 0; + #endregion #region SumRestTimesOneShift @@ -2656,7 +2658,7 @@ public class IndexModel : PageModel #endregion #region Rotating - + else if (command.ShiftWork == "4") { @@ -2664,7 +2666,7 @@ public class IndexModel : PageModel bool hasSickLeave = false; for (var da = d1; da <= d2; da.AddDays(1)) { - + var FirstDayOfMonth = new PersianDateTime(da.Year, da.Month, 1); var w1 = 0; var w2 = 0; @@ -2744,9 +2746,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2Shanbe1); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1Shanbe1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2Shanbe1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest0w1) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest0w1) endTimeSingel2 = endTimeSingel2.Subtract(rest0w1); sumRest = sumRest.Add(rest0w1); @@ -2755,7 +2757,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -2763,7 +2766,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } - + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -2772,16 +2775,17 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2Shanbe1); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1Shanbe1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2Shanbe1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest0w1) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest0w1) endTimeSingel2 = endTimeSingel2.Subtract(rest0w1); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -2809,9 +2813,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2Shanbe2); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1Shanbe2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2Shanbe2); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest0w2) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest0w2) endTimeSingel2 = endTimeSingel2.Subtract(rest0w2); sumRest = sumRest.Add(rest0w2); @@ -2820,7 +2824,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -2828,6 +2833,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -2836,14 +2842,15 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2Shanbe2); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1Shanbe2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2Shanbe2); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest0w2) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest0w2) endTimeSingel2 = endTimeSingel2.Subtract(rest0w2); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -2871,9 +2878,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2Shanbe3); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1Shanbe3); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2Shanbe3); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest0w3) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest0w3) endTimeSingel2 = endTimeSingel2.Subtract(rest0w3); sumRest = sumRest.Add(rest0w3); @@ -2882,7 +2889,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -2890,6 +2898,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -2898,15 +2907,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2Shanbe3); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1Shanbe3); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2Shanbe3); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest0w3) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest0w3) endTimeSingel2 = endTimeSingel2.Subtract(rest0w3); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -2934,9 +2944,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2Shanbe4); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1Shanbe4); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2Shanbe4); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest0w4) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest0w4) endTimeSingel2 = endTimeSingel2.Subtract(rest0w4); sumRest = sumRest.Add(rest0w4); @@ -2945,7 +2955,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -2953,6 +2964,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -2961,14 +2973,15 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2Shanbe4); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1Shanbe4); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2Shanbe4); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest0w3) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest0w3) endTimeSingel2 = endTimeSingel2.Subtract(rest0w4); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -2976,7 +2989,7 @@ public class IndexModel : PageModel { HolidaysAndNot = HolidaysAndNot.Add(rotatingCheck.TotalWorkingTime); } - + } } else if (command.Shanbe4 && leavId > 0) @@ -2997,9 +3010,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2Shanbe1); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1Shanbe1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2Shanbe1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest0w1) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest0w1) endTimeSingel2 = endTimeSingel2.Subtract(rest0w1); sumRest = sumRest.Add(rest0w1); @@ -3008,7 +3021,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -3016,6 +3030,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -3024,15 +3039,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2Shanbe1); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1Shanbe1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2Shanbe1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest0w1) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest0w1) endTimeSingel2 = endTimeSingel2.Subtract(rest0w1); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -3060,9 +3076,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2Shanbe2); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1Shanbe2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2Shanbe2); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest0w2) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest0w2) endTimeSingel2 = endTimeSingel2.Subtract(rest0w2); sumRest = sumRest.Add(rest0w2); @@ -3071,7 +3087,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -3079,6 +3096,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -3087,14 +3105,15 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2Shanbe2); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1Shanbe2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2Shanbe2); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest0w2) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest0w2) endTimeSingel2 = endTimeSingel2.Subtract(rest0w2); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -3125,9 +3144,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2YekShanbe1); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1YekShanbe1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2YekShanbe1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest1w1) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest1w1) endTimeSingel2 = endTimeSingel2.Subtract(rest1w1); sumRest = sumRest.Add(rest1w1); @@ -3136,7 +3155,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -3144,6 +3164,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -3152,15 +3173,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2YekShanbe1); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1YekShanbe1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2YekShanbe1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest1w1) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest1w1) endTimeSingel2 = endTimeSingel2.Subtract(rest1w1); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -3188,9 +3210,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2YekShanbe2); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1YekShanbe2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2YekShanbe2); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest1w2) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest1w2) endTimeSingel2 = endTimeSingel2.Subtract(rest1w2); sumRest = sumRest.Add(rest1w2); @@ -3199,7 +3221,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -3207,6 +3230,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -3215,15 +3239,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2YekShanbe2); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1YekShanbe2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2YekShanbe2); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest1w2) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest1w2) endTimeSingel2 = endTimeSingel2.Subtract(rest1w2); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -3251,9 +3276,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2YekShanbe3); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1YekShanbe3); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2YekShanbe3); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest1w3) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest1w3) endTimeSingel2 = endTimeSingel2.Subtract(rest1w3); sumRest = sumRest.Add(rest1w3); @@ -3262,7 +3287,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -3270,6 +3296,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -3278,15 +3305,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2YekShanbe3); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1YekShanbe3); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2YekShanbe3); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest1w3) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest1w3) endTimeSingel2 = endTimeSingel2.Subtract(rest1w3); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -3314,9 +3342,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2YekShanbe4); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1YekShanbe4); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2YekShanbe4); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest1w4) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest1w4) endTimeSingel2 = endTimeSingel2.Subtract(rest1w4); sumRest = sumRest.Add(rest1w4); @@ -3325,7 +3353,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -3333,6 +3362,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -3341,15 +3371,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2YekShanbe4); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1YekShanbe4); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2YekShanbe4); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest1w4) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest1w4) endTimeSingel2 = endTimeSingel2.Subtract(rest1w4); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -3377,9 +3408,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2YekShanbe1); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1YekShanbe1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2YekShanbe1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest1w1) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest1w1) endTimeSingel2 = endTimeSingel2.Subtract(rest1w1); sumRest = sumRest.Add(rest1w1); @@ -3388,7 +3419,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -3396,6 +3428,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -3404,15 +3437,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2YekShanbe1); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1YekShanbe1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2YekShanbe1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest1w1) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest1w1) endTimeSingel2 = endTimeSingel2.Subtract(rest1w1); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -3440,9 +3474,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2YekShanbe2); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1YekShanbe2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2YekShanbe2); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest1w2) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest1w2) endTimeSingel2 = endTimeSingel2.Subtract(rest1w2); sumRest = sumRest.Add(rest1w2); @@ -3451,7 +3485,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -3459,6 +3494,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -3467,15 +3503,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2YekShanbe2); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1YekShanbe2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2YekShanbe2); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest1w2) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest1w2) endTimeSingel2 = endTimeSingel2.Subtract(rest1w2); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -3506,9 +3543,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2DoShanbe1); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1DoShanbe1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2DoShanbe1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest2w1) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest2w1) endTimeSingel2 = endTimeSingel2.Subtract(rest2w1); sumRest = sumRest.Add(rest2w1); @@ -3518,7 +3555,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -3526,6 +3564,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -3534,15 +3573,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2DoShanbe1); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1DoShanbe1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2DoShanbe1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest2w1) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest2w1) endTimeSingel2 = endTimeSingel2.Subtract(rest2w1); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -3570,9 +3610,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2DoShanbe2); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1DoShanbe2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2DoShanbe2); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest2w2) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest2w2) endTimeSingel2 = endTimeSingel2.Subtract(rest2w2); sumRest = sumRest.Add(rest2w2); @@ -3581,7 +3621,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -3589,6 +3630,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -3597,15 +3639,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2DoShanbe2); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1DoShanbe2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2DoShanbe2); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest2w2) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest2w2) endTimeSingel2 = endTimeSingel2.Subtract(rest2w2); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -3633,9 +3676,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2DoShanbe3); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1DoShanbe3); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2DoShanbe3); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest2w3) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest2w3) endTimeSingel2 = endTimeSingel2.Subtract(rest2w3); sumRest = sumRest.Add(rest2w3); @@ -3644,7 +3687,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -3652,6 +3696,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -3660,15 +3705,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2DoShanbe3); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1DoShanbe3); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2DoShanbe3); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest2w3) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest2w3) endTimeSingel2 = endTimeSingel2.Subtract(rest2w3); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -3696,9 +3742,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2DoShanbe4); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1DoShanbe4); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2DoShanbe4); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest2w4) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest2w4) endTimeSingel2 = endTimeSingel2.Subtract(rest2w4); sumRest = sumRest.Add(rest2w4); @@ -3707,7 +3753,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -3715,6 +3762,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -3723,15 +3771,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2DoShanbe4); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1DoShanbe4); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2DoShanbe4); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest2w4) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest2w4) endTimeSingel2 = endTimeSingel2.Subtract(rest2w4); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -3759,9 +3808,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2DoShanbe1); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1DoShanbe1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2DoShanbe1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest2w1) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest2w1) endTimeSingel2 = endTimeSingel2.Subtract(rest2w1); sumRest = sumRest.Add(rest2w1); @@ -3770,7 +3819,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -3778,6 +3828,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -3786,15 +3837,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2DoShanbe1); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1DoShanbe1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2DoShanbe1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest2w1) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest2w1) endTimeSingel2 = endTimeSingel2.Subtract(rest2w1); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -3822,9 +3874,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2DoShanbe2); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1DoShanbe2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2DoShanbe2); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest2w2) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest2w2) endTimeSingel2 = endTimeSingel2.Subtract(rest2w2); sumRest = sumRest.Add(rest2w2); @@ -3833,7 +3885,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -3841,6 +3894,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -3849,15 +3903,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2DoShanbe2); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1DoShanbe2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2DoShanbe2); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest2w2) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest2w2) endTimeSingel2 = endTimeSingel2.Subtract(rest2w2); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -3888,9 +3943,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2SeShanbe1); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1SeShanbe1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2SeShanbe1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest3w1) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest3w1) endTimeSingel2 = endTimeSingel2.Subtract(rest3w1); sumRest = sumRest.Add(rest3w1); @@ -3899,7 +3954,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -3907,6 +3963,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -3915,15 +3972,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2SeShanbe1); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1SeShanbe1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2SeShanbe1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest3w1) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest3w1) endTimeSingel2 = endTimeSingel2.Subtract(rest3w1); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -3951,9 +4009,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2SeShanbe2); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1SeShanbe2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2SeShanbe2); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest3w2) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest3w2) endTimeSingel2 = endTimeSingel2.Subtract(rest3w2); sumRest = sumRest.Add(rest3w2); @@ -3962,7 +4020,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -3970,6 +4029,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -3978,15 +4038,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2SeShanbe2); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1SeShanbe2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2SeShanbe2); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest3w2) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest3w2) endTimeSingel2 = endTimeSingel2.Subtract(rest3w2); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -4014,9 +4075,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2SeShanbe3); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1SeShanbe3); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2SeShanbe3); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest3w3) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest3w3) endTimeSingel2 = endTimeSingel2.Subtract(rest3w3); sumRest = sumRest.Add(rest3w3); @@ -4025,7 +4086,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -4033,6 +4095,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -4041,15 +4104,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2SeShanbe3); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1SeShanbe3); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2SeShanbe3); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest3w3) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest3w3) endTimeSingel2 = endTimeSingel2.Subtract(rest3w3); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -4077,9 +4141,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2SeShanbe4); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1SeShanbe4); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2SeShanbe4); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest3w4) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest3w4) endTimeSingel2 = endTimeSingel2.Subtract(rest3w4); sumRest = sumRest.Add(rest3w4); @@ -4088,7 +4152,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -4096,6 +4161,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -4104,15 +4170,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2SeShanbe4); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1SeShanbe4); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2SeShanbe4); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest3w4) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest3w4) endTimeSingel2 = endTimeSingel2.Subtract(rest3w4); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -4140,9 +4207,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2SeShanbe1); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1SeShanbe1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2SeShanbe1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest3w1) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest3w1) endTimeSingel2 = endTimeSingel2.Subtract(rest3w1); sumRest = sumRest.Add(rest3w1); @@ -4151,7 +4218,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -4159,6 +4227,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -4167,15 +4236,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2SeShanbe1); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1SeShanbe1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2SeShanbe1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest3w1) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest3w1) endTimeSingel2 = endTimeSingel2.Subtract(rest3w1); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -4203,9 +4273,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2SeShanbe2); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1SeShanbe2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2SeShanbe2); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest3w2) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest3w2) endTimeSingel2 = endTimeSingel2.Subtract(rest3w2); sumRest = sumRest.Add(rest3w2); @@ -4214,7 +4284,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -4222,6 +4293,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -4230,15 +4302,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2SeShanbe2); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1SeShanbe2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2SeShanbe2); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest3w2) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest3w2) endTimeSingel2 = endTimeSingel2.Subtract(rest3w2); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -4270,10 +4343,10 @@ public class IndexModel : PageModel startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1CheharShanbe1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2CheharShanbe1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest4w1) + if (endTimeSingel2 - starTimeSingel1 >= rest4w1) endTimeSingel2 = endTimeSingel2.Subtract(rest4w1); sumRest = sumRest.Add(rest4w1); @@ -4282,7 +4355,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -4290,6 +4364,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -4299,16 +4374,17 @@ public class IndexModel : PageModel startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1CheharShanbe1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2CheharShanbe1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest4w1) + if (endTimeSingel2 - starTimeSingel1 >= rest4w1) endTimeSingel2 = endTimeSingel2.Subtract(rest4w1); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -4337,10 +4413,10 @@ public class IndexModel : PageModel startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1CheharShanbe2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2CheharShanbe2); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest4w2) + if (endTimeSingel2 - starTimeSingel1 >= rest4w2) endTimeSingel2 = endTimeSingel2.Subtract(rest4w2); sumRest = sumRest.Add(rest4w2); @@ -4349,7 +4425,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -4357,6 +4434,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -4365,15 +4443,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2CheharShanbe2); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1CheharShanbe2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2CheharShanbe2); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest4w2) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest4w2) endTimeSingel2 = endTimeSingel2.Subtract(rest4w2); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -4402,10 +4481,10 @@ public class IndexModel : PageModel startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1CheharShanbe3); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2CheharShanbe3); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - - if (endTimeSingel2 - starTimeSingel1 >= rest4w3) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + + if (endTimeSingel2 - starTimeSingel1 >= rest4w3) endTimeSingel2 = endTimeSingel2.Subtract(rest4w3); sumRest = sumRest.Add(rest4w3); @@ -4414,7 +4493,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -4422,6 +4502,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -4430,17 +4511,18 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2CheharShanbe3); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1CheharShanbe3); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2CheharShanbe3); - - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - - if (endTimeSingel2 - starTimeSingel1 >= rest4w3) + + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + + if (endTimeSingel2 - starTimeSingel1 >= rest4w3) endTimeSingel2 = endTimeSingel2.Subtract(rest4w3); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -4468,11 +4550,11 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2CheharShanbe4); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1CheharShanbe4); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2CheharShanbe4); - - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - - if (endTimeSingel2 - starTimeSingel1 >= rest4w4) + + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + + if (endTimeSingel2 - starTimeSingel1 >= rest4w4) endTimeSingel2 = endTimeSingel2.Subtract(rest4w4); sumRest = sumRest.Add(rest4w4); @@ -4481,7 +4563,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -4489,6 +4572,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -4498,16 +4582,17 @@ public class IndexModel : PageModel startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1CheharShanbe4); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2CheharShanbe4); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - - if (endTimeSingel2 - starTimeSingel1 >= rest4w4) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + + if (endTimeSingel2 - starTimeSingel1 >= rest4w4) endTimeSingel2 = endTimeSingel2.Subtract(rest4w4); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -4536,10 +4621,10 @@ public class IndexModel : PageModel startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1CheharShanbe1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2CheharShanbe1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - - if (endTimeSingel2 - starTimeSingel1 >= rest4w1) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + + if (endTimeSingel2 - starTimeSingel1 >= rest4w1) endTimeSingel2 = endTimeSingel2.Subtract(rest4w1); sumRest = sumRest.Add(rest4w1); @@ -4548,7 +4633,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -4556,6 +4642,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -4564,16 +4651,17 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2CheharShanbe1); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1CheharShanbe1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2CheharShanbe1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - - if (endTimeSingel2 - starTimeSingel1 >= rest4w1) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + + if (endTimeSingel2 - starTimeSingel1 >= rest4w1) endTimeSingel2 = endTimeSingel2.Subtract(rest4w1); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -4601,11 +4689,11 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2CheharShanbe2); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1CheharShanbe2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2CheharShanbe2); - - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest4w2) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + + if (endTimeSingel2 - starTimeSingel1 >= rest4w2) endTimeSingel2 = endTimeSingel2.Subtract(rest4w2); sumRest = sumRest.Add(rest4w2); @@ -4614,7 +4702,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -4622,6 +4711,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -4631,15 +4721,16 @@ public class IndexModel : PageModel startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1CheharShanbe2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2CheharShanbe2); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest4w2) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest4w2) endTimeSingel2 = endTimeSingel2.Subtract(rest4w2); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -4670,9 +4761,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2PanjShanbe1); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1PanjShanbe1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2PanjShanbe1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest5w1) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest5w1) endTimeSingel2 = endTimeSingel2.Subtract(rest5w1); sumRest = sumRest.Add(rest5w1); @@ -4681,7 +4772,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -4689,6 +4781,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -4697,15 +4790,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2PanjShanbe1); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1PanjShanbe1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2PanjShanbe1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest5w1) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest5w1) endTimeSingel2 = endTimeSingel2.Subtract(rest5w1); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -4733,9 +4827,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2PanjShanbe2); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1PanjShanbe2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2PanjShanbe2); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest5w2) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest5w2) endTimeSingel2 = endTimeSingel2.Subtract(rest5w2); sumRest = sumRest.Add(rest5w2); @@ -4744,7 +4838,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -4752,6 +4847,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -4760,15 +4856,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2PanjShanbe2); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1PanjShanbe2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2PanjShanbe2); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest5w2) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest5w2) endTimeSingel2 = endTimeSingel2.Subtract(rest5w2); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -4796,9 +4893,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2PanjShanbe3); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1PanjShanbe3); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2PanjShanbe3); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest5w3) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest5w3) endTimeSingel2 = endTimeSingel2.Subtract(rest5w3); sumRest = sumRest.Add(rest5w3); @@ -4807,7 +4904,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -4815,6 +4913,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -4823,15 +4922,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2PanjShanbe3); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1PanjShanbe3); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2PanjShanbe3); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest5w3) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest5w3) endTimeSingel2 = endTimeSingel2.Subtract(rest5w3); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -4859,9 +4959,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2PanjShanbe4); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1PanjShanbe4); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2PanjShanbe4); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest5w4) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest5w4) endTimeSingel2 = endTimeSingel2.Subtract(rest5w4); sumRest = sumRest.Add(rest5w4); @@ -4870,7 +4970,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -4878,6 +4979,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -4886,15 +4988,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2PanjShanbe4); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1PanjShanbe4); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2PanjShanbe4); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest5w4) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest5w4) endTimeSingel2 = endTimeSingel2.Subtract(rest5w4); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -4922,9 +5025,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2PanjShanbe1); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1PanjShanbe1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2PanjShanbe1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest5w1) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest5w1) endTimeSingel2 = endTimeSingel2.Subtract(rest5w1); sumRest = sumRest.Add(rest5w1); @@ -4933,7 +5036,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -4941,6 +5045,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -4949,15 +5054,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2PanjShanbe1); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1PanjShanbe1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2PanjShanbe1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest5w1) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest5w1) endTimeSingel2 = endTimeSingel2.Subtract(rest5w1); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -4985,9 +5091,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2PanjShanbe2); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1PanjShanbe2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2PanjShanbe2); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest5w2) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest5w2) endTimeSingel2 = endTimeSingel2.Subtract(rest5w2); sumRest = sumRest.Add(rest5w2); @@ -4996,7 +5102,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { notHolidays = notHolidays.Add(dailyFix); } @@ -5004,6 +5111,7 @@ public class IndexModel : PageModel { notHolidays = notHolidays.Add(rotatingCheck.TotalWorkingTime); } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else @@ -5012,15 +5120,16 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2PanjShanbe2); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1PanjShanbe2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2PanjShanbe2); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest5w2) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest5w2) endTimeSingel2 = endTimeSingel2.Subtract(rest5w2); var rotatingCheck = RotatingShiftCheck(starTimeSingel1, endTimeSingel2, startTimeTowSh1, endTimeTowSh2); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { HolidaysAndNot = HolidaysAndNot.Add(dailyFix); } @@ -5050,9 +5159,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2Jome1); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1Jome1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2Jome1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest6w1) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest6w1) endTimeSingel2 = endTimeSingel2.Subtract(rest6w1); sumRest = sumRest.Add(rest6w1); @@ -5060,9 +5169,10 @@ public class IndexModel : PageModel endTimeTowSh2); rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); - + DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { jomeh = jomeh.Add(dailyFix); } @@ -5070,11 +5180,13 @@ public class IndexModel : PageModel { jomeh = jomeh.Add(rotatingCheck.TotalWorkingTime); } + //افزودن جمعه کاری if (!leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr)) { fridays += 1; } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else if (command.Jome1 && leavId > 0) @@ -5093,9 +5205,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2Jome2); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1Jome2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2Jome2); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest6w2) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest6w2) endTimeSingel2 = endTimeSingel2.Subtract(rest6w2); sumRest = sumRest.Add(rest6w2); @@ -5104,7 +5216,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { jomeh = jomeh.Add(dailyFix); } @@ -5112,11 +5225,13 @@ public class IndexModel : PageModel { jomeh = jomeh.Add(rotatingCheck.TotalWorkingTime); } + //افزودن جمعه کاری if (!leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr)) { fridays += 1; } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else if (command.Jome2 && leavId > 0) @@ -5135,9 +5250,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2Jome3); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1Jome3); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2Jome3); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest6w3) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest6w3) endTimeSingel2 = endTimeSingel2.Subtract(rest6w3); sumRest = sumRest.Add(rest6w3); @@ -5146,7 +5261,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { jomeh = jomeh.Add(dailyFix); } @@ -5154,11 +5270,13 @@ public class IndexModel : PageModel { jomeh = jomeh.Add(rotatingCheck.TotalWorkingTime); } + //افزودن جمعه کاری if (!leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr)) { fridays += 1; } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else if (command.Jome3 && leavId > 0) @@ -5177,9 +5295,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2Jome4); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1Jome4); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2Jome4); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest6w4) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest6w4) endTimeSingel2 = endTimeSingel2.Subtract(rest6w4); sumRest = sumRest.Add(rest6w4); @@ -5188,7 +5306,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { jomeh = jomeh.Add(dailyFix); } @@ -5196,11 +5315,13 @@ public class IndexModel : PageModel { jomeh = jomeh.Add(rotatingCheck.TotalWorkingTime); } + //افزودن جمعه کاری if (!leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr)) { fridays += 1; } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else if (command.Jome4 && leavId > 0) @@ -5219,9 +5340,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2Jome1); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1Jome1); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2Jome1); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest6w1) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest6w1) endTimeSingel2 = endTimeSingel2.Subtract(rest6w1); sumRest = sumRest.Add(rest6w1); @@ -5230,7 +5351,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { jomeh = jomeh.Add(dailyFix); } @@ -5238,11 +5360,13 @@ public class IndexModel : PageModel { jomeh = jomeh.Add(rotatingCheck.TotalWorkingTime); } + //افزودن جمعه کاری if (!leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr)) { fridays += 1; } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else if (command.Jome1 && leavId > 0) @@ -5261,9 +5385,9 @@ public class IndexModel : PageModel endTimeSingel2 = Convert.ToDateTime(command.SingleShift2Jome2); startTimeTowSh1 = Convert.ToDateTime(command.TowShifts1Jome2); endTimeTowSh2 = Convert.ToDateTime(command.TowShifts2Jome2); - if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) - endTimeSingel2 = endTimeSingel2.AddDays(1); - if (endTimeSingel2 - starTimeSingel1 >= rest6w2) + if (endTimeSingel2.TimeOfDay == new TimeSpan(0, 0, 0)) + endTimeSingel2 = endTimeSingel2.AddDays(1); + if (endTimeSingel2 - starTimeSingel1 >= rest6w2) endTimeSingel2 = endTimeSingel2.Subtract(rest6w2); sumRest = sumRest.Add(rest6w2); @@ -5272,7 +5396,8 @@ public class IndexModel : PageModel rotatingCheck.RotatingDate = test; rotatingResultList.Add(rotatingCheck); DateTime testGr = test.ToGeorgianDateTime(); - if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && rotatingCheck.TotalWorkingTime > dailyFix) + if (leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr) && + rotatingCheck.TotalWorkingTime > dailyFix) { jomeh = jomeh.Add(dailyFix); } @@ -5280,11 +5405,13 @@ public class IndexModel : PageModel { jomeh = jomeh.Add(rotatingCheck.TotalWorkingTime); } + //افزودن جمعه کاری if (!leavList.Any(x => x.StartLeaveGr <= testGr && x.EndLeaveGr >= testGr)) { fridays += 1; } + Over22 = Over22.Add(rotatingCheck.NightWorkSpan); } else if (command.Jome2 && leavId > 0) @@ -5559,9 +5686,9 @@ public class IndexModel : PageModel rotatingResultList.Add(rotatingCheck); //var Over22Computing = Over22Complex2424(start, end); bool hasLeave = leavList.Any(x => (x.StartLeaveGr <= start && x.EndLeaveGr >= start) || - (x.StartLeaveGr <= end && x.EndLeaveGr >= end) || - (x.StartLeaveGr >= start && x.StartLeaveGr <= end) || - (x.EndLeaveGr >= start && x.EndLeaveGr <= end)); + (x.StartLeaveGr <= end && x.EndLeaveGr >= end) || + (x.StartLeaveGr >= start && x.StartLeaveGr <= end) || + (x.EndLeaveGr >= start && x.EndLeaveGr <= end)); if (!hasLeave) { Over22 = Over22.Add(rotatingCheck.NightWorkSpan); @@ -5694,9 +5821,9 @@ public class IndexModel : PageModel rotatingResultList.Add(rotatingCheck); //var Over22Computing = Over22Complex2424(start, end); bool hasLeave = leavList.Any(x => (x.StartLeaveGr <= start && x.EndLeaveGr >= start) || - (x.StartLeaveGr <= end && x.EndLeaveGr >= end) || - (x.StartLeaveGr >= start && x.StartLeaveGr <= end) || - (x.EndLeaveGr >= start && x.EndLeaveGr <= end)); + (x.StartLeaveGr <= end && x.EndLeaveGr >= end) || + (x.StartLeaveGr >= start && x.StartLeaveGr <= end) || + (x.EndLeaveGr >= start && x.EndLeaveGr <= end)); if (!hasLeave) { Over22 = Over22.Add(rotatingCheck.NightWorkSpan); @@ -6183,7 +6310,8 @@ public class IndexModel : PageModel //var Over22Computing = Over22Complex2424(start, end); bool hasLeave = leavList.Any(x => (x.StartLeaveGr <= start && x.EndLeaveGr >= start) || (x.StartLeaveGr <= endComplex && x.EndLeaveGr >= endComplex) || - (x.StartLeaveGr >= startComplex && x.StartLeaveGr <= endComplex) || + (x.StartLeaveGr >= startComplex && + x.StartLeaveGr <= endComplex) || (x.EndLeaveGr >= startComplex && x.EndLeaveGr <= endComplex)); if (!hasLeave) { @@ -6327,7 +6455,7 @@ public class IndexModel : PageModel Over22 = Over22.Add(rotatingCheck.NightWorkSpan); fridays += 1; } - + var WorkHours = end - start; var NextStart = start.AddHours(72); @@ -6594,17 +6722,18 @@ public class IndexModel : PageModel var AllDaysCount = (conEnd - conStart).TotalDays + 1; - var endContract = command.ContractEnd.ToGeorgianDateTime(); - int AllmandatoryDays = 0; - for (var gDate = conStart; gDate <= endContract; gDate = gDate.AddDays(1)) - { - if (gDate.DayOfWeek != DayOfWeek.Friday) - { - AllmandatoryDays += 1; - } - } - TimeSpan mandatoryFix =new TimeSpan(7,20,0).Multiply(AllmandatoryDays); - + var endContract = command.ContractEnd.ToGeorgianDateTime(); + int AllmandatoryDays = 0; + for (var gDate = conStart; gDate <= endContract; gDate = gDate.AddDays(1)) + { + if (gDate.DayOfWeek != DayOfWeek.Friday) + { + AllmandatoryDays += 1; + } + } + + TimeSpan mandatoryFix = new TimeSpan(7, 20, 0).Multiply(AllmandatoryDays); + var allDays = (endContract - conStart).TotalDays + 1; @@ -7033,10 +7162,13 @@ public class IndexModel : PageModel #region MandatoryTimeCompute - if (command.ShiftWork == "1" && totalHoursShift1 > mandatoryFix) Mandatory = totalHoursShift1.Subtract(mandatoryFix); + if (command.ShiftWork == "1" && totalHoursShift1 > mandatoryFix) + Mandatory = totalHoursShift1.Subtract(mandatoryFix); if (command.ShiftWork == "2" && totalHoursShift1And2 > mandatoryFix) - Mandatory = totalHoursShift1And2.Subtract(mandatoryFix); + } + + Mandatory = totalHoursShift1And2.Subtract(mandatoryFix); if (command.ShiftWork == "4" && totalHoursShift1 > mandatoryFix) Mandatory = totalHoursShift1.Subtract(mandatoryFix); if ((command.ShiftWork == "5" && totalHoursShift1 > mandatoryFix) diff --git a/ServiceHost/Areas/Camera/Pages/ErrorMessage.cshtml b/ServiceHost/Areas/Camera/Pages/ErrorMessage.cshtml index 55ea471e..ea47577a 100644 --- a/ServiceHost/Areas/Camera/Pages/ErrorMessage.cshtml +++ b/ServiceHost/Areas/Camera/Pages/ErrorMessage.cshtml @@ -25,6 +25,13 @@ font-weight: 700; margin: 0 0 40px 0; } + + .logoutBtn { + background-color: #22a6a6; + padding: 7px 70px; + border-radius: 5px; + color: #ffffff !important; + } } @@ -59,6 +66,7 @@
-

@Model.Message

+

@Model.Message

+ خروج
\ No newline at end of file diff --git a/ServiceHost/Areas/Camera/Pages/ErrorMessage.cshtml.cs b/ServiceHost/Areas/Camera/Pages/ErrorMessage.cshtml.cs index 8747bf49..cb41eda5 100644 --- a/ServiceHost/Areas/Camera/Pages/ErrorMessage.cshtml.cs +++ b/ServiceHost/Areas/Camera/Pages/ErrorMessage.cshtml.cs @@ -1,11 +1,19 @@ -using Microsoft.AspNetCore.Mvc; +using AccountManagement.Application.Contracts.Account; +using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; namespace ServiceHost.Areas.Camera.Pages { public class ErrorMessageModel : PageModel { - public string Message { get; set; } + private readonly IAccountApplication _accountApplication; + + public ErrorMessageModel(IAccountApplication accountApplication) + { + _accountApplication = accountApplication; + } + + public string Message { get; set; } public void OnGet(string message) { if (message == "ServiceNotFound") @@ -14,5 +22,11 @@ namespace ServiceHost.Areas.Camera.Pages if (message == "EmployeeNotFound") Message = "شما هیچ پرسنلی را به حضور غیاب اضافه نکرده‌اید."; } - } + + public IActionResult OnGetLogout() + { + _accountApplication.Logout(); + return RedirectToPage("/Index"); + } + } } diff --git a/ServiceHost/Areas/Camera/Pages/Index.cshtml b/ServiceHost/Areas/Camera/Pages/Index.cshtml index a3d45134..bffb56e8 100644 --- a/ServiceHost/Areas/Camera/Pages/Index.cshtml +++ b/ServiceHost/Areas/Camera/Pages/Index.cshtml @@ -39,6 +39,12 @@ font-weight: 700; /* margin: 0 0 40px 0; */ } + .logoutBtn { + background-color: #22a6a6; + padding: 7px 70px; + border-radius: 5px; + color: #ffffff !important; + } } @@ -164,7 +170,8 @@
-

برای ساعات حضور و غیاب میباست از گوشی استفاده نمایید!

+

برای ساعات حضور و غیاب میباست از گوشی استفاده نمایید!

+ خروج
diff --git a/ServiceHost/Areas/Camera/Pages/Index.cshtml.cs b/ServiceHost/Areas/Camera/Pages/Index.cshtml.cs index eb223460..48fc7131 100644 --- a/ServiceHost/Areas/Camera/Pages/Index.cshtml.cs +++ b/ServiceHost/Areas/Camera/Pages/Index.cshtml.cs @@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using System.IO; +using AccountManagement.Application.Contracts.Account; using AccountManagement.Domain.TaskAgg; using CompanyManagment.App.Contracts.PersonnleCode; using CompanyManagment.App.Contracts.RollCallEmployee; @@ -24,12 +25,14 @@ public class IndexModel : PageModel private readonly IRollCallEmployeeApplication _rollCallEmployeeApplication; private readonly IAuthHelper _authHelper; private readonly IPersonnelCodeApplication _personnelCodeApplication; + private readonly IAccountApplication _accountApplication; + public long WorkshopId; public string UrlPath { get; set; } public List ImageDataList; public List PersonelIds; - public IndexModel(IWebHostEnvironment webHostEnvironment, IConfiguration configuration, IEmployeeApplication employeeApplication, IRollCallApplication rollCallApplication, IAuthHelper authHelper, IRollCallServiceApplication rollCallServiceApplication, IRollCallEmployeeApplication rollCallEmployeeApplication, IPersonnelCodeApplication personnelCodeApplication) + public IndexModel(IWebHostEnvironment webHostEnvironment, IConfiguration configuration, IEmployeeApplication employeeApplication, IRollCallApplication rollCallApplication, IAuthHelper authHelper, IRollCallServiceApplication rollCallServiceApplication, IRollCallEmployeeApplication rollCallEmployeeApplication, IPersonnelCodeApplication personnelCodeApplication, IAccountApplication accountApplication) { _webHostEnvironment = webHostEnvironment; _configuration = configuration; @@ -39,6 +42,7 @@ public class IndexModel : PageModel _rollCallServiceApplication = rollCallServiceApplication; _rollCallEmployeeApplication = rollCallEmployeeApplication; _personnelCodeApplication = personnelCodeApplication; + _accountApplication = accountApplication; } public IActionResult OnGet() @@ -230,6 +234,12 @@ public class IndexModel : PageModel }); } } + + public IActionResult OnGetLogout() + { + _accountApplication.Logout(); + return RedirectToPage("/Index"); + } } public class ImageData diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/CaseHistory.cshtml b/ServiceHost/Areas/Client/Pages/Company/RollCall/CaseHistory.cshtml index 948283b0..b1c030ff 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/CaseHistory.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/CaseHistory.cshtml @@ -76,7 +76,7 @@ - + diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/CurrentDay.cshtml b/ServiceHost/Areas/Client/Pages/Company/RollCall/CurrentDay.cshtml index b0c69421..12a6e6fd 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/CurrentDay.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/CurrentDay.cshtml @@ -44,7 +44,7 @@
-
+
@@ -168,7 +168,7 @@
-
+
غیبت
ردیف
@@ -229,7 +229,7 @@
-
+
مرخصی
ردیف
diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml b/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml index 314fe386..a95e8851 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml @@ -14,6 +14,21 @@