Beispiel #1
0
        public IPageOfItems <ScheduleItem> GetScheduleItems(Event evnt, ScheduleItemFilterCriteria scheduleItemFilterCriteria)
        {
            int pageIndex = 0;
            int pageSize  = 50;

            if (context.RequestDataFormat == RequestDataFormat.Web)
            {
                pageIndex = scheduleItemFilterCriteria.PageIndex;
                pageSize  = scheduleItemFilterCriteria.PageSize;
            }

            IPageOfItems <ScheduleItem> scheduleItems =
                cache.GetItems <IPageOfItems <ScheduleItem>, ScheduleItem>(
                    string.Format("GetScheduleItems-FilterCriteria:{0}", scheduleItemFilterCriteria),
                    new CachePartition(pageIndex, pageSize),
                    () => repository.GetScheduleItems(new PagingInfo(pageIndex, pageSize), evnt, context.User.IsAuthenticated && context.User.Cast <User>() != null ? context.User.Cast <User>().ID : Guid.Empty, scheduleItemFilterCriteria).FillTags(tagService),
                    si => si.GetDependencies()
                    );

            if (context.RequestDataFormat.IsFeed())
            {
                scheduleItems = scheduleItems.Since(si => si.Modified, context.HttpContext.Request.IfModifiedSince());
            }

            return(scheduleItems);
        }
Beispiel #2
0
        public IPageOfItems <Post> GetPosts(PagingInfo pagingInfo, Blog blog)
        {
            IPageOfItems <Post> posts =
                cache.GetItems <IPageOfItems <Post>, Post>(
                    string.Format("GetPosts-{0}", blog.GetCacheItemKey()),
                    pagingInfo.ToCachePartition(),
                    () => pluginEngine.ProcessDisplayOfPosts(context, () => repository.GetPosts(pagingInfo, blog).FillTags(tagService).FillComments(commentService)),
                    p => p.GetDependencies()
                    );

            if (context.RequestDataFormat.IsFeed())
            {
                posts = posts.Since(p => p.Published.Value, context.HttpContext.Request.IfModifiedSince());
            }

            return(posts);
        }
Beispiel #3
0
        public IPageOfItems <Post> GetPosts(int pageIndex, int pageSize, BlogAddress blogAddress)
        {
            IPageOfItems <Post> posts =
                cache.GetItems <IPageOfItems <Post>, Post>(
                    string.Format("GetPosts-Blog:{0}", blogAddress.BlogName),
                    new CachePartition(pageIndex, pageSize),
                    () => pluginEngine.ProcessDisplayOfPosts(context, () => repository.GetPostsByBlog(context.Site.ID, blogAddress.BlogName).GetPage(pageIndex, pageSize).FillTags(tagService).FillComments(commentService)),
                    p => p.GetDependencies()
                    );

            if (context.RequestDataFormat.IsFeed())
            {
                posts = posts.Since(p => p.Published.Value, context.HttpContext.Request.IfModifiedSince());
            }

            return(posts);
        }
Beispiel #4
0
        public IPageOfItems <Post> GetPosts(PagingInfo pagingInfo)
        {
            bool includeDrafts        = context.RequestDataFormat == RequestDataFormat.Web && context.User.IsAuthenticated && context.User.IsInRole("Admin");
            IPageOfItems <Post> posts =
                cache.GetItems <IPageOfItems <Post>, Post>(
                    string.Format("GetPosts-IncludeDrafts:{0}", includeDrafts),
                    pagingInfo.ToCachePartition(),
                    () => pluginEngine.ProcessDisplayOfPosts(context, () => repository.GetPosts(pagingInfo, includeDrafts).FillTags(tagService).FillComments(commentService)),
                    p => p.GetDependencies()
                    );

            if (!includeDrafts)
            {
                posts = posts.Since(p => p.Published.Value, context.HttpContext.Request.IfModifiedSince());
            }

            return(posts);
        }