public async Task <List <HoiDong> > LoadData(IHoiDong _service, string SearchString) { List <HoiDong> list = new List <HoiDong>(); if (!String.IsNullOrEmpty(SearchString)) { var result = await _service.GetAll(x => x.TenHoiDong.ToLower().Contains(SearchString.ToLower()) && x.Status == 1); list = result.ToList(); } else { var result = await _service.GetAll(x => x.Status == 1); list = result.ToList(); } return(list.OrderBy(x => x.StatusPhanCong).ToList()); }
public async Task <IActionResult> Create(MoDot moDot) { var allXDDG = await _serviceXDDG.GetAll(); if (allXDDG.Any()) { foreach (var item in allXDDG) { item.Status = 0; await _serviceXDDG.Update(item); } } var HoiDong = await _serviceHoiDong.GetAll(); if (HoiDong.Any()) { foreach (var item in HoiDong) { item.StatusPhanCong = (int)StatusPhanCong.ChuaPhanCong; await _serviceHoiDong.Update(item); } } var DeTai = await _serviceDeTai.GetAll(); if (DeTai.Any()) { foreach (var item in DeTai) { item.TinhTrangPhanCong = (int)StatusPhanCong.ChuaPhanCong; await _serviceDeTai.Update(item); } } if (moDot.Loai == (int)MoDotLoai.DangKy) { var Nhom = await _serviceNhom.GetAll(); if (Nhom.Any()) { foreach (var item in Nhom) { item.Status = (int)BaseStatus.Disable; await _serviceNhom.Update(item); } } } moDot.Status = 1; moDot.IdquanLy = long.Parse(User.Identity.Name); await _service.Add(moDot); return(RedirectToAction("Index", new { mess = "Mở đợt thành công" })); }
public async Task <IActionResult> Index() { Dot = 1; var moDot = await _serviceMoDot.GetEntity(x => x.Status == 1); var hoiDong = await _serviceHoiDong.GetAll(x => x.Status == 1); var deTai = await _serviceDeTai.GetAll(x => x.TinhTrangPhanCong == (int)StatusPhanCong.ChuaPhanCong && x.TinhTrangDeTai == (int)StatusDeTai.DaDangKy); var allDot = await _serviceMoDot.GetAll(); ViewBag.DeTai = deTai; if (!allDot.Any()) { return(View(hoiDong)); } if (moDot != null && moDot.Loai != (int)MoDotLoai.DangKy) { string temp = ""; if (moDot.Loai == (int)MoDotLoai.XetDuyetDeTai) { temp = "Xét duyệt đề tài (" + moDot.ThoiGianBd.Value.ToString("HH:mm:ss dd/MM/yyyy") + " - " + moDot.ThoiGianKt.Value.ToString("HH:mm:ss dd/MM/yyyy") + ")"; } else { temp = "Đánh giá nghiệm thu đề tài (" + moDot.ThoiGianBd.Value.ToString("HH:mm:ss dd/MM/yyyy") + " - " + moDot.ThoiGianKt.Value.ToString("HH:mm:ss dd/MM/yyyy") + ")"; } ViewBag.MoDot = temp; ViewBag.IdMoDot = moDot.Id; } if (allDot.Count() > 1 && allDot.ToList()[allDot.Count() - 2].Loai == moDot.Loai) { Dot = 2; deTai = await _serviceDeTai.GetAll(x => x.TinhTrangPhanCong == (int)StatusPhanCong.ChuaPhanCong && x.TinhTrangDeTai == (int)StatusDeTai.DanhGiaLai); ViewBag.DeTai = deTai; } return(View(hoiDong.OrderBy(x => x.StatusPhanCong))); }