public static WeightedTagList AddUserStoryTags(string tagString, User user, int storyID, int hostID) { WeightedTagList tags = GetOrInsertTags(tagString, user.IsAdministrator); StoryUserHostTagCollection storyUserHostTags = new StoryUserHostTagCollection(); foreach (WeightedTag tag in tags) { StoryUserHostTag storyUserHostTag = new StoryUserHostTag(); //TODO: GJ: move to WeightedTag.ToStoryUserHostTag() storyUserHostTag.StoryID = storyID; storyUserHostTag.HostID = hostID; storyUserHostTag.UserID = user.UserID; storyUserHostTag.TagID = tag.TagID; storyUserHostTags.Add(storyUserHostTag); StoryCache.ClearUserTaggedStories(tag.TagName, user.UserID, storyID); } storyUserHostTags.BatchSave(); UserAction.RecordTag(hostID, user, Story.FetchByID(storyID), tags); //when a user adds a tag, we need to mark the story as updated //so update the index during the incremental crawl Story story = Story.FetchByID(storyID); story.UpdatedOn = DateTime.Now; story.Save(); return(tags); }
protected void Page_Load(object sender, EventArgs e) { this.RenderRssChannel(StoryDataTableToRss.ConvertToRssChannel( StoryCache.GetUserKickedStories(this.UrlParameters.UserIdentifier, this.HostProfile.HostID, 1, 25), this.HostProfile.SiteTitle + " : Stories kicked by " + this.UrlParameters.UserIdentifier, "Stories kicked by " + this.UrlParameters.UserIdentifier, this.HostProfile.RootUrl + "/", this.HostProfile)); }
protected void Page_Load(object sender, EventArgs e) { this.RenderRssChannel(StoryDataTableToRss.ConvertToRssChannel( StoryCache.GetCategoryStories(this.UrlParameters.CategoryID, false, this.HostProfile.HostID, 1, 25), this.HostProfile.SiteTitle + " - new " + this.UrlParameters.CategoryIdentifier + " stories", "the newest " + this.UrlParameters.CategoryIdentifier + " stories from " + this.HostProfile.SiteTitle, this.HostProfile.RootUrl + "/", this.HostProfile)); }
IEnumerable <IProcessor> _GetProcessors(Story story) { var runner = TestRunner.ConstructFor(story); if (runner != null) { yield return(runner); } var consoleReporter = ConsoleReport.ConstructFor(story); if (consoleReporter != null) { yield return(consoleReporter); } yield return(new ExceptionProcessor()); var storyCache = StoryCache.ConstructFor(story); if (storyCache != null) { yield return(storyCache); } yield return(new Disposer()); foreach (var addedProcessor in _addedProcessors) { yield return(addedProcessor()); } }
protected void Page_Load(object sender, EventArgs e) { this.RenderRssChannel(StoryDataTableToRss.ConvertToRssChannel( StoryCache.GetTaggedStories(this.UrlParameters.TagIdentifier, this.HostProfile.HostID, 1, 25), this.HostProfile.SiteTitle + " - Stories tagged with " + this.UrlParameters.TagIdentifier, "the latest stories tagged with '" + this.UrlParameters.TagIdentifier + "' from " + this.HostProfile.SiteTitle, this.HostProfile.RootUrl + "/", this.HostProfile)); }
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; } }
protected void Page_Load(object sender, EventArgs e) { this.StoryList.DataBind(StoryCache.GetTaggedStories(this.UrlParameters.TagIdentifier, this.HostProfile.HostID, this.UrlParameters.PageNumber, this.UrlParameters.PageSize)); this.Paging.RecordCount = StoryCache.GetTaggedStoryCount(this.UrlParameters.TagIdentifier, this.HostProfile.HostID); this.Paging.PageNumber = UrlParameters.PageNumber; this.Paging.PageSize = UrlParameters.PageSize; this.Paging.BaseUrl = UrlFactory.CreateUrl(UrlFactory.PageName.ViewTag, HttpUtility.UrlEncode(this.UrlParameters.TagIdentifier)); }
protected void Page_Load(object sender, EventArgs e) { this.StoryList.DataBind(StoryCache.GetCategoryStories(this.UrlParameters.CategoryID, true, this.HostProfile.HostID, this.UrlParameters.PageNumber, this.UrlParameters.PageSize)); this.Paging.RecordCount = StoryCache.GetCategoryStoryCount(this.UrlParameters.CategoryID, true, this.HostProfile.HostID); this.Paging.PageNumber = UrlParameters.PageNumber; this.Paging.PageSize = UrlParameters.PageSize; this.Paging.BaseUrl = UrlFactory.CreateUrl(UrlFactory.PageName.ViewCategory, this.UrlParameters.CategoryIdentifier); }
protected void Page_Load(object sender, EventArgs e) { //TODO: config this.RenderRssChannel(StoryDataTableToRss.ConvertToRssChannel( StoryCache.GetCategoryStories(this.UrlParameters.CategoryID, true, this.HostProfile.HostID, 1, 25), this.HostProfile.SiteTitle + " - published " + this.UrlParameters.CategoryIdentifier + " stories", "the latest published " + this.UrlParameters.CategoryIdentifier + " stories from " + this.HostProfile.SiteTitle, this.HostProfile.RootUrl + "/", this.HostProfile)); }
protected void Page_Load(object sender, EventArgs e) { //TODO: config this.RenderRssChannel(StoryDataTableToRss.ConvertToRssChannel( StoryCache.GetAllStories(false, this.HostProfile.HostID, 1, 25), this.HostProfile.SiteTitle + " - new stories", "the latest stories from " + this.HostProfile.SiteTitle, this.HostProfile.RootUrl + "/", this.HostProfile)); }
public static ApiPagedList <ApiStory> GetUpcomingPageStories(int hostID, int pageNumber, int pageSize) { ApplyPageLimits(ref pageNumber, ref pageSize); PagedStoryCollection pagedCollection = new PagedStoryCollection(); pagedCollection.Items = StoryCache.GetAllStories(false, hostID, pageNumber, pageSize); pagedCollection.Total = StoryCache.GetStoryCount(hostID, false); return(pagedCollection.ToApi()); }
public static ApiPagedList <ApiStory> GetUserFriendsKickedStories(int hostID, string username, int pageNumber, int pageSize) { ApplyPageLimits(ref pageNumber, ref pageSize); PagedStoryCollection pagedCollection = new PagedStoryCollection(); pagedCollection.Items = StoryCache.GetFriendsKickedStories(username, hostID, pageNumber, pageSize); pagedCollection.Total = StoryCache.GetFriendsKickedStoriesCount(username, hostID); return(pagedCollection.ToApi()); }
public static ApiPagedList <ApiStory> GetTaggedStories(int hostID, string tag, int pageNumber, int pageSize) { ApplyPageLimits(ref pageNumber, ref pageSize); PagedStoryCollection pagedCollection = new PagedStoryCollection(); pagedCollection.Items = StoryCache.GetTaggedStories(tag, hostID, pageNumber, pageSize); pagedCollection.Total = StoryCache.GetTaggedStoryCount(tag, hostID); return(pagedCollection.ToApi()); }
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()); }
protected void Page_Load(object sender, EventArgs e) { this.UserProfileHeader.User = this.UserProfile; this.StoryListControl.NoStoriesCaption = string.Format("{0} has not kicked any stories.", this.UrlParameters.UserIdentifier); this.StoryListControl.Title = "Stories kicked by " + this.UrlParameters.UserIdentifier; this.StoryListControl.DataBind(StoryCache.GetUserKickedStories(this.UrlParameters.UserIdentifier, this.HostProfile.HostID, this.UrlParameters.PageNumber, this.UrlParameters.PageSize)); this.Paging.RecordCount = StoryCache.GetUserKickedStoriesCount(this.UrlParameters.UserIdentifier, this.HostProfile.HostID); this.Paging.PageNumber = UrlParameters.PageNumber; this.Paging.PageSize = UrlParameters.PageSize; this.Paging.BaseUrl = UrlFactory.CreateUrl(this.PageName, this.UrlParameters.UserIdentifier); }
protected void Page_Load(object sender, EventArgs e) { //TODO Will need to modify the Comment & CommentList web controls to show related story this.UserProfileHeader.User = this.UserProfile; Incremental.Kick.Dal.CommentCollection commentTable = StoryCache.GetUserComments(this.UrlParameters.UserIdentifier, this.HostProfile.HostID, this.UrlParameters.PageNumber, this.UrlParameters.PageSize); this.CommentList.DisplayStoryTitle = true; this.CommentList.DataBind(commentTable); this.Paging.RecordCount = StoryCache.GetUserCommentsCount(this.UrlParameters.UserIdentifier, this.HostProfile.HostID); this.Paging.PageNumber = UrlParameters.PageNumber; this.Paging.PageSize = UrlParameters.PageSize; this.Paging.BaseUrl = UrlFactory.CreateUrl(this.PageName, this.UrlParameters.UserIdentifier); }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.HostProfile.FeedBurnerMainRssFeedUrl) || Request.QueryString["Redirect"] == "0") { this.RenderRssChannel(StoryDataTableToRss.ConvertToRssChannel( StoryCache.GetAllStories(true, this.HostProfile.HostID, 1, 25), this.HostProfile.SiteTitle, "the latest published stories from " + this.HostProfile.SiteTitle, this.HostProfile.RootUrl + "/", this.HostProfile)); } else { Response.Redirect(this.HostProfile.FeedBurnerMainRssFeedUrl); } }
protected void Page_Load(object sender, EventArgs e) { this.UserProfileHeader.User = this.UserProfile; this.StoryListControl.NoStoriesCaption = string.Format("Friends of {0} have not submitted any stories.", this.UrlParameters.UserIdentifier); this.StoryListControl.Title = "Stories submitted by friends of " + this.UrlParameters.UserIdentifier; if (!this.UserProfile.Friends.Count.Equals(0)) { this.StoryListControl.DataBind(StoryCache.GetFriendsSubmittedStories(this.UrlParameters.UserIdentifier, this.HostProfile.HostID, this.UrlParameters.PageNumber, this.UrlParameters.PageSize)); this.Paging.RecordCount = StoryCache.GetFriendsSubmittedStoriesCount(this.UrlParameters.UserIdentifier, this.HostProfile.HostID); } this.Paging.PageNumber = UrlParameters.PageNumber; this.Paging.PageSize = UrlParameters.PageSize; this.Paging.BaseUrl = UrlFactory.CreateUrl(this.PageName, this.UrlParameters.UserIdentifier); }
protected void AddComment_Click(object sender, EventArgs e) { if (!Page.IsValid) { return; } string comment = TextHelper.EncodeAndReplaceComment(Comment.Text); int commentID = Dal.Comment.CreateComment(KickPage.HostProfile.HostID, _storyID, KickPage.KickUserProfile, comment); //now clear the cache for this story (NOTE: in the future, we can just update the cache too) StoryCache.RemoveStory(_storyID, KickPage.UrlParameters.StoryIdentifier); Response.Redirect( UrlFactory.CreateUrl(UrlFactory.PageName.ViewStory, KickPage.UrlParameters.StoryIdentifier, KickPage.UrlParameters.CategoryIdentifier, commentID)); }
protected void Page_Load(object sender, EventArgs e) { Dal.Story story = StoryCache.GetStory(UrlParameters.StoryIdentifier, HostProfile.HostID); if (story == null || story.IsSpam && !this.KickUserProfile.IsModerator) { Response.Redirect("/missingstory"); } Title = story.Title; Caption = ""; UsersWhoKicked.DataBind(story.UsersWhoKicked); StorySummary.DataBind(story); StorySummary.ShowMoreLink = false; StorySummary.ShowGetKickImageCodeLink = true; CommentList.DataBind(StoryCache.GetComments(story.StoryID)); AddComment.DataBind(story.StoryID); DisplayAds = true; KickMenu.DisplayAds = true; KickMenu.DisplayCategories = false; KickMenu.DisplayWhatElse = false; KickItImagePersonalization.StoryUrl = story.Url; if (!String.IsNullOrEmpty(story.AdsenseID)) { if (KickUserProfile.UserID != story.UserID) { //flick a coin if (ThreadSafeRandom.FlickCoin()) { System.Diagnostics.Debug.WriteLine("Showing author ads " + story.AdsenseID); AdSenseID = story.AdsenseID; } } } //related stories control RelatedStories.DataBind(SimilarStoriesCache.GetSimilarStoryCollection(this.HostProfile.HostID, story.StoryID)); }
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)) }
protected void Page_Load(object sender, EventArgs e) { this.Paging.PageNumber = UrlParameters.PageNumber; this.Paging.PageSize = UrlParameters.PageSize; if (this.UrlParameters.StoryListSortBy == Incremental.Kick.Common.Enums.StoryListSortBy.RecentlyPromoted) { this.UrlParameters.StoryListSortBy = Incremental.Kick.Common.Enums.StoryListSortBy.LatestUpcoming; } if (!this.UrlParameters.CategoryIdentifierSpecified) { this.StoryList.DataBind(StoryCache.GetAllStories(false, this.HostProfile.HostID, this.UrlParameters.PageNumber, this.UrlParameters.PageSize)); this.Paging.RecordCount = StoryCache.GetStoryCount(this.HostProfile.HostID, false); this.Paging.BaseUrl = UrlFactory.CreateUrl(UrlFactory.PageName.Home) + "/upcoming"; } 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); } }
protected void Page_Load(object sender, EventArgs e) { Incremental.Kick.Dal.Story story = StoryCache.GetStory(this.UrlParameters.StoryIdentifier, this.HostProfile.HostID); System.Diagnostics.Trace.WriteLine("Redirecting to " + story.Url); this.Response.Redirect(story.Url); }