Example #1
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;
            }
        }
Example #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 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;
            }
        }