finishOffDayOfWeek for CWS

This commit is contained in:
MahanCh
2025-06-29 14:01:47 +03:30
parent b133aa67d2
commit 80c0ec28d5
24 changed files with 2702 additions and 1754 deletions

View File

@@ -969,7 +969,7 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, 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<long, RollCall>, IRollCallRepos
List<RollCallsByDateViewModel> result = new();
foreach (var day in days)
{
List<RollCallEmployee> activatedEmployeesListInDay = new();
bool isHoliday = totalHolidays.Any(x => x.HolidaydateGr == day);
//in working days everyone should be present
if (day.DayOfWeek != DayOfWeek.Friday && !isHoliday)
List<RollCallEmployee> 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<long, RollCall>, IRollCallRepos
}
//گزارش آنلاین حضور غیاب کارگاه
public CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId)
{