Example #1
0
 public void ActionExecute(ExecutingContext executeContext)
 {
     if (executeContext.Instance.State == WorkflowInstanceState.Reject || executeContext.Instance.State == WorkflowInstanceState.Kill)
     {
         CommandBus.Dispatch <string>(new DeletePending(),
                                      executeContext.Instance.InstanceID);
     }
     else
     {
         var current = executeContext.To;
         if (current.NodeType == WorkflowNodeCategory.Decision)
         {
             DecisionJump(executeContext);
         }
         else
         {
             if (!executeContext.Result && !String.IsNullOrEmpty(executeContext.From.Cooperation))
             {
                 CooperationPending.Execute(executeContext);
             }
             else
             {
                 string instanceID = executeContext.Instance.InstanceID;
                 if (current.NodeType == WorkflowNodeCategory.End)
                 {
                     CommandBus.Dispatch <string>(new DeletePending(), instanceID);
                 }
                 else
                 {
                     AssignToPendingUser(executeContext, current);
                 }
             }
         }
     }
 }
Example #2
0
        public void ActionExecute(ExecutingContext executeContext)
        {
            if (executeContext.Instance.State == WorkflowInstanceState.Reject)
            {
                CommandBus.Dispatch <string>(new DeletePending(),
                                             executeContext.Instance.InstanceID);
            }
            else
            {
                if (executeContext.Instance.Current.NodeType == WorkflowNodeCategory.Decision)
                {
                    DecisionJump(executeContext);
                }

                if (!executeContext.Result && executeContext.Instance.Current.Cooperation == 1)
                {
                    CooperationPending.Execute(executeContext);
                }
                else
                {
                    string instanceID = executeContext.Instance.InstanceID;
                    var    current    = GetCurrentNode(instanceID);
                    if (current.NodeType == WorkflowNodeCategory.End)
                    {
                        CommandBus.Dispatch <string>(new DeletePending(), instanceID);
                    }
                    else
                    {
                        List <User> userList = GetUserByGroup(current.Groups, current.Actors);
                        foreach (User user in userList)
                        {
                            WritePending(user.UniqueId, executeContext);
                        }

                        string NID = executeContext.Instance.Current.NID;

                        Dictionary <string, object> deleteArg = new Dictionary <string, object>()
                        {
                            { "instanceID", instanceID },
                            { "nodeID", NID }
                        };

                        CommandBus.Dispatch <Dictionary <string, Object> >(new DeletePending(), deleteArg);
                    }
                }
            }
        }