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() { IEnumerable <BaiPost> baiPosts = await _service.GetAll(x => x.IdnguoiTao == long.Parse(User.Identity.Name) && x.Status.Value == (int)BaseStatus.Active);; var DeTai = await _serviceDeTai.GetAll(x => x.IdgiangVien == long.Parse(User.Identity.Name) && x.TinhTrangDeTai != (int)StatusDeTai.MoiTao ); foreach (var item in DeTai) { var temp = await _service.GetAll(x => x.IddeTaiNghienCuu == item.Id && x.IdnguoiTao != long.Parse(User.Identity.Name) && x.Status.Value == (int)BaseStatus.Active); baiPosts = baiPosts.Concat(temp); } return(View(baiPosts.OrderByDescending(x => x.NgayPost))); }
public async Task <IViewComponentResult> InvokeAsync(string ma) { long id; long.TryParse(ma, out id); IEnumerable <DeTaiNghienCuu> model = await _service.GetAll(x => x.IdgiangVien == id && x.NhomSinhVien.Any() == true); return(await Task.FromResult <IViewComponentResult>(View(model))); }
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))); }
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> LoadData() { try { var draw = HttpContext.Request.Form["draw"].FirstOrDefault(); // Skip number of Rows count var start = Request.Form["start"].FirstOrDefault(); // Paging Length 10,20 var length = Request.Form["length"].FirstOrDefault(); // Sort Column Name var sortColumn = Request.Form["columns[" + Request.Form["order[0][column]"].FirstOrDefault() + "][name]"].FirstOrDefault(); // Sort Column Direction (asc, desc) var sortColumnDirection = Request.Form["order[0][dir]"].FirstOrDefault(); // Search Value from (Search box) var searchValue = Request.Form["search[value]"].FirstOrDefault(); //Paging Size (10, 20, 50,100) int pageSize = length != null?Convert.ToInt32(length) : 0; int skip = start != null?Convert.ToInt32(start) : 0; int recordsTotal = 0; // getting all Customer data var entity = await _service.GetAll(x => x.TinhTrangDeTai == (int)StatusDeTai.DaDuyet || x.TinhTrangDeTai == (int)StatusDeTai.DaDangKy); if (!entity.Any()) { return(Json(new { draw = draw, recordsFiltered = recordsTotal, recordsTotal = recordsTotal, data = "" })); } //foreach(var item in entity) //{ // string name = item.IdgiangVienNavigation.Ho +" "+ item.IdgiangVienNavigation.Ten; //} //Mapping var list = _mapper.Map <IEnumerable <DeTaiNghienCuu>, IEnumerable <DeTaiNghienCuuViewModel> >(entity); foreach (var item in list) { if (int.Parse(item.TinhTrangDangKy) == (int)StatusDangKyDeTai.Con) { item.TinhTrangDangKy = "Còn"; } else { item.TinhTrangDangKy = "Hết"; } } //Sorting if (!string.IsNullOrEmpty(sortColumn) && !string.IsNullOrEmpty(sortColumnDirection)) { PropertyDescriptor prop = TypeDescriptor.GetProperties(typeof(DeTaiNghienCuuViewModel)).Find(sortColumn, false); if (sortColumnDirection.Equals("asc")) { list = list.OrderBy(x => prop.GetValue(x)); } else { list = list.OrderByDescending(x => prop.GetValue(x)); } } //Search if (!string.IsNullOrEmpty(searchValue)) { list = list.Where(x => x.Id.ToString().Contains(searchValue) || x.TenDeTai.IndexOf(searchValue, StringComparison.OrdinalIgnoreCase) >= 0 || x.TinhTrangDangKy.IndexOf(searchValue, StringComparison.OrdinalIgnoreCase) >= 0 || x.MoTa.IndexOf(searchValue, StringComparison.OrdinalIgnoreCase) >= 0 //|| x.HoTenGVHD.ToString().IndexOf(searchValue, StringComparison.OrdinalIgnoreCase) >= 0 //|| x.Email.ToString().IndexOf(searchValue, StringComparison.OrdinalIgnoreCase) >= 0 || x.TenTep.IndexOf(searchValue, StringComparison.OrdinalIgnoreCase) >= 0 ); } //total number of rows counts recordsTotal = list.Count(); //Paging var data = list.Skip(skip).Take(pageSize).ToList(); //Returning Json Data return(Json(new { draw = draw, recordsFiltered = recordsTotal, recordsTotal = recordsTotal, data = data })); } catch (Exception) { throw; } }