Exemple #1
0
        public IList <WorkflowProcess> Query(Dictionary <string, object> queryArg)
        {
            using ISession session = DbFactory.OpenSession();
            WorkflowOpertaion direction = (WorkflowOpertaion)Enum.Parse(typeof(WorkflowOpertaion),
                                                                        queryArg["Direction"].ToString());

            return(session.Query <WorkflowProcess>()
                   .Where(e => e.InstanceID == queryArg["InstanceID"].ToString())
                   .Where(e => e.Direction == direction)
                   .OrderByDescending(e => e.CreateTime)
                   .ToList());
        }
Exemple #2
0
        public List <User> GetActorByGroup(Node node, WorkflowOpertaion direction)
        {
            List <User>   userList = new List <User>();
            List <string> gList    = new List <string>();
            List <string> ids      = new List <string>();

            foreach (Group g in node.Groups)
            {
                gList.Add(string.Format("'{0}'", g.ID.ToString()));
            }

            foreach (Actor item in node.Actors)
            {
                ids.Add(string.Format("'{0}'", item.ID));
            }

            if (gList.Count > 0)
            {
                if (node.Rules.Count > 0)
                {
                    userList.AddRange(QueryActor(string.Join(",", gList), node.Rules));
                }
                else
                {
                    userList.AddRange(_actorService.GetActorByRole(string.Join(",", gList)));
                }
            }

            if (ids.Count > 0)
            {
                userList.AddRange(_actorService.Query(string.Join(",", ids)));
            }

            if (direction == WorkflowOpertaion.Back && node.Cooperation == 0)
            {
                WorkflowProcess process = base.ProcessService
                                          .Get(node.InstanceID)
                                          .Where(n => n.Origin == node.ID)
                                          .OrderByDescending(e => e.CreateDateTime)
                                          .FirstOrDefault();

                //return new UserByActorQueryService().Query(process.ActorID).ToList();
                return(userList.Where(e => e.UniqueId == process.ActorID).ToList());
            }
            else
            {
                return(userList
                       .ToLookup(p => p.UniqueId)
                       .Select(c => c.First())
                       .ToList());
            }
        }
        public List <User> GetActorByGroup(string actors, string groups, string organizations, Node node, WorkflowOpertaion direction)
        {
            if (direction == WorkflowOpertaion.Back && String.IsNullOrEmpty(node.Cooperation))
            {
                WorkflowProcess process = base.ProcessService
                                          .Get(node.InstanceID)
                                          .Where(n => n.Origin == node.ID)
                                          .OrderByDescending(e => e.CreateTime)
                                          .FirstOrDefault();

                return(_actorService.GetUserByRoleIDs(new List <string> {
                    process.ActorID
                }).ToList());
            }
            else
            {
                List <User> userList = GetAllActor(actors, groups, organizations);
                if (node.Rules.Count > 0)
                {
                    userList = QueryActor(userList, node.Rules);
                }
                return(userList
                       .ToLookup(p => p.ID)
                       .Select(c => c.First())
                       .ToList());
            }
        }
        public List <User> GetActorByGroup(Node node, WorkflowOpertaion direction)
        {
            dynamic dyObject = this.ToJoin(node);

            return(GetActorByGroup((String)dyObject.Actors, (String)dyObject.Groups, (String)dyObject.Organizations, node, direction));
        }
 /// <summary>
 /// 跳转过程处理入库
 /// </summary>
 /// <param name="executeContext">执行上下文</param>
 protected void Processing(ExecutingContext executeContext, string transitionID, WorkflowOpertaion command)
 {
     workflowService.ProcessService.Persistent(new WorkflowProcess()
     {
         RelationshipID = executeContext.From.NID,
         Origin         = executeContext.From.ID,
         Destination    = executeContext.To.ID,
         TransitionID   = transitionID,
         InstanceID     = executeContext.Instance.InstanceID,
         NodeType       = executeContext.From.NodeType,
         Command        = command
     });
 }