internal static IQueryable<vw_carrot_Content> GetAllBlogList(CarrotCMSDataContext ctx, Guid siteID) {
			return (from ct in ctx.vw_carrot_Contents
					orderby ct.NavOrder, ct.NavMenuText
					where ct.SiteID == siteID
					 && ct.IsLatestVersion == true
					 && ct.ContentTypeID == ContentPageType.GetIDByType(ContentPageType.PageType.BlogEntry)
					select ct);
		}
		internal static IQueryable<vw_carrot_Content> FindPageByTitleAndDate(CarrotCMSDataContext ctx, Guid siteID, string sTitle, string sFileNameFrag, DateTime dateCreate) {
			return (from ct in ctx.vw_carrot_Contents
					orderby ct.NavOrder, ct.NavMenuText
					where ct.SiteID == siteID
					 && ct.IsLatestVersion == true
					 && (ct.PageHead.ToLower() == sTitle.ToLower() || ct.TitleBar.ToLower() == sTitle.ToLower())
					 && ct.FileName.ToLower().Contains(sFileNameFrag.ToLower())
					 && ct.CreateDate.Date == dateCreate.Date
					select ct);
		}
		internal static IQueryable<vw_carrot_Content> GetLatestContentList(CarrotCMSDataContext ctx, Guid siteID, bool bActiveOnly) {
			return (from ct in ctx.vw_carrot_Contents
					orderby ct.NavOrder, ct.NavMenuText
					where ct.SiteID == siteID
					 && ct.IsLatestVersion == true
					 && ct.ContentTypeID == ContentPageType.GetIDByType(ContentPageType.PageType.ContentEntry)
					 && (ct.PageActive == true || bActiveOnly == false)
					 && (ct.GoLiveDate < DateTime.UtcNow || bActiveOnly == false)
					 && (ct.RetireDate > DateTime.UtcNow || bActiveOnly == false)
					select ct);
		}
		internal static IQueryable<vw_carrot_Content> TopLevelPages(CarrotCMSDataContext ctx, Guid siteID, bool bActiveOnly) {
			SearchParameterObject sp = new SearchParameterObject {
				SiteID = siteID,
				DateCompare = DateTime.UtcNow,
				ContentTypeID = ContentPageType.GetIDByType(ContentPageType.PageType.ContentEntry),
				ContentType = ContentPageType.PageType.ContentEntry,
				ActiveOnly = bActiveOnly
			};

			return cqTopLevelPages(ctx, sp);
		}
		internal static IQueryable<vw_carrot_ContentSnippet> GetSnippets(CarrotCMSDataContext ctx, Guid siteID, bool bActiveOnly) {
			return (from ct in ctx.vw_carrot_ContentSnippets
					orderby ct.ContentSnippetName
					where ct.SiteID == siteID
					&& ct.IsLatestVersion == true
					&& (ct.ContentSnippetActive == true || bActiveOnly == false)
					&& (ct.GoLiveDate < DateTime.UtcNow || bActiveOnly == false)
					&& (ct.RetireDate > DateTime.UtcNow || bActiveOnly == false)
					&& ct.IsLatestVersion == true
					select ct);
		}
 internal static IQueryable<vw_carrot_Comment> FindCommentsByDate(CarrotCMSDataContext ctx, Guid siteID, Guid rootContentID, DateTime postDate, string postIP, string sCommentText)
 {
     return (from r in ctx.vw_carrot_Comments
             orderby r.CreateDate descending
             where r.SiteID == siteID
                 && r.Root_ContentID == rootContentID
                 && r.CreateDate.Date == postDate.Date
                 && r.CommenterIP == postIP
                 && r.PostComment.Trim() == sCommentText.Trim()
             select r);
 }
		public static CarrotCMSDataContext Create(IDbConnection connection) {
#if DEBUG
			CarrotCMSDataContext _db = new CarrotCMSDataContext(connection);
			DataDiagnostic dd = new DataDiagnostic(_db, iDBConnCounter);
			iDBConnCounter++;
			if (iDBConnCounter > 4096) {
				iDBConnCounter = 0;
			}
			return _db;
#endif
			return new CarrotCMSDataContext(connection);
		}
