protected void Page_Load(object sender, EventArgs e) { //TODO: GJ: decode url string url = Request["url"].Trim(); string title = Request["title"]; if (String.IsNullOrEmpty(title)) { title = ""; } title = title.Trim(); //TODO: GJ: we could improve performance here (better story cache) Incremental.Kick.Dal.Story story = Incremental.Kick.Dal.Story.FetchStoryByUrl(url); if (story == null) { this.Response.Redirect("~/submit/?url=" + HttpUtility.UrlEncode(url) + "&title=" + HttpUtility.UrlEncode(title)); } else { //TODO: GJ: should we auto kick??? this.Response.Redirect(UrlFactory.CreateUrl(UrlFactory.PageName.ViewStory, story.StoryIdentifier, CategoryCache.GetCategory(story.CategoryID, this.HostProfile.HostID).CategoryIdentifier)); } }
protected void UpdateStoryKickCounts_Click(object sender, EventArgs e) { //NOTE: GJ: a little hackery here - kicks are currently not under a transaction so when something goes wrong, the kick count can get out of sync. //Iterate thru each story and update its kick count based on the number of kicks it has received IDataReader dataReader = Incremental.Kick.Dal.Story.FetchAll(); while (dataReader.Read()) { int storyID = dataReader.GetInt32(0); Incremental.Kick.Dal.Story story = Incremental.Kick.Dal.Story.FetchByID(storyID); System.Diagnostics.Trace.WriteLine(String.Format("Updading {0} to {1}", story.KickCount, story.StoryKickRecords().Count)); story.KickCount = story.StoryKickRecords().Count; story.Save(); } }
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); }