Exemplo n.º 1
0
        private static void AddCustomPagesToMenu(FirmaSession currentFirmaSession, FirmaMenuItem menuType, LtInfoMenuItem topLevelMenu, string menuGroupName)
        {
            MultiTenantHelpers.GetCustomPages(menuType).ForEach(x =>
            {
                var isVisible = new CustomPageViewFeature().HasPermission(currentFirmaSession, x).HasPermission;
                if (isVisible)
                {
                    // var customPageUrl = null;
                    switch (menuType.ToEnum)
                    {
                    case FirmaMenuItemEnum.About:
                        topLevelMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <CustomPageController>(c => c.About(x.CustomPageVanityUrl)), currentFirmaSession, x.CustomPageDisplayName, menuGroupName));
                        break;

                    case FirmaMenuItemEnum.Projects:
                        topLevelMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <CustomPageController>(c => c.Project(x.CustomPageVanityUrl)), currentFirmaSession, x.CustomPageDisplayName, menuGroupName));
                        break;

                    case FirmaMenuItemEnum.ProgramInfo:
                        topLevelMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <CustomPageController>(c => c.ProgramInfo(x.CustomPageVanityUrl)), currentFirmaSession, x.CustomPageDisplayName, menuGroupName));
                        break;

                    case FirmaMenuItemEnum.Results:
                        topLevelMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <CustomPageController>(c => c.Results(x.CustomPageVanityUrl)), currentFirmaSession, x.CustomPageDisplayName, menuGroupName));
                        break;

                    default:
                        topLevelMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <CustomPageController>(c => c.About(x.CustomPageVanityUrl)), currentFirmaSession, x.CustomPageDisplayName, menuGroupName));
                        break;
                    }
                }
            });
        }
        public static string GetFirmaMenuItemDisplayName(this FirmaMenuItem firmaMenuItem)
        {
            if (firmaMenuItem.FirmaMenuItemID == FirmaMenuItem.Projects.FirmaMenuItemID)
            {
                return(FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized());
            }

            return(firmaMenuItem.FirmaMenuItemDisplayName);
        }
Exemplo n.º 3
0
 public static List <CustomPage> GetCustomPages(FirmaMenuItem firmaMenuItem)
 {
     return(HttpRequestStorage.DatabaseEntities.CustomPages
            .Where(x => x.FirmaMenuItemID == firmaMenuItem.FirmaMenuItemID).OrderBy(x => x.SortOrder).ThenBy(x => x.CustomPageDisplayName).ToList());
 }