public SortParm ParseSort() { SortParm Sort = new SortParm(); string sSortFld = string.Empty; string sSortDir = string.Empty; if (!String.IsNullOrEmpty(this.OrderBy)) { int pos = this.OrderBy.LastIndexOf(" "); sSortFld = this.OrderBy.Substring(0, pos).Trim(); sSortDir = this.OrderBy.Substring(pos).Trim(); } Sort.SortField = sSortFld; Sort.SortDirection = sSortDir; return(Sort); }
public SortParm ParseSort() { SortParm Sort = new SortParm(); string sSortFld = string.Empty; string sSortDir = string.Empty; if (!String.IsNullOrEmpty(this.OrderBy)) { int pos = this.OrderBy.LastIndexOf(" "); sSortFld = this.OrderBy.Substring(0, pos).Trim(); sSortDir = this.OrderBy.Substring(pos).Trim(); } Sort.SortField = sSortFld; Sort.SortDirection = sSortDir; return Sort; }
public override void FetchData() { HttpContext context = HttpContext.Current; string sPagePath = SiteData.CurrentScriptName; if (String.IsNullOrEmpty(this.OrderBy)) { this.OrderBy = "GoLiveDate desc"; } List <SiteNav> lstContents = new List <SiteNav>(); string sSearchTerm = String.Empty; ContentPageType.PageType viewContentType = ContentPageType.PageType.BlogEntry; if (this.IgnoreSitePath) { sPagePath = String.Format("/siteid-{0}.aspx", SiteData.CurrentSiteID); } if (context != null) { 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.OrderBy = "GoLiveDate desc"; break; } SortParm sp = this.ParseSort(); string sSortFld = sp.SortField; string sSortDir = sp.SortDirection; int iPageNbr = this.PageNumberZeroIndex; if (context != null) { switch (this.ContentType) { case SummaryContentType.Blog: viewContentType = ContentPageType.PageType.BlogEntry; TotalRecords = navHelper.GetFilteredContentPagedCount(SiteData.CurrentSite, sPagePath, !SecurityData.IsAuthEditor); lstContents = navHelper.GetFilteredContentPagedList(SiteData.CurrentSite, sPagePath, !SecurityData.IsAuthEditor, this.PageSize, iPageNbr, sSortFld, sSortDir); break; case SummaryContentType.ChildContentPage: viewContentType = ContentPageType.PageType.ContentEntry; TotalRecords = navHelper.GetChildNavigationCount(SiteData.CurrentSiteID, sPagePath, !SecurityData.IsAuthEditor); lstContents = navHelper.GetLatestChildContentPagedList(SiteData.CurrentSiteID, sPagePath, !SecurityData.IsAuthEditor, this.PageSize, iPageNbr, sSortFld, sSortDir); break; case SummaryContentType.ContentPage: viewContentType = ContentPageType.PageType.ContentEntry; TotalRecords = navHelper.GetSitePageCount(SiteData.CurrentSiteID, viewContentType, !SecurityData.IsAuthEditor); lstContents = navHelper.GetLatestContentPagedList(SiteData.CurrentSiteID, viewContentType, !SecurityData.IsAuthEditor, this.PageSize, iPageNbr, sSortFld, sSortDir); break; case SummaryContentType.SpecifiedCategories: viewContentType = ContentPageType.PageType.BlogEntry; TotalRecords = navHelper.GetFilteredContentByIDPagedCount(SiteData.CurrentSite, SelectedCategories, SelectedCategorySlugs, !SecurityData.IsAuthEditor); lstContents = navHelper.GetFilteredContentByIDPagedList(SiteData.CurrentSite, SelectedCategories, SelectedCategorySlugs, !SecurityData.IsAuthEditor, this.PageSize, iPageNbr, sSortFld, sSortDir); break; case SummaryContentType.SiteSearch: TotalRecords = navHelper.GetSiteSearchCount(SiteData.CurrentSiteID, sSearchTerm, !SecurityData.IsAuthEditor); lstContents = navHelper.GetLatestContentSearchList(SiteData.CurrentSiteID, sSearchTerm, !SecurityData.IsAuthEditor, this.PageSize, iPageNbr, sSortFld, sSortDir); break; } } else { viewContentType = ContentPageType.PageType.ContentEntry; TotalRecords = navHelper.GetSitePageCount(SiteData.CurrentSiteID, viewContentType, false); lstContents = navHelper.GetLatestContentPagedList(Guid.NewGuid(), viewContentType, false, this.PageSize, iPageNbr, sSortFld, sSortDir); } lstContents.ToList().ForEach(q => IdentifyLinkAsInactive(q)); this.DataSource = lstContents; PrevNext(); }