Пример #1
0
 protected string CreateWorkflowInstance(string NID, string resource)
 {
     return(WorkflowInstance.CreateWorkflowInstance(NID, resource));
 }
Пример #2
0
        /// <summary>
        /// 进行流程跳转
        /// </summary>
        /// <param name="context"></param>
        public void Jump(WorkflowContext context)
        {
            WorkflowInstance instance = context.Instance;

            if (instance.State == WorkflowInstanceState.Running)
            {
                if (context.TransitionID == Utils.CONST_REJECT_TRANSITION_ID)
                {
                    Reject(instance, context);
                    return;
                }

                Node       current           = instance.Current;
                Transition currentTransition = current.Transitions
                                               .FirstOrDefault(e => e.NID == context.TransitionID);

                Node to = workflowService.NodeService.Query(current.InstanceID)
                          .Where(e => e.ID == currentTransition.Destination).FirstOrDefault();

                var executeContext = new ExecutingContext()
                {
                    From     = current,
                    To       = to,
                    Instance = context.Instance,
                    Data     = context.Data,
                    Result   = false
                };

                if (current.Cooperation == 1)
                {
                    this.Discuss(context, current, executeContext);
                }
                else
                {
                    this.Invoke(context.Instance.InstanceID, currentTransition, executeContext);
                }

                if (to.NodeType == WorkflowNodeCategory.End)
                {
                    workflowService.InstanceService.Transfer(WorkflowInstanceState.End, instance.InstanceID);
                }
                else if (to.NodeType == WorkflowNodeCategory.Decision)
                {
                    Transition transition = (currentTransition.Direction == WorkflowOpertaion.Back) ?
                                            workflowService.NodeService.GetBackTransition(WorkflowInstance.GetInstance(instance.InstanceID).Current) :
                                            workflowService.NodeService.GetTransition(to);

                    if (transition == null)
                    {
                        return;
                    }
                    Jump(new WorkflowContext()
                    {
                        Instance     = WorkflowInstance.GetInstance(instance.InstanceID),
                        TransitionID = transition.NID,
                        Data         = context.Data
                    });
                }
            }
        }
Пример #3
0
 protected string CreateWorkflowInstance(string startNID, string structureID, string structure)
 {
     return(WorkflowInstance.CreateWorkflowInstance(startNID, structureID, structure));
 }