public virtual JsonResult GetApplicationMenu() { var appMenu = new List <dynamic>(); var cacheKey = string.Empty; try { if (UserClaims != null) { //Creates a cacheKey using user login cacheKey = "appMenu" + UserClaims.FirstOrDefault(uc => uc.ClaimType == ClaimTypes.WindowsAccountName).Value; appMenu = (List <dynamic>)HttpContext.Cache.Get(cacheKey); } if (appMenu == null || appMenu.Count <= 0) { var menu = AppMenu.GetApplicationMenu(); appMenu = AppMenu.CastToDynamicMenuList(menu); if (!string.IsNullOrEmpty(cacheKey)) { HttpContext.Cache.Add(cacheKey, appMenu, null, DateTime.Now.AddHours(1), Cache.NoSlidingExpiration, CacheItemPriority.Default, null); } } } catch (Exception ex) { } return(Json(appMenu, JsonRequestBehavior.AllowGet)); }
public virtual JsonResult GetAboutMenu() { var aboutMenu = new List <dynamic>(); try { var menuList = AppMenu.GetAboutMenu(Header.LabelMenuHelp, Header.LabelMenuOpenTicket, Header.LabelMenuAbout); aboutMenu = AppMenu.CastToDynamicMenuList(menuList); } catch (Exception ex) { } return(Json(aboutMenu, JsonRequestBehavior.AllowGet)); }
public virtual JsonResult GetMyAppsMenu() { var myAppsMenu = new List <dynamic>(); var cacheKey = string.Empty; try { var menuList = default(List <MenuModel>); if (UserClaims != null) { //Creates a cacheKey using user login cacheKey = "myAppsMenu" + UserClaims.FirstOrDefault(uc => uc.ClaimType == ClaimTypes.WindowsAccountName).Value; menuList = (List <MenuModel>)HttpContext.Cache.Get(cacheKey); } if (menuList == null || menuList.Count <= 0) { menuList = AppMenu.GetMyAppsMenu(AppCode, Header.LabelMenuMyApps); if (!string.IsNullOrEmpty(cacheKey)) { HttpContext.Cache.Add(cacheKey, menuList, null, DateTime.Now.AddHours(1), Cache.NoSlidingExpiration, CacheItemPriority.Default, null); } } //Changes menu label for current Culture menuList.FirstOrDefault().Text = Header.LabelMenuMyApps; myAppsMenu = AppMenu.CastToDynamicMenuList(menuList); } catch (Exception ex) { } return(Json(myAppsMenu, JsonRequestBehavior.AllowGet)); }