diff --git a/Company.Domain/CustomizeWorkshopGroupSettingsAgg/Entities/CustomizeWorkshopGroupSettings.cs b/Company.Domain/CustomizeWorkshopGroupSettingsAgg/Entities/CustomizeWorkshopGroupSettings.cs index f6fb2e6f..79a731e6 100644 --- a/Company.Domain/CustomizeWorkshopGroupSettingsAgg/Entities/CustomizeWorkshopGroupSettings.cs +++ b/Company.Domain/CustomizeWorkshopGroupSettingsAgg/Entities/CustomizeWorkshopGroupSettings.cs @@ -17,341 +17,344 @@ namespace Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities; public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity { - public CustomizeWorkshopGroupSettings() - { + public CustomizeWorkshopGroupSettings() + { - } + } - public CustomizeWorkshopGroupSettings(string groupName, double salary, - long customizeWorkshopSettingId, ICollection customizeWorkshopGroupSettingsShifts, - FridayPay fridayPay, OverTimePay overTimePay, BaseYearsPay baseYearsPay, - BonusesPay bonusesPay, NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay, - FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction, - FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit, - HolidayWork holidayWork, BreakTime breakTime, WorkshopShiftStatus workshopShiftStatus, IrregularShift irregularShift, int leavePermittedDays, - ICollection rotatingShifts, List weeklyOffDays) : - base(fridayPay, overTimePay, baseYearsPay, bonusesPay, nightWorkPay, - marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction, lateToWork, - earlyExit, holidayWork, breakTime, leavePermittedDays,weeklyOffDays) - { - GroupName = groupName; - Salary = salary; - CustomizeWorkshopSettingId = customizeWorkshopSettingId; - GuardGroupShifts(customizeWorkshopGroupSettingsShifts); - WorkshopShiftStatus = workshopShiftStatus; + public CustomizeWorkshopGroupSettings(string groupName, double salary, + long customizeWorkshopSettingId, ICollection customizeWorkshopGroupSettingsShifts, + FridayPay fridayPay, OverTimePay overTimePay, BaseYearsPay baseYearsPay, + BonusesPay bonusesPay, NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay, + FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction, + FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit, + HolidayWork holidayWork, BreakTime breakTime, WorkshopShiftStatus workshopShiftStatus, IrregularShift irregularShift, int leavePermittedDays, + ICollection rotatingShifts, List weeklyOffDays) : + base(fridayPay, overTimePay, baseYearsPay, bonusesPay, nightWorkPay, + marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction, lateToWork, + earlyExit, holidayWork, breakTime, leavePermittedDays, weeklyOffDays) + { + GroupName = groupName; + Salary = salary; + CustomizeWorkshopSettingId = customizeWorkshopSettingId; + GuardGroupShifts(customizeWorkshopGroupSettingsShifts); + WorkshopShiftStatus = workshopShiftStatus; - CustomizeRotatingShifts = workshopShiftStatus == WorkshopShiftStatus.Rotating ? rotatingShifts : []; + CustomizeRotatingShifts = workshopShiftStatus == WorkshopShiftStatus.Rotating ? rotatingShifts : []; - CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : []; + CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : []; - IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ? - new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None) - : new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts); - } + IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ? + new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None) + : new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts); + } - private void GuardGroupShifts(ICollection customizeWorkshopGroupSettingsShifts) - { - if (customizeWorkshopGroupSettingsShifts.Count >= 4) - { - throw new InvalidDataException("شما نمیتوانید بیشتر از سه ساعت کاری در کارگاه بگذارید"); - } - } + private void GuardGroupShifts(ICollection customizeWorkshopGroupSettingsShifts) + { + if (customizeWorkshopGroupSettingsShifts.Count >= 4) + { + throw new InvalidDataException("شما نمیتوانید بیشتر از سه ساعت کاری در کارگاه بگذارید"); + } + } - public string GroupName { get; private set; } - public double Salary { get; private set; } - public long CustomizeWorkshopSettingId { get; private set; } - public WorkshopShiftStatus WorkshopShiftStatus { get; private set; } - public bool MainGroup { get; private set; } - public bool IsShiftChange { get; private set; } - public bool IsSettingChange { get; private set; } - public IrregularShift IrregularShift { get; set; } - public ICollection CustomizeWorkshopGroupSettingsShifts { get; set; } - public ICollection CustomizeWorkshopEmployeeSettingsCollection { get; set; } - public ICollection CustomizeRotatingShifts { get; set; } - public CustomizeWorkshopSettings CustomizeWorkshopSettings { get; set; } + public string GroupName { get; private set; } + public double Salary { get; private set; } + public long CustomizeWorkshopSettingId { get; private set; } + public WorkshopShiftStatus WorkshopShiftStatus { get; private set; } + public bool MainGroup { get; private set; } + public bool IsShiftChange { get; private set; } + public bool IsSettingChange { get; private set; } + public IrregularShift IrregularShift { get; set; } + public ICollection CustomizeWorkshopGroupSettingsShifts { get; set; } + public ICollection CustomizeWorkshopEmployeeSettingsCollection { get; set; } + public ICollection CustomizeRotatingShifts { get; set; } + public CustomizeWorkshopSettings CustomizeWorkshopSettings { get; set; } - public CustomizeWorkshopGroupSettings CreateMainGroup(FridayPay fridayPay, - OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay, ShiftPay shiftPay, - NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, FamilyAllowance familyAllowance, - LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction, - LateToWork lateToWork, EarlyExit earlyExit, - ICollection customizeWorkshopGroupSettingsShifts, - HolidayWork holidayWork, IrregularShift irregularShift, ICollection rotatingShifts, - WorkshopShiftStatus workshopShiftStatus, long customizeWorkshopSettingId, BreakTime breakTime, int leavePermittedDays) - { - GuardGroupShifts(customizeWorkshopGroupSettingsShifts); - GroupName = "اصلی"; - Salary = 0; - FridayPay = fridayPay; - OverTimePay = overTimePay; - BaseYearsPay = baseYearsPay; - BonusesPay = bonusesPay; - NightWorkPay = nightWorkPay; - MarriedAllowance = marriedAllowance; - ShiftPay = shiftPay; - FamilyAllowance = familyAllowance; - LeavePay = leavePay; - InsuranceDeduction = insuranceDeduction; - FineAbsenceDeduction = fineAbsenceDeduction; - LateToWork = lateToWork; - EarlyExit = earlyExit; - HolidayWork = holidayWork; - LeavePermittedDays = leavePermittedDays; - CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : []; + public CustomizeWorkshopGroupSettings CreateMainGroup(FridayPay fridayPay, + OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay, ShiftPay shiftPay, + NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, FamilyAllowance familyAllowance, + LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction, + LateToWork lateToWork, EarlyExit earlyExit, + ICollection customizeWorkshopGroupSettingsShifts, + HolidayWork holidayWork, IrregularShift irregularShift, ICollection rotatingShifts, + WorkshopShiftStatus workshopShiftStatus, long customizeWorkshopSettingId, BreakTime breakTime, int leavePermittedDays) + { + GuardGroupShifts(customizeWorkshopGroupSettingsShifts); + GroupName = "اصلی"; + Salary = 0; + FridayPay = fridayPay; + OverTimePay = overTimePay; + BaseYearsPay = baseYearsPay; + BonusesPay = bonusesPay; + NightWorkPay = nightWorkPay; + MarriedAllowance = marriedAllowance; + ShiftPay = shiftPay; + FamilyAllowance = familyAllowance; + LeavePay = leavePay; + InsuranceDeduction = insuranceDeduction; + FineAbsenceDeduction = fineAbsenceDeduction; + LateToWork = lateToWork; + EarlyExit = earlyExit; + HolidayWork = holidayWork; + LeavePermittedDays = leavePermittedDays; + CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : []; - CustomizeRotatingShifts = workshopShiftStatus == WorkshopShiftStatus.Rotating ? rotatingShifts : []; + CustomizeRotatingShifts = workshopShiftStatus == WorkshopShiftStatus.Rotating ? rotatingShifts : []; - IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ? - new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None) - : new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts); - WorkshopShiftStatus = workshopShiftStatus; - CustomizeWorkshopSettingId = customizeWorkshopSettingId; - MainGroup = true; - BreakTime = breakTime; - CustomizeWorkshopEmployeeSettingsCollection = []; + IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ? + new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None) + : new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts); + WorkshopShiftStatus = workshopShiftStatus; + CustomizeWorkshopSettingId = customizeWorkshopSettingId; + MainGroup = true; + BreakTime = breakTime; + CustomizeWorkshopEmployeeSettingsCollection = []; - return this; + return this; - } + } - public void EditAndOverwriteOnEmployees(string groupName, double salary, IEnumerable employeeIds, - FridayPay fridayPay, - OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay, ShiftPay shiftPay, - NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, FamilyAllowance familyAllowance, - LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction, - LateToWork lateToWork, EarlyExit earlyExit, HolidayWork holidayWork, bool isSettingChange, int leavePermittedDays) - { - GroupName = groupName; - Salary = salary; - FridayPay = fridayPay; - OverTimePay = overTimePay; - BaseYearsPay = baseYearsPay; - BonusesPay = bonusesPay; - NightWorkPay = nightWorkPay; - MarriedAllowance = marriedAllowance; - ShiftPay = shiftPay; - FamilyAllowance = familyAllowance; - LeavePay = leavePay; - InsuranceDeduction = insuranceDeduction; - FineAbsenceDeduction = fineAbsenceDeduction; - LateToWork = lateToWork; - EarlyExit = earlyExit; - HolidayWork = holidayWork; - IsSettingChange = isSettingChange; - LeavePermittedDays = leavePermittedDays; + public void EditAndOverwriteOnEmployees(string groupName, double salary, IEnumerable employeeIds, + FridayPay fridayPay, + OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay, ShiftPay shiftPay, + NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, FamilyAllowance familyAllowance, + LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction, + LateToWork lateToWork, EarlyExit earlyExit, HolidayWork holidayWork, bool isSettingChange, int leavePermittedDays) + { + GroupName = groupName; + Salary = salary; + FridayPay = fridayPay; + OverTimePay = overTimePay; + BaseYearsPay = baseYearsPay; + BonusesPay = bonusesPay; + NightWorkPay = nightWorkPay; + MarriedAllowance = marriedAllowance; + ShiftPay = shiftPay; + FamilyAllowance = familyAllowance; + LeavePay = leavePay; + InsuranceDeduction = insuranceDeduction; + FineAbsenceDeduction = fineAbsenceDeduction; + LateToWork = lateToWork; + EarlyExit = earlyExit; + HolidayWork = holidayWork; + IsSettingChange = isSettingChange; + LeavePermittedDays = leavePermittedDays; - var employeeSettingsShift = CustomizeWorkshopGroupSettingsShifts - .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(); + var employeeSettingsShift = CustomizeWorkshopGroupSettingsShifts + .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(); - var permittedToOverWrite = CustomizeWorkshopEmployeeSettingsCollection.Where(x => employeeIds.Contains(x.EmployeeId)); - foreach (var item in permittedToOverWrite) - { - item.EditEmployees(Salary, FridayPay, OverTimePay, BaseYearsPay, BonusesPay - , NightWorkPay, MarriedAllowance, ShiftPay, FamilyAllowance, LeavePay, InsuranceDeduction, FineAbsenceDeduction, - LateToWork, EarlyExit, HolidayWork, IrregularShift, false, leavePermittedDays); - } - } - public void EditAndOverwriteOnAllEmployees(string groupName, double salary, - FridayPay fridayPay, - OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay, ShiftPay shiftPay, - NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, FamilyAllowance familyAllowance, - LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction, - LateToWork lateToWork, EarlyExit earlyExit, HolidayWork holidayWork, bool isSettingChange, int leavePermittedDays) - { - SetValueObjects(fridayPay, overTimePay, baseYearsPay, bonusesPay - , nightWorkPay, marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction, - lateToWork, earlyExit); - GroupName = groupName; - Salary = salary; - HolidayWork = holidayWork; - IsSettingChange = isSettingChange; - LeavePermittedDays = leavePermittedDays; + var permittedToOverWrite = CustomizeWorkshopEmployeeSettingsCollection.Where(x => employeeIds.Contains(x.EmployeeId)); + foreach (var item in permittedToOverWrite) + { + item.EditEmployees(Salary, FridayPay, OverTimePay, BaseYearsPay, BonusesPay + , NightWorkPay, MarriedAllowance, ShiftPay, FamilyAllowance, LeavePay, InsuranceDeduction, FineAbsenceDeduction, + LateToWork, EarlyExit, HolidayWork, IrregularShift, false, leavePermittedDays); + } + } + public void EditAndOverwriteOnAllEmployees(string groupName, double salary, + FridayPay fridayPay, + OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay, ShiftPay shiftPay, + NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, FamilyAllowance familyAllowance, + LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction, + LateToWork lateToWork, EarlyExit earlyExit, HolidayWork holidayWork, bool isSettingChange, int leavePermittedDays) + { + SetValueObjects(fridayPay, overTimePay, baseYearsPay, bonusesPay + , nightWorkPay, marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction, + lateToWork, earlyExit); + GroupName = groupName; + Salary = salary; + HolidayWork = holidayWork; + IsSettingChange = isSettingChange; + LeavePermittedDays = leavePermittedDays; - var employeeSettingsShift = CustomizeWorkshopGroupSettingsShifts - .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(); + var employeeSettingsShift = CustomizeWorkshopGroupSettingsShifts + .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(); - foreach (var item in CustomizeWorkshopEmployeeSettingsCollection) - { - item.EditEmployees(Salary, FridayPay, OverTimePay, BaseYearsPay, BonusesPay - , NightWorkPay, MarriedAllowance, ShiftPay, FamilyAllowance, LeavePay, InsuranceDeduction, FineAbsenceDeduction, - LateToWork, EarlyExit, HolidayWork, IrregularShift, false, leavePermittedDays); - } - } + foreach (var item in CustomizeWorkshopEmployeeSettingsCollection) + { + item.EditEmployees(Salary, FridayPay, OverTimePay, BaseYearsPay, BonusesPay + , NightWorkPay, MarriedAllowance, ShiftPay, FamilyAllowance, LeavePay, InsuranceDeduction, FineAbsenceDeduction, + LateToWork, EarlyExit, HolidayWork, IrregularShift, false, leavePermittedDays); + } + } - public void RemoveEmployeeFromGroup(long employeeId) - { - var currentItem = CustomizeWorkshopEmployeeSettingsCollection.FirstOrDefault(x => x.EmployeeId == employeeId); - if (currentItem != null) - CustomizeWorkshopEmployeeSettingsCollection.Remove(currentItem); - } + public void RemoveEmployeeFromGroup(long employeeId) + { + var currentItem = CustomizeWorkshopEmployeeSettingsCollection.FirstOrDefault(x => x.EmployeeId == employeeId); + if (currentItem != null) + CustomizeWorkshopEmployeeSettingsCollection.Remove(currentItem); + } - public void EditSimpleAndOverwriteOnEmployee(string groupName, IEnumerable employeeIds, - ICollection customizeWorkshopGroupSettingsShifts, WorkshopShiftStatus workshopShiftStatus, - IrregularShift irregularShift, BreakTime breakTime, bool isShiftChange, HolidayWork holidayWork, ICollection rotatingShifts, List weeklyOffDays) - { - GroupName = groupName; - CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : []; - WorkshopShiftStatus = workshopShiftStatus; + public void EditSimpleAndOverwriteOnEmployee(string groupName, IEnumerable employeeIds, + ICollection customizeWorkshopGroupSettingsShifts, WorkshopShiftStatus workshopShiftStatus, + IrregularShift irregularShift, BreakTime breakTime, bool isShiftChange, HolidayWork holidayWork, ICollection rotatingShifts, List weeklyOffDays) + { + GroupName = groupName; + CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : []; + WorkshopShiftStatus = workshopShiftStatus; - IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ? - new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None) - : new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts); - CustomizeRotatingShifts = workshopShiftStatus == WorkshopShiftStatus.Rotating ? rotatingShifts : []; + IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ? + new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None) + : new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts); + CustomizeRotatingShifts = workshopShiftStatus == WorkshopShiftStatus.Rotating ? rotatingShifts : []; - BreakTime = new BreakTime(breakTime.HasBreakTimeValue, breakTime.BreakTimeValue); - IsShiftChange = isShiftChange; + BreakTime = new BreakTime(breakTime.HasBreakTimeValue, breakTime.BreakTimeValue); + IsShiftChange = isShiftChange; - HolidayWork = holidayWork; + HolidayWork = holidayWork; - WeeklyOffDays = weeklyOffDays; + WeeklyOffDays = weeklyOffDays; - //var employeeSettingsShift = customizeWorkshopGroupSettingsShifts - // .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(); - if (isShiftChange) - { + //var employeeSettingsShift = customizeWorkshopGroupSettingsShifts + // .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(); + if (isShiftChange) + { - } + } - var permittedToOverWrite = CustomizeWorkshopEmployeeSettingsCollection.Where(x => employeeIds.Contains(x.EmployeeId)); + var permittedToOverWrite = CustomizeWorkshopEmployeeSettingsCollection.Where(x => employeeIds.Contains(x.EmployeeId)); - foreach (var item in permittedToOverWrite) - { - var newRotatingShifts = CustomizeRotatingShifts.Select(x => new CustomizeRotatingShift(x.StartTime, x.EndTime)) - .ToList(); - item.SimpleEdit(customizeWorkshopGroupSettingsShifts - .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(), - IrregularShift, WorkshopShiftStatus, BreakTime, false, HolidayWork, newRotatingShifts,WeeklyOffDays.ToList()); - } + foreach (var item in permittedToOverWrite) + { + var employeeWeeklyOffDays = WeeklyOffDays.Select(x => new WeeklyOffDay(x.DayOfWeek)).ToList(); + var newRotatingShifts = CustomizeRotatingShifts.Select(x => new CustomizeRotatingShift(x.StartTime, x.EndTime)) + .ToList(); + item.SimpleEdit(customizeWorkshopGroupSettingsShifts + .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(), + IrregularShift, WorkshopShiftStatus, BreakTime, false, HolidayWork, newRotatingShifts, employeeWeeklyOffDays); + } - } + } - public void EditSimpleAndOverwriteOnAllEmployees(string groupName, - ICollection customizeWorkshopGroupSettingsShifts, - WorkshopShiftStatus workshopShiftStatus, IrregularShift irregularShift, BreakTime breakTime, bool isShiftChange, - HolidayWork holidayWork, ICollection rotatingShifts ,List weeklyOffDays) - { - GroupName = groupName; - CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : []; - WorkshopShiftStatus = workshopShiftStatus; + public void EditSimpleAndOverwriteOnAllEmployees(string groupName, + ICollection customizeWorkshopGroupSettingsShifts, + WorkshopShiftStatus workshopShiftStatus, IrregularShift irregularShift, BreakTime breakTime, bool isShiftChange, + HolidayWork holidayWork, ICollection rotatingShifts, List weeklyOffDays) + { + GroupName = groupName; + CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : []; + WorkshopShiftStatus = workshopShiftStatus; - IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ? - new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None) - : new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts); + IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ? + new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None) + : new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts); - CustomizeRotatingShifts = workshopShiftStatus == WorkshopShiftStatus.Rotating ? rotatingShifts : []; + CustomizeRotatingShifts = workshopShiftStatus == WorkshopShiftStatus.Rotating ? rotatingShifts : []; - BreakTime = new BreakTime(breakTime.HasBreakTimeValue, breakTime.BreakTimeValue); - IsShiftChange = isShiftChange; - HolidayWork = holidayWork; + BreakTime = new BreakTime(breakTime.HasBreakTimeValue, breakTime.BreakTimeValue); + IsShiftChange = isShiftChange; + HolidayWork = holidayWork; - WeeklyOffDays = weeklyOffDays; - //var employeeSettingsShift = customizeWorkshopGroupSettingsShifts - // .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(); - - foreach (var item in CustomizeWorkshopEmployeeSettingsCollection) - { - var newRotatingShifts = CustomizeRotatingShifts.Select(x => new CustomizeRotatingShift(x.StartTime, x.EndTime)) - .ToList(); - item.SimpleEdit(customizeWorkshopGroupSettingsShifts - .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(), - irregularShift, workshopShiftStatus, breakTime, false, HolidayWork, newRotatingShifts,WeeklyOffDays.ToList()); - } - - } - - public void AddEmployeeSettingToGroupWithGroupData(long employeeId, long workshopId) - { - var shifts = CustomizeWorkshopGroupSettingsShifts - .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(); - - FridayPay fridayPay = new(FridayPay.FridayPayType, FridayPay.Value); - OverTimePay overTimePay = new(OverTimePay.OverTimePayType, OverTimePay.Value); - BaseYearsPay baseYearsPay = new(BaseYearsPay.BaseYearsPayType, BaseYearsPay.Value, BaseYearsPay.PaymentType); - BonusesPay bonusesPay = new(BonusesPay.BonusesPayType, BonusesPay.Value, BonusesPay.PaymentType); - NightWorkPay nightWorkPay = new(NightWorkPay.NightWorkingType, NightWorkPay.Value); - MarriedAllowance marriedAllowance = new(MarriedAllowance.MarriedAllowanceType, MarriedAllowance.Value); - ShiftPay shiftPay = new(ShiftType.None, ShiftPayType.None, 0); - FamilyAllowance familyAllowance = new(FamilyAllowance.FamilyAllowanceType, FamilyAllowance.Value); - LeavePay leavePay = new(LeavePay.LeavePayType, LeavePay.Value); - InsuranceDeduction insuranceDeduction = new(InsuranceDeduction.InsuranceDeductionType, InsuranceDeduction.Value); - FineAbsenceDeduction fineAbsenceDeduction = new( - FineAbsenceDeduction.FineAbsenceDeductionType, FineAbsenceDeduction.Value, - FineAbsenceDeduction.FineAbsenceDayOfWeekCollection - .Select(x => new FineAbsenceDayOfWeek(x.DayOfWeek)).ToList() - ); - LateToWork lateToWork = new( - LateToWork.LateToWorkType, - LateToWork.LateToWorkTimeFines.Select(x => new LateToWorkTimeFine(x.Minute, x.FineMoney)) - .ToList(), LateToWork.Value - ); - EarlyExit earlyExit = new(EarlyExit.EarlyExitType, - EarlyExit.EarlyExitTimeFines.Select(x => new EarlyExitTimeFine(x.Minute, x.FineMoney)) - .ToList(), EarlyExit.Value); - IrregularShift irregularShift = new(IrregularShift.StartTime, IrregularShift.EndTime, - IrregularShift.WorkshopIrregularShifts); - BreakTime breakTime = new(BreakTime.HasBreakTimeValue, BreakTime.BreakTimeValue); - List weeklyOffDays = WeeklyOffDays.Select(x => new WeeklyOffDay(x.DayOfWeek)).ToList(); - - var rotatingShift = CustomizeRotatingShifts.Select(x => new CustomizeRotatingShift(x.StartTime, x.EndTime)).ToList(); - - var customizeWorkshopEmployeeSettings = new CustomizeWorkshopEmployeeSettings(fridayPay, overTimePay, baseYearsPay, bonusesPay, nightWorkPay, - marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction, lateToWork, - earlyExit, employeeId, workshopId, Salary, id, shifts, HolidayWork, irregularShift, - WorkshopShiftStatus, breakTime, LeavePermittedDays, rotatingShift, weeklyOffDays); - - CustomizeWorkshopEmployeeSettingsCollection.Add(customizeWorkshopEmployeeSettings); - } + WeeklyOffDays = weeklyOffDays; + //var employeeSettingsShift = customizeWorkshopGroupSettingsShifts + // .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(); - private void SetValueObjects(FridayPay fridayPay, OverTimePay overTimePay, BaseYearsPay baseYearsPay, - BonusesPay bonusesPay - , NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay, - FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction, - FineAbsenceDeduction fineAbsenceDeduction, - LateToWork lateToWork, EarlyExit earlyExit) - { - FridayPay = new(fridayPay.FridayPayType, fridayPay.Value); - OverTimePay = new(overTimePay.OverTimePayType, overTimePay.Value); - BaseYearsPay = new(baseYearsPay.BaseYearsPayType, baseYearsPay.Value, baseYearsPay.PaymentType); - BonusesPay = new(bonusesPay.BonusesPayType, bonusesPay.Value, bonusesPay.PaymentType); - NightWorkPay = new(nightWorkPay.NightWorkingType, nightWorkPay.Value); - MarriedAllowance = new(marriedAllowance.MarriedAllowanceType, marriedAllowance.Value); - ShiftPay = new(shiftPay.ShiftType, shiftPay.ShiftPayType, shiftPay.Value); - FamilyAllowance = new(familyAllowance.FamilyAllowanceType, familyAllowance.Value); - LeavePay = new(leavePay.LeavePayType, leavePay.Value); - InsuranceDeduction = new(insuranceDeduction.InsuranceDeductionType, insuranceDeduction.Value); - FineAbsenceDeduction = new( - fineAbsenceDeduction.FineAbsenceDeductionType, fineAbsenceDeduction.Value, - fineAbsenceDeduction.FineAbsenceDayOfWeekCollection - .Select(x => new FineAbsenceDayOfWeek(x.DayOfWeek)).ToList() - ); - LateToWork = new( - lateToWork.LateToWorkType, - lateToWork.LateToWorkTimeFines.Select(x => new LateToWorkTimeFine(x.Minute, x.FineMoney)) - .ToList(), lateToWork.Value - ); - EarlyExit = new(earlyExit.EarlyExitType, - earlyExit.EarlyExitTimeFines.Select(x => new EarlyExitTimeFine(x.Minute, x.FineMoney)) - .ToList(), earlyExit.Value); - } + foreach (var item in CustomizeWorkshopEmployeeSettingsCollection) + { + var employeeWeeklyOffDays = WeeklyOffDays.Select(x => new WeeklyOffDay(x.DayOfWeek)).ToList(); + var newRotatingShifts = CustomizeRotatingShifts.Select(x => new CustomizeRotatingShift(x.StartTime, x.EndTime)) + .ToList(); + item.SimpleEdit(customizeWorkshopGroupSettingsShifts + .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(), + irregularShift, workshopShiftStatus, breakTime, false, HolidayWork, newRotatingShifts, employeeWeeklyOffDays); + } + + } + + public void AddEmployeeSettingToGroupWithGroupData(long employeeId, long workshopId) + { + var shifts = CustomizeWorkshopGroupSettingsShifts + .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(); + + FridayPay fridayPay = new(FridayPay.FridayPayType, FridayPay.Value); + OverTimePay overTimePay = new(OverTimePay.OverTimePayType, OverTimePay.Value); + BaseYearsPay baseYearsPay = new(BaseYearsPay.BaseYearsPayType, BaseYearsPay.Value, BaseYearsPay.PaymentType); + BonusesPay bonusesPay = new(BonusesPay.BonusesPayType, BonusesPay.Value, BonusesPay.PaymentType); + NightWorkPay nightWorkPay = new(NightWorkPay.NightWorkingType, NightWorkPay.Value); + MarriedAllowance marriedAllowance = new(MarriedAllowance.MarriedAllowanceType, MarriedAllowance.Value); + ShiftPay shiftPay = new(ShiftType.None, ShiftPayType.None, 0); + FamilyAllowance familyAllowance = new(FamilyAllowance.FamilyAllowanceType, FamilyAllowance.Value); + LeavePay leavePay = new(LeavePay.LeavePayType, LeavePay.Value); + InsuranceDeduction insuranceDeduction = new(InsuranceDeduction.InsuranceDeductionType, InsuranceDeduction.Value); + FineAbsenceDeduction fineAbsenceDeduction = new( + FineAbsenceDeduction.FineAbsenceDeductionType, FineAbsenceDeduction.Value, + FineAbsenceDeduction.FineAbsenceDayOfWeekCollection + .Select(x => new FineAbsenceDayOfWeek(x.DayOfWeek)).ToList() + ); + LateToWork lateToWork = new( + LateToWork.LateToWorkType, + LateToWork.LateToWorkTimeFines.Select(x => new LateToWorkTimeFine(x.Minute, x.FineMoney)) + .ToList(), LateToWork.Value + ); + EarlyExit earlyExit = new(EarlyExit.EarlyExitType, + EarlyExit.EarlyExitTimeFines.Select(x => new EarlyExitTimeFine(x.Minute, x.FineMoney)) + .ToList(), EarlyExit.Value); + IrregularShift irregularShift = new(IrregularShift.StartTime, IrregularShift.EndTime, + IrregularShift.WorkshopIrregularShifts); + BreakTime breakTime = new(BreakTime.HasBreakTimeValue, BreakTime.BreakTimeValue); + List weeklyOffDays = WeeklyOffDays.Select(x => new WeeklyOffDay(x.DayOfWeek)).ToList(); + + var rotatingShift = CustomizeRotatingShifts.Select(x => new CustomizeRotatingShift(x.StartTime, x.EndTime)).ToList(); + + var customizeWorkshopEmployeeSettings = new CustomizeWorkshopEmployeeSettings(fridayPay, overTimePay, baseYearsPay, bonusesPay, nightWorkPay, + marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction, lateToWork, + earlyExit, employeeId, workshopId, Salary, id, shifts, HolidayWork, irregularShift, + WorkshopShiftStatus, breakTime, LeavePermittedDays, rotatingShift, weeklyOffDays); + + CustomizeWorkshopEmployeeSettingsCollection.Add(customizeWorkshopEmployeeSettings); + } - //public void OverWriteEmployeesShiftAndSalary(IEnumerable ids,ICollection employeeSettingsShifts,double salary) - //{ - // var permittedToOverWrite= RollCallWorkshopEmployeeSettingsCollection.Where(x => ids.Contains(x.id)); - // foreach (var item in permittedToOverWrite) - // { - // item.OverWriteSalaryAndShift(employeeSettingsShifts, salary); - // } - //} + private void SetValueObjects(FridayPay fridayPay, OverTimePay overTimePay, BaseYearsPay baseYearsPay, + BonusesPay bonusesPay + , NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay, + FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction, + FineAbsenceDeduction fineAbsenceDeduction, + LateToWork lateToWork, EarlyExit earlyExit) + { + FridayPay = new(fridayPay.FridayPayType, fridayPay.Value); + OverTimePay = new(overTimePay.OverTimePayType, overTimePay.Value); + BaseYearsPay = new(baseYearsPay.BaseYearsPayType, baseYearsPay.Value, baseYearsPay.PaymentType); + BonusesPay = new(bonusesPay.BonusesPayType, bonusesPay.Value, bonusesPay.PaymentType); + NightWorkPay = new(nightWorkPay.NightWorkingType, nightWorkPay.Value); + MarriedAllowance = new(marriedAllowance.MarriedAllowanceType, marriedAllowance.Value); + ShiftPay = new(shiftPay.ShiftType, shiftPay.ShiftPayType, shiftPay.Value); + FamilyAllowance = new(familyAllowance.FamilyAllowanceType, familyAllowance.Value); + LeavePay = new(leavePay.LeavePayType, leavePay.Value); + InsuranceDeduction = new(insuranceDeduction.InsuranceDeductionType, insuranceDeduction.Value); + FineAbsenceDeduction = new( + fineAbsenceDeduction.FineAbsenceDeductionType, fineAbsenceDeduction.Value, + fineAbsenceDeduction.FineAbsenceDayOfWeekCollection + .Select(x => new FineAbsenceDayOfWeek(x.DayOfWeek)).ToList() + ); + LateToWork = new( + lateToWork.LateToWorkType, + lateToWork.LateToWorkTimeFines.Select(x => new LateToWorkTimeFine(x.Minute, x.FineMoney)) + .ToList(), lateToWork.Value + ); + EarlyExit = new(earlyExit.EarlyExitType, + earlyExit.EarlyExitTimeFines.Select(x => new EarlyExitTimeFine(x.Minute, x.FineMoney)) + .ToList(), earlyExit.Value); + } + + + //public void OverWriteEmployeesShiftAndSalary(IEnumerable ids,ICollection employeeSettingsShifts,double salary) + //{ + // var permittedToOverWrite= RollCallWorkshopEmployeeSettingsCollection.Where(x => ids.Contains(x.id)); + // foreach (var item in permittedToOverWrite) + // { + // item.OverWriteSalaryAndShift(employeeSettingsShifts, salary); + // } + //} } diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CustomizeWorkshopGroupSettingsViewModel.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CustomizeWorkshopGroupSettingsViewModel.cs index a19afa21..82f02021 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CustomizeWorkshopGroupSettingsViewModel.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CustomizeWorkshopGroupSettingsViewModel.cs @@ -1,4 +1,6 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; +using _0_Framework.Domain.CustomizeCheckoutShared.Base; using _0_Framework.Domain.CustomizeCheckoutShared.Enums; using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; @@ -18,4 +20,5 @@ public class CustomizeWorkshopGroupSettingsViewModel public BreakTime BreakTime { get; set; } public FridayWork FridayWork { get; set; } public HolidayWork HolidayWork { get; set; } + public List OffDayOfWeeks { get; set; } } \ No newline at end of file diff --git a/CompanyManagment.Application/CustomizeWorkshopSettingsApplication.cs b/CompanyManagment.Application/CustomizeWorkshopSettingsApplication.cs index b9fe479d..ed28d05e 100644 --- a/CompanyManagment.Application/CustomizeWorkshopSettingsApplication.cs +++ b/CompanyManagment.Application/CustomizeWorkshopSettingsApplication.cs @@ -348,7 +348,7 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo workshopSettings.BaseYearsPay, workshopSettings.BonusesPay, workshopSettings.NightWorkPay, workshopSettings.MarriedAllowance, workshopSettings.ShiftPay, workshopSettings.FamilyAllowance, workshopSettings.LeavePay, workshopSettings.InsuranceDeduction, workshopSettings.FineAbsenceDeduction, workshopSettings.LateToWork, workshopSettings.EarlyExit, - command.HolidayWork, breakTime, command.WorkshopShiftStatus, command.IrregularShift, command.LeavePermittedDays, customizeRotatingShifts, workshopSettings.WeeklyOffDays); + command.HolidayWork, breakTime, command.WorkshopShiftStatus, command.IrregularShift, command.LeavePermittedDays, customizeRotatingShifts, weeklyOffDays); _customizeWorkshopGroupSettingsRepository.Create(entity); @@ -387,7 +387,9 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo var isChanged = false; #region validation - var commandOffDayHashSet = command.WeeklyOffDays.ToHashSet(); + //var commandOffDayHashSet = command.WeeklyOffDays.ToHashSet(); + var commandOffDayHashSet = command.WeeklyOffDays?.ToHashSet() ?? []; + var groupOffDayHashSet = customizeWorkshopGroupSettings.WeeklyOffDays.Select(x => x.DayOfWeek).ToHashSet(); if (command.WorkshopShiftStatus == WorkshopShiftStatus.Regular) @@ -554,13 +556,13 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo var breakTime = new BreakTime(command.BreakTime.HasBreakTimeValue, command.BreakTime.BreakTimeValue); - + var weeklyOffDays = command.WeeklyOffDays?.Select(x => new WeeklyOffDay(x)).ToList() ?? []; var entity = new CustomizeWorkshopEmployeeSettings(customizeWorkshopGroupSettings.FridayPay, customizeWorkshopGroupSettings.OverTimePay, customizeWorkshopGroupSettings.BaseYearsPay, customizeWorkshopGroupSettings.BonusesPay, customizeWorkshopGroupSettings.NightWorkPay, customizeWorkshopGroupSettings.MarriedAllowance, customizeWorkshopGroupSettings.ShiftPay, customizeWorkshopGroupSettings.FamilyAllowance, customizeWorkshopGroupSettings.LeavePay, customizeWorkshopGroupSettings.InsuranceDeduction, customizeWorkshopGroupSettings.FineAbsenceDeduction, customizeWorkshopGroupSettings.LateToWork, customizeWorkshopGroupSettings.EarlyExit, command.EmployeeIds.First(), command.WorkshopId, customizeWorkshopGroupSettings.Salary, command.GroupId, - shiftCollection, command.HolidayWork, command.IrregularShift, command.WorkshopShiftStatus, breakTime, command.LeavePermittedDays, rotatingShift, customizeWorkshopGroupSettings.WeeklyOffDays); + shiftCollection, command.HolidayWork, command.IrregularShift, command.WorkshopShiftStatus, breakTime, command.LeavePermittedDays, rotatingShift, weeklyOffDays); _customizeWorkshopEmployeeSettingsRepository.Create(entity); @@ -671,7 +673,7 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo using var transActionScope = new TransactionScope(); entity.ChangeWorkshopShifts(shiftCollection, workshopShiftStatus, holidayWork, offDays); - + //op = ChangeAllGroupsShiftsWithEmployees(entity, replaceChangedGroups); //if (!op.IsSuccedded) @@ -718,7 +720,9 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo ICollection rotatingShift = []; bool isChanged; - var commandOffDayHashSet = command.OffDayOfWeeks.ToHashSet(); + //var commandOffDayHashSet = command.OffDayOfWeeks.ToHashSet(); + var commandOffDayHashSet = command.OffDayOfWeeks?.ToHashSet() ?? []; + var workshopOffDayHashSet = workshopSettings.WeeklyOffDays.Select(x => x.DayOfWeek).ToHashSet(); if (command.WorkshopShiftStatus == WorkshopShiftStatus.Regular) @@ -866,7 +870,7 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo ICollection rotatingShift = []; bool isChanged = false; - var commandOffDayHashSet = command.WeeklyOffDays.ToHashSet(); + var commandOffDayHashSet = command.WeeklyOffDays?.ToHashSet()??[]; var groupOffDayHashSet = groupSettings.WeeklyOffDays.Select(x => x.DayOfWeek).ToHashSet(); if (command.WorkshopShiftStatus == WorkshopShiftStatus.Regular) @@ -1436,7 +1440,8 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo double salary = command.Salary.MoneyToDouble(); - var commandOffDayHashSet = command.WeeklyOffDays.ToHashSet(); + var commandOffDayHashSet = command.WeeklyOffDays?.ToHashSet()??[]; + var entityOffDayHashSet = entity.WeeklyOffDays.Select(x => x.DayOfWeek).ToHashSet(); bool isChanged; diff --git a/CompanyManagment.EFCore/Repository/CustomizeWorkshopSettingsRepository.cs b/CompanyManagment.EFCore/Repository/CustomizeWorkshopSettingsRepository.cs index 51d02eb7..d5e612fd 100644 --- a/CompanyManagment.EFCore/Repository/CustomizeWorkshopSettingsRepository.cs +++ b/CompanyManagment.EFCore/Repository/CustomizeWorkshopSettingsRepository.cs @@ -318,7 +318,8 @@ public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext, { EndTime = r.EndTime.ToString("HH:mm"), StartTime = r.StartTime.ToString("HH:mm") - }).ToList() + }).ToList(), + OffDayOfWeeks = g.WeeklyOffDays.Select(x=>x.DayOfWeek).ToList() }).ToList(), diff --git a/CompanyManagment.EFCore/Repository/RollCallRepository.cs b/CompanyManagment.EFCore/Repository/RollCallRepository.cs index 0e07d3bb..2f83995b 100644 --- a/CompanyManagment.EFCore/Repository/RollCallRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallRepository.cs @@ -969,7 +969,7 @@ public class RollCallRepository : RepositoryBase, IRollCallRepos var activatedEmployeesList = activeEmployeesQuery.ToList(); var leavesList = leavesQuery.ToList(); - //start search year may be in another year + //start of search year may be different to end of search year var holidays1 = _holidayItemApplication.Search(new HolidayItemSearchModel() { HolidayYear = startSearch.ToFarsiYear() @@ -984,33 +984,46 @@ public class RollCallRepository : RepositoryBase, IRollCallRepos List result = new(); foreach (var day in days) { - - List activatedEmployeesListInDay = new(); bool isHoliday = totalHolidays.Any(x => x.HolidaydateGr == day); - //in working days everyone should be present - if (day.DayOfWeek != DayOfWeek.Friday && !isHoliday) + List activatedEmployeesListInDay = new(); + + activatedEmployeesListInDay = activatedEmployeesList + .Join(employeeSettingsList.Where(x => x.WeeklyOffDays == null || !x.WeeklyOffDays.Select(w => w.DayOfWeek).Contains(day.DayOfWeek)) + , x => x.EmployeeId, y => y.EmployeeId, + (x, _) => x).ToList(); + + if (isHoliday) { - activatedEmployeesListInDay = activatedEmployeesList; + activatedEmployeesListInDay = activatedEmployeesListInDay + .Join(employeeSettingsList.Where(x => x.WeeklyOffDays == null || x.HolidayWork != HolidayWork.Default) + , x => x.EmployeeId, y => y.EmployeeId, + (x, _) => x).ToList(); } - //in fridays, friday workers should be present - else if (day.DayOfWeek == DayOfWeek.Friday) - { - activatedEmployeesListInDay = activatedEmployeesList - .Join(employeeSettingsList.Where(x => x.FridayWork != FridayWork.Default) - , x => x.EmployeeId, y => y.EmployeeId, - (x, y) => x).ToList(); - } + ////in working days everyone should be present + //if (day.DayOfWeek != DayOfWeek.Friday && isHoliday == false) + //{ + // activatedEmployeesListInDay = activatedEmployeesList; + //} - //in holidays holiday worksers should be present - else - { - activatedEmployeesListInDay = activatedEmployeesList - .Join(employeeSettingsList.Where(x => x.HolidayWork != HolidayWork.Default) - , x => x.EmployeeId, y => y.EmployeeId, - (x, y) => x).ToList(); - } + ////in fridays, friday workers should be present + //else if (day.DayOfWeek == DayOfWeek.Friday) + //{ + // activatedEmployeesListInDay = activatedEmployeesList + // .Join(employeeSettingsList.Where(x => x.FridayWork != FridayWork.Default) + // , x => x.EmployeeId, y => y.EmployeeId, + // (x, y) => x).ToList(); + //} + + ////in holidays holiday workers should be present + //else + //{ + // activatedEmployeesListInDay = activatedEmployeesList + // .Join(employeeSettingsList.Where(x => x.HolidayWork != HolidayWork.Default) + // , x => x.EmployeeId, y => y.EmployeeId, + // (x, y) => x).ToList(); + //} var item = new RollCallsByDateViewModel() { DateGr = day, @@ -1037,6 +1050,7 @@ public class RollCallRepository : RepositoryBase, IRollCallRepos } + //گزارش آنلاین حضور غیاب کارگاه public CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId) { diff --git a/ServiceHost/Areas/Client/Pages/Company/Employees/_Partials/WorkshopSettingGrouping.cshtml b/ServiceHost/Areas/Client/Pages/Company/Employees/_Partials/WorkshopSettingGrouping.cshtml index c9e9a871..6ff38ac0 100644 --- a/ServiceHost/Areas/Client/Pages/Company/Employees/_Partials/WorkshopSettingGrouping.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/Employees/_Partials/WorkshopSettingGrouping.cshtml @@ -173,7 +173,7 @@ - -
-
-
وضعیت فعالیت مجموعه در روز های جمعه و تعطیلات رسمی
-
+
+
+ روزهای تعطیل هفته +
-
-
- @*
وضعیت فعالیت مجموعه در روز های جمعه
*@ - @*
- - -
-
- - -
*@ -
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ وضعیت فعالیت مجموعه در روزهای جمعه و تعطیلات رسمی +
+
+
+ وضعیت پرسنل در روز های تعطیل رسمی : + +
+ +
- -
-
- @*
وضعیت فعالیت مجموعه در روز های تعطیلات رسمی
*@ -
- - -
-
- - -
-
+
+ +
+
+
+
+
+ +
diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/ModalEditEmployeeFromGroup.cshtml b/ServiceHost/Areas/Client/Pages/Company/RollCall/ModalEditEmployeeFromGroup.cshtml index 684c25a3..0daac264 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/ModalEditEmployeeFromGroup.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/ModalEditEmployeeFromGroup.cshtml @@ -379,46 +379,118 @@
- -
-
-
وضعیت فعالیت مجموعه در روز های جمعه و تعطیلات رسمی
-
-
-
- @*
وضعیت فعالیت مجموعه در روز های جمعه
*@ - @*
- - -
-
- - -
*@ +
+
+ روزهای تعطیل هفته +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ وضعیت فعالیت مجموعه در روزهای جمعه و تعطیلات رسمی +
+
+
+ وضعیت پرسنل در روز های تعطیل رسمی : + +
+ + +
+ +
+ +
- - -
-
- @*
وضعیت فعالیت مجموعه در روز های تعطیلات رسمی
*@ -
- - -
-
- - -
-
+
+
-
diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/ModalEditGroup.cshtml b/ServiceHost/Areas/Client/Pages/Company/RollCall/ModalEditGroup.cshtml index 642b43fc..227dc226 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/ModalEditGroup.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/ModalEditGroup.cshtml @@ -391,46 +391,119 @@
- -
-
-
وضعیت فعالیت مجموعه در روز های جمعه و تعطیلات رسمی
-
- -
-
- @*
وضعیت فعالیت مجموعه در روز های جمعه
*@ - @*
- - -
-
- - -
*@ -
- -
- - -
-
- @*
وضعیت فعالیت مجموعه در روز های تعطیلات رسمی
*@ -
- - -
-
- - -
-
-
- -
-
+
+
+ روزهای تعطیل هفته
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ وضعیت فعالیت مجموعه در روزهای جمعه و تعطیلات رسمی +
+
+
+ وضعیت پرسنل در روز های تعطیل رسمی : + +
+ + +
+ +
+ + +
+ +
+
+
+ +
+ +
+ + +
@@ -488,4 +561,4 @@ var ajaxReCalculateValuesUrl = `@Url.Page("./Grouping", "ReCalculateValues")`; - \ No newline at end of file + \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/WorkshopSetting/_Partials/ModalCreateSettingWorkshop.cshtml b/ServiceHost/Areas/Client/Pages/Company/RollCall/WorkshopSetting/_Partials/ModalCreateSettingWorkshop.cshtml index de2d4228..6322a8a8 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/WorkshopSetting/_Partials/ModalCreateSettingWorkshop.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/WorkshopSetting/_Partials/ModalCreateSettingWorkshop.cshtml @@ -88,45 +88,109 @@