Example #1
0
        public ActionResult NewPlanApproveStep()
        {
            string strErrText;

            //读取计划审批步骤数据
            FlowSystem             flow     = new FlowSystem();
            List <ApproveFlowStep> listStep = flow.LoadApproveFlowStepsByFlowType(InnoSoft.LS.Resources.Options.PlanApproveFlow, LoginAccountId, LoginStaffName, out strErrText);

            if (listStep == null)
            {
                throw new Exception(strErrText);
            }

            //生成新步骤序号
            int nStepNum = 1;

            if (listStep.Count > 0)
            {
                nStepNum = listStep[listStep.Count - 1].StepNum + 1;
            }

            //创建空的Model
            ApproveFlowStepViewModel model = new ApproveFlowStepViewModel();

            model.StepNum = nStepNum;

            model.Conditions = new List <ApproveFlowStepConditionViewModel>();
            model.Conditions.Add(new ApproveFlowStepConditionViewModel());

            //生成处理人下拉列表项
            StaffSystem  staff     = new StaffSystem();
            List <Staff> listStaff = staff.LoadStaffs(LoginAccountId, LoginStaffName, out strErrText);

            if (listStaff == null)
            {
                throw new Exception(strErrText);
            }
            List <SelectListItem> selectListStaff = new List <SelectListItem>();

            selectListStaff.Add(new SelectListItem {
                Text = string.Empty, Value = string.Empty
            });
            selectListStaff.AddRange(from s in listStaff
                                     select new SelectListItem
            {
                Text  = s.FullName,
                Value = s.Id.ToString()
            });
            ViewData["Disposers"] = new SelectList(selectListStaff, "Value", "Text");

            return(View(model));
        }
Example #2
0
        public JsonResult LoadPriceApproveStepsGrid(string sidx, string sord, int page, int rows)
        {
            //读取价格审批步骤数据
            string                 strErrText;
            FlowSystem             flow     = new FlowSystem();
            List <ApproveFlowStep> listStep = flow.LoadApproveFlowStepsByFlowType(InnoSoft.LS.Resources.Options.PriceApproveFlow, LoginAccountId, LoginStaffName, out strErrText);

            if (listStep == null)
            {
                throw new Exception(strErrText);
            }

            //提取当前页面数据
            int nTotalRows  = listStep.Count;
            int nPageIndex  = page;
            int nPageSize   = rows;
            int nTotalPages = nTotalRows / nPageSize;

            if (nTotalRows % nPageSize > 0)
            {
                nTotalPages++;
            }

            string sortExpression = (sidx ?? "StepNum") + " " + (sord ?? "ASC");
            var    data           = listStep.OrderBy(sortExpression).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList();

            //生成表格数据
            var ret = new
            {
                total   = nTotalPages,
                page    = nPageIndex,
                records = nTotalRows,
                rows    = (
                    from s in data
                    select new
                {
                    id = s.Id,
                    cell = new string[] {
                        s.Id.ToString(),
                        s.StepNum.ToString(),
                        s.StepName,
                        s.DisposerName,
                        s.Conditions
                    }
                }).ToArray()
            };

            return(Json(ret, JsonRequestBehavior.AllowGet));
        }