Пример #1
0
        /// <summary>
        /// 自由工作流审核通过
        /// </summary>
        /// <param name="userInfo">用户信息</param>
        /// <param name="flowId">工作流主键</param>
        /// <param name="workFlowCategory">类型</param>
        /// <param name="toId">发送给主键</param>
        /// <param name="toFullName">发送给名称</param>
        /// <param name="auditIdea">意见</param>
        /// <returns></returns>
        public int FreeAuditPass(BaseUserInfo userInfo, string flowId, string workFlowCategory, string toId, string toFullName, 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.FreeAuditPass(userReportManager, flowId,workFlowCategory, toId, toFullName, auditIdea);
                    dbHelper.CommitTransaction();
                    BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod());
                }
                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="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;
        }