/// <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);
        }
 public WorkflowInstance Query(string instanceID)
 {
     try
     {
         WorkflowInstance instance = Connection.Query <WorkflowInstance>(ResourceManage.SQL_WORKFLOW_INSTANCE, param: new { InstanceID = instanceID }).FirstOrDefault();
         instance.Current = WorkflowGlobalServiceProvider.Resolve <IWorkflowNodeService>().GetNode(instanceID);
         return(instance);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #3
0
 public IList <WorkflowInstance> Query(string instanceID)
 {
     try
     {
         return(Connection.Query <WorkflowInstance, Node, WorkflowInstance>(ResourceManage.SQL_WORKFLOW_INSTANCE, (instance, node) =>
         {
             instance.Current = WorkflowGlobalServiceProvider.Resolve <IWorkflowNodeService>().GetNode(node);
             return instance;
         }, param: new { InstanceID = instanceID }, splitOn: "Name").ToList());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #4
0
        public IList <WorkflowInstance> Query(object condition)
        {
            string sql = ResourceManage.GetString(ResourceManage.SQL_WORKFLOW_INSTANCE);

            try
            {
                return(Connection.Query <WorkflowInstance, Node, WorkflowInstance>(sql, (instance, node) =>
                {
                    instance.Current = WorkflowGlobalServiceProvider.Resolve <IWorkflowNodeService>().GetNode(node);
                    return instance;
                }, param: condition, splitOn: "Name").ToList());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #5
0
        /// <summary>
        /// 上一个执行跳转节点
        /// </summary>
        /// <returns></returns>
        public Node GetPrevious(Node entry)
        {
            Transition transition = GetHistoryTransition(entry);

            if (transition == null)
            {
                return(null);
            }
            WorkflowMode mode = WorkflowGlobalServiceProvider.Resolve <IWorkflowInstanceService>().GetMode(entry.InstanceID);

            if (mode == WorkflowMode.Mix)
            {
                Node wrapNode = this.FindNodeByID(transition.Origin, entry.InstanceID);
                return(this.GetNode(wrapNode));
            }
            else
            {
                return(base.Connection.Query <Node>(ResourceManage.SQL_WORKFLOW_NODE_SELECT_ID, new { entry.InstanceID, ID = transition.Origin }).FirstOrDefault());
            }
        }
 public static WorkflowInstance GetInstance(string instanceID)
 {
     return(WorkflowGlobalServiceProvider.Resolve <IWorkflowInstanceService>()
            .Query(instanceID));
 }
 public static WorkflowInstance GetInstance(string instanceID)
 {
     return(WorkflowGlobalServiceProvider.Resolve <IWorkflowInstanceService>()
            .Query(new { InstanceID = instanceID })
            .FirstOrDefault());
 }
Example #8
0
 public static IWorkflowAction Create(string name)
 {
     return(WorkflowGlobalServiceProvider.QueryActions()
            .FirstOrDefault(entry => string.Equals(entry.GetType().FullName, name, StringComparison.OrdinalIgnoreCase)));
 }