public JsonResult SaveRecipients(FormCollection collection) { AssignUserInfo(); RecipientBusiness = Get <QL_NGUOINHAN_VANBANBusiness>(); JsonResultBO result = new JsonResultBO(true); long id = collection["ID"].ToLongOrZero(); QL_NGUOINHAN_VANBAN recipients = RecipientBusiness.Find(id) ?? new QL_NGUOINHAN_VANBAN(); recipients.TEN_NHOM = collection["TEN_NHOM"]; bool existed = RecipientBusiness.CheckExistedName(recipients.TEN_NHOM, recipients.ID); if (existed) { result.Status = false; result.Message = "Nhóm đã tồn tại trên hệ thống"; } recipients.NGUOINHAN_IDS = collection["NGUOINHAN_IDS"]; recipients.DM_PHONGBAN_ID = currentUser.DM_PHONGBAN_ID.GetValueOrDefault(); recipients.IS_DEFAULT = collection["IS_DEFAULT"].ToIntOrZero() > 0; RecipientBusiness.Save(recipients); result.Message = "Cập nhật nhóm người nhận thành công"; return(Json(result)); }
// GET: DTPhanCongDaoTao/DTPhanCongDaoTao /// <summary> /// @author: duynn /// </summary> /// <returns></returns> public ActionResult Index() { AssignUserInfo(); RecipientBusiness = Get <QL_NGUOINHAN_VANBANBusiness>(); QLNguoiNhanVanBanIndexViewModel viewModel = new QLNguoiNhanVanBanIndexViewModel(); QL_NGUOINHAN_VANBAN_SEARCH_BO searchModel = new QL_NGUOINHAN_VANBAN_SEARCH_BO(); SessionManager.SetValue("QLNguoiNhanVanBanSearch", searchModel); viewModel.GroupRecipients = RecipientBusiness.GetDataByPage(searchModel, currentUser); viewModel.IsSystemAdmin = currentUser.ListVaiTro.Any(x => x.MA_VAITRO == "QLHT"); viewModel.DepartmentId = currentUser.DM_PHONGBAN_ID.GetValueOrDefault(); return(View(viewModel)); }
public PartialViewResult LuuSoPhatHanh(int id) { AssignUserInfo(); var HSCV_VANBANDIBusiness = Get <HSCV_VANBANDIBusiness>(); var DM_DANHMUC_DATABusiness = Get <DM_DANHMUC_DATABusiness>(); var DM_NGUOIDUNGBusiness = Get <DM_NGUOIDUNGBusiness>(); var TAILIEUDINHKEMBusiness = Get <TAILIEUDINHKEMBusiness>(); var CCTC_THANHPHANBusiness = Get <CCTC_THANHPHANBusiness>(); var DmNguoiDungBusiness = Get <DM_NGUOIDUNGBusiness>(); recipientBusiness = Get <QL_NGUOINHAN_VANBANBusiness>(); VanBanDiVM model = new VanBanDiVM(); model.TreeDonVi = CCTC_THANHPHANBusiness.GetTreeLabel(currentUser); model.VanBan = HSCV_VANBANDIBusiness.Find(id); if (!string.IsNullOrEmpty(model.VanBan.DONVINHAN_INTERNAL_ID)) { model.ListDonVi = CCTC_THANHPHANBusiness.GetDataByIds(model.VanBan.DONVINHAN_INTERNAL_ID.ToListInt(',')); } if (model.ListDonVi == null) { model.ListDonVi = new List <CCTC_THANHPHAN>(); } model.GroupUserIdsReceiveDirectly = new List <long>(); if (!string.IsNullOrEmpty(model.VanBan.USER_RECEIVE_DIRECTLY)) { model.GroupUserIdsReceiveDirectly = model.VanBan.USER_RECEIVE_DIRECTLY.ToListLong(','); model.LstReceiveDirectly = DM_NGUOIDUNGBusiness.GetDanhSachByListIds(model.GroupUserIdsReceiveDirectly); } else { model.LstReceiveDirectly = new List <SelectListItem>(); } model.Recipients = recipientBusiness.GetRecipientGroups(currentUser.DeptParentID.GetValueOrDefault()); model.LstDoUuTien = DM_DANHMUC_DATABusiness.DsByMaNhom(VanBanConstant.DOUUTIEN, 0, model.VanBan.DOUUTIEN_ID.HasValue ? model.VanBan.DOUUTIEN_ID.Value : 0); model.LstDoKhan = DM_DANHMUC_DATABusiness.DsByMaNhom(VanBanConstant.DOQUANTRONG, 0, model.VanBan.DOKHAN_ID.HasValue ? model.VanBan.DOKHAN_ID.Value : 0); model.LstLinhVucVanBan = DM_DANHMUC_DATABusiness.DsByMaNhom(VanBanConstant.LINHVUCVANBAN, 0, model.VanBan.LINHVUCVANBAN_ID.HasValue ? model.VanBan.LINHVUCVANBAN_ID.Value : 0); model.LstLoaiVanBan = DM_DANHMUC_DATABusiness.DsByMaNhom(VanBanConstant.LOAIVANBAN, 0, model.VanBan.LOAIVANBAN_ID.HasValue ? model.VanBan.LOAIVANBAN_ID.Value : 0); model.ListTaiLieu = TAILIEUDINHKEMBusiness.GetDataByItemID(id, LOAITAILIEU.VANBAN); model.ListTaiLieu = model.ListTaiLieu.Where(x => x.IS_ACTIVE == 1) .GroupBy(x => x.TAILIEU_GOC_ID).Select(x => x.FirstOrDefault()) .ToList(); model.NguoiKy = DM_NGUOIDUNGBusiness.Find(model.VanBan.NGUOIKY_ID); model.LstSoVanBanDi = DM_DANHMUC_DATABusiness.DsByMaNhomByDept(VanBanConstant.SOVANBANDI, 0, currentUser.DeptParentID.Value); model.CodeDocumentType = (DM_DANHMUC_DATABusiness.Find(model.VanBan.LOAIVANBAN_ID) ?? new DM_DANHMUC_DATA()).CODE; model.CodePublishDepartment = (CCTC_THANHPHANBusiness.Find(currentUser.DM_PHONGBAN_ID) ?? new CCTC_THANHPHAN()).CODE; return(PartialView("_LuuSoPhatHanh", model)); }
/// <summary> /// @author: duynn /// </summary> /// <returns></returns> public JsonResult SearchData(FormCollection collection) { AssignUserInfo(); RecipientBusiness = Get <QL_NGUOINHAN_VANBANBusiness>(); PageListResultBO <QL_NGUOINHAN_VANBAN_BO> result = new PageListResultBO <QL_NGUOINHAN_VANBAN_BO>(); QL_NGUOINHAN_VANBAN_SEARCH_BO searchModel = (QL_NGUOINHAN_VANBAN_SEARCH_BO)SessionManager.GetValue("QLNguoiNhanVanBanSearch"); if (searchModel == null) { searchModel = new QL_NGUOINHAN_VANBAN_SEARCH_BO(); } //searchModel.QueryDeptId = currentUser.DM_PHONGBAN_ID.GetValueOrDefault(); searchModel.QueryName = collection["TEN_NHOM"]; result = RecipientBusiness.GetDataByPage(searchModel, currentUser); return(Json(result)); }
/// <summary> /// @author: duynn /// </summary> /// <returns></returns> public PartialViewResult EditRecipients(int id = 0) { AssignUserInfo(); RecipientBusiness = Get <QL_NGUOINHAN_VANBANBusiness>(); UserBusiness = Get <DM_NGUOIDUNGBusiness>(); CCTC_THANHPHANBusiness = Get <CCTC_THANHPHANBusiness>(); QLNguoiNhanVanBanEditViewModel viewModel = new QLNguoiNhanVanBanEditViewModel(); QL_NGUOINHAN_VANBAN entity = RecipientBusiness.Find(id) ?? new QL_NGUOINHAN_VANBAN(); List <long> choosenUserIds = new List <long>(); /** * dah sách ngươi dùng */ if (!string.IsNullOrEmpty(entity.NGUOINHAN_IDS)) { choosenUserIds = entity.NGUOINHAN_IDS.ToListLong(','); } /** * lấy danh sách người dùng phòng ban */ List <NguoiDungPhongBanBO> groupDepts = UserBusiness.GetUsersOfDepartments(); //if (currentUser.ListVaiTro.Any(x=>x.MA_VAITRO == "QLHT")) //{ // groupDeptUsers = UserBusiness.GetUsersOfDepartments(); //} //else //{ // groupDeptUsers = UserBusiness.GetUsersOfDepartments(currentUser.DM_PHONGBAN_ID.GetValueOrDefault()); //} foreach (var dept in groupDepts) { SelectListGroup group = new SelectListGroup() { Name = dept.PhongBan.NAME }; viewModel.GroupUsers.AddRange(this.GetGroupUsers(group, choosenUserIds, dept.LstNguoiDung)); } viewModel.Department = CCTC_THANHPHANBusiness.Find(currentUser.DM_PHONGBAN_ID) ?? new CCTC_THANHPHAN(); viewModel.IsSystemAdmin = currentUser.ListVaiTro.Any(x => x.MA_VAITRO == "QLHT"); viewModel.Entity = entity; return(PartialView("_EditRecipient", viewModel)); }
/// <summary> /// @author: duynn /// </summary> /// <returns></returns> public JsonResult GetDataPerPage(int pageSize, int pageIndex, string sortQuery) { AssignUserInfo(); RecipientBusiness = Get <QL_NGUOINHAN_VANBANBusiness>(); PageListResultBO <QL_NGUOINHAN_VANBAN_BO> result = new PageListResultBO <QL_NGUOINHAN_VANBAN_BO>(); QL_NGUOINHAN_VANBAN_SEARCH_BO searchModel = (QL_NGUOINHAN_VANBAN_SEARCH_BO)SessionManager.GetValue("QLNguoiNhanVanBanSearch"); if (searchModel == null) { searchModel = new QL_NGUOINHAN_VANBAN_SEARCH_BO(); } //searchModel.QueryDeptId = currentUser.DM_PHONGBAN_ID.GetValueOrDefault(); searchModel.pageIndex = pageIndex; searchModel.pageSize = pageSize; searchModel.sortQuery = sortQuery; result = RecipientBusiness.GetDataByPage(searchModel, currentUser); return(Json(result)); }
/// <summary> /// @author: duynn /// </summary> /// <returns></returns> public JsonResult Delete(long id) { JsonResultBO result = new JsonResultBO(true); RecipientBusiness = Get <QL_NGUOINHAN_VANBANBusiness>(); QL_NGUOINHAN_VANBAN entity = RecipientBusiness.Find(id); if (entity != null) { RecipientBusiness.repository.Delete(id); result.Message = "Xóa nhóm người nhận thành công"; } else { result.Status = false; result.Message = "Thông tin nhóm người nhận không tồn tại"; } return(Json(result)); }