Carrotware.CMS.Core.CannedQueries.GetAllRootTbl C# (CSharp) Method

GetAllRootTbl() static private method

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

Usage Example

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();
        }
All Usage Examples Of Carrotware.CMS.Core.CannedQueries::GetAllRootTbl