public void BuildMenu(SageMenuSettingInfo objMenuSetting)
 {
     menuType = objMenuSetting.MenuType;
     switch (int.Parse(objMenuSetting.MenuType))
     {
         case 0:
             //LoadTopAdminMenu();
             break;
         case 1:
             GetPages(objMenuSetting);
             break;
         case 2:
             LoadSideMenu(objMenuSetting);
             break;
         case 3:
             LoadFooterMenu(objMenuSetting);
             break;
     }
 }
        public static SageMenuSettingInfo GetMenuSetting(int PortalID, int UserModuleID)
        {
            SageMenuSettingInfo objSetting = new SageMenuSettingInfo();
            string StoredProcedureName = "[dbo].[usp_SageMenuSettingGetAll]";
            SQLHandler sagesql = new SQLHandler();
            List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@UserModuleID", UserModuleID));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@PortalID", PortalID));

            try
            {
                objSetting = sagesql.ExecuteAsObject<SageMenuSettingInfo>(StoredProcedureName, ParaMeterCollection);

            }
            catch (Exception e)
            {
                throw e;
            }
            return objSetting;
        }
 public void GetCurrentMenuID()
 {
     SageMenuSettingInfo objinf = new SageMenuSettingInfo();
     objinf = MenuController.GetMenuSetting(GetPortalID, UserModuleID);
     Session["MenuID"] = objinf.MenuID;
 }
 public void BuildFooterMenu(List<MenuManagerInfo> objMenuManagerInfoList, SageMenuSettingInfo objMenuSetting)
 {
     int pageID = 0;
     int parentID = 0;
     string itemPath = string.Empty;
     StringBuilder html = new StringBuilder();
     html.Append("<div class='" + ContainerClientID + "'> <ul class='sfFootermenu'>");
     foreach (MenuManagerInfo objMenuManagerInfo in objMenuManagerInfoList)
     {
         pageID = objMenuManagerInfo.MenuItemID;
         parentID = objMenuManagerInfo.ParentID;
         if (objMenuManagerInfo.MenuLevel == "0")
         {
             string PageURL = objMenuManagerInfo.URL.Split('/').Last();
             string pageLink = objMenuManagerInfo.LinkType == "0" ? pagePath + "/" + PageURL + Extension : "/" + PageURL;
             if (objMenuManagerInfo.LinkURL == string.Empty)
             {
                 pageLink = pageLink.IndexOf(Extension) > 0 ? pageLink : pageLink + Extension;
             }
             if (objMenuManagerInfo.ChildCount > 0)
             {
                 html.Append("<li class='sfParent'>");
             }
             else
             {
                 html.Append("<li>");
             }
             string menuItem = BuildMenuItem(int.Parse(objMenuSetting.DisplayMode), objMenuManagerInfo, pageLink, objMenuSetting.Caption);
             html.Append(menuItem);
             if (objMenuManagerInfo.LinkType == "1")
             {
                 html.Append("<ul class='megamenu'><li><div class='megawrapper'>");
                 html.Append(objMenuManagerInfo.HtmlContent);
                 html.Append("</div></li><ul>");
             }
             else
             {
                 if (objMenuManagerInfo.ChildCount > 0)
                 {
                     html.Append("<ul>");
                     itemPath = objMenuManagerInfo.Title;
                     string footerChild = BuildFooterChildren(objMenuManagerInfoList, pageID, int.Parse(objMenuSetting.DisplayMode), objMenuSetting.Caption);
                     html.Append(footerChild);
                     html.Append("</ul>");
                 }
             }
             html.Append("</li>");
         }
         itemPath = string.Empty;
     }
     html.Append("</div>");
     ltrNav.Text = html.ToString();
 }
 public void LoadFooterMenu(SageMenuSettingInfo objMenuSetting)
 {
     List<MenuManagerInfo> objMenuMangerList = GetFooterMenu_Localized(PortalID, UserName, CultureCode, UserModuleID);
     BuildFooterMenu(objMenuMangerList, objMenuSetting);
 }
 public void BuildSideMenu(List<MenuInfo> objMenuInfoList, SageMenuSettingInfo objMenuSetting)
 {
     int pageID = 0;
     int parentID = 0;
     int categoryLevel = 0;
     string itemPath = string.Empty;
     StringBuilder html = new StringBuilder();
     html.Append("<div class='");
     html.Append(ContainerClientID);
     html.Append("'>");
     if (objMenuInfoList.Count > 0)
     {
         html.Append("<ul class='sfSidemenu'>");
         foreach (MenuInfo objMenu in objMenuInfoList)
         {
             pageID = objMenu.PageID;
             parentID = objMenu.ParentID;
             categoryLevel = objMenu.Level;
             string PageURL = objMenu.TabPath.Split('/').Last();
             string pageLink = GetApplicationName + "/" + PageURL + Extension;
             if (objMenu.Level == 0)
             {
                 html.Append("<li class='sfLevel1'>");
                 if (objMenu.ChildCount > 0)
                 {
                     string sideMenuItem = BuildSideMenuItem(int.Parse(objMenuSetting.DisplayMode), objMenu, pageLink, "");
                     html.Append(sideMenuItem);
                 }
                 else
                 {
                     string sideMenuItem = BuildSideMenuItem(int.Parse(objMenuSetting.DisplayMode), objMenu, pageLink, "");
                     html.Append(sideMenuItem);
                 }
                 if (objMenu.ChildCount > 0)
                 {
                     html.Append("<ul>");
                     string sideMenuChildren = BindSideMenuChildren(objMenuInfoList, pageID, int.Parse(objMenuSetting.DisplayMode));
                     html.Append(sideMenuChildren);
                     html.Append("</ul>");
                 }
                 html.Append("</li>");
             }
             itemPath = string.Empty;
         }
         html.Append("</ul>");
     }
     html.Append("</div>");
     ltrNav.Text = html.ToString();
 }
 public void LoadSideMenu(SageMenuSettingInfo objMenuSetting)
 {
     List<MenuInfo> objMenuInfoList = GetSideMenu(PortalID, UserName, objMenuSetting.MenuID, CultureCode);
     BuildSideMenu(objMenuInfoList, objMenuSetting);
 }
    public void BindPages(List<MenuManagerInfo> objMenuInfoList, SageMenuSettingInfo objMenuSetting)
    {
        int pageID = 0;
        int parentID = 0;
        string itemPath = string.Empty; ;
        StringBuilder html = new StringBuilder();
        int rootItemCount = 0;
        foreach (MenuManagerInfo objMenuInfo in objMenuInfoList)
        {
            if (int.Parse(objMenuInfo.MenuLevel) == 0)
            {
                rootItemCount = objMenuInfoList.IndexOf(objMenuInfo);
            }
        }
        html.Append(BuildMenuClassContainer(int.Parse(objMenuSetting.TopMenuSubType)));
        int countMenuInfo = 0;
        foreach (MenuManagerInfo objMenuInfo in objMenuInfoList)
        {
            pageID = objMenuInfo.MenuItemID;
            parentID = objMenuInfo.ParentID;
            if (objMenuInfo.MenuLevel == "0")
            {
                string PageURL =  objMenuInfo.URL.Split('/').Last();
                string pageLink = objMenuInfo.LinkType == "0" ? pagePath + "/" + PageURL + Extension :  objMenuInfo.LinkURL;
                if (objMenuInfo.LinkURL == string.Empty)
                {
                    pageLink = pageLink.IndexOf(Extension) > 0 ? pageLink : pageLink + Extension;
                }
                string firstclass = string.Empty;
                string activeClass = PageURL == PageName ? "sfActive" : "";
                if (objMenuInfo.ChildCount > 0)
                {
                    firstclass = countMenuInfo == 0 ? "class='sfFirst sfParent " + activeClass + "'" : countMenuInfo == rootItemCount ? "class='sfParent sfLast " + activeClass + "'" : "class='sfParent " + activeClass + "'";
                }
                else
                {
                    firstclass = countMenuInfo == 0 ? "class='sfFirst " + activeClass + "'" : countMenuInfo == rootItemCount ? "class='sfLast " + activeClass + "'" : "class='" + activeClass + "'";
                }

                html.Append("<li ");
                html.Append(firstclass);
                html.Append(">");
                string menuItem = BuildMenuItem(int.Parse(objMenuSetting.DisplayMode), objMenuInfo, pageLink, objMenuSetting.Caption);
                html.Append(menuItem);
                if (objMenuInfo.LinkType == "1")
                {
                    html.Append("<ul class='megamenu'><li style=''><div class='megawrapper'>");
                    html.Append(objMenuInfo.HtmlContent);
                    html.Append("</div></li></ul>");
                }
                else
                {
                    if (objMenuInfo.ChildCount > 0)
                    {
                        html.Append("<ul style='display: none; visibility: hidden;'>");
                        itemPath = objMenuInfo.Title;
                        string childCategory = BindChildCategory(objMenuInfoList, pageID, int.Parse(objMenuSetting.DisplayMode), objMenuSetting.Caption);
                        html.Append(childCategory);
                        html.Append("</ul>");
                    }
                }
                html.Append("</li>");
            }
            itemPath = string.Empty;
            countMenuInfo++;
        }
        html.Append("</ul></div>");
        ltrNav.Text = html.ToString();
    }
 public void GetPages(SageMenuSettingInfo objMenuSetting)
 {
     List<MenuManagerInfo> objMenuInfoList = GetMenuFront(PortalID, UserName, CultureCode, UserModuleID);
     BindPages(objMenuInfoList, objMenuSetting);
 }
 public void GetAllMenuSettings()
 {
     SageMenuSettingInfo objMenuSetting = new SageMenuSettingInfo();
     objMenuSetting = MenuController.GetMenuSetting(PortalID, UserModuleID);
     BuildMenu(objMenuSetting);
 }