コード例 #1
0
        /// <summary>
        /// 获取反射调用的类
        /// 回写状态时用
        /// </summary>
        /// <param name="currentId">当前工作流主键</param>
        /// <returns></returns>
        public IWorkFlowManager GetWorkFlowManager(string currentId)
        {
            IWorkFlowManager workFlowManager = new BaseUserBillManager();

            BaseWorkFlowCurrentEntity workFlowCurrentEntity = this.GetEntity(currentId);

            workFlowManager.SetUserInfo(this.UserInfo);
            workFlowManager.CurrentTableName = workFlowCurrentEntity.CategoryCode;

            string workFlowId = this.GetEntity(currentId).WorkFlowId.ToString();

            if (!workFlowId.Equals("0"))
            {
                BaseWorkFlowProcessManager workFlowProcessManager = new BaseWorkFlowProcessManager(this.DbHelper, this.UserInfo);
                BaseWorkFlowProcessEntity  workFlowProcessEntity  = new BaseWorkFlowProcessEntity();
                if (!string.IsNullOrEmpty(workFlowId))
                {
                    workFlowProcessEntity = workFlowProcessManager.GetEntity(workFlowId);
                }
                if (!string.IsNullOrEmpty(workFlowProcessEntity.CallBackClass))
                {
                    // 这里本来是想动态创建类库 编码外包[100]
                    Type objType = Type.GetType(workFlowProcessEntity.CallBackClass, true);
                    workFlowManager = (IWorkFlowManager)Activator.CreateInstance(objType);
                    workFlowManager.SetUserInfo(this.UserInfo);
                }
                if (!string.IsNullOrEmpty(workFlowProcessEntity.CallBackTable))
                {
                    // 这里本来是想动态创建类库 编码外包[100]
                    workFlowManager.CurrentTableName = workFlowProcessEntity.CallBackTable;
                }
            }
            // workFlowManager = new BaseUserBillManager(this.DbHelper, this.UserInfo);
            return(workFlowManager);
        }
コード例 #2
0
        public BaseWorkFlowProcessEntity GetEntity(BaseUserInfo userInfo, string id)
        {
            // 写入调试信息
            #if (DEBUG)
            int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod());
            #endif

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

            BaseWorkFlowProcessEntity workFlowEntity = new BaseWorkFlowProcessEntity();
            using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.WorkFlowDbType))
            {
                try
                {
                    dbHelper.Open(WorkFlowDbConnection);
                    // 创建实现类
                    BaseWorkFlowProcessManager workFlowManager = new BaseWorkFlowProcessManager(dbHelper, userInfo);
                    workFlowEntity = workFlowManager.GetEntity(id);
                    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(workFlowEntity);
        }