private void GetNextStepUser(NextStep nextStep, IActivity activity, IWorkflowContext context) { IActor actor = activity.Actor; nextStep.Users = new List <NextStepUser>(); if (activity is ResponseActivity) { nextStep.MultipleSelectTag = (activity as ResponseActivity).MultipleSelectTag; } if (actor is UserSelectActor) { UserSelectActor userSelectActor = actor as UserSelectActor; nextStep.AllowFree = userSelectActor.AllowFree; nextStep.OnlySingleSel = userSelectActor.OnlySingleSelect; nextStep.AutoSelectAll = userSelectActor.AutoSelectAll; nextStep.AllowSelect = true; actor = userSelectActor.InnerActor; actor.Owner = activity; } else { nextStep.AllowFree = false; nextStep.AutoSelectAll = true; nextStep.AllowSelect = false; nextStep.OnlySingleSel = false; } if (actor != null) { try { var groupByActors = actor.Resolve(context).GroupBy(o => o.DepartmentId); foreach (var actors in groupByActors) { foreach (IUser u in actors.OrderBy(o => o.Rank)) { nextStep.Users.Add(new NextStepUser() { StepName = activity.Name, ID = u.Id, Name = u.Name, OrgId = u.Department.Id, OrgName = u.Department.Name, Rank = u.Rank, OrgRank = u.Department.Rank }); } } } catch (Exception ex) { nextStep.Message = ex.Message; } } if (activity is EndActivity) { nextStep.NeedUser = false; } }
public NextStep GetStepUser(string activityName) { Validate(); var returnValue = new NextStep(); var activity = CurrentWorkflow[activityName]; if (activity == null) { throw new FoxOneException("流程中不存在步骤名为:{0} 的步骤", activityName); } returnValue.NeedUser = true; returnValue.StepName = activity.Name; returnValue.Label = activity.Alias; GetNextStepUser(returnValue, activity, GetWorkflowContext()); return(returnValue); }
public List <NextStep> GetAllStep() { Validate(); List <NextStep> returnValue = new List <NextStep>(); IWorkflowContext context = GetWorkflowContext(); foreach (var acti in CurrentWorkflow.Activities) { if ((acti is ResponseActivity) || (acti is EndActivity)) { var nextStep = new NextStep() { Label = acti.Alias, LabelDescription = "", StepName = acti.Name, NeedUser = true }; returnValue.Add(nextStep); } } return(returnValue.OrderBy(o => o.Rank).ToList()); }
public List <NextStep> GetNextStep() { Validate(); List <NextStep> returnValue = new List <NextStep>(); IWorkflowContext context = GetWorkflowContext(); var trans = GetAvailableTransitions(context); foreach (var tran in trans) { var nextStep = new NextStep() { Label = tran.Label, LabelDescription = tran.Description, StepName = tran.To.Name, Rank = tran.Rank, NeedUser = true }; GetNextStepUser(nextStep, tran.To, context); returnValue.Add(nextStep); } return(returnValue.OrderBy(o => o.Rank).ToList()); }