Exemple #1
0
        private static int ResolveMenuCollection(List<Menu> dbMenus, Menu parentMenu, int level)
        {
            int count = 0;

            foreach (var menu in dbMenus.Where(m => m.Parent == parentMenu))
            {
                count++;

                _menus.Add(menu);
                menu.TreeLevel = level;
                menu.IsTreeLeaf = true;
                menu.Enabled = true;

                level++;
                int childCount = ResolveMenuCollection(dbMenus, menu, level);
                if (childCount != 0)
                {
                    menu.IsTreeLeaf = false;
                }
                level--;
            }

            return count;
        }
Exemple #2
0
 public object Clone()
 {
     Menu menu = new Menu {
         ID = ID,
         Name = Name,
         ImageUrl = ImageUrl,
         NavigateUrl = NavigateUrl,
         Remark = Remark,
         SortIndex = SortIndex,
         TreeLevel = TreeLevel,
         Enabled = Enabled,
         IsTreeLeaf = IsTreeLeaf
     };
     return menu;
 }