Inheritance: IDisposable
コード例 #1
0
        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();
        }
コード例 #2
0
        internal SiteMapOrder(vw_carrot_Content c)
        {
            if (c != null)
            {
                SiteData site = SiteData.GetSiteFromCache(c.SiteID);

                this.SiteID           = c.SiteID;
                this.Root_ContentID   = c.Root_ContentID;
                this.PageActive       = c.PageActive;
                this.Parent_ContentID = c.Parent_ContentID;
                this.NavMenuText      = c.NavMenuText;
                this.FileName         = c.FileName;
                this.NavOrder         = c.NavOrder;

                if (this.Parent_ContentID.HasValue)
                {
                    this.NavLevel = 0;
                }
                else
                {
                    this.NavLevel = 10;
                }

                this.ContentType = ContentPageType.GetTypeByID(c.ContentTypeID);
                this.CreateDate  = site.ConvertUTCToSiteTime(c.CreateDate);
                this.GoLiveDate  = site.ConvertUTCToSiteTime(c.GoLiveDate);
                this.RetireDate  = site.ConvertUTCToSiteTime(c.RetireDate);
            }
        }
コード例 #3
0
        internal static IQueryable <vw_carrot_Content> GetContentByCategoryIDs(CarrotCMSDataContext ctx, Guid siteID, bool bActiveOnly, List <Guid> lstCategoryGUIDs, List <string> lstCategorySlugs)
        {
            if (lstCategoryGUIDs == null)
            {
                lstCategoryGUIDs = new List <Guid>();
            }
            if (lstCategorySlugs == null)
            {
                lstCategorySlugs = new List <string>();
            }

            return(from ct in ctx.vw_carrot_Contents
                   where ct.SiteID == siteID &&
                   ((from m in ctx.carrot_CategoryContentMappings
                     join cc in ctx.carrot_ContentCategories on m.ContentCategoryID equals cc.ContentCategoryID
                     where cc.SiteID == siteID &&
                     lstCategorySlugs.Contains(cc.CategorySlug)
                     select m.Root_ContentID).Contains(ct.Root_ContentID) ||
                    (from m in ctx.carrot_CategoryContentMappings
                     where lstCategoryGUIDs.Contains(m.ContentCategoryID)
                     select m.Root_ContentID).Contains(ct.Root_ContentID)) &&
                   ct.ContentTypeID == ContentPageType.GetIDByType(ContentPageType.PageType.BlogEntry) &&
                   (ct.PageActive == true || bActiveOnly == false) &&
                   (ct.GoLiveDate < DateTime.UtcNow || bActiveOnly == false) &&
                   (ct.RetireDate > DateTime.UtcNow || bActiveOnly == false) &&
                   ct.IsLatestVersion == true
                   select ct);
        }
コード例 #4
0
        private void PerformCommonSaveRoot(SiteData pageSite, carrot_RootContent rc)
        {
            rc.Root_ContentID = this.Root_ContentID;
            rc.PageActive     = true;
            rc.BlockIndex     = false;
            rc.ShowInSiteMap  = true;

            rc.SiteID        = this.SiteID;
            rc.ContentTypeID = ContentPageType.GetIDByType(this.ContentType);

            rc.CreateDate = DateTime.UtcNow;
            if (this.CreateUserId != Guid.Empty)
            {
                rc.CreateUserId = this.CreateUserId;
            }
            else
            {
                rc.CreateUserId = SecurityData.CurrentUserGuid;
            }
            rc.GoLiveDate = pageSite.ConvertSiteTimeToUTC(this.GoLiveDate);
            rc.RetireDate = pageSite.ConvertSiteTimeToUTC(this.RetireDate);

            if (this.CreateDate.Year > 1950)
            {
                rc.CreateDate = pageSite.ConvertSiteTimeToUTC(this.CreateDate);
            }
        }
コード例 #5
0
 internal static IQueryable <carrot_RootContent> GetContentAllRootTbl(CarrotCMSDataContext ctx, Guid siteID)
 {
     return(from ct in ctx.carrot_RootContents
            where ct.SiteID == siteID
            where ct.ContentTypeID == ContentPageType.GetIDByType(ContentPageType.PageType.ContentEntry)
            select ct);
 }
