private List <MenuManagerInfo> GetCustomSideMenu(int PortalID, string UserName, string CultureCode, int UserModuleID) { List <MenuManagerInfo> lstMenuItems = new List <MenuManagerInfo>(); if (SageFrameSettingKeys.SideMenu && UserName == "anonymoususer") { if (!SageFrame.Common.CacheHelper.Get(CultureCode + ".SideMenu" + PortalID.ToString(), out lstMenuItems)) { lstMenuItems = MenuManagerDataController.GetSageMenu(UserModuleID, PortalID, UserName); SageFrame.Common.CacheHelper.Add(lstMenuItems, CultureCode + ".SideMenu" + PortalID.ToString()); } } else { lstMenuItems = MenuManagerDataController.GetSageMenu(UserModuleID, PortalID, UserName); } IEnumerable <MenuManagerInfo> lstParent = new List <MenuManagerInfo>(); List <MenuManagerInfo> lstHierarchy = new List <MenuManagerInfo>(); lstParent = from pg in lstMenuItems where pg.MenuLevel == "0" select pg; foreach (MenuManagerInfo parent in lstParent) { lstHierarchy.Add(parent); GetChildPages(ref lstHierarchy, parent, lstMenuItems); } return(lstHierarchy); }
private void GenerateSitemapIndex() { string sSiteMapFilePath = HttpRuntime.AppDomainAppPath + "sitemap_index.xml"; if (!File.Exists(HttpRuntime.AppDomainAppPath + "sitemap_index.xml")) { List <SitemapInfo> items = MenuManagerDataController.GetSiteMapPages(GetUsername, GetCurrentCultureName); FileInfo fi = new FileInfo(sSiteMapFilePath); xd = new XmlDocument(); XmlNode rootNode = xd.CreateElement("urlset"); XmlAttribute attrXmlNS = xd.CreateAttribute("xmlns"); attrXmlNS.InnerText = "http://www.sitemaps.org/schemas/sitemap/0.9"; rootNode.Attributes.Append(attrXmlNS); XmlTextWriter writer = new XmlTextWriter(Response.OutputStream, Encoding.UTF8); rootNode.AppendChild(GenerateIndexNode(Page.Request.Url.Scheme + "://" + Request.Url.Authority + GetApplicationName + "/sitemap_" + GetPortalID + ".xml")); xd.AppendChild(rootNode); xd.InsertBefore(xd.CreateXmlDeclaration("1.0", "UTF-8", null), rootNode); xd.Save(sSiteMapFilePath); } else { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(HttpRuntime.AppDomainAppPath + "sitemap_index.xml"); XmlNode node = GenerateIndexNode(Page.Request.Url.Scheme + "://" + Request.Url.Authority + GetApplicationName + "/sitemap_" + GetPortalID + ".xml"); XmlNode childNode = xmlDoc.DocumentElement; childNode.InsertAfter(node, childNode.LastChild); xmlDoc.Save(sSiteMapFilePath); } }
private void GenerateSitemap() { if (!File.Exists(HttpRuntime.AppDomainAppPath + "sitemap_" + GetPortalID + ".xml")) { GenerateSitemapIndex(); } else { XmlDocument doc = new XmlDocument(); doc.Load(HttpRuntime.AppDomainAppPath + "sitemap_index.xml"); XmlNodeList nodeList = doc.GetElementsByTagName("lastmod"); foreach (XmlNode xmlNode in nodeList) { xmlNode.InnerText = DateTime.Now.ToString(); } } string sSiteMapFilePath = HttpRuntime.AppDomainAppPath + "sitemap_" + GetPortalID + ".xml"; List <SitemapInfo> items = MenuManagerDataController.GetSiteMapPages(GetUsername, GetCurrentCultureName); FileInfo fi = new FileInfo(sSiteMapFilePath); xd = new XmlDocument(); XmlNode rootNode = xd.CreateElement("urlset"); XmlAttribute attrXmlNS = xd.CreateAttribute("xmlns"); attrXmlNS.InnerText = "http://www.sitemaps.org/schemas/sitemap/0.9"; rootNode.Attributes.Append(attrXmlNS); ChangeFreuency = ddlChangeFrequency.SelectedItem.ToString(); PriorityValues = ddlPriorityValues.SelectedItem.ToString(); XmlTextWriter writer = new XmlTextWriter(Response.OutputStream, Encoding.UTF8); foreach (SitemapInfo info in items) { DateTime Updated; if (info.UpdatedOn == null || info.UpdatedOn == "") { Updated = DateTime.Parse(info.AddedOn); } else { Updated = DateTime.Parse(info.UpdatedOn); } //Valid option for changefreq:(always,hourly,daily,weekly,monthly,yearly,never) //Valid priority values have range interval [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]. string urlpath = info.PortalID > 1 ? string.Format("/portal/{0}{1}", info.PortalName, info.TabPath) : info.TabPath; rootNode.AppendChild(GenerateUrlNode(Page.Request.Url.Scheme + "://" + Request.Url.Authority + GetApplicationName + urlpath + SageFrameSettingKeys.PageExtension, Updated, ChangeFreuency, PriorityValues)); } xd.AppendChild(rootNode); xd.InsertBefore(xd.CreateXmlDeclaration("1.0", "UTF-8", null), rootNode); xd.Save(sSiteMapFilePath); }
public List <MenuManagerInfo> GetFooterMenu_Localized(int PortalID, string UserName, string CultureCode, int UserModuleID) { List <MenuManagerInfo> lstMenuItems = new List <MenuManagerInfo>(); lstMenuItems = MenuManagerDataController.GetSageMenu_Localized(UserModuleID, PortalID, UserName, CultureCode); IEnumerable <MenuManagerInfo> lstParent = new List <MenuManagerInfo>(); List <MenuManagerInfo> lstHierarchy = new List <MenuManagerInfo>(); lstParent = from pg in lstMenuItems where pg.MenuLevel == "0" select pg; foreach (MenuManagerInfo parent in lstParent) { lstHierarchy.Add(parent); GetChildPages(ref lstHierarchy, parent, lstMenuItems); } return(lstHierarchy); }