예제 #1
0
        private static void ConsignExecutorWithCondition(IWfProcess process, out List <IUser> users)
        {
            WfAssigneeCollection assignees = new WfAssigneeCollection();

            assignees.Add((IUser)OguObjectSettings.GetConfig().Objects[OguObject.approver1.ToString()].Object);

            users = new List <IUser>();
            users.Add((IUser)OguObjectSettings.GetConfig().Objects[OguObject.requestor.ToString()].Object);
            users.Add((IUser)OguObjectSettings.GetConfig().Objects[OguObject.approver2.ToString()].Object);

            WfConsignExecutor exec = new WfConsignExecutor(process.CurrentActivity, process.CurrentActivity, assignees, users, new List <IUser>(), WfBranchProcessBlockingType.WaitAllBranchProcessesComplete, WfBranchProcessExecuteSequence.Parallel);

            exec.Execute();
        }
예제 #2
0
        public WfExecutorBase CreateExecutor()
        {
            WfExecutorBase executor = null;

            switch (this.OperationType)
            {
            case WfControlOperationType.MoveTo:
                executor = new WfMoveToExecutor(
                    WfClientContext.Current.OriginalActivity,
                    WfClientContext.Current.OriginalActivity, ToTransferParams(),
                    WfClientContext.Current.Locks);
                break;

            case WfControlOperationType.Consign:
            {
                WfAssigneeCollection assignees = new WfAssigneeCollection();

                WfAssignee assignee = new WfAssignee(WfClientContext.Current.User);

                assignees.Add(assignee);

                executor = new WfConsignExecutor(
                    WfClientContext.Current.OriginalActivity,
                    WfClientContext.Current.OriginalActivity,
                    assignees,
                    this.Assignees.ToUsers(),
                    this.Circulators.ToUsers(),
                    BlockingType,
                    SequenceType);
            }
            break;

            case WfControlOperationType.Return:
                if (this._RejectMode == WfRejectMode.LikeAddApprover)
                {
                    executor = new WfAddApproverExecutor(WfClientContext.Current.CurrentActivity, WfClientContext.Current.CurrentActivity.Process.Activities.FindActivityByDescriptorKey(TargetActivityDescriptor.Key));
                }
                else
                {
                    executor = new WfReturnExecutor(WfClientContext.Current.CurrentActivity, WfClientContext.Current.CurrentActivity.Process.Activities.FindActivityByDescriptorKey(TargetActivityDescriptor.Key));
                }
                break;

            default:
                throw new WfRuntimeException(Translator.Translate(Define.DefaultCulture, "不能处理操作类型为{0}", this.OperationType));
            }

            return(executor);
        }