コード例 #6
0
        internal SiteNav(vw_carrot_Content c)
        {
            if (c != null)
            {
                SiteData site = SiteData.GetSiteFromCache(c.SiteID);

                this.Root_ContentID   = c.Root_ContentID;
                this.SiteID           = c.SiteID;
                this.FileName         = c.FileName;
                this.Thumbnail        = c.PageThumbnail;
                this.ShowInSiteMap    = c.ShowInSiteMap;
                this.BlockIndex       = c.BlockIndex;
                this.PageActive       = c.PageActive;
                this.CreateDate       = site.ConvertUTCToSiteTime(c.CreateDate);
                this.GoLiveDate       = site.ConvertUTCToSiteTime(c.GoLiveDate);
                this.RetireDate       = site.ConvertUTCToSiteTime(c.RetireDate);
                this.EditDate         = site.ConvertUTCToSiteTime(c.EditDate);
                this.EditUserId       = c.EditUserId;
                this.CreditUserId     = c.CreditUserId;
                this.ShowInSiteNav    = c.ShowInSiteNav;
                this.CreateUserId     = c.CreateUserId;
                this.ContentType      = ContentPageType.GetTypeByID(c.ContentTypeID);
                this.ContentID        = c.ContentID;
                this.Parent_ContentID = c.Parent_ContentID;
                this.TitleBar         = c.TitleBar;
                this.NavMenuText      = c.NavMenuText;
                this.PageHead         = c.PageHead;
                this.PageText         = c.PageText;
                this.NavOrder         = c.NavOrder;
                this.TemplateFile     = c.TemplateFile;
            }
        }
コード例 #7
0
		public ContentPage(Guid siteID, ContentPageType.PageType pageType) {
			this.Root_ContentID = Guid.NewGuid();
			this.ContentID = Guid.NewGuid();
			this.ContentType = pageType;
			this.SiteID = siteID;
			this.VersionCount = 0;

			this.CreateDate = SiteData.GetSiteByID(siteID).Now;
			this.EditDate = this.CreateDate;
			this.GoLiveDate = this.CreateDate.AddMinutes(-5);
			this.RetireDate = this.CreateDate.AddYears(200);

			this.NavMenuText = "PAGE " + this.Root_ContentID.ToString().ToLower();
			this.FileName = "/" + this.Root_ContentID.ToString().ToLower() + ".aspx";
			this.TemplateFile = SiteData.DefaultTemplateFilename;

			this.BlockIndex = false;
			this.PageActive = true;
			this.ShowInSiteMap = true;
			this.ShowInSiteNav = true;

			this.LeftPageText = PageContentEmpty;
			this.RightPageText = PageContentEmpty;
			this.PageText = PageContentEmpty;

			if (pageType != ContentPageType.PageType.ContentEntry) {
				this.Parent_ContentID = null;
				this.NavOrder = SiteData.BlogSortOrderNumber;
				this.ShowInSiteMap = false;
				this.ShowInSiteNav = false;
			}

			this.ContentCategories = new List<ContentCategory>();
			this.ContentTags = new List<ContentTag>();
		}
コード例 #8
0
 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);
 }
コード例 #9
0
 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);
 }
コード例 #10
0
 internal static IQueryable <carrot_Content> GetContentAllContentTbl(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.ContentEntry)
            select c);
 }
コード例 #11
0
        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.ToLower() into grp
                    orderby grp.Count() descending
                    select new KeyValuePair <string, float>(grp.Key.ToLower(), (float)grp.Count()))
                   .ToDictionary(t => t.Key, t => t.Value));
        }
コード例 #12
0
 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);
 }
コード例 #13
0
 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);
 }
