private AjaxTreeNodeCollection getChildrenNodes(string id) { AjaxTreeNodeCollection result = new AjaxTreeNodeCollection(); IList<Organization> organizations = repository.All<Organization>().Where(o => o.ParentID == id && o.Status == 0).OrderBy(o => o.SortOrder).ToList<Organization>(); if (organizations != null) { foreach (var org in organizations) { AjaxTreeNode node = new AjaxTreeNode() { ID = org.ID, Text = org.Name, Value = org.ID, Tag = org.Type.ToString(), IcoSrc = string.Format("{0}Plugins/Authorize/Content/Themes/{1}/Images/{2}", WebUtil.GetRootPath(), Skin, getResourceIcon(ResourceType.Menu)), VirtualNodeCount = repository.All<Organization>().Count(o => o.ParentID == org.ID) + authService.GetEmployees(org.ID).Count }; result.Add(node); } } IList<Employee> employees =authService.GetEmployees(id); if (employees != null) { foreach (var employee in employees) { AjaxTreeNode newNode = CreateNode(employee); result.Add(newNode); } } return result; }
/// <summary> /// 获取子节点 /// </summary> /// <param name="id"></param> /// <returns></returns> private AjaxTreeNodeCollection getChildrenNodes(string id) { AjaxTreeNodeCollection result = new AjaxTreeNodeCollection(); IList<Participantor> participantors = workflowEngine.GetRoleAndOrgParticipantors().Where(p => p.ParentID == id).ToList(); foreach (Participantor participantor in participantors) { AjaxTreeNode node = new AjaxTreeNode() { ID = participantor.ID, Text = participantor.Name, Value = participantor.ID, Tag = Enum.Parse(typeof(ParticipantorType), participantor.ParticipantorType.ToString()).ToString(), IcoSrc = string.Format("{0}Plugins/Workflow/Content/Themes/{1}/Images/{2}", WebUtil.GetRootPath(), Skin, getResourceIcon(participantor.ParticipantorType.ToSafeString())), VirtualNodeCount = workflowEngine.GetRoleAndOrgParticipantors().Count(o => o.ParentID == participantor.ID), }; result.Add(node); } return result; }