public List <KeHoachCongTacModel> GetThamDuAndChuTri(string userName, DateTime startDate, DateTime endDate) { KeHoachCTDataService ketHoachCTDataService = new KeHoachCTDataService(); List <KeHoachCT> listKeHoachCT = ketHoachCTDataService.GetThamDuAndChuTri(userName, startDate, endDate); List <KeHoachCT> listKeHoachCTMonday = new List <KeHoachCT>(); List <KeHoachCT> listKeHoachCTTuesday = new List <KeHoachCT>(); List <KeHoachCT> listKeHoachCTWednesday = new List <KeHoachCT>(); List <KeHoachCT> listKeHoachCTThursday = new List <KeHoachCT>(); List <KeHoachCT> listKeHoachCTFriday = new List <KeHoachCT>(); List <KeHoachCT> listKeHoachCTSaturday = new List <KeHoachCT>(); List <KeHoachCT> listKeHoachCTSunday = new List <KeHoachCT>(); List <KeHoachCongTacModel> listKeHoachCTModel = new List <KeHoachCongTacModel>(); foreach (var item in listKeHoachCT) { KeHoachCongTacModel keHoachCongTacModel = new KeHoachCongTacModel(); keHoachCongTacModel.Ngay = item.Ngay; if ("Monday".Equals(item.Ngay)) { listKeHoachCTMonday.Add(item); } if ("Tuesday".Equals(item.Ngay)) { listKeHoachCTTuesday.Add(item); } if ("Wednesday".Equals(item.Ngay)) { listKeHoachCTWednesday.Add(item); } if ("Thursday ".Equals(item.Ngay)) { listKeHoachCTThursday.Add(item); } if ("Friday".Equals(item.Ngay)) { listKeHoachCTFriday.Add(item); } if ("Saturday".Equals(item.Ngay)) { listKeHoachCTSaturday.Add(item); } if ("Sunday".Equals(item.Ngay)) { listKeHoachCTSunday.Add(item); } } KeHoachCongTacModel listKeHoachCTDayMondayModel = new KeHoachCongTacModel(); listKeHoachCTDayMondayModel.Ngay = "Thứ 2"; listKeHoachCTDayMondayModel.ListCongTac = listKeHoachCTMonday; listKeHoachCTModel.Add(listKeHoachCTDayMondayModel); KeHoachCongTacModel listKeHoachCTDayTuesdayModel = new KeHoachCongTacModel(); listKeHoachCTDayTuesdayModel.Ngay = "Thứ 3"; listKeHoachCTDayTuesdayModel.ListCongTac = listKeHoachCTTuesday; listKeHoachCTModel.Add(listKeHoachCTDayTuesdayModel); KeHoachCongTacModel listKeHoachCTDayWednesdayModel = new KeHoachCongTacModel(); listKeHoachCTDayWednesdayModel.Ngay = "Thứ 4"; listKeHoachCTDayWednesdayModel.ListCongTac = listKeHoachCTWednesday; listKeHoachCTModel.Add(listKeHoachCTDayWednesdayModel); KeHoachCongTacModel listKeHoachCTDayThursdayModel = new KeHoachCongTacModel(); listKeHoachCTDayThursdayModel.Ngay = "Thứ 5"; listKeHoachCTDayThursdayModel.ListCongTac = listKeHoachCTThursday; listKeHoachCTModel.Add(listKeHoachCTDayThursdayModel); KeHoachCongTacModel listKeHoachCTDayFridayModel = new KeHoachCongTacModel(); listKeHoachCTDayFridayModel.Ngay = "Thứ 6"; listKeHoachCTDayFridayModel.ListCongTac = listKeHoachCTFriday; listKeHoachCTModel.Add(listKeHoachCTDayFridayModel); KeHoachCongTacModel listKeHoachCTDaySaturdayModel = new KeHoachCongTacModel(); listKeHoachCTDaySaturdayModel.Ngay = "Thứ 7"; listKeHoachCTDaySaturdayModel.ListCongTac = listKeHoachCTSaturday; listKeHoachCTModel.Add(listKeHoachCTDaySaturdayModel); KeHoachCongTacModel listKeHoachCTDaySundayModel = new KeHoachCongTacModel(); listKeHoachCTDaySundayModel.Ngay = "Chủ nhật"; listKeHoachCTDaySundayModel.ListCongTac = listKeHoachCTSunday; listKeHoachCTModel.Add(listKeHoachCTDaySundayModel); //Display kehoachcongtac from screen PhongBan PhongBanBussinessService phongBanBussinessService = new PhongBanBussinessService(); foreach (var itemKeHoachCTModel in listKeHoachCTModel) { itemKeHoachCTModel.ListCongTac = phongBanBussinessService.GetDistinctList(itemKeHoachCTModel.ListCongTac); } return(listKeHoachCTModel); }
public List <KeHoachCongTacModel> GetKeHoachCongTac(JQueryDataTableParamModel param, string distinct = null) { KeHoachCTDataService keHoachCTDataService = new KeHoachCTDataService(); List <KeHoachCT> listKeHoachCT = keHoachCTDataService.GetKeHoachCongTac(param); List <KeHoachCT> listKeHoachCTMonday = new List <KeHoachCT>(); List <KeHoachCT> listKeHoachCTTuesday = new List <KeHoachCT>(); List <KeHoachCT> listKeHoachCTWednesday = new List <KeHoachCT>(); List <KeHoachCT> listKeHoachCTThursday = new List <KeHoachCT>(); List <KeHoachCT> listKeHoachCTFriday = new List <KeHoachCT>(); List <KeHoachCT> listKeHoachCTSaturday = new List <KeHoachCT>(); List <KeHoachCT> listKeHoachCTSunday = new List <KeHoachCT>(); List <KeHoachCongTacModel> listKeHoachCTModel = new List <KeHoachCongTacModel>(); foreach (var item in listKeHoachCT) { KeHoachCongTacModel keHoachCongTacModel = new KeHoachCongTacModel(); keHoachCongTacModel.Ngay = item.Ngay; if ("Monday".Equals(item.Ngay)) { listKeHoachCTMonday.Add(item); } if ("Tuesday".Equals(item.Ngay)) { listKeHoachCTTuesday.Add(item); } if ("Wednesday".Equals(item.Ngay)) { listKeHoachCTWednesday.Add(item); } if ("Thursday ".Equals(item.Ngay)) { listKeHoachCTThursday.Add(item); } if ("Friday".Equals(item.Ngay)) { listKeHoachCTFriday.Add(item); } if ("Saturday".Equals(item.Ngay)) { listKeHoachCTSaturday.Add(item); } if ("Sunday".Equals(item.Ngay)) { listKeHoachCTSunday.Add(item); } } KeHoachCongTacModel listKeHoachCTDayMondayModel = new KeHoachCongTacModel(); listKeHoachCTDayMondayModel.Ngay = "Thứ 2"; listKeHoachCTDayMondayModel.ListCongTac = listKeHoachCTMonday; listKeHoachCTModel.Add(listKeHoachCTDayMondayModel); KeHoachCongTacModel listKeHoachCTDayTuesdayModel = new KeHoachCongTacModel(); listKeHoachCTDayTuesdayModel.Ngay = "Thứ 3"; listKeHoachCTDayTuesdayModel.ListCongTac = listKeHoachCTTuesday; listKeHoachCTModel.Add(listKeHoachCTDayTuesdayModel); KeHoachCongTacModel listKeHoachCTDayWednesdayModel = new KeHoachCongTacModel(); listKeHoachCTDayWednesdayModel.Ngay = "Thứ 4"; listKeHoachCTDayWednesdayModel.ListCongTac = listKeHoachCTWednesday; listKeHoachCTModel.Add(listKeHoachCTDayWednesdayModel); KeHoachCongTacModel listKeHoachCTDayThursdayModel = new KeHoachCongTacModel(); listKeHoachCTDayThursdayModel.Ngay = "Thứ 5"; listKeHoachCTDayThursdayModel.ListCongTac = listKeHoachCTThursday; listKeHoachCTModel.Add(listKeHoachCTDayThursdayModel); KeHoachCongTacModel listKeHoachCTDayFridayModel = new KeHoachCongTacModel(); listKeHoachCTDayFridayModel.Ngay = "Thứ 6"; listKeHoachCTDayFridayModel.ListCongTac = listKeHoachCTFriday; listKeHoachCTModel.Add(listKeHoachCTDayFridayModel); KeHoachCongTacModel listKeHoachCTDaySaturdayModel = new KeHoachCongTacModel(); listKeHoachCTDaySaturdayModel.Ngay = "Thứ 7"; listKeHoachCTDaySaturdayModel.ListCongTac = listKeHoachCTSaturday; listKeHoachCTModel.Add(listKeHoachCTDaySaturdayModel); KeHoachCongTacModel listKeHoachCTDaySundayModel = new KeHoachCongTacModel(); listKeHoachCTDaySundayModel.Ngay = "Chủ nhật"; listKeHoachCTDaySundayModel.ListCongTac = listKeHoachCTSunday; listKeHoachCTModel.Add(listKeHoachCTDaySundayModel); //Display kehoachcongtac from screen PhongBan if (!string.IsNullOrEmpty(distinct)) { PhongBanBussinessService phongBanBussinessService = new PhongBanBussinessService(); foreach (var itemKeHoachCTModel in listKeHoachCTModel) { itemKeHoachCTModel.ListCongTac = phongBanBussinessService.GetDistinctList(itemKeHoachCTModel.ListCongTac); } } return(listKeHoachCTModel); }