コード例 #14
0
        internal ContentPage(vw_carrot_Content c)
        {
            if (c != null)
            {
                SiteData site = SiteData.GetSiteFromCache(c.SiteID);

                this.Root_ContentID   = c.Root_ContentID;
                this.SiteID           = c.SiteID;
                this.Heartbeat_UserId = c.Heartbeat_UserId;
                this.EditHeartbeat    = c.EditHeartbeat;
                this.FileName         = c.FileName;

                this.CreateUserId = c.CreateUserId;
                this.CreateDate   = site.ConvertUTCToSiteTime(c.CreateDate);

                this.GoLiveDate = site.ConvertUTCToSiteTime(c.GoLiveDate);
                this.RetireDate = site.ConvertUTCToSiteTime(c.RetireDate);
                this.EditDate   = site.ConvertUTCToSiteTime(c.EditDate);

                this.ShowInSiteMap = c.ShowInSiteMap;
                this.BlockIndex    = c.BlockIndex;
                this.PageActive    = c.PageActive;
                this.ShowInSiteNav = c.ShowInSiteNav;

                this.PageSlug    = c.PageSlug;
                this.ContentType = ContentPageType.GetTypeByID(c.ContentTypeID);

                this.ContentID        = c.ContentID;
                this.Parent_ContentID = c.Parent_ContentID;
                this.IsLatestVersion  = c.IsLatestVersion;
                this.TitleBar         = c.TitleBar;
                this.NavMenuText      = c.NavMenuText;
                this.PageHead         = c.PageHead;
                this.PageText         = c.PageText;
                this.LeftPageText     = c.LeftPageText;
                this.RightPageText    = c.RightPageText;
                this.NavOrder         = c.NavOrder;
                this.EditUserId       = c.EditUserId;
                this.CreditUserId     = c.CreditUserId;
                this.TemplateFile     = c.TemplateFile;
                this.Thumbnail        = c.PageThumbnail;

                if (String.IsNullOrEmpty(this.PageSlug) && this.ContentType == ContentPageType.PageType.BlogEntry)
                {
                    this.PageSlug = c.FileName;
                }

                this.MetaDescription = c.MetaDescription;
                this.MetaKeyword     = c.MetaKeyword;

                this.VersionCount = c.VersionCount.HasValue ? c.VersionCount.Value : 0;
            }
        }
コード例 #15
0
		internal static IQueryable<vw_carrot_Content> GetAllByTypeList(CarrotCMSDataContext ctx, Guid siteID, bool bActiveOnly, ContentPageType.PageType entryType) {
			return (from ct in ctx.vw_carrot_Contents
					orderby ct.NavOrder, ct.NavMenuText
					where ct.SiteID == siteID
					&& ct.IsLatestVersion == true
					&& (ct.PageActive == true || bActiveOnly == false)
					&& (ct.GoLiveDate < DateTime.UtcNow || bActiveOnly == false)
					&& (ct.RetireDate > DateTime.UtcNow || bActiveOnly == false)
					&& ct.IsLatestVersion == true
					&& ct.ContentTypeID == ContentPageType.GetIDByType(entryType)
					select ct);
		}
コード例 #16
0
 internal static IQueryable <vw_carrot_Content> GetLatestBlogListDateRange(CarrotCMSDataContext ctx, Guid siteID, DateTime dateBegin, DateTime dateEnd, bool bActiveOnly)
 {
     return(from ct in ctx.vw_carrot_Contents
            where ct.SiteID == siteID &&
            ct.IsLatestVersion == true &&
            ct.GoLiveDate >= dateBegin &&
            ct.GoLiveDate <= dateEnd &&
            ct.ContentTypeID == ContentPageType.GetIDByType(ContentPageType.PageType.BlogEntry) &&
            (ct.PageActive == true || bActiveOnly == false) &&
            (ct.GoLiveDate < DateTime.UtcNow || bActiveOnly == false) &&
            (ct.RetireDate > DateTime.UtcNow || bActiveOnly == false)
            select ct);
 }
コード例 #17
0
 internal static IQueryable <vw_carrot_Content> GetContentByCategoryURL(CarrotCMSDataContext ctx, Guid siteID, bool bActiveOnly, string sCatURL)
 {
     return(from c in ctx.vw_carrot_CategoryURLs
            join m in ctx.carrot_CategoryContentMappings on c.ContentCategoryID equals m.ContentCategoryID
            join ct in ctx.vw_carrot_Contents on m.Root_ContentID equals ct.Root_ContentID
            where c.SiteID == siteID &&
            ct.SiteID == siteID &&
            c.CategoryUrl.ToLower() == sCatURL.ToLower() &&
            ct.ContentTypeID == ContentPageType.GetIDByType(ContentPageType.PageType.BlogEntry) &&
            (ct.PageActive == true || bActiveOnly == false) &&
            (ct.GoLiveDate < DateTime.UtcNow || bActiveOnly == false) &&
            (ct.RetireDate > DateTime.UtcNow || bActiveOnly == false) &&
            ct.IsLatestVersion == true
            select ct);
 }
