示例#1
0
文件: Action.cs 项目: bertyang/Mobile
        private List <C_MENU_TREE> GetMenuTree(List <C_MENU_TREE> mtmList, string Pid)
        {
            List <C_MENU_TREE> listTree = new List <C_MENU_TREE>();

            List <C_MENU_TREE> listParent = mtmList.Where(item => item.ParentID == Pid).ToList();

            foreach (C_MENU_TREE t in listParent)
            {
                C_MENU_TREE tm = new C_MENU_TREE();
                tm.id       = t.id;
                tm.text     = t.text;
                tm.iconCls  = t.iconCls;
                tm.ParentID = t.ParentID;
                tm.url      = t.url;

                if (mtmList.Where(item => item.ParentID == t.id).Any())
                {
                    tm.children = GetMenuTree(mtmList, t.id);
                }
                else
                {
                    tm.children = new List <C_MENU_TREE>();
                }
                listTree.Add(tm);
            }
            return(listTree);
        }
示例#2
0
文件: Action.cs 项目: bertyang/Mobile
        private static List <C_MENU_TREE> GetMenuRangeTree(List <C_MENU_TREE> mtmList, string Pid)
        {
            List <C_MENU_TREE> listTree = new List <C_MENU_TREE>();

            List <C_MENU_TREE> listParent = mtmList.Where(item => item.ParentID == Pid).ToList();

            if (listParent.Any())//如果是按钮模块权限自动添加 一个默认的 页基本权限
            {
                C_MENU_TREE c = listParent.First();
                if (!string.IsNullOrEmpty(c.id) && c.id.Substring(0, 2) == "r-")
                {
                    C_MENU_TREE tm = new C_MENU_TREE();
                    tm.id   = "nullid";
                    tm.text = "页基本权限";
                    //tm.iconCls = t.iconCls;
                    tm.ParentID = Pid;
                    tm.children = new List <C_MENU_TREE>();
                    listTree.Add(tm);
                }
            }


            foreach (C_MENU_TREE t in listParent)
            {
                C_MENU_TREE tm = new C_MENU_TREE();

                tm.id   = t.id;
                tm.text = t.text;
                //tm.iconCls = t.iconCls;
                tm.ParentID = t.ParentID;
                //tm.url = t.url;

                if (mtmList.Where(item => item.ParentID == t.id).Any())
                {
                    tm.children = GetMenuRangeTree(mtmList, t.id);
                }
                else
                {
                    tm.children = new List <C_MENU_TREE>();
                }
                listTree.Add(tm);
            }
            return(listTree);
        }