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); }
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); }
public void FetchData() { base.ReadPageNbr(); string sPagePath = SiteData.CurrentScriptName; if (String.IsNullOrEmpty(this.OrderBy)) { this.InitOrderByDescending(x => x.GoLiveDate); } List <SiteNav> lstContents = new List <SiteNav>(); string sSearchTerm = String.Empty; ContentPageType.PageType viewContentType = ContentPageType.PageType.BlogEntry; if (this.IgnoreSitePath) { sPagePath = String.Format("/siteid-{0}", SiteData.CurrentSiteID); } if (SiteData.IsWebView) { if (SiteData.CurrentSite.IsSiteSearchPath && !this.IgnoreSitePath) { this.ContentType = SummaryContentType.SiteSearch; sSearchTerm = GetSearchTerm(); } } switch (this.ContentType) { case SummaryContentType.Blog: case SummaryContentType.ContentPage: case SummaryContentType.SiteSearch: this.InitOrderByDescending(x => x.GoLiveDate); break; } SortParm sp = this.ParseSort(); string sSortFld = sp.SortField; string sSortDir = sp.SortDirection; if (this.PageNumber <= 0) { this.PageNumber = 1; } using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) { if (SiteData.IsWebView) { switch (this.ContentType) { case SummaryContentType.Blog: viewContentType = ContentPageType.PageType.BlogEntry; this.TotalRecords = navHelper.GetFilteredContentPagedCount(SiteData.CurrentSite, sPagePath, !SecurityData.IsAuthEditor); lstContents = navHelper.GetFilteredContentPagedList(SiteData.CurrentSite, sPagePath, !SecurityData.IsAuthEditor, this.PageSize, this.PageNumberZeroIndex, sSortFld, sSortDir); break; case SummaryContentType.ChildContentPage: viewContentType = ContentPageType.PageType.ContentEntry; this.TotalRecords = navHelper.GetChildNavigationCount(SiteData.CurrentSiteID, sPagePath, !SecurityData.IsAuthEditor); lstContents = navHelper.GetLatestChildContentPagedList(SiteData.CurrentSiteID, sPagePath, !SecurityData.IsAuthEditor, this.PageSize, this.PageNumberZeroIndex, sSortFld, sSortDir); break; case SummaryContentType.ContentPage: viewContentType = ContentPageType.PageType.ContentEntry; this.TotalRecords = navHelper.GetSitePageCount(SiteData.CurrentSiteID, viewContentType, !SecurityData.IsAuthEditor); lstContents = navHelper.GetLatestContentPagedList(SiteData.CurrentSiteID, viewContentType, !SecurityData.IsAuthEditor, this.PageSize, this.PageNumberZeroIndex, sSortFld, sSortDir); break; case SummaryContentType.SpecifiedCategories: viewContentType = ContentPageType.PageType.BlogEntry; this.TotalRecords = navHelper.GetFilteredContentByIDPagedCount(SiteData.CurrentSite, null, SelectedCategorySlugs, !SecurityData.IsAuthEditor); lstContents = navHelper.GetFilteredContentByIDPagedList(SiteData.CurrentSite, null, SelectedCategorySlugs, !SecurityData.IsAuthEditor, this.PageSize, this.PageNumberZeroIndex, sSortFld, sSortDir); break; case SummaryContentType.SiteSearch: this.TotalRecords = navHelper.GetSiteSearchCount(SiteData.CurrentSiteID, sSearchTerm, !SecurityData.IsAuthEditor); lstContents = navHelper.GetLatestContentSearchList(SiteData.CurrentSiteID, sSearchTerm, !SecurityData.IsAuthEditor, this.PageSize, this.PageNumberZeroIndex, sSortFld, sSortDir); break; } } else { viewContentType = ContentPageType.PageType.ContentEntry; this.TotalRecords = navHelper.GetSitePageCount(SiteData.CurrentSiteID, viewContentType, false); lstContents = navHelper.GetLatestContentPagedList(Guid.NewGuid(), viewContentType, false, this.PageSize, this.PageNumberZeroIndex, sSortFld, sSortDir); } } lstContents.ToList().ForEach(q => CMSConfigHelper.IdentifyLinkAsInactive(q)); this.DataSource = lstContents; }