コード例 #18
0
        private List <SyndicationItem> GetRecentPagesOrPosts(RSSFeedInclude feedData)
        {
            List <SyndicationItem> syndRSS = new List <SyndicationItem>();
            List <SiteNav>         lst     = new List <SiteNav>();

            ContentPageType PageType = new ContentPageType();

            using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) {
                if (feedData == RSSFeedInclude.PageOnly || feedData == RSSFeedInclude.BlogAndPages)
                {
                    List <SiteNav> lst1 = navHelper.GetLatest(this.SiteID, 8, true);
                    lst = lst.Union(lst1).ToList();
                    List <SiteNav> lst2 = navHelper.GetLatestUpdates(this.SiteID, 10, true);
                    lst = lst.Union(lst2).ToList();
                }
                if (feedData == RSSFeedInclude.BlogOnly || feedData == RSSFeedInclude.BlogAndPages)
                {
                    List <SiteNav> lst1 = navHelper.GetLatestPosts(this.SiteID, 8, true);
                    lst = lst.Union(lst1).ToList();
                    List <SiteNav> lst2 = navHelper.GetLatestPostUpdates(this.SiteID, 10, true);
                    lst = lst.Union(lst2).ToList();
                }
            }

            lst.RemoveAll(x => x.ShowInSiteMap == false && x.ContentType == ContentPageType.PageType.ContentEntry);
            lst.RemoveAll(x => x.BlockIndex == true);

            foreach (SiteNav sn in lst)
            {
                SyndicationItem si = new SyndicationItem();

                string sPageURI = RemoveDupeSlashesURL(this.ConstructedCanonicalURL(sn));

                Uri PageURI = new Uri(sPageURI);

                si.Content = new TextSyndicationContent(sn.PageTextPlainSummaryMedium.ToString());
                si.Title   = new TextSyndicationContent(sn.NavMenuText);
                si.Links.Add(SyndicationLink.CreateSelfLink(PageURI));
                si.AddPermalink(PageURI);

                si.LastUpdatedTime = sn.EditDate;
                si.PublishDate     = sn.CreateDate;

                syndRSS.Add(si);
            }

            return(syndRSS.OrderByDescending(p => p.PublishDate).ToList());
        }
コード例 #19
0
 internal static IQueryable <vw_carrot_Content> GetContentByUserURL(CarrotCMSDataContext ctx, Guid siteID, bool bActiveOnly, string sUserURL)
 {
     return(from ed in ctx.vw_carrot_EditorURLs
            join ct in ctx.vw_carrot_Contents on ed.SiteID equals ct.SiteID
            where ed.SiteID == siteID &&
            ct.SiteID == siteID &&
            ed.UserUrl.ToLower() == sUserURL.ToLower() &&
            ct.ContentTypeID == ContentPageType.GetIDByType(ContentPageType.PageType.BlogEntry) &&
            (ct.PageActive == true || bActiveOnly == false) &&
            (ct.GoLiveDate < DateTime.UtcNow || bActiveOnly == false) &&
            (ct.RetireDate > DateTime.UtcNow || bActiveOnly == false) &&
            ct.IsLatestVersion == true &&
            ((ed.UserId == ct.EditUserId && ct.CreditUserId == null) ||
             (ed.UserId == ct.CreditUserId && ct.CreditUserId != null))
            select ct);
 }
