示例#1
0
        /// <summary>
        /// 提交审批(步骤流)
        /// </summary>
        /// <param name="userInfo">用户信息</param>
        /// <param name="categoryCode">单据类型代码</param>
        /// <param name="categoryFullName">单据类型名称</param>
        /// <param name="objectIds">单据主键组</param>
        /// <param name="objectFullName">单据名称</param>
        /// <param name="workFlowCode">工作流编号</param>
        /// <param name="auditIdea">审批意见</param>
        /// <param name="returnStatusCode">返回码</param>
        /// <param name="dtWorkFlowActivity">步骤列表</param>
        /// <returns></returns>
        public string AuditStatr(BaseUserInfo userInfo, string categoryCode, string categoryFullName, string[] objectIds, string objectFullName, string workFlowCode, string auditIdea, out string returnStatusCode, DataTable dtWorkFlowActivity = null)
        {
            // 写入调试信息
            #if (DEBUG)
            int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod());
            #endif

            // 加强安全验证防止未授权匿名调用
            #if (!DEBUG)
            LogOnService.UserIsLogOn(userInfo);
            #endif

            string returnValue = string.Empty;
            returnStatusCode = string.Empty;
            using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.WorkFlowDbType))
            {
                try
                {
                    dbHelper.Open(WorkFlowDbConnection);
                    // 默认的都按报表来处理,特殊的直接调用,明确指定
                    IWorkFlowManager           userReportManager      = new UserReportManager(userInfo);
                    BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(dbHelper, userInfo);
                    // 事物开始
                    dbHelper.BeginTransaction();
                    for (int i = 0; i < objectIds.Length; i++)
                    {
                        returnValue = workFlowCurrentManager.AutoStatr(userReportManager, objectIds[i], objectFullName, categoryCode, categoryFullName, workFlowCode, auditIdea, dtWorkFlowActivity);
                    }
                    BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod());
                    // 提交事务
                    dbHelper.CommitTransaction();
                    if (!string.IsNullOrEmpty(returnValue))
                    {
                        returnStatusCode = StatusCode.OK.ToString();
                    }
                }
                catch (Exception ex)
                {
                    // 回滚事务
                    dbHelper.RollbackTransaction();
                    BaseExceptionManager.LogException(dbHelper, userInfo, ex);
                    throw ex;
                }
                finally
                {
                    dbHelper.Close();
                }
            }

            // 写入调试信息
            #if (DEBUG)
            BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart);
            #endif

            return(returnValue);
        }
示例#2
0
        /// <summary>
        /// 自动工作流审核通过
        /// </summary>
        /// <param name="flowIds">当前流程主键组</param>
        /// <param name="auditIdea">提交意见</param>
        /// <returns>影响行数</returns>
        public int AuditPass(BaseUserInfo userInfo, string[] flowIds, string auditIdea)
        {
            // 写入调试信息
            #if (DEBUG)
            int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod());
            #endif

            // 加强安全验证防止未授权匿名调用
            #if (!DEBUG)
            LogOnService.UserIsLogOn(userInfo);
            #endif

            int returnValue = 0;
            using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.WorkFlowDbType))
            {
                try
                {
                    dbHelper.Open(WorkFlowDbConnection);
                    IWorkFlowManager           userReportManager      = new UserReportManager(userInfo);
                    BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(dbHelper, userInfo);
                    dbHelper.BeginTransaction();
                    returnValue = workFlowCurrentManager.AutoAuditPass(flowIds, auditIdea);
                    BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod());
                    dbHelper.CommitTransaction();
                }
                catch (Exception ex)
                {
                    dbHelper.RollbackTransaction();
                    BaseExceptionManager.LogException(dbHelper, userInfo, ex);
                    throw ex;
                }
                finally
                {
                    dbHelper.Close();
                }
            }

            // 写入调试信息
            #if (DEBUG)
            BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart);
            #endif

            return(returnValue);
        }