示例#1
0
        /// <summary>
        /// 获取委托服务
        /// </summary>
        /// <returns>委托服务实例</returns>
        private DelegateServiceBase GetDelegateService()
        {
            if (_delegateService == null)
            {
                int?   fromActivityInstanceID = null;
                string fromActivityGUID       = string.Empty;
                string fromActivityName       = string.Empty;
                if (IsNotNodeMediatorStart(this) == true)
                {
                    fromActivityInstanceID = ActivityForwardContext.FromActivityInstance.ID;
                    fromActivityGUID       = ActivityForwardContext.FromActivityInstance.ActivityGUID;
                    fromActivityName       = ActivityForwardContext.FromActivityInstance.ActivityName;
                }

                var delegateContext = new DelegateContext
                {
                    AppInstanceID     = ActivityForwardContext.ProcessInstance.AppInstanceID,
                    ProcessGUID       = ActivityForwardContext.ProcessInstance.ProcessGUID,
                    ProcessInstanceID = ActivityForwardContext.ProcessInstance.ID,
                    ActivityGUID      = fromActivityGUID,
                    ActivityName      = fromActivityName
                };
                _delegateService = DelegateServiceFactory.CreateDelegateService(DelegateScopeTypeEnum.Activity,
                                                                                this.Session,
                                                                                delegateContext);
            }
            return(_delegateService);
        }
示例#2
0
        /// <summary>
        /// 获取委托服务
        /// </summary>
        /// <returns>委托服务类</returns>
        private DelegateServiceBase GetDelegateService()
        {
            //执行Action列表
            var delegateContext = new DelegateContext
            {
                AppInstanceID     = ActivityForwardContext.ProcessInstance.AppInstanceID,
                ProcessGUID       = ActivityForwardContext.ProcessInstance.ProcessGUID,
                ProcessInstanceID = ActivityForwardContext.ProcessInstance.ID,
                ActivityGUID      = ActivityForwardContext.FromActivityInstance.ActivityGUID,
                ActivityName      = ActivityForwardContext.FromActivityInstance.ActivityName
            };

            var delegateService = DelegateServiceFactory.CreateDelegateService(DelegateScopeTypeEnum.Activity,
                                                                               this.Session,
                                                                               delegateContext);

            return(delegateService);
        }
        /// <summary>
        /// 执行方法
        /// </summary>
        internal override void ExecuteWorkItem()
        {
            try
            {
                //执行Action列表
                var delegateContext = new DelegateContext
                {
                    AppInstanceID     = ActivityForwardContext.ProcessInstance.AppInstanceID,
                    ProcessGUID       = ActivityForwardContext.ProcessInstance.ProcessGUID,
                    ProcessInstanceID = ActivityForwardContext.ProcessInstance.ID,
                    ActivityGUID      = ActivityForwardContext.FromActivityInstance.ActivityGUID,
                    ActivityName      = ActivityForwardContext.FromActivityInstance.ActivityName
                };

                var delegateService = DelegateServiceFactory.CreateDelegateService(DelegateScopeTypeEnum.Activity,
                                                                                   this.Session,
                                                                                   delegateContext);
                ExecteActionList(base.EventActivity.ActionList, delegateService as IDelegateService);
            }
            catch (System.Exception ex)
            {
                throw;
            }
        }