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)); }
/// <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 PageListResultBO <WF_STEP_BO> GetDaTaByPage(int idStream, WF_STEP_SEARCHBO searchModel, int pageIndex = 1, int pageSize = 20) { var query = from tbl in this.context.WF_STEP where tbl.WF_ID == idStream join tbl_state1 in this.context.WF_STATE on tbl.STATE_BEGIN equals tbl_state1.ID into jstate from stateBegin in jstate.DefaultIfEmpty() join tbl_state2 in this.context.WF_STATE on tbl.STATE_END equals tbl_state2.ID into jstate2 from stateEnd in jstate2.DefaultIfEmpty() select new WF_STEP_BO { ID = tbl.ID, WF_ID = tbl.WF_ID, NAME = tbl.NAME, GHICHU = tbl.GHICHU, STATE_BEGIN = tbl.STATE_BEGIN, STATE_END = tbl.STATE_END, ICON = tbl.ICON, IS_RETURN = tbl.IS_RETURN, create_at = tbl.create_at, create_by = tbl.create_by, edit_at = tbl.edit_at, edit_by = tbl.edit_by, TrangThaiBatDau = stateBegin != null ? stateBegin.STATE_NAME : "", TrangThaiKetThuc = stateEnd != null ? stateEnd.STATE_NAME : "", }; if (searchModel != null) { if (!string.IsNullOrEmpty(searchModel.sortQuery)) { query = query.OrderBy(searchModel.sortQuery); } else { query = query.OrderByDescending(x => x.ID); } } else { query = query.OrderByDescending(x => x.ID); } var resultmodel = new PageListResultBO <WF_STEP_BO>(); if (pageSize == -1) { var dataPageList = query.ToList(); resultmodel.Count = dataPageList.Count; resultmodel.TotalPage = 1; resultmodel.ListItem = dataPageList; } else { var dataPageList = query.ToPagedList(pageIndex, pageSize); resultmodel.Count = dataPageList.TotalItemCount; resultmodel.TotalPage = dataPageList.PageCount; resultmodel.ListItem = dataPageList.ToList(); } return(resultmodel); }