Beispiel #8
0
        public static CarrotCMSDataContext Create(IDbConnection connection)
        {
#if DEBUG
            CarrotCMSDataContext _db = new CarrotCMSDataContext(connection);
            DataDiagnostic       dd  = new DataDiagnostic(_db, iDBConnCounter);
            iDBConnCounter++;
            if (iDBConnCounter > 4096)
            {
                iDBConnCounter = 0;
            }
            return(_db);
#endif
            return(new CarrotCMSDataContext(connection));
        }
		internal static IQueryable<vw_carrot_Content> GetLatestContentByParent(CarrotCMSDataContext ctx, Guid siteID, Guid? parentContentID, bool bActiveOnly) {
			SearchParameterObject sp = new SearchParameterObject {
				SiteID = siteID,
				ParentContentID = parentContentID,
				DateCompare = DateTime.UtcNow,
				ActiveOnly = bActiveOnly
			};

			return cqGetLatestContentByParent1(ctx, sp);
		}
		internal static IQueryable<vw_carrot_Content> GetLatestContentBySibling(CarrotCMSDataContext ctx, Guid siteID, string sPage, bool bActiveOnly) {
			SearchParameterObject sp = new SearchParameterObject {
				SiteID = siteID,
				FileName = sPage,
				DateCompare = DateTime.UtcNow,
				ActiveOnly = bActiveOnly
			};

			return cqGetLatestContentBySibling2(ctx, sp);
		}
		internal static vw_carrot_ContentSnippet GetLatestContentSnippetByID(CarrotCMSDataContext ctx, Guid siteID, bool bActiveOnly, Guid itemID) {
			SearchParameterObject sp = new SearchParameterObject {
				SiteID = siteID,
				DateCompare = DateTime.UtcNow,
				ActiveOnly = bActiveOnly,
				ItemSlugID = itemID
			};
			return cqGetLatestContentSnippetByID(ctx, sp);
		}
		internal static vw_carrot_Content GetLatestContentByURL(CarrotCMSDataContext ctx, Guid siteID, bool bActiveOnly, string sPage) {
			SearchParameterObject sp = new SearchParameterObject {
				SiteID = siteID,
				DateCompare = DateTime.UtcNow,
				ActiveOnly = bActiveOnly,
				FileName = sPage
			};
			return cqGetLatestContentByURL(ctx, sp);
		}
 internal static IQueryable<vw_carrot_Comment> GetSiteContentComments(CarrotCMSDataContext ctx, Guid siteID)
 {
     return (from r in ctx.vw_carrot_Comments
             orderby r.CreateDate descending
             where r.SiteID == siteID
             select r);
 }
Beispiel #14
0
        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);
        }
		internal static IQueryable<vw_carrot_Content> PostsByDateRange(CarrotCMSDataContext ctx, Guid siteID, DateTime dateBegin, DateTime dateEnd, bool bActiveOnly) {
			SearchParameterObject sp = new SearchParameterObject {
				SiteID = siteID,
				DateCompare = DateTime.UtcNow,
				ContentTypeID = ContentPageType.GetIDByType(ContentPageType.PageType.BlogEntry),
				ContentType = ContentPageType.PageType.BlogEntry,
				DateBegin = dateBegin,
				DateEnd = dateEnd,
				ActiveOnly = bActiveOnly
			};

			return cqPostsByDateRange(ctx, sp);
		}
		internal static vw_carrot_Content FindHome(CarrotCMSDataContext ctx, Guid siteID, bool bActiveOnly) {
			SearchParameterObject sp = new SearchParameterObject {
				SiteID = siteID,
				DateCompare = DateTime.UtcNow,
				ActiveOnly = bActiveOnly
			};

			return cqFindHome(ctx, sp);
		}
        internal static Dictionary<string, float> GetTemplateCounts(CarrotCMSDataContext ctx, Guid siteID, ContentPageType.PageType pageType)
        {
            Guid contentTypeID = ContentPageType.GetIDByType(pageType);

            return (from ct in ctx.vw_carrot_Contents.Where(c => c.SiteID == siteID && c.ContentTypeID == contentTypeID && c.IsLatestVersion == true)
                    group ct by ct.TemplateFile into grp
                    orderby grp.Count() descending
                    select new KeyValuePair<string, float>(grp.Key, (float)grp.Count()))
                    .ToDictionary(t => t.Key, t => t.Value);
        }
		internal static IQueryable<vw_carrot_Content> GetContentByCategoryURL(CarrotCMSDataContext ctx, Guid siteID, bool bActiveOnly, string sCatURL) {
			SearchParameterObject sp = new SearchParameterObject {
				SiteID = siteID,
				DateCompare = DateTime.UtcNow,
				FileName = sCatURL,
				ActiveOnly = bActiveOnly
			};

			return cqGetContentByCategoryURL(ctx, sp);
		}
 internal static IQueryable<vw_carrot_TagURL> GetTagURLs(CarrotCMSDataContext ctx, Guid siteID)
 {
     return (from ct in ctx.vw_carrot_TagURLs
             where ct.SiteID == siteID
             select ct);
 }
 internal static IQueryable<vw_carrot_Comment> GetSiteContentCommentsByPostType(CarrotCMSDataContext ctx, Guid siteID, ContentPageType.PageType contentEntry, bool? approved, bool? spam)
 {
     return (from r in ctx.vw_carrot_Comments
             orderby r.CreateDate descending
             where r.SiteID == siteID
                    && (spam == null || r.IsSpam == spam)
                    && (approved == null || r.IsApproved == approved)
                 && r.ContentTypeID == ContentPageType.GetIDByType(contentEntry)
             select r);
 }
 internal static IQueryable<vw_carrot_Comment> GetSiteContentCommentsByPostType(CarrotCMSDataContext ctx, Guid siteID, ContentPageType.PageType contentEntry)
 {
     return (from r in ctx.vw_carrot_Comments
             orderby r.CreateDate descending
             where r.SiteID == siteID
                 && r.ContentTypeID == ContentPageType.GetIDByType(contentEntry)
             select r);
 }
		internal static int GetContentCountByParent(CarrotCMSDataContext ctx, Guid siteID, string parentPage, bool bActiveOnly) {
			SearchParameterObject sp = new SearchParameterObject {
				SiteID = siteID,
				ParentFileName = parentPage,
				DateCompare = DateTime.UtcNow,
				ActiveOnly = bActiveOnly
			};

			return cqGetContentCountByParent2(ctx, sp);
		}
		internal static carrot_SerialCache SearchSeriaCache(CarrotCMSDataContext ctx, Guid itemID, string keyType) {
			return SearchSeriaCache(ctx, SiteData.CurrentSiteID, SecurityData.CurrentUserGuid, itemID, keyType);
		}
		internal static IQueryable<vw_carrot_Content> GetLatestContentWithParent(CarrotCMSDataContext ctx, Guid siteID, Guid? parentContentID, bool bActiveOnly) {
			SearchParameterObject sp = new SearchParameterObject {
				SiteID = siteID,
				ParentContentID = parentContentID,
				ContentTypeID = ContentPageType.GetIDByType(ContentPageType.PageType.ContentEntry),
				ContentType = ContentPageType.PageType.ContentEntry,
				DateCompare = DateTime.UtcNow,
				ActiveOnly = bActiveOnly
			};

			return cqGetLatestContentWithParent(ctx, sp);
		}
