public void FixOrphanPages(Guid siteID) { List <SiteMapOrder> lstContent = CannedQueries.GetAllContentList(db, siteID).Select(ct => new SiteMapOrder(ct)).ToList(); List <Guid> lstIDs = lstContent.Select(x => x.Root_ContentID).ToList(); lstContent.RemoveAll(x => x.Parent_ContentID == null); lstContent.RemoveAll(x => lstIDs.Contains(x.Parent_ContentID.Value)); lstIDs = lstContent.Select(x => x.Root_ContentID).ToList(); IQueryable <carrot_Content> querySite = (from c in db.carrot_Contents where c.IsLatestVersion == true && c.Parent_ContentID != null && lstIDs.Contains(c.Root_ContentID) select c); db.carrot_Contents.BatchUpdate(querySite, p => new carrot_Content { Parent_ContentID = null }); IQueryable <carrot_Content> querySite2 = (from c in db.carrot_Contents join rc in db.carrot_RootContents on c.Root_ContentID equals rc.Root_ContentID where c.IsLatestVersion == true && c.Parent_ContentID != null && rc.SiteID == siteID && rc.ContentTypeID == ContentPageType.GetIDByType(ContentPageType.PageType.BlogEntry) select c); db.carrot_Contents.BatchUpdate(querySite2, p => new carrot_Content { Parent_ContentID = null }); db.SubmitChanges(); }
public int GetSitePageCount(ContentPageType.PageType entryType) { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { int iCount = CannedQueries.GetAllByTypeList(_db, this.SiteID, false, entryType).Count(); return(iCount); } }
public static int GetCommentCountByContent(Guid rootContentID, bool bActiveOnly) { using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) { return((from c in CannedQueries.GetContentPageComments(_db, rootContentID, bActiveOnly) select c).Count()); } }
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 List <SiteNav> GetMasterNavigation(Guid siteID, bool bActiveOnly) { List <SiteNav> lstContent = (from ct in CannedQueries.GetLatestContentList(db, siteID, bActiveOnly) select new SiteNav(ct)).ToList(); return(lstContent); }
public List <SiteNav> 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)); }
private void SaveKeywordsAndTags(CarrotCMSDataContext _db) { IQueryable <carrot_TagContentMapping> oldContentTags = CannedQueries.GetContentTagMapByContentID(_db, this.Root_ContentID); IQueryable <carrot_CategoryContentMapping> oldContentCategories = CannedQueries.GetContentCategoryMapByContentID(_db, this.Root_ContentID); if (this.ContentType == ContentPageType.PageType.BlogEntry) { List <carrot_TagContentMapping> newContentTags = (from x in this.ContentTags select new carrot_TagContentMapping { ContentTagID = x.ContentTagID, Root_ContentID = this.Root_ContentID, TagContentMappingID = Guid.NewGuid() }).ToList(); List <carrot_CategoryContentMapping> newContentCategories = (from x in this.ContentCategories select new carrot_CategoryContentMapping { ContentCategoryID = x.ContentCategoryID, Root_ContentID = this.Root_ContentID, CategoryContentMappingID = Guid.NewGuid() }).ToList(); foreach (carrot_TagContentMapping s in newContentTags) { _db.carrot_TagContentMappings.InsertOnSubmit(s); } foreach (carrot_CategoryContentMapping s in newContentCategories) { _db.carrot_CategoryContentMappings.InsertOnSubmit(s); } } _db.carrot_TagContentMappings.BatchDelete(oldContentTags); _db.carrot_CategoryContentMappings.BatchDelete(oldContentCategories); }
public static int GetCommentCountByContent(Guid siteID, Guid rootContentID, DateTime postDate, string postIP) { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { return((from c in CannedQueries.FindCommentsByDate(_db, siteID, rootContentID, postDate, postIP) select c).Count()); } }
public void DeleteAll(Guid rootWidgetID) { IQueryable <carrot_WidgetData> w1 = CannedQueries.GetWidgetDataByRootAll(db, rootWidgetID); carrot_Widget w2 = CompiledQueries.cqGetRootWidget(db, rootWidgetID); bool bPendingDel = false; if (w1 != null) { db.carrot_WidgetDatas.BatchDelete(w1); bPendingDel = true; } if (w2 != null) { db.carrot_Widgets.DeleteOnSubmit(w2); bPendingDel = true; } if (bPendingDel) { db.SubmitChanges(); } }
public static int GetAllCommentCountBySite(Guid siteID) { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { return((from c in CannedQueries.GetSiteContentComments(_db, siteID) select c).Count()); } }
public static int GetCommentCountByContent(Guid rootContentID, bool?approved, bool?spam) { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { return((from c in CannedQueries.GetContentPageComments(_db, rootContentID, approved, spam) select c).Count()); } }
public static int GetCommentCountBySiteAndType(Guid siteID, ContentPageType.PageType pageType, bool?approved, bool?spam) { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { return((from c in CannedQueries.GetSiteContentCommentsByPostType(_db, siteID, pageType, approved, spam) select c).Count()); } }
public int GetFilteredContentByIDPagedCount(SiteData currentSite, List <Guid> lstCategoryGUIDs, List <string> lstCategorySlugs, bool bActiveOnly) { Guid siteID = currentSite.SiteID; IQueryable <vw_carrot_Content> query1 = CannedQueries.GetContentByCategoryIDs(db, siteID, bActiveOnly, lstCategoryGUIDs, lstCategorySlugs); return(query1.Count()); }
public List <SiteNav> GetFilteredContentByIDPagedList(SiteData currentSite, List <Guid> lstCategoryGUIDs, List <string> lstCategorySlugs, bool bActiveOnly, int pageSize, int pageNumber, string sortField, string sortDir) { Guid siteID = currentSite.SiteID; IQueryable <vw_carrot_Content> query1 = CannedQueries.GetContentByCategoryIDs(db, siteID, bActiveOnly, lstCategoryGUIDs, lstCategorySlugs); return(PerformDataPagingQueryableContent(siteID, bActiveOnly, pageSize, pageNumber, sortField, sortDir, query1)); }
public List <SiteNav> GetLatestPostUpdates(Guid siteID, int iUpdates, bool bActiveOnly) { List <SiteNav> lstContent = (from ct in CannedQueries.GetLatestBlogList(db, siteID, bActiveOnly) orderby ct.EditDate descending select new SiteNav(ct)).Take(iUpdates).ToList(); return(lstContent); }
public List <ContentTag> GetTagList(Guid siteID, int iUpdates) { List <ContentTag> lstContent = (from ct in CannedQueries.GetTagURLs(db, siteID) where ct.IsPublic == true orderby ct.UseCount descending select new ContentTag(ct)).Take(iUpdates).ToList(); return(lstContent); }
public static List <PostComment> GetAllCommentsBySite(Guid siteID) { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { IQueryable <PostComment> s = (from c in CannedQueries.GetSiteContentComments(_db, siteID) select new PostComment(c)); return(s.ToList()); } }
public List <ContentTag> GetTagListForPost(Guid siteID, int iUpdates, Guid rootContentID) { List <ContentTag> lstContent = (from ct in CannedQueries.GetPostTagURLs(db, siteID, rootContentID) where ct.IsPublic == true orderby ct.TagText select new ContentTag(ct)).Take(iUpdates).ToList(); return(lstContent); }
public List <ContentCategory> GetCategoryListForPost(Guid siteID, int iUpdates, string urlFileName) { List <ContentCategory> lstContent = (from ct in CannedQueries.GetPostCategoryURL(db, siteID, urlFileName) where ct.IsPublic == true orderby ct.CategoryText select new ContentCategory(ct)).Take(iUpdates).ToList(); return(lstContent); }
public List <IContentMetaInfo> GetCategoryListForPost(Guid siteID, int iUpdates, Guid rootContentID) { List <IContentMetaInfo> lstContent = (from ct in CannedQueries.GetPostCategoryURL(db, siteID, rootContentID) where ct.IsPublic == true orderby ct.CategoryText select(IContentMetaInfo) new ContentCategory(ct)).Take(iUpdates).ToList(); return(lstContent); }
public static List <PostComment> GetCommentsByContentPage(Guid rootContentID, bool bActiveOnly) { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { IQueryable <vw_carrot_Comment> lstComments = (from c in CannedQueries.GetContentPageComments(_db, rootContentID, bActiveOnly) select c); return(lstComments.Select(x => new PostComment(x)).ToList()); } }
public List <IContentMetaInfo> GetTagListForPost(Guid siteID, int iUpdates, string urlFileName) { List <IContentMetaInfo> lstContent = (from ct in CannedQueries.GetPostTagURLs(db, siteID, urlFileName) where ct.IsPublic == true orderby ct.TagText select(IContentMetaInfo) new ContentTag(ct)).Take(iUpdates).ToList(); return(lstContent); }
public List <IContentMetaInfo> GetCategoryList(Guid siteID, int iUpdates) { List <IContentMetaInfo> lstContent = (from ct in CannedQueries.GetCategoryURLs(db, siteID) where ct.IsPublic == true orderby ct.UseCount descending select(IContentMetaInfo) new ContentCategory(ct)).Take(iUpdates).ToList(); return(lstContent); }
public static List <PostComment> GetCommentsByContentPageNumber(Guid rootContentID, int iPageNbr, int iPageSize, string SortBy, bool?approved, bool?spam) { int startRec = iPageNbr * iPageSize; using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { IQueryable <vw_carrot_Comment> lstComments = (from c in CannedQueries.GetContentPageComments(_db, rootContentID, approved, spam) select c); return(PaginateComments(lstComments, iPageNbr, iPageSize, SortBy).ToList()); } }
public static List <PostComment> GetCommentsBySitePageNumber(Guid siteID, int iPageNbr, int iPageSize, string SortBy, ContentPageType.PageType pageType) { int startRec = iPageNbr * iPageSize; using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { IQueryable <vw_carrot_Comment> lstComments = (from c in CannedQueries.GetSiteContentCommentsByPostType(_db, siteID, pageType) select c); return(PaginateComments(lstComments, iPageNbr, iPageSize, SortBy).ToList()); } }
public void SetStatusList(Guid rootContentID, List <Guid> lstWidgetIDs, bool widgetStatus) { IQueryable <carrot_Widget> queryWidgets = (from w in CannedQueries.GetWidgetsByRootContent(db, rootContentID) where lstWidgetIDs.Contains(w.Root_WidgetID) && w.WidgetActive != widgetStatus select w); db.carrot_Widgets.BatchUpdate(queryWidgets, p => new carrot_Widget { WidgetActive = widgetStatus }); db.SubmitChanges(); }
public List <SiteNav> GetLatestContentPagedList(Guid siteID, ContentPageType.PageType postType, bool bActiveOnly, int pageSize, int pageNumber, string sortField, string sortDir) { IQueryable <vw_carrot_Content> query1 = null; if (postType == ContentPageType.PageType.ContentEntry) { query1 = CannedQueries.GetLatestContentList(db, siteID, bActiveOnly); } else { query1 = CannedQueries.GetLatestBlogList(db, siteID, bActiveOnly); } return(PerformDataPagingQueryableContent(siteID, bActiveOnly, pageSize, pageNumber, sortField, sortDir, query1)); }
public List <SiteNav> GetLevelDepthNavigation(Guid siteID, int iDepth, bool bActiveOnly) { List <SiteNav> lstContent = null; List <Guid> lstSub = new List <Guid>(); if (iDepth < 1) { iDepth = 1; } if (iDepth > 10) { iDepth = 10; } List <Guid> lstTop = CompiledQueries.TopLevelPages(db, siteID, false).Select(z => z.Root_ContentID).ToList(); while (iDepth > 1) { lstSub = (from ct in CannedQueries.GetLatestContentList(db, siteID, bActiveOnly) where ct.SiteID == siteID && ct.ShowInSiteNav == true && (ct.PageActive == true || bActiveOnly == false) && ct.IsLatestVersion == true && (ct.GoLiveDate < DateTime.UtcNow || bActiveOnly == false) && (ct.RetireDate > DateTime.UtcNow || bActiveOnly == false) && (!lstTop.Contains(ct.Root_ContentID) && lstTop.Contains(ct.Parent_ContentID.Value)) select ct.Root_ContentID).Distinct().ToList(); lstTop = lstTop.Union(lstSub).ToList(); iDepth--; } lstContent = (from ct in CannedQueries.GetLatestContentList(db, siteID, bActiveOnly) orderby ct.NavOrder, ct.NavMenuText where ct.SiteID == siteID && ct.ShowInSiteNav == true && (ct.PageActive == true || bActiveOnly == false) && ct.IsLatestVersion == true && (ct.GoLiveDate < DateTime.UtcNow || bActiveOnly == false) && (ct.RetireDate > DateTime.UtcNow || bActiveOnly == false) && lstTop.Contains(ct.Root_ContentID) select new SiteNav(ct)).ToList(); return(lstContent); }
public List <SiteNav> GetTwoLevelNavigation(Guid siteID, bool bActiveOnly) { List <SiteNav> lstContent = null; List <Guid> lstTop = CompiledQueries.TopLevelPages(db, siteID, false).Select(z => z.Root_ContentID).ToList(); lstContent = (from ct in CannedQueries.GetLatestContentList(db, siteID, bActiveOnly) orderby ct.NavOrder, ct.NavMenuText where ct.SiteID == siteID && (ct.PageActive == true || bActiveOnly == false) && (ct.GoLiveDate < DateTime.UtcNow || bActiveOnly == false) && (ct.RetireDate > DateTime.UtcNow || bActiveOnly == false) && ct.IsLatestVersion == true && (lstTop.Contains(ct.Root_ContentID) || lstTop.Contains(ct.Parent_ContentID.Value)) select new SiteNav(ct)).ToList(); return(lstContent); }
public TimeZoneContent(Guid siteID) { // use C# libraries for timezones rather than pass in offset as some dates are +/- an hour off because of DST this.SiteID = siteID; this.ContentLocalDates = new List <ContentLocalTime>(); this.BlogPostUrls = new List <BlogPostPageUrl>(); SiteData site = SiteData.GetSiteFromCache(siteID); List <carrot_RootContent> queryAllContent = null; using (CarrotCMSDataContext db = CarrotCMSDataContext.GetDataContext()) { queryAllContent = CannedQueries.GetAllRootTbl(db, siteID).ToList(); } var allContentDates = (from p in queryAllContent select p.GoLiveDate).Distinct().ToList(); var blogDateList = (from p in queryAllContent where p.ContentTypeID == ContentPageType.GetIDByType(ContentPageType.PageType.BlogEntry) select p.GoLiveDate).Distinct().ToList(); this.ContentLocalDates = (from d in allContentDates select new ContentLocalTime() { GoLiveDate = d, GoLiveDateLocal = site.ConvertUTCToSiteTime(d) }).ToList(); this.BlogPostUrls = (from bd in blogDateList join ld in this.ContentLocalDates on bd equals ld.GoLiveDate select new BlogPostPageUrl() { GoLiveDate = ld.GoLiveDate, PostPrefix = CleanPostPrefix(ContentPageHelper.CreateFileNameFromSlug(siteID, ld.GoLiveDateLocal, string.Empty)), GoLiveDateLocal = ld.GoLiveDateLocal }).ToList(); }