示例#1
0
 public static bool CanAddMenu(int parentId)
 {
     IList<MenuInfo> menusByParentId = new MenuDao().GetMenusByParentId(parentId);
     if ((menusByParentId == null) || (menusByParentId.Count == 0))
     {
         return true;
     }
     if (parentId == 0)
     {
         return (menusByParentId.Count < 3);
     }
     return (menusByParentId.Count < 5);
 }
示例#2
0
 public static IList<MenuInfo> GetMenus()
 {
     IList<MenuInfo> list = new List<MenuInfo>();
     MenuDao dao = new MenuDao();
     IList<MenuInfo> topMenus = dao.GetTopMenus();
     if (topMenus != null)
     {
         foreach (MenuInfo info in topMenus)
         {
             list.Add(info);
             IList<MenuInfo> menusByParentId = dao.GetMenusByParentId(info.MenuId);
             if (menusByParentId != null)
             {
                 foreach (MenuInfo info2 in menusByParentId)
                 {
                     list.Add(info2);
                 }
             }
         }
     }
     return list;
 }
示例#3
0
 public static IList<MenuInfo> GetInitMenus()
 {
     MenuDao dao = new MenuDao();
     IList<MenuInfo> topMenus = dao.GetTopMenus();
     foreach (MenuInfo info in topMenus)
     {
         info.Chilren = dao.GetMenusByParentId(info.MenuId);
         if (info.Chilren == null)
         {
             info.Chilren = new List<MenuInfo>();
         }
     }
     return topMenus;
 }