コード例 #20
0
 internal PostComment(vw_carrot_Comment c)
 {
     if (c != null)
     {
         this.ContentCommentID = c.ContentCommentID;
         this.Root_ContentID   = c.Root_ContentID;
         this.CreateDate       = SiteData.CurrentSite.ConvertUTCToSiteTime(c.CreateDate);
         this.CommenterIP      = c.CommenterIP;
         this.CommenterName    = c.CommenterName;
         this.CommenterEmail   = c.CommenterEmail;
         this.CommenterURL     = c.CommenterURL;
         this.PostCommentText  = c.PostComment;
         this.IsApproved       = c.IsApproved;
         this.IsSpam           = c.IsSpam;
         this.NavMenuText      = c.NavMenuText;
         this.FileName         = c.FileName;
         this.ContentType      = ContentPageType.GetTypeByID(c.ContentTypeID);
     }
 }
コード例 #21
0
        internal static IQueryable <vw_carrot_Content> GetContentByStatusAndDateRange(CarrotCMSDataContext ctx, Guid siteID, ContentPageType.PageType pageType,
                                                                                      DateTime dateBegin, DateTime dateEnd, bool?bActive, bool?bSiteMap, bool?bSiteNav, bool?bBlock)
        {
            Guid gContent      = ContentPageType.GetIDByType(ContentPageType.PageType.ContentEntry);
            Guid gBlog         = ContentPageType.GetIDByType(ContentPageType.PageType.BlogEntry);
            Guid contentTypeID = ContentPageType.GetIDByType(pageType);

            return(from ct in ctx.vw_carrot_Contents
                   orderby ct.ContentTypeValue, ct.NavMenuText
                   where ct.SiteID == siteID &&
                   ct.IsLatestVersion == true &&
                   ct.GoLiveDate >= dateBegin &&
                   ct.GoLiveDate <= dateEnd &&
                   (ct.ContentTypeID == contentTypeID || pageType == ContentPageType.PageType.Unknown) &&
                   (ct.PageActive == Convert.ToBoolean(bActive) || bActive == null) &&
                   (ct.BlockIndex == Convert.ToBoolean(bBlock) || bBlock == null) &&
                   ((ct.ShowInSiteMap == Convert.ToBoolean(bSiteMap) && ct.ContentTypeID == gContent) || bSiteMap == null) &&
                   ((ct.ShowInSiteNav == Convert.ToBoolean(bSiteNav) && ct.ContentTypeID == gContent) || bSiteNav == null)
                   select ct);
        }
コード例 #22
0
        internal BasicContentData(vw_carrot_Content c)
        {
            if (c != null)
            {
                SiteData site = SiteData.GetSiteFromCache(c.SiteID);

                this.SiteID           = c.SiteID;
                this.Root_ContentID   = c.Root_ContentID;
                this.PageActive       = c.PageActive;
                this.Parent_ContentID = c.Parent_ContentID;
                this.FileName         = c.FileName;
                this.TemplateFile     = c.TemplateFile;
                this.NavOrder         = c.NavOrder;

                this.ContentType = ContentPageType.GetTypeByID(c.ContentTypeID);
                this.CreateDate  = site.ConvertUTCToSiteTime(c.CreateDate);
                this.GoLiveDate  = site.ConvertUTCToSiteTime(c.GoLiveDate);
                this.RetireDate  = site.ConvertUTCToSiteTime(c.RetireDate);
            }
        }
コード例 #23
0
        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();
        }
コード例 #24
0
        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.Create()) {
                queryAllContent = CannedQueries.GetAllRootTbl(db, siteID).ToList();
            }

            this.ContentLocalDates = (from p in queryAllContent
                                      select new ContentLocalTime {
                Root_ContentID = p.Root_ContentID,
                ContentTypeID = p.ContentTypeID,
                GoLiveDate = p.GoLiveDate,
                PageSlug = p.PageSlug,
                FileName = p.FileName,
                GoLiveDateLocal = site.ConvertUTCToSiteTime(p.GoLiveDate)
            }).ToList();

            IEnumerable <ContentLocalTime> queryBlog = (from c in this.ContentLocalDates
                                                        where c.ContentTypeID == ContentPageType.GetIDByType(ContentPageType.PageType.BlogEntry)
                                                        select c);

            this.BlogPostUrls = (from p in queryBlog
                                 select new BlogPostPageUrl {
                Root_ContentID = p.Root_ContentID,
                GoLiveDateLocal = p.GoLiveDateLocal,
                FileName = ContentPageHelper.CreateFileNameFromSlug(siteID, p.GoLiveDateLocal, p.PageSlug)
            }).ToList();
        }