Beispiel #25
0
 public DataDiagnostic(CarrotCMSDataContext db)
 {
     db.Connection.StateChange += DBContextChange;
     db.Log = new DebugTextWriter();
 }
		internal static carrot_SerialCache SearchSeriaCache(CarrotCMSDataContext ctx, Guid siteID, Guid userID, Guid itemID, string keyType) {
			SearchParameterObject searchParm = new SearchParameterObject {
				SiteID = siteID,
				DateCompare = DateTime.UtcNow,
				UserId = userID,
				ItemID = itemID,
				KeyType = keyType
			};

			return cqGetSerialCacheTbl(ctx, searchParm);
		}
Beispiel #27
0
 public DataDiagnostic(CarrotCMSDataContext db, int iCtr)
 {
     iDBCounter = iCtr;
     db.Connection.StateChange += DBContextChange;
     db.Log = new DebugTextWriter();
 }
 internal static IQueryable<carrot_WidgetData> GetWidgetDataByRootAll(CarrotCMSDataContext ctx, Guid rootWidgetID)
 {
     return (from r in ctx.carrot_WidgetDatas
             where r.Root_WidgetID == rootWidgetID
             select r);
 }
 internal static IQueryable<carrot_Content> GetBlogAllContentTbl(CarrotCMSDataContext ctx, Guid siteID)
 {
     return (from ct in ctx.carrot_RootContents
             join c in ctx.carrot_Contents on ct.Root_ContentID equals c.Root_ContentID
             where ct.SiteID == siteID
             where c.IsLatestVersion == true
                  && ct.ContentTypeID == ContentPageType.GetIDByType(ContentPageType.PageType.BlogEntry)
             select c);
 }
		//=====================

		internal static IQueryable<vw_carrot_Content> GetOtherNotPage(CarrotCMSDataContext ctx, Guid siteID, Guid rootContentID, Guid? parentContentID) {
			SearchParameterObject sp = new SearchParameterObject {
				SiteID = siteID,
				RootContentID = rootContentID,
				ParentContentID = parentContentID,
				ContentTypeID = ContentPageType.GetIDByType(ContentPageType.PageType.ContentEntry),
				DateCompare = DateTime.UtcNow
			};

			return cqGetOtherNotPage(ctx, sp);
		}
 internal static IQueryable<carrot_Widget> GetWidgetsByRootContent(CarrotCMSDataContext ctx, Guid rootContentID)
 {
     return (from r in ctx.carrot_Widgets
             where r.Root_ContentID == rootContentID
             select r);
 }
		internal static vw_carrot_Content GetNextPost(CarrotCMSDataContext ctx, Guid siteID, bool bActiveOnly, Guid rootContentID) {
			SearchParameterObject sp = new SearchParameterObject {
				SiteID = siteID,
				RootContentID = rootContentID,
				DateCompare = DateTime.UtcNow,
				ActiveOnly = bActiveOnly
			};

			return cqGetNextPost(ctx, sp);
		}
 internal static IQueryable<carrot_RootContent> GetAllRootTbl(CarrotCMSDataContext ctx, Guid siteID)
 {
     return (from ct in ctx.carrot_RootContents
             where ct.SiteID == siteID
             select ct);
 }