public PartialViewResult Detail(int id) { WF_STEPBusiness = Get <WF_STEPBusiness>(); var myModel = WF_STEPBusiness.GetDaTaByID(id); return(PartialView("_DetailPartial", myModel)); }
public JsonResult getData(int idStream, int indexPage, string sortQuery, int pageSize) { WF_STEPBusiness = Get <WF_STEPBusiness>(); var searchModel = SessionManager.GetValue("wfstepSearchModel") as WF_STEP_SEARCHBO; if (!string.IsNullOrEmpty(sortQuery)) { if (searchModel == null) { searchModel = new WF_STEP_SEARCHBO(); } searchModel.sortQuery = sortQuery; if (pageSize > 0) { searchModel.pageSize = pageSize; } SessionManager.SetValue("wfstepSearchModel", searchModel); } var data = WF_STEPBusiness.GetDaTaByPage(idStream, searchModel, indexPage, pageSize); foreach (var item in data.ListItem) { if (!string.IsNullOrEmpty(item.ICON)) { item.ICON = Path.Combine(HostUpload, item.ICON); } } return(Json(data)); }
public JsonResult Delete(long id) { var result = new JsonResultBO(true); WF_STEPBusiness = Get <WF_STEPBusiness>(); WF_STEPBusiness.repository.Delete(id); WF_STEPBusiness.Save(); return(Json(result)); }
public PartialViewResult Edit(long id) { WF_STEPBusiness = Get <WF_STEPBusiness>(); var WF_STATEBusiness = Get <WF_STATEBusiness>(); var myModel = new EditVM(); myModel.objModel = WF_STEPBusiness.repository.Find(id); myModel.dsTrangThaiStart = WF_STATEBusiness.GetDsTrangThai(myModel.objModel.WF_ID.GetValueOrDefault(), myModel.objModel.STATE_BEGIN.GetValueOrDefault()); myModel.dsTrangThaiEnd = WF_STATEBusiness.GetDsTrangThai(myModel.objModel.WF_ID.GetValueOrDefault(), myModel.objModel.STATE_END.GetValueOrDefault()); return(PartialView("_EditPartial", myModel)); }
public JsonResult Create(FormCollection collection, HttpPostedFileBase ICON) { AssignUserInfo(); WF_STEPBusiness = Get <WF_STEPBusiness>(); var result = new JsonResultBO(true); try { var myobj = new WF_STEP(); myobj.WF_ID = collection["WF_ID"].ToIntOrZero(); myobj.STATE_BEGIN = collection["STATE_BEGIN"].ToIntOrZero(); myobj.STATE_END = collection["STATE_END"].ToIntOrZero(); myobj.create_at = DateTime.Now; myobj.IS_RETURN = collection["IS_RETURN"].ToBoolByOnOff(); myobj.create_by = currentUser.ID; myobj.NAME = collection["NAME"].ToString(); myobj.GHICHU = collection["GHICHU"].ToString(); myobj.REQUIRED_REVIEW = collection["REQUIRED_REVIEW"].ToBoolByOnOff(); if (ICON != null) { var resultUpload = UploadProvider.SaveFile(ICON, null, ".jpg,.png,.jpeg", null, "IconWF", UPLOADFOLDER); if (resultUpload.status) { myobj.ICON = resultUpload.path; } else { result.Message = resultUpload.message; } } WF_STEPBusiness.Save(myobj); } catch { result.Status = false; result.Message = "Không thêm mới được"; } return(Json(result)); }
/// <summary> /// Danh sách bước chuyển trạng thái theo luồng xử lý /// </summary> /// <returns></returns> public ActionResult Index(int id) { var model = new IndexVM(); WF_STEPBusiness = Get <WF_STEPBusiness>(); var WF_STREAMBusiness = Get <WF_STREAMBusiness>(); var searchmodel = new WF_STEP_SEARCHBO(); SessionManager.SetValue("wfstepSearchModel", null); model.LuongXuLy = WF_STREAMBusiness.Find(id); model.LstStep = WF_STEPBusiness.GetDaTaByPage(id, null); foreach (var item in model.LstStep.ListItem) { if (!string.IsNullOrEmpty(item.ICON)) { item.ICON = Path.Combine(HostUpload, item.ICON); } } model.GoData = WF_STEPBusiness.GetDataByStream(id); return(View(model)); }
public JsonResult searchData(FormCollection form) { WF_STEPBusiness = Get <WF_STEPBusiness>(); var searchModel = SessionManager.GetValue("wfstepSearchModel") as WF_STEP_SEARCHBO; if (searchModel == null) { searchModel = new WF_STEP_SEARCHBO(); searchModel.pageSize = 20; } var idStream = form["QR_WF_ID"].ToIntOrZero(); searchModel.QR_STATE_BEGIN = form["QR_STATE_BEGIN"].ToIntOrZero(); searchModel.QR_STATE_END = form["QR_STATE_END"].ToIntOrZero(); searchModel.QR_IS_RETURN = form["QR_IS_RETURN"].ToBoolByOnOff(); searchModel.QR_NAME = form["QR_NAME"].ToString(); searchModel.QR_GHICHU = form["QR_GHICHU"].ToString(); SessionManager.SetValue("wfstepSearchModel", searchModel); var data = WF_STEPBusiness.GetDaTaByPage(idStream, searchModel, 1, searchModel.pageSize); return(Json(data)); }
public ActionResult DetailVanBanDen(long id, int type = VANBANDEN_CONSTANT.CHUA_XULY) { AssignUserInfo(); wfItemUserProcess = Get <WF_ITEM_USER_PROCESSBusiness>(); wfReviewUserBusiness = Get <WF_REVIEW_USERBusiness>(); dmDanhMucDataBusiness = Get <DM_DANHMUC_DATABusiness>(); hscvVanBanDenBusiness = Get <HSCV_VANBANDENBusiness>(); attachmentBusiness = Get <TAILIEUDINHKEMBusiness>(); var HSCVREADVANBANBusiness = Get <HSCVREADVANBANBusiness>(); HSCV_VANBANDEN entityVanBanDen = hscvVanBanDenBusiness.Find(id); bool canAccess = wfItemUserProcess.CheckPermissionProcess(id, true == entityVanBanDen.IS_NOIBO ? MODULE_CONSTANT.VANBANDENNOIBO : MODULE_CONSTANT.VANBANDEN, currentUser.ID); bool canReview = wfReviewUserBusiness.CheckPermissionReview(id, true == entityVanBanDen.IS_NOIBO ? MODULE_CONSTANT.VANBANDENNOIBO : MODULE_CONSTANT.VANBANDEN, currentUser.ID); if ((!canAccess && !canReview) || entityVanBanDen == null) { return(Redirect("/Home/UnAuthor")); } var checkread = HSCVREADVANBANBusiness.repository.All() .Where(x => x.USER_ID == currentUser.ID && x.TYPE == 1 && x.VANBAN_ID == id).FirstOrDefault(); if (checkread == null) { HSCV_READVANBAN readObj = new HSCV_READVANBAN(); readObj.TYPE = 1; readObj.USER_ID = currentUser.ID; readObj.VANBAN_ID = id; HSCVREADVANBANBusiness.Save(readObj); } DetailVanBanDenViewModel model = new DetailVanBanDenViewModel(); DM_DANHMUC_DATA entityDonViGui = dmDanhMucDataBusiness.Find(entityVanBanDen.DONVI_ID); DM_DANHMUC_DATA entityDoKhan = dmDanhMucDataBusiness.Find(entityVanBanDen.DOKHAN_ID); DM_DANHMUC_DATA entityDoUuTien = dmDanhMucDataBusiness.Find(entityVanBanDen.DOMAT_ID); DM_DANHMUC_DATA entityLinhVucVanBan = dmDanhMucDataBusiness.Find(entityVanBanDen.LINHVUCVANBAN_ID); DM_DANHMUC_DATA entityLoaiVanBan = dmDanhMucDataBusiness.Find(entityVanBanDen.LOAIVANBAN_ID); DM_DANHMUC_DATA entityLoaiCoQuan = dmDanhMucDataBusiness.Find(entityVanBanDen.LOAI_COQUAN_ID); DM_DANHMUC_DATA entityThongTinLoaiVanBan = dmDanhMucDataBusiness.Find(entityVanBanDen.THONGTIN_LOAI_ID); DM_DANHMUC_DATA entityCongVanDen = dmDanhMucDataBusiness.Find(entityVanBanDen.CONGVAN_DEN_ID); model.currentUserId = currentUser.ID; model.entityVanBanDen = entityVanBanDen; model.nameOfDonViGui = entityDonViGui != null ? entityDonViGui.TEXT : string.Empty; model.nameOfDoKhan = entityDoKhan != null ? entityDoKhan.TEXT : string.Empty; model.nameOfDoUuTien = entityDoUuTien != null ? entityDoUuTien.TEXT : string.Empty; model.nameOfLinhVucVanBan = entityLinhVucVanBan != null ? entityLinhVucVanBan.TEXT : string.Empty; model.nameOfLoaiVanBan = entityLoaiVanBan != null ? entityLoaiVanBan.TEXT : string.Empty; model.nameOfLoaiCoQuan = entityLoaiCoQuan != null ? entityLoaiCoQuan.TEXT : string.Empty; model.nameOfThongTinLoaiBan = entityThongTinLoaiVanBan != null ? entityThongTinLoaiVanBan.TEXT : string.Empty; model.nameOfCongVanDen = entityCongVanDen != null ? entityCongVanDen.TEXT : string.Empty; model.groupOfTaiLieuDinhKems = attachmentBusiness.GetDataByItemID(entityVanBanDen.ID, LOAITAILIEU.VANBANDEN); model.typeOfVanBanDen = type; bool isFinish = hscvVanBanDenBusiness.CheckIsFinish(id); model.canCreateCalendar = (entityVanBanDen.NGUOITAO == currentUser.ID && isFinish); if (isFinish == false && entityVanBanDen.NGAYCONGTAC != null) { //kiểm tra người dùng có bước xử lý hay không? bool hasSteps = false; wfProcessBusiness = Get <WF_PROCESSBusiness>(); wfReviewUserBusiness = Get <WF_REVIEW_USERBusiness>(); wfReviewBusiness = Get <WF_REVIEWBusiness>(); wfStateBusiness = Get <WF_STATEBusiness>(); wfStepBusiness = Get <WF_STEPBusiness>(); wfStateFunctionBusiness = Get <WF_STATE_FUNCTIONBusiness>(); WF_PROCESS process = wfProcessBusiness.repository.All() .Where(x => x.ITEM_ID == id && x.ITEM_TYPE == MODULE_CONSTANT.VANBANDEN && x.USER_ID == currentUser.ID).FirstOrDefault(); WF_REVIEW reviewReject = wfReviewBusiness.repository.All() .Where(x => x.ITEMID == id && x.ITEMTYPE == MODULE_CONSTANT.VANBANDEN && x.IS_REJECT == true) .OrderByDescending(x => x.ID).FirstOrDefault(); WF_FUNCTION function = null; bool requireReview = false; List <WF_STEP> nextSteps = new List <WF_STEP>(); List <StepBackBO> stepsBack = new List <StepBackBO>(); if (process != null) { if (process != null || reviewReject != null) { WF_STATE startState = wfStateBusiness.Find(process.CURRENT_STATE); if (startState != null) { if (startState.IS_KETTHUC != true) { nextSteps = wfStepBusiness.GetListNextStep(process.WF_ID.GetValueOrDefault(), startState.ID); stepsBack = wfStepBusiness.GetListNextStepBack(process); } function = wfStateFunctionBusiness.CheckGetFunction(startState.ID, entityVanBanDen.ID, MODULE_CONSTANT.VANBANDEN); } } else if (process.IS_PENDING == true) { WF_REVIEW reviewFinish = wfReviewBusiness.repository.All() .Where(x => x.ITEMID == id && x.ITEMTYPE == MODULE_CONSTANT.VANBANDEN && x.IS_FINISH != true) .OrderByDescending(x => x.ID).FirstOrDefault(); if (reviewFinish != null) { requireReview = wfReviewUserBusiness.CheckReviewing(reviewFinish.ID, currentUser.ID); } } hasSteps = (nextSteps.Any() || stepsBack.Any() || function != null || requireReview == true); } model.hasSteps = hasSteps; if (hasSteps) { entityVanBanDen.NGAYCONGTAC = new DateTime(entityVanBanDen.NGAYCONGTAC.Value.Year, entityVanBanDen.NGAYCONGTAC.Value.Month, entityVanBanDen.NGAYCONGTAC.Value.Day); lichCongTacBusiness = Get <LICHCONGTACBusiness>(); model.isDuplicateCalendar = lichCongTacBusiness.repository.All() .Where(x => x.LANHDAO_ID == currentUser.ID && x.NGAY_CONGTAC.Equals(entityVanBanDen.NGAYCONGTAC.Value)).Count() > 0; } } return(View(model)); }