Пример #1
0
        //----------------------------------------------------------------------------
        //                                  自由流
        //----------------------------------------------------------------------------

        #region public string AuditFreeStart(BaseUserInfo userInfo, string categoryCode, string categoryFullName, string[] objectIds, string objectFullName, string objectId, string workFlowCode, string toUserId, string toDepartmentId, string toRoleId, string auditIdea, out string returnStatusCode)
        /// <summary>
        /// 提交审批(自由流)
        /// </summary>
        /// <param name="userInfo"></param>
        /// <param name="categoryCode"></param>
        /// <param name="categoryFullName"></param>
        /// <param name="objectIds"></param>
        /// <param name="objectFullName"></param>
        /// <param name="objectId"></param>
        /// <param name="workFlowCode"></param>
        /// <param name="toUserId"></param>
        /// <param name="toDepartmentId"></param>
        /// <param name="toRoleId"></param>
        /// <param name="auditIdea"></param>
        /// <param name="returnStatusCode"></param>
        /// <returns></returns>
        public string AuditFreeStart(BaseUserInfo userInfo, string categoryCode, string categoryFullName, string[] objectIds, string objectFullName, string objectId, string workFlowCode, string toUserId, string toDepartmentId, string toRoleId, string auditIdea, out string returnStatusCode)
        {
            // 写入调试信息
            #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           workFlowManager        = new BaseUserBillManager(userInfo);
                    BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(dbHelper, userInfo);
                    // 事物开始
                    dbHelper.BeginTransaction();
                    for (int i = 0; i < objectIds.Length; i++)
                    {
                        returnValue = workFlowCurrentManager.FreeStart(workFlowManager, objectIds[i], objectFullName, categoryCode, categoryFullName, workFlowCode, toUserId, toDepartmentId, toRoleId, auditIdea);
                    }
                    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);
        }