GetAllRootTbl() static private method

static private GetAllRootTbl ( CarrotCMSDataContext ctx, Guid siteID ) : IQueryable
ctx CarrotCMSDataContext
siteID Guid
return IQueryable
Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
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();
        }