コード例 #25
0
 public int GetSitePageCount(Guid siteID, ContentPageType.PageType entryType, bool bActiveOnly)
 {
     int iCount = CannedQueries.GetAllByTypeList(db, siteID, bActiveOnly, entryType).Count();
     return iCount;
 }
コード例 #26
0
        public Dictionary<string, float> GetPopularTemplateList(Guid siteID, ContentPageType.PageType pageType)
        {
            Dictionary<string, float> lstTemps = CannedQueries.GetTemplateCounts(db, siteID, pageType);

            return lstTemps;
        }
コード例 #27
0
        public List<ContentPage> GetPagedSortedContent(Guid siteID, ContentPageType.PageType entryType, bool bActiveOnly, int pageSize, int pageNumber, string sSortParm)
        {
            string sortField = "";
            string sortDir = "";
            IQueryable<vw_carrot_Content> query1 = null;

            if (!String.IsNullOrEmpty(sSortParm)) {
                int pos = sSortParm.LastIndexOf(" ");
                sortField = sSortParm.Substring(0, pos).Trim();
                sortDir = sSortParm.Substring(pos).Trim();
            }

            query1 = CannedQueries.GetAllByTypeList(db, siteID, bActiveOnly, entryType);

            return PerformDataPagingQueryableContent(siteID, bActiveOnly, pageSize, pageNumber, sortField, sortDir, query1);
        }
コード例 #28
0
        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);
        }
コード例 #29
0
ファイル: SiteNavHelper.cs プロジェクト: mjohn/CarrotCakeCMS
 public int GetSitePageCount(Guid siteID, ContentPageType.PageType entryType)
 {
     return _navHelper.GetSitePageCount(siteID, entryType);
 }
コード例 #30
0
 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);
 }
コード例 #31
0
        public static PageType GetTypeByID(Guid contentTypeID)
        {
            ContentPageType _type = ContentPageTypeList.Where(t => t.ContentTypeID == contentTypeID).FirstOrDefault();

            return(GetTypeByName(_type.ContentTypeValue));
        }
コード例 #32
0
ファイル: PostComment.cs プロジェクト: sunsiz/CarrotCakeCMS
 public static int GetCommentCountBySiteAndType(Guid siteID, ContentPageType.PageType pageType, bool? approved, bool? spam)
 {
     using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) {
         return (from c in CannedQueries.GetSiteContentCommentsByPostType(_db, siteID, pageType, approved, spam)
                 select c).Count();
     }
 }
コード例 #33
0
		public int GetSitePageCount(Guid siteID, ContentPageType.PageType entryType, bool bActiveOnly) {
			return 50;
		}
コード例 #34
0
		public int GetSitePageCount(Guid siteID, ContentPageType.PageType entryType) {
			return 50;
		}
コード例 #35
0
ファイル: PostComment.cs プロジェクト: sunsiz/CarrotCakeCMS
        public static List<PostComment> GetCommentsBySitePageNumber(Guid siteID, int iPageNbr, int iPageSize, string SortBy, ContentPageType.PageType pageType, bool? approved, bool? spam)
        {
            int startRec = iPageNbr * iPageSize;
            using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) {
                IQueryable<vw_carrot_Comment> lstComments = (from c in CannedQueries.GetSiteContentCommentsByPostType(_db, siteID, pageType, approved, spam)
                                                             select c);

                return PaginateComments(lstComments, iPageNbr, iPageSize, SortBy).ToList();
            }
        }
