Пример #1
0
        private WfProcessCollection GetDeletedProcesses(WfActivityCollection deletedActivities)
        {
            WfProcessCollection deletedProcesses = new WfProcessCollection();

            foreach (IWfActivity activity in deletedActivities)
            {
                if (activity is IWfAnchorActivity)
                {
                    foreach (IWfOperation operation in ((IWfAnchorActivity)activity).Operations)
                    {
                        foreach (WfBranchProcessInfo branchProcessInfo in operation.Branches)
                        {
                            deletedProcesses.Add(branchProcessInfo.Process);

                            WfProcessCollection deletedSubProcesses =
                                GetDeletedProcesses(branchProcessInfo.Process.Activities);

                            foreach (IWfProcess subProcess in deletedSubProcesses)
                            {
                                deletedProcesses.Add(subProcess);
                            }
                        }
                    }
                }
            }

            return(deletedProcesses);
        }
Пример #2
0
        public void Withdraw(IWfActivity destinationActivity)
        {
            ExceptionHelper.FalseThrow <ArgumentNullException>(destinationActivity != null, "destinationActivity");

            lock (this)
            {
                ExceptionHelper.FalseThrow <WfEngineException>(this.Activities.ContainsKey(destinationActivity.ID),
                                                               Resource.InvalidWithdrawActivityID, destinationActivity.ID);

                if (this.CurrentActivity != destinationActivity &&
                    string.Compare(this.CurrentActivity.ID, destinationActivity.ID, true) != 0)
                {
                    WfActivityCollection deletedActivities = DoWithdraw(destinationActivity);
                    WfProcessCollection  deletedProcesses  = GetDeletedProcesses(deletedActivities);

                    ((WfActivityBase)destinationActivity).Status = WfActivityStatus.Running;
                    this.Status = WfProcessStatus.Running;

                    WorkflowSettings.GetConfig().EnqueueWorkItemExecutor.EnqueueWithdrawWorkItem(
                        destinationActivity,
                        deletedActivities,
                        deletedProcesses);
                }
            }
        }
Пример #3
0
        private WfActivityCollection DoWithdraw(IWfActivity destinationActivity)
        {
            WfActivityCollection deletedActivities = new WfActivityCollection();

            while (string.Compare(this.CurrentActivity.ID, destinationActivity.ID, true) != 0)
            {
                deletedActivities.Add(this.LastActivity);

                Activities.Remove(this.LastActivity);
            }

            return(deletedActivities);
        }
Пример #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected WfProcess(SerializationInfo info, StreamingContext context)
        {
            this._ID         = info.GetString("ID");
            this._ResourceID = info.GetString("ResourceID");
            this._Activities = (WfActivityCollection)info.GetValue("Activities", typeof(WfActivityCollection));
            this._Context    = (WfProcessContext)info.GetValue("Context", typeof(WfProcessContext));

            this._Status          = (WfProcessStatus)info.GetValue("Status", typeof(WfProcessStatus));
            this._StartTime       = info.GetDateTime("StartTime");
            this._EndTime         = info.GetDateTime("EndTime");
            this._Creator         = (IUser)info.GetValue("Creator", typeof(IUser));
            this._OwnerDepartment = (IOrganization)info.GetValue("OwnerDepartment", typeof(IOrganization));

            this._EntryInfo   = (WfBranchProcessInfo)info.GetValue("EntryInfo", typeof(WfBranchProcessInfo));
            this._LoadingType = (DataLoadingType)info.GetValue("LoadingType", typeof(DataLoadingType));

            WfProcessContextCache.Instance[this._ID] = this;
        }