internal List <SiteNav> GetSiteUpdates(ListContentType contentType, int takeTop, List <Guid> lstCategories, List <string> lstCategorySlugs) { List <SiteNav> _siteUpdates = new List <SiteNav>(); if (lstCategories == null) { lstCategories = new List <Guid>(); } if (lstCategorySlugs == null) { lstCategorySlugs = new List <string>(); } if (lstCategories.Any() || lstCategorySlugs.Any()) { contentType = ListContentType.SpecifiedCategories; } using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) { switch (contentType) { case ListContentType.Blog: _siteUpdates = navHelper.GetLatestPosts(this.TheSite.SiteID, takeTop, !SecurityData.IsAuthEditor); break; case ListContentType.ContentPage: _siteUpdates = navHelper.GetLatest(this.TheSite.SiteID, takeTop, !SecurityData.IsAuthEditor); break; case ListContentType.SpecifiedCategories: if (takeTop > 0) { _siteUpdates = navHelper.GetFilteredContentByIDPagedList(SiteData.CurrentSite, lstCategories, lstCategorySlugs, !SecurityData.IsAuthEditor, takeTop, 0, "GoLiveDate", "DESC"); } else { _siteUpdates = navHelper.GetFilteredContentByIDPagedList(SiteData.CurrentSite, lstCategories, lstCategorySlugs, !SecurityData.IsAuthEditor, 250000, 0, "NavMenuText", "ASC"); } break; } } if (_siteUpdates == null) { _siteUpdates = new List <SiteNav>(); } _siteUpdates = TweakData(_siteUpdates); return(_siteUpdates); }
private List <SyndicationItem> GetRecentPagesOrPosts(RSSFeedInclude feedData) { List <SyndicationItem> syndRSS = new List <SyndicationItem>(); List <SiteNav> lst = new List <SiteNav>(); ContentPageType PageType = new ContentPageType(); using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) { if (feedData == RSSFeedInclude.PageOnly || feedData == RSSFeedInclude.BlogAndPages) { List <SiteNav> lst1 = navHelper.GetLatest(this.SiteID, 8, true); lst = lst.Union(lst1).ToList(); List <SiteNav> lst2 = navHelper.GetLatestUpdates(this.SiteID, 10, true); lst = lst.Union(lst2).ToList(); } if (feedData == RSSFeedInclude.BlogOnly || feedData == RSSFeedInclude.BlogAndPages) { List <SiteNav> lst1 = navHelper.GetLatestPosts(this.SiteID, 8, true); lst = lst.Union(lst1).ToList(); List <SiteNav> lst2 = navHelper.GetLatestPostUpdates(this.SiteID, 10, true); lst = lst.Union(lst2).ToList(); } } lst.RemoveAll(x => x.ShowInSiteMap == false && x.ContentType == ContentPageType.PageType.ContentEntry); lst.RemoveAll(x => x.BlockIndex == true); foreach (SiteNav sn in lst) { SyndicationItem si = new SyndicationItem(); string sPageURI = RemoveDupeSlashesURL(this.ConstructedCanonicalURL(sn)); Uri PageURI = new Uri(sPageURI); si.Content = new TextSyndicationContent(sn.PageTextPlainSummaryMedium.ToString()); si.Title = new TextSyndicationContent(sn.NavMenuText); si.Links.Add(SyndicationLink.CreateSelfLink(PageURI)); si.AddPermalink(PageURI); si.LastUpdatedTime = sn.EditDate; si.PublishDate = sn.CreateDate; syndRSS.Add(si); } return(syndRSS.OrderByDescending(p => p.PublishDate).ToList()); }
protected List <SiteNav> GetUpdates() { List <SiteNav> lst = new List <SiteNav>(); using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) { switch (this.ContentType) { case ListContentType.Blog: lst = navHelper.GetLatestPosts(SiteData.CurrentSiteID, this.TakeTop, !SecurityData.IsAuthEditor); break; case ListContentType.ContentPage: lst = navHelper.GetLatest(SiteData.CurrentSiteID, this.TakeTop, !SecurityData.IsAuthEditor); break; case ListContentType.SpecifiedCategories: if (this.TakeTop > 0) { lst = navHelper.GetFilteredContentByIDPagedList(SiteData.CurrentSite, this.SelectedCategories, this.SelectedCategorySlugs, !SecurityData.IsAuthEditor, this.TakeTop, 0, "GoLiveDate", "DESC"); } else { lst = navHelper.GetFilteredContentByIDPagedList(SiteData.CurrentSite, this.SelectedCategories, this.SelectedCategorySlugs, !SecurityData.IsAuthEditor, 3200000, 0, "NavMenuText", "ASC"); } break; } if (this.ShowUpdateDate && String.IsNullOrEmpty(this.DateFormat)) { this.DateFormat = "({0:d})"; } if (this.ShowUpdateDate && !String.IsNullOrEmpty(this.DateFormat)) { lst.ForEach(x => x.NavMenuText = String.Format("{0} {1}", x.NavMenuText, String.Format(this.DateFormat, x.GoLiveDate))); } } return(lst); }