コード例 #36
0
        internal static IQueryable<vw_carrot_Content> GetContentByStatusAndDateRange(CarrotCMSDataContext ctx, Guid siteID, ContentPageType.PageType pageType,
            DateTime dateBegin, DateTime dateEnd, bool? bActive, bool? bSiteMap, bool? bSiteNav, bool? bBlock)
        {
            Guid gContent = ContentPageType.GetIDByType(ContentPageType.PageType.ContentEntry);
            Guid gBlog = ContentPageType.GetIDByType(ContentPageType.PageType.BlogEntry);
            Guid contentTypeID = ContentPageType.GetIDByType(pageType);

            return (from ct in ctx.vw_carrot_Contents
                    orderby ct.ContentTypeValue, ct.NavMenuText
                    where ct.SiteID == siteID
                        && ct.IsLatestVersion == true
                        && ct.GoLiveDate >= dateBegin
                        && ct.GoLiveDate <= dateEnd
                        && (ct.ContentTypeID == contentTypeID || pageType == ContentPageType.PageType.Unknown)
                        && (ct.PageActive == Convert.ToBoolean(bActive) || bActive == null)
                        && (ct.BlockIndex == Convert.ToBoolean(bBlock) || bBlock == null)
                        && ((ct.ShowInSiteMap == Convert.ToBoolean(bSiteMap) && ct.ContentTypeID == gContent) || bSiteMap == null)
                        && ((ct.ShowInSiteNav == Convert.ToBoolean(bSiteNav) && ct.ContentTypeID == gContent) || bSiteNav == null)
                    select ct);
        }
コード例 #37
0
 public int GetSitePageCount(Guid siteID, ContentPageType.PageType entryType)
 {
     int iCount = CannedQueries.GetAllByTypeList(db, siteID, false, entryType).Count();
     return iCount;
 }
コード例 #38
0
ファイル: SiteData.cs プロジェクト: mjohn/CarrotCakeCMS
 public int GetSitePageCount(ContentPageType.PageType entryType)
 {
     using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) {
         int iCount = CannedQueries.GetAllByTypeList(_db, this.SiteID, false, entryType).Count();
         return iCount;
     }
 }
コード例 #39
0
		public List<ContentPage> GetPagedSortedContent(Guid siteID, ContentPageType.PageType entryType, bool bActiveOnly, int pageSize, int pageNumber, string sSortParm) {
			SortParm srt = new SortParm(sSortParm);

			IQueryable<vw_carrot_Content> query1 = CannedQueries.GetAllByTypeList(db, siteID, bActiveOnly, entryType);

			return PerformDataPagingQueryableContent(siteID, bActiveOnly, pageSize, pageNumber, srt.SortField, srt.SortDirection, query1);
		}
コード例 #40
0
        public static Guid GetIDByType(PageType contentType)
        {
            ContentPageType _type = ContentPageTypeList.Where(t => t.ContentTypeValue.ToLower() == contentType.ToString().ToLower()).FirstOrDefault();

            return(_type.ContentTypeID);
        }
コード例 #41
0
ファイル: SiteData.cs プロジェクト: mjohn/CarrotCakeCMS
        private List<SyndicationItem> GetRecentPagesOrPosts(RSSFeedInclude feedData)
        {
            List<SyndicationItem> syndRSS = new List<SyndicationItem>();
            List<SiteNav> lst = new List<SiteNav>();

            ContentPageType PageType = new ContentPageType();

            using (SiteNavHelper navHelper = new SiteNavHelper()) {
                if (feedData == RSSFeedInclude.PageOnly || feedData == RSSFeedInclude.BlogAndPages) {
                    List<SiteNav> lst1 = navHelper.GetLatest(this.SiteID, 8, true);
                    lst = lst.Union(lst1).ToList();
                    List<SiteNav> lst2 = navHelper.GetLatestUpdates(this.SiteID, 10, true);
                    lst = lst.Union(lst2).ToList();
                }
                if (feedData == RSSFeedInclude.BlogOnly || feedData == RSSFeedInclude.BlogAndPages) {
                    List<SiteNav> lst1 = navHelper.GetLatestPosts(this.SiteID, 8, true);
                    lst = lst.Union(lst1).ToList();
                    List<SiteNav> lst2 = navHelper.GetLatestPostUpdates(this.SiteID, 10, true);
                    lst = lst.Union(lst2).ToList();
                }
            }

            lst.RemoveAll(x => x.ShowInSiteMap == false && x.ContentType == ContentPageType.PageType.ContentEntry);
            lst.RemoveAll(x => x.BlockIndex == true);

            foreach (SiteNav sn in lst) {
                SyndicationItem si = new SyndicationItem();

                string sPageURI = RemoveDupeSlashesURL(this.ConstructedCanonicalURL(sn));

                Uri PageURI = new Uri(sPageURI);

                si.Content = new TextSyndicationContent(sn.PageTextPlainSummaryMedium);
                si.Title = new TextSyndicationContent(sn.NavMenuText);
                si.Links.Add(SyndicationLink.CreateSelfLink(PageURI));
                si.AddPermalink(PageURI);

                si.LastUpdatedTime = sn.EditDate;
                si.PublishDate = sn.CreateDate;

                syndRSS.Add(si);
            }

            return syndRSS.OrderByDescending(p => p.PublishDate).ToList();
        }
