コード例 #1
0
ファイル: ProcessModel.cs プロジェクト: egman77/FapCore3.0
        /// <summary>
        /// 获取任务节点审批人
        /// </summary>
        /// <param name="activityId"></param>
        /// <returns></returns>
        public PerformerList GetActivityPerformers(string activityId)
        {
            IList <Participant> participants = GetActivityParticipants(activityId);
            PerformerList       performers   = new PerformerList();

            if (participants.Any())
            {
                foreach (var pp in participants)
                {
                    if (pp.Type == ParticipantTypeEnum.User)
                    {
                        Performer pf = new Performer();
                        pf.UserId   = pp.ID;
                        pf.UserName = pp.Name;
                        performers.Add(pf);
                    }
                    else if (pp.Type == ParticipantTypeEnum.Role)
                    {
                        var ps = GetPerformerByRole(pp.ID);
                        if (ps.Any())
                        {
                            performers.AddRange(ps);
                        }
                    }
                    else if (pp.Type == ParticipantTypeEnum.DynRole)
                    {
                        IDictionary <string, object> bizData = ProcessEntity.BizData as IDictionary <string, object>;
                        var ps = GetPerformerByDynRole(pp.ID, pp.BindField, bizData);
                        if (ps.Any())
                        {
                            performers.AddRange(ps);
                        }
                    }
                    else if (pp.Type == ParticipantTypeEnum.Other)
                    {
                        //同其他节点审批人
                        PerformerList others = GetActivityPerformers(pp.ID);
                        performers.AddRange(others);
                    }
                }
            }
            return(performers);
        }