Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Paging.PageNumber = UrlParameters.PageNumber;
            this.Paging.PageSize   = UrlParameters.PageSize;

            if (!this.UrlParameters.CategoryIdentifierSpecified)
            {
                this.StoryList.DataBind(StoryCache.GetPopularStories(this.HostProfile.HostID, false, this.UrlParameters.StoryListSortBy, this.UrlParameters.PageNumber, this.UrlParameters.PageSize));
                this.Paging.RecordCount = StoryCache.GetPopularStoriesCount(this.HostProfile.HostID, false, this.UrlParameters.StoryListSortBy);
                this.Paging.BaseUrl     = UrlFactory.CreateUrl(UrlFactory.PageName.Home) + "/upcoming/popular/" + this.UrlParameters.StoryListSortBy.ToString().ToLower();
            }
            else
            {
                this.StoryList.DataBind(StoryCache.GetCategoryStories(this.UrlParameters.CategoryID, false, this.HostProfile.HostID, this.UrlParameters.PageNumber, this.UrlParameters.PageSize));
                this.Paging.RecordCount = StoryCache.GetCategoryStoryCount(this.UrlParameters.CategoryID, false, this.HostProfile.HostID);
                this.Paging.BaseUrl     = UrlFactory.CreateUrl(UrlFactory.PageName.ViewCategoryNewStories, this.UrlParameters.CategoryIdentifier);
            }

            switch (this.UrlParameters.StoryListSortBy)
            {
            case StoryListSortBy.Today:
                this.PageName = UrlFactory.PageName.UpcomingToday;
                break;

            case StoryListSortBy.PastWeek:
                this.PageName = UrlFactory.PageName.UpcomingWeek;
                break;

            default:
                this.PageName = UrlFactory.PageName.NewStories;
                break;
            }
        }
Exemplo n.º 2
0
            public static ApiPagedList <ApiStory> GetUpcomingStoriesPagedAndSorted(int hostID, int pageNumber, int pageSize, StoryListSortBy timePeriod)
            {
                ApplyPageLimits(ref pageNumber, ref pageSize);
                PagedStoryCollection pagedCollection = new PagedStoryCollection();

                pagedCollection.Items = StoryCache.GetPopularStories(hostID, false, timePeriod, pageNumber, pageSize);
                pagedCollection.Total = StoryCache.GetPopularStoriesCount(hostID, false, timePeriod);
                return(pagedCollection.ToApi());
            }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            switch (this.UrlParameters.StoryListSortBy)
            {
            case StoryListSortBy.RecentlyPromoted:
                this.PopularStoryNavigator.DataBind(StoryCache.GetAllStories(true, this.HostProfile.HostID, this.UrlParameters.PageNumber, this.UrlParameters.PageSize), StoryCache.GetStoryCount(this.HostProfile.HostID, true));
                break;

            default:
                this.PopularStoryNavigator.DataBind(StoryCache.GetPopularStories(this.HostProfile.HostID, true, this.UrlParameters.StoryListSortBy, this.UrlParameters.PageNumber, this.UrlParameters.PageSize), StoryCache.GetPopularStoriesCount(this.HostProfile.HostID, true, this.UrlParameters.StoryListSortBy));
                break;
            }

            switch (this.UrlParameters.StoryListSortBy)
            {
            case StoryListSortBy.Today:
                this.PageName = UrlFactory.PageName.PopularToday;
                break;

            case StoryListSortBy.PastWeek:
                this.PageName = UrlFactory.PageName.PopularWeek;
                break;

            case StoryListSortBy.PastTenDays:
                this.PageName = UrlFactory.PageName.PopularTenDays;
                break;

            case StoryListSortBy.PastMonth:
                this.PageName = UrlFactory.PageName.PopularMonth;
                break;

            case StoryListSortBy.PastYear:
                this.PageName = UrlFactory.PageName.PopularYear;
                break;
            }

            //this.SubCaption = String.Format(@"<a href=""{0}"" class=""highlight"">View {1} >></a>", UrlFactory.CreateUrl(UrlFactory.PageName.NewStories), Strings.Pluralize(StoryCache.GetUpcomingStoryCount(this.HostProfile), "upcoming stories"));
            this.SubCaption = String.Format(@"<a href=""{0}"" class=""highlight"">View {1} >></a>", UrlFactory.CreateUrl(UrlFactory.PageName.NewStories), String.Format("{0:#,###}", StoryCache.GetUpcomingStoryCount(this.HostProfile)) + " upcoming stories");
            //String.Format("{0:#,###}", StoryCache.GetUpcomingStoryCount(this.HostProfile))
        }