Ejemplo n.º 1
0
        /// <summary>
        /// 新增审批流程步骤数据
        /// </summary>
        /// <param name="data">流程步骤数据集</param>
        /// <param name="nOpStaffId">操作员工编码</param>
        /// <param name="strOpStaffName">操作员工姓名</param>
        /// <param name="strErrText">出错信息</param>
        /// <returns></returns>
        public long InsertApproveFlowStep(ApproveFlowStep data, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            //创建参数数组
            SqlParameter[] Params =
                {
                    MakeParam(ID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Output, (object)data.Id),
                    MakeParam(STEPNAME_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)data.StepName),
                    MakeParam(STEPNUM_PARAM, SqlDbType.Int, 4, ParameterDirection.Input, (object)data.StepNum),
                    MakeParam(FLOWTYPE_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)data.FlowType),
                    MakeParam(DISPOSERID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)data.DisposerId),
                    MakeParam(CONDITIONEXPRESSION_PARAM, SqlDbType.NVarChar, 100, ParameterDirection.Input, (object)data.ConditionExpression??System.DBNull.Value),
                    MakeParam(OPSTAFFID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)nOpStaffId),
                    MakeParam(OPSTAFFNAME_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)strOpStaffName)
                };

            SqlParameterCollection outParams;
            if (Execute("InsertApproveFlowStep", Params, out outParams, out strErrText) < 0)
            {
                return 0;
            }
            else
            {
                return (long)outParams[ID_PARAM].Value;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 新增审批流程步骤数据
        /// </summary>
        /// <param name="data">流程步骤数据集</param>
        /// <param name="listConditions">步骤执行条件数据集</param>
        /// <param name="nOpStaffId">操作员工编码</param>
        /// <param name="strOpStaffName">操作员工姓名</param>
        /// <param name="strErrText">出错信息</param>
        /// <returns></returns>
        public long InsertApproveFlowStep(ApproveFlowStep data, List<ApproveFlowStepCondition> listConditions, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            long nId = 0;
            try
            {
                using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0)))
                {
                    using (FlowDAO dao = new FlowDAO())
                    {
                        //保存步骤数据
                        nId = dao.InsertApproveFlowStep(data, nOpStaffId, strOpStaffName, out strErrText);
                        if (nId <= 0)
                        {
                            return 0;
                        }

                        //保存条件数据
                        foreach (ApproveFlowStepCondition condition in listConditions)
                        {
                            condition.StepId = nId;

                            if (!dao.InsertApproveFlowStepCondition(condition, nOpStaffId, strOpStaffName, out strErrText))
                            {
                                return 0;
                            }
                        }
                    }
                    transScope.Complete();
                }
                return nId;
            }
            catch (Exception e)
            {
                strErrText = e.Message;
                return -1;
            }
        }
Ejemplo n.º 3
0
        public ActionResult NewPriceApproveStep(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.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.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.InsertApproveFlowStep(data, listConditions, LoginAccountId, LoginStaffName, out strErrText) > 0)
                {
                    return Json(string.Empty);
                }
                else
                {
                    return Json(strErrText);
                }
            }
            return View(model);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 修改审批流程步骤数据
        /// </summary>
        /// <param name="data">流程步骤数据集</param>
        /// <param name="listConditions">步骤执行条件数据集</param>
        /// <param name="nOpStaffId">操作员工编码</param>
        /// <param name="strOpStaffName">操作员工姓名</param>
        /// <param name="strErrText">出错信息</param>
        /// <returns></returns>
        public bool UpdateApproveFlowStep(ApproveFlowStep data, List<ApproveFlowStepCondition> listConditions, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            try
            {
                using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0)))
                {
                    using (FlowDAO dao = new FlowDAO())
                    {
                        //修改步骤数据
                        if (!dao.UpdateApproveFlowStep(data, nOpStaffId, strOpStaffName, out strErrText))
                        {
                            return false;
                        }

                        //删除原条件数据
                        if (!dao.DeleteApproveFlowStepConditions(data.Id, nOpStaffId, strOpStaffName, out strErrText))
                        {
                            return false;
                        }

                        //保存新条件数据
                        foreach (ApproveFlowStepCondition condition in listConditions)
                        {
                            if (!dao.InsertApproveFlowStepCondition(condition, nOpStaffId, strOpStaffName, out strErrText))
                            {
                                return false;
                            }
                        }
                    }
                    transScope.Complete();
                }
                return true;
            }
            catch (Exception e)
            {
                strErrText = e.Message;
                return false;
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 新增审批流程步骤数据
 /// </summary>
 /// <param name="data">流程步骤数据集</param>
 /// <param name="listCondition">步骤执行条件数据集</param>
 /// <param name="nOpStaffId">操作员工编码</param>
 /// <param name="strOpStaffName">操作员工姓名</param>
 /// <param name="strErrText">出错信息</param>
 /// <returns></returns>
 public long InsertApproveFlowStep(ApproveFlowStep data, List<ApproveFlowStepCondition> listCondition, long nOpStaffId, string strOpStaffName, out string strErrText)
 {
     FlowRule rule = new FlowRule();
     return rule.InsertApproveFlowStep(data, listCondition, nOpStaffId, strOpStaffName, out strErrText);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 修改审批流程步骤数据
        /// </summary>
        /// <param name="data">流程步骤数据集</param>
        /// <param name="nOpStaffId">操作员工编码</param>
        /// <param name="strOpStaffName">操作员工姓名</param>
        /// <param name="strErrText">出错信息</param>
        /// <returns></returns>
        public bool UpdateApproveFlowStep(ApproveFlowStep data, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            //创建参数数组
            SqlParameter[] Params =
                {
                    MakeParam(ID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)data.Id),
                    MakeParam(STEPNAME_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)data.StepName),
                    MakeParam(STEPNUM_PARAM, SqlDbType.Int, 4, ParameterDirection.Input, (object)data.StepNum),
                    MakeParam(FLOWTYPE_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)data.FlowType),
                    MakeParam(DISPOSERID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)data.DisposerId),
                    MakeParam(CONDITIONEXPRESSION_PARAM, SqlDbType.NVarChar, 100, ParameterDirection.Input, (object)data.ConditionExpression??System.DBNull.Value),
                    MakeParam(OPSTAFFID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)nOpStaffId),
                    MakeParam(OPSTAFFNAME_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)strOpStaffName)
                };

            if (Execute("UpdateApproveFlowStep", Params, out strErrText) >= 0)
                return true;
            else
                return false;
        }