public void ProcessWeeks(List <EmployeePlanningWeek> weeks, long[] ids) { // 1.need load dayinfo for previous and next weeks // 2. load dayinfo from begin of month(month of monday) DateTime beginMonth = new DateTime(CurrentMonday.Year, CurrentMonday.Month, 1); DateTime beginMonthMonday = DateTimeHelper.GetMonday(beginMonth); DateTime beginPrevWeek = CurrentMonday.AddDays(-7); DateTime endNextWeek = CurrentMonday.AddDays(13); DateTime beginDate = (beginMonthMonday < beginPrevWeek) ? beginMonthMonday : beginPrevWeek; SrvEmployeesPlanningDayList cache_planning_days = new SrvEmployeesPlanningDayList(ids, beginDate, endNextWeek); SrvEmployeesRecordingDayList cache_actual_days = new SrvEmployeesRecordingDayList(ids, beginDate, endNextWeek); foreach (EmployeePlanningWeek w in weeks) { ProcessWeek(cache_planning_days.GetList(w.EmployeeId), cache_actual_days.GetList(w.EmployeeId), w); } }
public void ProcessWeeks(List<EmployeePlanningWeek> weeks, long[] ids) { // 1.need load dayinfo for previous and next weeks // 2. load dayinfo from begin of month(month of monday) DateTime beginMonth = new DateTime(CurrentMonday.Year, CurrentMonday.Month, 1); DateTime beginMonthMonday = DateTimeHelper.GetMonday(beginMonth); DateTime beginPrevWeek = CurrentMonday.AddDays(-7); DateTime endNextWeek = CurrentMonday.AddDays(13); DateTime beginDate = (beginMonthMonday < beginPrevWeek) ? beginMonthMonday : beginPrevWeek; SrvEmployeesPlanningDayList cache_planning_days = new SrvEmployeesPlanningDayList(ids, beginDate, endNextWeek); SrvEmployeesRecordingDayList cache_actual_days = new SrvEmployeesRecordingDayList(ids, beginDate, endNextWeek); foreach (EmployeePlanningWeek w in weeks) { ProcessWeek(cache_planning_days.GetList(w.EmployeeId), cache_actual_days.GetList(w.EmployeeId), w); } }