예제 #1
0
        /// <summary>
        /// 检查是否是步骤流
        /// </summary>
        /// <param name="userInfo">用户信息</param>
        /// <param name="categoryCode">单据类型代码</param>
        /// <param name="objectIds">单据主键组</param>
        /// <param name="returnStatusCode">返回代码</param>
        /// <param name="returnStatusMessage">返回信息</param>
        /// <returns></returns>
        public bool CheckIsAutoWorkFlow(BaseUserInfo userInfo, string categoryCode, string[] objectIds, out string returnStatusCode, out string returnStatusMessage)
        {
            // 写入调试信息
            #if (DEBUG)
            int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod());
            #endif

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

            returnStatusCode    = string.Empty;
            returnStatusMessage = string.Empty;
            bool returnValue = true;
            using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.WorkFlowDbType))
            {
                try
                {
                    // 打开数据库
                    dbHelper.Open(WorkFlowDbConnection);

                    BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(dbHelper, userInfo);
                    string processId = string.Empty;
                    for (int i = 0; i < objectIds.Length; i++)
                    {
                        processId = workFlowCurrentManager.GetCurrentId(categoryCode, objectIds[i]);
                        if (string.IsNullOrEmpty(processId))
                        {
                            // 批量审批时需要返回false 含有自由流是不能批量审批的。
                            if (i > 0)
                            {
                                returnStatusMessage = "你选中的记录里包含自由审批流程所以不能批量审批。";
                            }
                            return(false);
                        }
                    }

                    BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod());
                }
                catch (Exception ex)
                {
                    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="objectId">单据主键</param>
        /// <returns></returns>
        public string GetCurrentId(BaseUserInfo userInfo, string categoryCode, string objectId)
        {
            string currentId = string.Empty;

            var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessWorkFlowDb(userInfo, parameter, (dbHelper) =>
            {
                var workFlowCurrentManager = new BaseWorkFlowCurrentManager(dbHelper, userInfo);
                currentId = workFlowCurrentManager.GetCurrentId(categoryCode, objectId);
                // BaseWorkFlowCurrentEntity workFlowCurrentEntity = workFlowCurrentManager.GetObject(currentId);
                // workFlowCurrentEntity.ActivityId;
                // workFlowCurrentEntity.ActivityFullName;
            });
            return(currentId);
        }
예제 #3
0
        /// <summary>
        /// 获取工作流主键
        /// </summary>
        /// <param name="userInfo">用户信息</param>
        /// <param name="categoryId">类型主键</param>
        /// <param name="objectId">单据主键</param>
        /// <returns></returns>
        public string GetCurrentId(BaseUserInfo userInfo, string categoryId, string objectId)
        {
            // 写入调试信息
            #if (DEBUG)
            int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod());
            #endif

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

            string returnValue = string.Empty;
            using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.WorkFlowDbType))
            {
                try
                {
                    // 打开数据库
                    dbHelper.Open(WorkFlowDbConnection);
                    BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(dbHelper, userInfo);
                    returnValue = workFlowCurrentManager.GetCurrentId(categoryId, objectId);
                    BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod());
                }
                catch (Exception ex)
                {
                    BaseExceptionManager.LogException(dbHelper, userInfo, ex);
                    throw ex;
                }
                finally
                {
                    dbHelper.Close();
                }
            }

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

            return(returnValue);
        }