Ejemplo n.º 1
0
        internal bool DecreaseByStatus(WfProcessStatus status)
        {
            bool changed = false;

            switch (status)
            {
            case WfProcessStatus.Aborted:
                if (this.Aborted > 0)
                {
                    this.Aborted--;
                    changed = true;
                }
                break;

            case WfProcessStatus.Completed:
                if (this.Completed > 0)
                {
                    this.Completed--;
                    changed = true;
                }
                break;
            }

            return(changed);
        }
Ejemplo n.º 2
0
 private static void AssertAllBranchesStatus(WfProcessStatus expectedStatus, IWfProcess process)
 {
     process.CurrentActivity.BranchProcessGroups.ForEach(grpup =>
     {
         grpup.Branches.ForEach(p => AssertProcessAndAllBranchesStatus(expectedStatus, p));
     }
                                                         );
 }
Ejemplo n.º 3
0
        private WfProcessStatus GetStatus(WfProcessCurrentInfo info)
        {
            WfProcessStatus status = info.Status;

            if (this.ContainsKey(info.InstanceID))
            {
                status = this[info.InstanceID].Status;
            }

            return(status);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 根据流程的状态变化,修改分支流程的统计计数
        /// </summary>
        /// <param name="originalStatus"></param>
        /// <param name="newStatus"></param>
        /// <returns>是否改变了统计值</returns>
        internal bool ChangeProcessStatus(WfProcessStatus originalStatus, WfProcessStatus newStatus)
        {
            bool changed = false;

            if (originalStatus != newStatus)
            {
                bool decChanged = DecreaseByStatus(originalStatus);
                bool incChanged = IncreaseByStatus(newStatus);

                changed = decChanged || incChanged;
            }

            return(changed);
        }
Ejemplo n.º 5
0
        public static CompleteFlag ConvertProcessStatusToCompletedFlag(WfProcessStatus status)
        {
            CompleteFlag result = CompleteFlag.NoComplete;

            switch (status)
            {
            case WfProcessStatus.Aborted:
                result = CompleteFlag.IsCancelled;
                break;

            case WfProcessStatus.Completed:
                result = CompleteFlag.IsComplete;
                break;
            }

            return(result);
        }
Ejemplo n.º 6
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;
		}
Ejemplo n.º 7
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;
        }
Ejemplo n.º 8
0
        private static string GetImageByStatus(WfProcessStatus status)
        {
            string result = ControlResources.ActivityLogoUrl;

            switch (status)
            {
            case WfProcessStatus.Aborted:
                result = ControlResources.CancelledLogoUrl;
                break;

            case WfProcessStatus.Paused:
                result = ControlResources.DelayLogoUrl;
                break;

            case WfProcessStatus.Completed:
                result = ControlResources.CompletedActivityLogoUrl;
                break;
            }

            return(result);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 修改分支流程中的流程状态
        /// </summary>
        /// <param name="branchProcessID"></param>
        /// <param name="originalStatus"></param>
        /// <param name="newStatus"></param>
        /// <returns></returns>
        internal bool ChangeProcessStatus(string branchProcessID, WfProcessStatus originalStatus, WfProcessStatus newStatus)
        {
            bool result = false;

            if (originalStatus != newStatus)
            {
                result = true;

                CheckProcessesStatusInBranches();

                if (this._Branches != null && this._Branches.AllProcessesStatus != null)
                {
                    if (this._Branches.AllProcessesStatus.ContainsKey(branchProcessID))
                    {
                        this._Branches.AllProcessesStatus[branchProcessID].Status = newStatus;
                    }
                }
            }

            return(result);
        }
Ejemplo n.º 10
0
 public static WfClientProcessStatus ToClientProcessStatus(this WfProcessStatus status)
 {
     return((WfClientProcessStatus)status);
 }
Ejemplo n.º 11
0
        private static string GetImageByStatus(WfProcessStatus status)
        {
            string result = ControlResources.ActivityLogoUrl;

            switch (status)
            {
                case WfProcessStatus.Aborted:
                    result = ControlResources.CancelledLogoUrl;
                    break;
                case WfProcessStatus.Paused:
                    result = ControlResources.DelayLogoUrl;
                    break;
                case WfProcessStatus.Completed:
                    result = ControlResources.CompletedActivityLogoUrl;
                    break;
            }

            return result;
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 设置流程的状态,同时更新父流程中关于子流程的状态信息
        /// </summary>
        /// <param name="status"></param>
        private void ChangeProcessStatus(WfProcessStatus status)
        {
            if (this._Status != status)
            {
                if (this.EntryInfo != null)
                {
                    if (((WfBranchProcessGroup)this.EntryInfo).ChangeProcessStatus(this.ID, this._Status, status))
                        WfRuntime.ProcessContext.AffectedProcesses.AddOrReplace(this.EntryInfo.OwnerActivity.Process);
                }

                this.ApplicationRuntimeParameters["PreviousProcessStatus"] = this._Status.ToString();

                this._Status = status;

                this.RefreshApplicationRuntimeParameters();

                WfRuntime.ProcessContext.StatusChangedProcesses.AddOrReplace(this);
                RegisterAndPrepareActions(this.ProcessStatusChangeActions);
            }
        }
		internal bool DecreaseByStatus(WfProcessStatus status)
		{
			bool changed = false;

			switch (status)
			{
				case WfProcessStatus.Aborted:
					if (this.Aborted > 0)
					{
						this.Aborted--;
						changed = true;
					}
					break;
				case WfProcessStatus.Completed:
					if (this.Completed > 0)
					{
						this.Completed--;
						changed = true;
					}
					break;
			}

			return changed;
		}
		/// <summary>
		/// 根据流程的状态变化,修改分支流程的统计计数
		/// </summary>
		/// <param name="originalStatus"></param>
		/// <param name="newStatus"></param>
		/// <returns>是否改变了统计值</returns>
		internal bool ChangeProcessStatus(WfProcessStatus originalStatus, WfProcessStatus newStatus)
		{
			bool changed = false;

			if (originalStatus != newStatus)
			{
				bool decChanged = DecreaseByStatus(originalStatus);
				bool incChanged = IncreaseByStatus(newStatus);

				changed = decChanged || incChanged;
			}

			return changed;
		}
		private static void AssertAllBranchesStatus(WfProcessStatus expectedStatus, IWfProcess process)
		{
			process.CurrentActivity.BranchProcessGroups.ForEach(grpup =>
			{
				grpup.Branches.ForEach(p => AssertProcessAndAllBranchesStatus(expectedStatus, p));
			}
			);
		}