public void SearchOne() { int iTake = 25; this.SelectedPage = null; this.Widgets = null; this.SelectedItem = Guid.Empty; this.TotalPages = 0; using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) { if (!String.IsNullOrEmpty(this.SearchFor)) { this.TotalPages = navHelper.GetSiteSearchCount(SiteData.CurrentSiteID, this.SearchFor, this.HideInactive); this.Pages = navHelper.GetLatestContentSearchList(SiteData.CurrentSiteID, this.SearchFor, this.HideInactive, iTake, 0, "NavMenuText", "ASC"); } } }
protected void btnSearch_Click(object sender, EventArgs e) { List <SiteNav> lstContents = new List <SiteNav>(); int iTake = 25; int iTotal = -1; phResults.Visible = true; sSearchTerm = txtSearchTerm.Text; hdnSelectedItem.Value = ""; GeneralUtilities.BindDataBoundControl(gvWidgets, null); if (!String.IsNullOrEmpty(gvPages.DefaultSort)) { int pos = gvPages.DefaultSort.LastIndexOf(" "); sSortFld = gvPages.DefaultSort.Substring(0, pos).Trim(); sSortDir = gvPages.DefaultSort.Substring(pos).Trim(); } bool bLimit = chkActive.Checked; using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) { if (!String.IsNullOrEmpty(sSearchTerm)) { iTotal = navHelper.GetSiteSearchCount(SiteData.CurrentSiteID, sSearchTerm, bLimit); lstContents = navHelper.GetLatestContentSearchList(SiteData.CurrentSiteID, sSearchTerm, bLimit, iTake, 0, sSortFld, sSortDir); } } if (iTotal > 0) { if (iTotal > lstContents.Count) { litResults.Text = String.Format("Showing {0} of {1} total results", lstContents.Count, iTotal); } else { litResults.Text = String.Format("Showing {0} results", lstContents.Count); } } GeneralUtilities.BindDataBoundControl(gvPages, lstContents); }
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; }