public async Task <IActionResult> Index(string mess) { IEnumerable <MoDot> listDotDangKy = await _service.GetAll(x => x.Loai == (int)MoDotLoai.DangKy); if (!listDotDangKy.Any()) { return(View()); } MoDot DotDangKyMoiNhat = listDotDangKy.ToList().Last(); MoDot moDot = await _service.GetEntity(x => x.Status == (int)MoDotStatus.Mo); DeTaiNghienCuu detai = await _serviceDeTai.GetEntity(x => x.NgayThucHien != null && x.NgayDangKy > DotDangKyMoiNhat.ThoiGianBd && x.NgayDangKy < DotDangKyMoiNhat.ThoiGianKt); if (mess != "") { ViewBag.mess = mess; } if (detai != null) { ViewBag.NgayBdDeTai = detai.NgayThucHien.Value.ToString("yyyy-MM-dd'T'HH:mm:ss"); ViewBag.NgayKtDeTai = detai.NgayKetThuc.Value.ToString("yyyy-MM-dd'T'HH:mm:ss"); } if (moDot != null) { if (DateTime.Now > moDot.ThoiGianKt.Value) { moDot.Status = (int)MoDotStatus.Dong; await _service.Update(moDot); } } return(View(moDot)); }
public async Task <IActionResult> Index(string mess) { IEnumerable <MoDot> listDotDangKy = await _serviceMoDot.GetAll(x => x.Loai == (int)MoDotLoai.DangKy); if (!listDotDangKy.Any()) { return(View()); } MoDot DotDangKyMoiNhat = listDotDangKy.ToList().LastOrDefault(); IEnumerable <DeTaiNghienCuu> listDeTaiHienTai = await _service.GetAll(x => x.TinhTrangDeTai == (int)StatusDeTai.DaDuyet || x.TinhTrangDeTai == (int)StatusDeTai.DaDangKy || x.TinhTrangDeTai == (int)StatusDeTai.HoanThanh || x.TinhTrangDeTai == (int)StatusDeTai.Huy && (x.NgayDangKy > DotDangKyMoiNhat.ThoiGianBd && x.NgayDangKy < DotDangKyMoiNhat.ThoiGianKt) || (x.NgayDangKy == null && x.TinhTrangDeTai == (int)StatusDeTai.DaDuyet)); IEnumerable <DeTaiNghienCuu> listDeTaiDeXuatHienTai = await _service.GetAll(x => x.Loai == LoaiDeTai.DeXuat && x.NgayDangKy > DotDangKyMoiNhat.ThoiGianBd && x.NgayDangKy < DotDangKyMoiNhat.ThoiGianKt); IEnumerable <GiangVien> listGiangVien = await _serviceGiangVien.GetAll(); DeTaiNghienCuuAdminViewModel viewModel = new DeTaiNghienCuuAdminViewModel() { DotDangKyHienTai = DotDangKyMoiNhat, listDeTaiHienTai = listDeTaiHienTai, listDeTaiDeXuatHienTai = listDeTaiDeXuatHienTai, listGiangVien = listGiangVien.Select(a => new SelectListItem() { Value = a.Id.ToString(), Text = a.Ho + " " + a.Ten }).ToList() }; if (mess != "") { ViewBag.mess = mess; } return(View(viewModel)); }
public async Task <IActionResult> Index() { var allDot = await _serviceMoDot.GetAll(); if (!allDot.Any()) { return(View()); } DotHienTai = await _serviceMoDot.GetEntity(x => x.Status == (int)MoDotStatus.Mo && x.Loai == (int)MoDotLoai.XetDuyetDeTai); if (DotHienTai == null) { return(View()); } ViewBag.MoDot = DotHienTai; Dot = 1; ViewBag.Dot = Dot; if (allDot.Count() > 1 && allDot.ToList()[allDot.Count() - 2].Loai == DotHienTai.Loai) { Dot = 2; ViewBag.Dot = Dot; } List <TinhTrangXDDG> data = LoadList(); if (Dot == 1) { List <TinhTrangXDDG> tabDot1 = data.ToList(); TabDotViewModel viewx = new TabDotViewModel(); //viewx.ListDeTaiDuocPhanCong = listDetaiXetDuyet; viewx.tabDot1 = tabDot1; return(View(viewx)); } else { List <TinhTrangXDDG> tabDot2 = data.ToList(); List <TinhTrangXDDG> tabDot1 = new List <TinhTrangXDDG>(); //edit lại foreach (var item in tabDot2) { TinhTrangXDDG t = new TinhTrangXDDG(); t.IdDeTai = item.IdDeTai; t.TenDeTai = item.TenDeTai; t.TinhTrangDeTai = item.TinhTrangDeTai; t.TinhTrang = "Đã đánh giá"; tabDot1.Add(t); } TabDotViewModel viewx = new TabDotViewModel(); //viewx.ListDeTaiDuocPhanCong = listDetaiXetDuyet; viewx.tabDot1 = tabDot1; viewx.tabDot2 = tabDot2; return(View(viewx)); } }
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))); }