Esempio n. 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 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;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 上移指定流程步骤数据
        /// </summary>
        /// <param name="nId">步骤编码</param>
        /// <param name="nOpStaffId">操作员工编码</param>
        /// <param name="strOpStaffName">操作员工姓名</param>
        /// <param name="strErrText">出错信息</param>
        /// <returns></returns>
        public bool MoveUpApproveStep(long nId, 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())
                    {
                        //读取步骤数据
                        ApproveFlowStep data = dao.LoadApproveFlowStep(nId, nOpStaffId, strOpStaffName, out strErrText);
                        if (data == null)
                        {
                            return false;
                        }

                        //调整当前步骤序号
                        int nStepNum = data.StepNum;
                        if (nStepNum > 1) nStepNum--;
                        data.StepNum = nStepNum;

                        //修改步骤数据
                        if (!dao.UpdateApproveFlowStep(data, nOpStaffId, strOpStaffName, out strErrText))
                        {
                            return false;
                        }
                    }
                    transScope.Complete();
                }
                return true;
            }
            catch (Exception e)
            {
                strErrText = e.Message;
                return false;
            }
        }