/// <summary>
        /// 获取回退线路
        /// </summary>
        /// <returns>路线</returns>
        protected Transition GetHistoryTransition(Node entry)
        {
            WorkflowMode mode = WorkflowGlobalServiceProvider.Resolve <IWorkflowInstanceService>().GetMode(entry.InstanceID);

            if (mode == WorkflowMode.Mix)
            {
                Transition transition = null;

                Dictionary <String, Object> queryArg = new Dictionary <string, object>
                {
                    { "InstanceID", entry.InstanceID },
                    { "Direction", (int)WorkflowOpertaion.Go }
                };

                WorkflowProcess process = ProcessService
                                          .Query(queryArg).Where(c => c.Destination == entry.ID)
                                          .FirstOrDefault();

                if (process != null && entry.NodeType != WorkflowNodeCategory.Start)
                {
                    transition = TransitionService.Query(entry.InstanceID).FirstOrDefault(e => e.NID == process.TransitionID && e.Direction == WorkflowOpertaion.Go);
                }

                return(transition);
            }

            return(null);
        }
        /// <summary>
        /// 获取回退线路
        /// </summary>
        /// <returns>路线</returns>
        protected Transition GetHistoryTransition(Node entry)
        {
            Transition transition = null;

            WorkflowProcess process = ProcessService.Query(new { entry.InstanceID, Command = 0 })
                                      .Where(c => c.Destination == entry.ID)
                                      .FirstOrDefault();

            if (process != null && entry.NodeType != WorkflowNodeCategory.Start)
            {
                ASTNode n = this.FindNodeByID(process.Origin, entry.InstanceID);

                while (n.NodeType == WorkflowNodeCategory.Decision)
                {
                    process = ProcessService.Query(new { entry.InstanceID, Command = 0 })
                              .FirstOrDefault(c => c.Destination == n.ID);

                    n = this.FindNodeByID(process.Origin, entry.InstanceID);

                    if (n.NodeType == WorkflowNodeCategory.Start)
                    {
                        break;
                    }
                }

                transition =
                    TransitionService.Query(new { entry.InstanceID }).FirstOrDefault(e => e.NID == process.TransitionID);
            }
            return(transition);
        }
 public Node GetNode(Node entry)
 {
     entry.Transitions = TransitionService.Query(entry.InstanceID).Where(t => t.RelationshipID == entry.NID).ToList();
     entry.Groups      = GroupService.Query(entry.InstanceID).Where(e => e.RelationshipID == entry.NID).ToList();
     entry.Actors      = ActorService.Query(entry.InstanceID).Where(e => e.RelationshipID == entry.NID).ToList();
     entry.Actions     = ActionService.Query(entry.InstanceID).Where(e => e.RelationshipID == entry.NID).ToList();
     entry.Command     = CommandService.Query(entry.InstanceID).Where(e => e.RelationshipID == entry.NID).FirstOrDefault();
     entry.Previous    = GetPrevious(entry);
     return(entry);
 }
 public Transition GetNextTransition(string id, string instanceID)
 {
     return(TransitionService
            .Query(instanceID)
            .FirstOrDefault(e => e.NID == id));
 }