public string GetBlogHeadingFromURL(SiteData currentSite, string sFilterPath)
        {
            Guid siteID = currentSite.SiteID;

            string sTitle = String.Empty;

            if (currentSite.CheckIsBlogCategoryPath(sFilterPath))
            {
                vw_carrot_CategoryURL query = CompiledQueries.cqGetCategoryByURL(db, siteID, sFilterPath);
                sTitle = query.CategoryText;
            }
            if (currentSite.CheckIsBlogTagPath(sFilterPath))
            {
                vw_carrot_TagURL query = CompiledQueries.cqGetTagByURL(db, siteID, sFilterPath);
                sTitle = query.TagText;
            }
            if (currentSite.CheckIsBlogEditorFolderPath(sFilterPath))
            {
                vw_carrot_EditorURL query = CompiledQueries.cqGetEditorByURL(db, siteID, sFilterPath);
                ExtendedUserData    usr   = new ExtendedUserData(query.UserId);
                sTitle = usr.ToString();
            }
            if (currentSite.CheckIsBlogDateFolderPath(sFilterPath))
            {
                BlogDatePathParser p  = new BlogDatePathParser(currentSite, sFilterPath);
                TimeSpan           ts = p.DateEndUTC - p.DateBeginUTC;

                int daysDelta = ts.Days;
                if (daysDelta > 90)
                {
                    sTitle = "Year " + p.DateBegin.ToString("yyyy");
                }
                if (daysDelta < 36)
                {
                    sTitle = p.DateBegin.ToString("MMMM yyyy");
                }
                if (daysDelta < 5)
                {
                    sTitle = p.DateBegin.ToString("MMMM d, yyyy");
                }
            }
            if (currentSite.CheckIsSiteSearchPath(sFilterPath))
            {
                sTitle = "Search Results";
            }

            return(sTitle);
        }
        public string GetBlogHeadingFromURL(SiteData currentSite, string sFilterPath)
        {
            string sTitle = String.Empty;

            if (currentSite.CheckIsBlogCategoryPath(sFilterPath)) {
                sTitle = "Category 1";
            }
            if (currentSite.CheckIsBlogTagPath(sFilterPath)) {
                sTitle = "Tag 1";
            }
            if (currentSite.CheckIsBlogEditorFolderPath(sFilterPath)) {
                sTitle = "Editor 1";
            }
            if (currentSite.CheckIsBlogDateFolderPath(sFilterPath)) {
                sTitle = DateTime.UtcNow.ToString("MMMM yyyy");
            }
            if (currentSite.CheckIsSiteSearchPath(sFilterPath)) {
                sTitle = "Search Results";
            }

            return sTitle;
        }
        public List<ContentPage> GetFilteredContentPagedList(SiteData currentSite, string sFilterPath, bool bActiveOnly,
            int pageSize, int pageNumber, string sortField, string sortDir)
        {
            IQueryable<vw_carrot_Content> query1 = null;
            Guid siteID = currentSite.SiteID;
            bool bFound = false;

            if (currentSite.CheckIsBlogCategoryPath(sFilterPath)) {
                query1 = CannedQueries.GetContentByCategoryURL(db, siteID, bActiveOnly, sFilterPath);
                bFound = true;
            }
            if (currentSite.CheckIsBlogTagPath(sFilterPath)) {
                query1 = CannedQueries.GetContentByTagURL(db, siteID, bActiveOnly, sFilterPath);
                bFound = true;
            }
            if (currentSite.CheckIsBlogEditorFolderPath(sFilterPath)) {
                query1 = CannedQueries.GetContentByUserURL(db, siteID, bActiveOnly, sFilterPath);
                bFound = true;
            }
            if (currentSite.CheckIsBlogDateFolderPath(sFilterPath)) {
                BlogDatePathParser p = new BlogDatePathParser(currentSite, sFilterPath);
                query1 = CannedQueries.GetLatestBlogListDateRange(db, siteID, p.DateBeginUTC, p.DateEndUTC, bActiveOnly);
                bFound = true;
            }

            if (!bFound) {
                query1 = CannedQueries.GetLatestBlogList(db, siteID, bActiveOnly);
            }

            return PerformDataPagingQueryableContent(siteID, bActiveOnly, pageSize, pageNumber, sortField, sortDir, query1);
        }
        public int GetFilteredContentPagedCount(SiteData currentSite, string sFilterPath, bool bActiveOnly)
        {
            IQueryable<vw_carrot_Content> query1 = null;
            Guid siteID = currentSite.SiteID;
            bool bFound = false;

            if (currentSite.CheckIsBlogCategoryPath(sFilterPath)) {
                query1 = CannedQueries.GetContentByCategoryURL(db, siteID, bActiveOnly, sFilterPath);
                bFound = true;
            }
            if (currentSite.CheckIsBlogTagPath(sFilterPath)) {
                query1 = CannedQueries.GetContentByTagURL(db, siteID, bActiveOnly, sFilterPath);
                bFound = true;
            }
            if (currentSite.CheckIsBlogEditorFolderPath(sFilterPath)) {
                query1 = CannedQueries.GetContentByUserURL(db, siteID, bActiveOnly, sFilterPath);
                bFound = true;
            }
            if (currentSite.CheckIsBlogDateFolderPath(sFilterPath)) {
                BlogDatePathParser p = new BlogDatePathParser(currentSite, sFilterPath);
                query1 = CannedQueries.GetLatestBlogListDateRange(db, siteID, p.DateBeginUTC, p.DateEndUTC, bActiveOnly);
                bFound = true;
            }
            if (!bFound) {
                query1 = CannedQueries.GetLatestBlogList(db, siteID, bActiveOnly);
            }

            return query1.Count();
        }
        public PageViewType GetBlogHeadingFromURL(SiteData currentSite, string sFilterPath)
        {
            Guid siteID = currentSite.SiteID;
            PageViewType pvt = new PageViewType { ExtraTitle = "", CurrentViewType = PageViewType.ViewType.SinglePage, RawValue = null };

            string sTitle = String.Empty;

            if (currentSite.CheckIsBlogCategoryPath(sFilterPath)) {
                pvt.CurrentViewType = PageViewType.ViewType.CategoryIndex;
                vw_carrot_CategoryURL query = CompiledQueries.cqGetCategoryByURL(db, siteID, sFilterPath);
                if (query != null) {
                    sTitle = query.CategoryText;
                    pvt.RawValue = query.CategoryText;
                }
            }
            if (currentSite.CheckIsBlogTagPath(sFilterPath)) {
                pvt.CurrentViewType = PageViewType.ViewType.TagIndex;
                vw_carrot_TagURL query = CompiledQueries.cqGetTagByURL(db, siteID, sFilterPath);
                if (query != null) {
                    sTitle = query.TagText;
                    pvt.RawValue = query.TagText;
                }
            }
            if (currentSite.CheckIsBlogEditorFolderPath(sFilterPath)) {
                pvt.CurrentViewType = PageViewType.ViewType.AuthorIndex;
                vw_carrot_EditorURL query = CompiledQueries.cqGetEditorByURL(db, siteID, sFilterPath);
                if (query != null) {
                    ExtendedUserData usr = new ExtendedUserData(query.UserId);
                    sTitle = usr.ToString();
                    pvt.RawValue = usr;
                }
            }
            if (currentSite.CheckIsBlogDateFolderPath(sFilterPath)) {
                pvt.CurrentViewType = PageViewType.ViewType.DateIndex;

                BlogDatePathParser p = new BlogDatePathParser(currentSite, sFilterPath);
                TimeSpan ts = p.DateEndUTC - p.DateBeginUTC;

                pvt.RawValue = p.DateBegin;

                int daysDelta = ts.Days;
                if (daysDelta < 400 && daysDelta > 90) {
                    sTitle = p.DateBegin.ToString("yyyy");
                    pvt.CurrentViewType = PageViewType.ViewType.DateYearIndex;
                }
                if (daysDelta < 36 && daysDelta > 3) {
                    sTitle = p.DateBegin.ToString("MMMM yyyy");
                    pvt.CurrentViewType = PageViewType.ViewType.DateMonthIndex;
                }
                if (daysDelta < 5) {
                    sTitle = p.DateBegin.ToString("MMMM d, yyyy");
                    pvt.CurrentViewType = PageViewType.ViewType.DateDayIndex;
                }
            }

            if (currentSite.CheckIsSiteSearchPath(sFilterPath)) {
                pvt.CurrentViewType = PageViewType.ViewType.SearchResults;
                string sSearchTerm = "";

                if (HttpContext.Current.Request.QueryString[SiteData.SearchQueryParameter] != null) {
                    sSearchTerm = HttpContext.Current.Request.QueryString[SiteData.SearchQueryParameter].ToString();
                }

                pvt.RawValue = sSearchTerm;
                sTitle = string.Format(" '{0}' ", sSearchTerm);
            }

            pvt.ExtraTitle = sTitle;

            return pvt;
        }
        public string GetBlogHeadingFromURL(SiteData currentSite, string sFilterPath)
        {
            Guid siteID = currentSite.SiteID;

            string sTitle = String.Empty;

            if (currentSite.CheckIsBlogCategoryPath(sFilterPath)) {
                vw_carrot_CategoryURL query = CompiledQueries.cqGetCategoryByURL(db, siteID, sFilterPath);
                sTitle = query.CategoryText;
            }
            if (currentSite.CheckIsBlogTagPath(sFilterPath)) {
                vw_carrot_TagURL query = CompiledQueries.cqGetTagByURL(db, siteID, sFilterPath);
                sTitle = query.TagText;
            }
            if (currentSite.CheckIsBlogEditorFolderPath(sFilterPath)) {
                vw_carrot_EditorURL query = CompiledQueries.cqGetEditorByURL(db, siteID, sFilterPath);
                ExtendedUserData usr = new ExtendedUserData(query.UserId);
                sTitle = usr.ToString();
            }
            if (currentSite.CheckIsBlogDateFolderPath(sFilterPath)) {
                BlogDatePathParser p = new BlogDatePathParser(currentSite, sFilterPath);
                TimeSpan ts = p.DateEndUTC - p.DateBeginUTC;

                int daysDelta = ts.Days;
                if (daysDelta > 90) {
                    sTitle = "Year " + p.DateBegin.ToString("yyyy");
                }
                if (daysDelta < 36) {
                    sTitle = p.DateBegin.ToString("MMMM yyyy");
                }
                if (daysDelta < 5) {
                    sTitle = p.DateBegin.ToString("MMMM d, yyyy");
                }
            }
            if (currentSite.CheckIsSiteSearchPath(sFilterPath)) {
                sTitle = "Search Results";
            }

            return sTitle;
        }