Example #1
0
        public ActionResult MainMenus()
        {
            List <B_Menu> menus = B_Menu.GetEntitysAll().OrderBy(s => s.Sort).ToList();

            menus = menus.FindAll(m => m.ParentID == 0);
            return(View(menus));
        }
Example #2
0
 public ContentResult UpdateAllRights()
 {
     try
     {
         List <B_Menu> menus    = B_Menu.GetEntitysAll();
         string        ErrorStr = "";
         foreach (B_Menu menu in menus)
         {
             if (menu.ParentID == 0)
             {
                 continue;
             }
             bool hasMainMenuTag          = false;
             List <B_MenuRights> muRights = null;
             if (string.IsNullOrWhiteSpace(menu.MenuUrl) == false)
             {
                 menu.MenuUrl = menu.MenuUrl.Trim().TrimEnd('/');
                 try
                 {
                     string   tmpUrl = menu.MenuUrl.TrimStart('/').Split('?')[0];
                     string[] arrUrl = tmpUrl.Split('/');
                     Type     type   = Type.GetType("WeBusiness.Controllers." + arrUrl[0] + "Controller");
                     muRights = BaseAuthorizeHelper.GetBOMenuRightsByControllerType(type, arrUrl[1], out hasMainMenuTag);
                 }
                 catch (Exception ex)
                 {
                     DAL.Log.Instance.Write(ex.ToString(), "BOMenu_Update");
                     ErrorStr += "【" + menu.MenuName + "】";
                 }
             }
             if (hasMainMenuTag && muRights != null)
             {
                 B_MenuRights.RelevanceList(menu.ID, muRights);
             }
             B_MenuRights.ClearHashMenuRights();
         }
         if (!string.IsNullOrWhiteSpace(ErrorStr))
         {
             return(Content("更新失败的菜单:" + ErrorStr));
         }
         return(Content("ok"));
     }
     catch (Exception ex)
     {
         DAL.Log.Instance.Write(ex.ToString(), "B_Menu_UpdateAllRights_error");
         return(Content("更新失败"));
     }
 }
Example #3
0
        public ActionResult Menus()
        {
            List <B_Menu> menus = B_Menu.GetEntitysAll();

            return(View(menus));
        }