コード例 #42
0
        public List<ContentPage> GetContentByDateRange(Guid siteID, DateTime dateMidpoint, int iDayRange, ContentPageType.PageType pageType, bool? bActive, bool? bSiteMap, bool? bSiteNav, bool? bBlock)
        {
            //assiging SQL min dates because of 1753 vs 0001 year issues
            DateTime dateBegin = (DateTime)System.Data.SqlTypes.SqlDateTime.MinValue; //DateTime.MinValue;
            DateTime dateEnd = (DateTime)System.Data.SqlTypes.SqlDateTime.MaxValue; //DateTime.MaxValue;

            if (iDayRange > 0) {
                dateBegin = dateMidpoint.AddDays(0 - iDayRange);
                dateEnd = dateMidpoint.AddDays(iDayRange);
            }

            List<ContentPage> lstContent = CannedQueries.GetContentByStatusAndDateRange(db, siteID, pageType, dateBegin, dateEnd, bActive, bSiteMap, bSiteNav, bBlock).Select(ct => new ContentPage(ct)).ToList();

            return lstContent;
        }
コード例 #43
0
 public List<ContentPage> GetLatestContentPagedList(Guid siteID, ContentPageType.PageType postType, bool bActiveOnly, int pageNumber, string sortField, string sortDir)
 {
     return GetLatestContentPagedList(siteID, postType, bActiveOnly, 10, pageNumber, sortField, sortDir);
 }
コード例 #44
0
ファイル: SiteNavHelper.cs プロジェクト: mjohn/CarrotCakeCMS
 public int GetSitePageCount(Guid siteID, ContentPageType.PageType entryType, bool bActiveOnly)
 {
     return _navHelper.GetSitePageCount(siteID, entryType, bActiveOnly);
 }
コード例 #45
0
 public List<ContentPage> GetLatestContentPagedList(Guid siteID, ContentPageType.PageType postType, bool bActiveOnly, int pageSize, int pageNumber)
 {
     return GetLatestContentPagedList(siteID, postType, bActiveOnly, pageSize, pageNumber, "", "");
 }
コード例 #46
0
ファイル: SiteNavHelper.cs プロジェクト: mjohn/CarrotCakeCMS
 public List<SiteNav> GetLatestContentPagedList(Guid siteID, ContentPageType.PageType postType, bool bActiveOnly, int pageSize, int pageNumber)
 {
     return _navHelper.GetLatestContentPagedList(siteID, postType, bActiveOnly, pageSize, pageNumber);
 }
コード例 #47
0
        public List<ContentPage> 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);
        }
コード例 #48
0
		public List<SiteNav> GetLatestContentPagedList(Guid siteID, ContentPageType.PageType postType, bool bActiveOnly, int pageNumber) {
			return SiteNavHelper.GetSamplerFakeNav(10);
		}
コード例 #49
0
 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);
 }
コード例 #50
0
		public List<SiteNav> GetLatestContentPagedList(Guid siteID, ContentPageType.PageType postType, bool bActiveOnly, int pageSize, int pageNumber, string sortField, string sortDir) {
			return SiteNavHelper.GetSamplerFakeNav(pageSize);
		}
コード例 #51
0
		public static int GetCommentCountBySiteAndType(Guid siteID, ContentPageType.PageType pageType) {
			using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) {
				return (from c in CannedQueries.GetSiteContentCommentsByPostType(_db, siteID, pageType)
						select c).Count();
			}
		}