private void BuildSubTree(Module model, int level)
 {
     var tempList = moduleList.Where(s => s.ParentId == model.Id).OrderBy(m => m.Sort).ToList();
     level++;
     foreach (var a in tempList)
     {
         a.TreeLevel = level;
         treeList.Add(a);
         BuildSubTree(a, level);
     }
 }
 /// <summary>
 /// 创建树第一级节点
 /// </summary>
 private void CreateXElement(XElement root, Module model)
 {
     var tempList = authorityList.Where(m => m.ParentId == model.Id).OrderBy(s => s.Sort).ToList();
     foreach (var temp in tempList)
     {
         XElement xe = new XElement("TreeNode", new object[]
         {
             new XAttribute("Text", temp.Text),
             new XAttribute("NodeID",temp.Id),
         });
         if (forPage && authorityList.Count(m => m.ParentId == temp.Id) > 0)
         {
             object[] xas = new object[]
             {
                 new XAttribute("Enabled", false),
             };
             xe.Add(xas);
         }
         root.Add(xe);
         CreateXElement(xe, temp);
     }
 }
 /// <summary>
 /// 创建树第一级节点
 /// </summary>
 private void CreateXElement(XElement root, Module model)
 {
     var tempList = moduleList.Where(m => m.ParentId == model.Id).OrderBy(s => s.Sort).ToList();
     foreach (var temp in tempList)
     {
         XElement xe = new XElement("TreeNode", new object[]
         {
             new XAttribute("Text", temp.Text),
             new XAttribute("EnableClickEvent",true),
             new XAttribute("NodeID",temp.Id),
         });
         root.Add(xe);
         CreateXElement(xe, temp);
     }
 }