Exemple #1
0
        public ActionResult ModifyPriceApproveStep(PriceApproveFlowStepViewModel model)
        {
            if (ModelState.IsValid)
            {
                //检查数据
                if (model.ConditionExpression == null || model.ConditionExpression == string.Empty)
                {
                    if (model.Conditions != null && model.Conditions.Count > 1)
                    {
                        return(Json(InnoSoft.LS.Resources.Strings.NotEnterConditionExpressionWhenMultiConditions));
                    }
                }
                else
                {
                    if (model.Conditions == null || model.Conditions.Count <= 1)
                    {
                        return(Json(InnoSoft.LS.Resources.Strings.CanNotEnterConditionExpressionWhenNoOrOneCondition));
                    }
                }

                //创建数据
                ApproveFlowStep data = new ApproveFlowStep();
                data.Id                  = model.Id;
                data.StepName            = model.StepName;
                data.StepNum             = model.StepNum;
                data.FlowType            = InnoSoft.LS.Resources.Options.PriceApproveFlow;
                data.DisposerId          = model.DisposerId;
                data.ConditionExpression = model.ConditionExpression;

                List <ApproveFlowStepCondition> listConditions = new List <ApproveFlowStepCondition>();
                if (model.Conditions != null)
                {
                    foreach (PriceApproveFlowStepConditionViewModel m in model.Conditions)
                    {
                        ApproveFlowStepCondition c = new ApproveFlowStepCondition();
                        c.StepId          = model.Id;
                        c.FlowType        = InnoSoft.LS.Resources.Options.PriceApproveFlow;
                        c.ConditionNum    = m.ConditionNum;
                        c.FieldName       = m.FieldName;
                        c.CompareOperator = m.CompareOperator;
                        c.FieldValue      = m.FieldValue;
                        listConditions.Add(c);
                    }
                }

                //保存数据
                string     strErrText;
                FlowSystem flow = new FlowSystem();
                if (flow.UpdateApproveFlowStep(data, listConditions, LoginAccountId, LoginStaffName, out strErrText))
                {
                    return(Json(string.Empty));
                }
                else
                {
                    return(Json(strErrText));
                }
            }
            return(View(model));
        }