Ejemplo n.º 1
0
		public WorkflowErrorEventArgs(OptimaJet.Workflow.Core.Model.ProcessInstance processInstance, OptimaJet.Workflow.Core.Persistence.ProcessStatus processStatus, TransitionDefinition executedTransition, System.Exception exception)
		{
			this.ProcessInstance = processInstance;
			this.ProcessStatus = processStatus;
			this.ExecutedTransition = executedTransition;
			this.Exception = exception;
		}
		public ProcessStatusChangedEventArgs(Guid processId, bool isSubprocess, ProcessStatus oldStatus, ProcessStatus newStatus)
		{
			this.ProcessId = processId;
			this.OldStatus = oldStatus;
			this.NewStatus = newStatus;
			this.IsSubprocess = isSubprocess;
		}
Ejemplo n.º 3
0
 /// <summary>
 /// 设置WorkflowProcessInstanceStatus新的状态
 /// </summary>
 /// <param name="processId"></param>
 /// <param name="status"></param>
 private void SetCustomStatus(Guid processId, ProcessStatus status)
 {
     using (TransactionScope serializableSupressedScope = PredefinedTransactionScopes.SerializableSupressedScope)
     {
         using (WorkflowPersistenceModelDataContext workflowPersistenceModelDataContext = base.CreateContext())
         {
             WorkflowProcessInstanceStatus workflowProcessInstanceStatus = workflowPersistenceModelDataContext.WorkflowProcessInstanceStatus.SingleOrDefault((WorkflowProcessInstanceStatus wpis) => wpis.Id == processId);
             if (workflowProcessInstanceStatus == null)
             {
                 throw new StatusNotDefinedException();
             }
             workflowProcessInstanceStatus.Status = status.Id;
             workflowPersistenceModelDataContext.SubmitChanges();
         }
         serializableSupressedScope.Complete();
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 设置流程的状态
        /// </summary>
        /// <param name="processInstance"></param>
        /// <param name="newStatus"></param>
        private void SetProcessNewStatus(ProcessInstance processInstance, ProcessStatus newStatus)
        {
            var oldStatus = PersistenceProvider.GetInstanceStatus(processInstance.ProcessId);
            if (newStatus == ProcessStatus.Finalized)
                PersistenceProvider.SetWorkflowFinalized(processInstance);
            else if (newStatus == ProcessStatus.Idled)
                PersistenceProvider.SetWorkflowIdled(processInstance);
            else if (newStatus == ProcessStatus.Initialized)
                PersistenceProvider.SetWorkflowIniialized(processInstance);
            else if (newStatus == ProcessStatus.Running)
                PersistenceProvider.SetWorkflowRunning(processInstance);
            else if (newStatus == ProcessStatus.Terminated)
                PersistenceProvider.SetWorkflowTerminated(processInstance,ErrorLevel.Critical,"Terminated");
            else
            {
                return;
            }

            if (ProcessSatusChanged != null)
                ProcessSatusChanged(this,new ProcessStatusChangedEventArgs(processInstance.ProcessId, oldStatus, newStatus));
        }
Ejemplo n.º 5
0
		static ProcessStatus()
		{
			ProcessStatus processStatu = new ProcessStatus()
			{
				Id = 255,
				IsAllowedToChangeStatus = false,
				IsAllowedToExecuteCommand = false
			};
			ProcessStatus.NotFound = processStatu;
			ProcessStatus processStatu1 = new ProcessStatus()
			{
				Id = 254,
				IsAllowedToChangeStatus = false,
				IsAllowedToExecuteCommand = false
			};
			ProcessStatus.Unknown = processStatu1;
			ProcessStatus processStatu2 = new ProcessStatus()
			{
				Id = 0,
				IsAllowedToChangeStatus = false,
				IsAllowedToExecuteCommand = false
			};
			ProcessStatus.Initialized = processStatu2;
			ProcessStatus processStatu3 = new ProcessStatus()
			{
				Id = 1,
				IsAllowedToChangeStatus = false,
				IsAllowedToExecuteCommand = false
			};
			ProcessStatus.Running = processStatu3;
			ProcessStatus processStatu4 = new ProcessStatus()
			{
				Id = 2,
				IsAllowedToChangeStatus = true,
				IsAllowedToExecuteCommand = true
			};
			ProcessStatus.Idled = processStatu4;
			ProcessStatus processStatu5 = new ProcessStatus()
			{
				Id = 3,
				IsAllowedToChangeStatus = true,
				IsAllowedToExecuteCommand = false
			};
			ProcessStatus.Finalized = processStatu5;
			ProcessStatus processStatu6 = new ProcessStatus()
			{
				Id = 4,
				IsAllowedToChangeStatus = true,
				IsAllowedToExecuteCommand = false
			};
			ProcessStatus.Terminated = processStatu6;
			ProcessStatus processStatu7 = new ProcessStatus()
			{
				Id = 5,
				IsAllowedToChangeStatus = true,
				IsAllowedToExecuteCommand = true
			};
			ProcessStatus.Error = processStatu7;
			List<ProcessStatus> processStatuses = new List<ProcessStatus>()
			{
				ProcessStatus.Initialized,
				ProcessStatus.Running,
				ProcessStatus.Idled,
				ProcessStatus.Finalized,
				ProcessStatus.Terminated,
				ProcessStatus.Error
			};
			ProcessStatus.All = processStatuses;
		}
Ejemplo n.º 6
0
 public ProcessStatusChangedEventArgs(Guid processId, ProcessStatus oldStatus, ProcessStatus newStatus)
 {
     ProcessId = processId;
     OldStatus = oldStatus;
     NewStatus = newStatus;
 }
Ejemplo n.º 7
0
 private void SetProcessNewStatus(ProcessInstance processInstance, ProcessStatus newStatus)
 {
     ProcessStatus ınstanceStatus = this.PersistenceProvider.GetInstanceStatus(processInstance.ProcessId);
     if (newStatus == ProcessStatus.Finalized)
     {
         this.PersistenceProvider.SetWorkflowFinalized(processInstance);
         if (processInstance.IsSubprocess)
         {
             this.MergeSubprocess(processInstance);
         }
     }
     else if (newStatus == ProcessStatus.Idled)
     {
         this.PersistenceProvider.SetWorkflowIdled(processInstance);
     }
     else if (newStatus == ProcessStatus.Initialized)
     {
         this.PersistenceProvider.SetWorkflowIniialized(processInstance);
     }
     else if (newStatus != ProcessStatus.Running)
     {
         if (newStatus != ProcessStatus.Terminated)
         {
             return;
         }
         this.PersistenceProvider.SetWorkflowTerminated(processInstance, ErrorLevel.Critical, "Terminated");
     }
     else
     {
         this.PersistenceProvider.SetWorkflowRunning(processInstance);
     }
     if (this.ProcessStatusChanged != null && ınstanceStatus.Id != newStatus.Id)
     {
         EventHandler<ProcessStatusChangedEventArgs> eventHandler = this.ProcessStatusChanged;
         ProcessStatusChangedEventArgs processStatusChangedEventArg = new ProcessStatusChangedEventArgs(processInstance.ProcessId, processInstance.IsSubprocess, ınstanceStatus, newStatus)
         {
             ProcessInstance = processInstance,
             SchemeCode = processInstance.ProcessScheme.Name
         };
         eventHandler(this, processStatusChangedEventArg);
     }
 }