/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { var query = this.GetService<UrlProvider>().GetQuery(); this.Id = Convert.ToInt32(query[0]); var comments = new HoodComments(Convert.ToInt32(Id)); var details = this.GetCore<HoodData>().GetHoodDetails(Convert.ToInt32(Id)); this.CurrentHoodBox.Hood = details; this.CurrentHoodBox.BindDataSource(); this.HoodPager.Repeater = this.HoodCommentsRepeater; this.HoodPager.Dt = comments.GetHoodComments(); this.HoodPager.PerPage = 20; this.IntializeEditor(this.CurrentHoodBox.Hood); if (query.Count > 1) { if (query[1] == "join" && !details.IsPublic && details.Users.All(x => x.UserId != this.PageContext.PageUserID)) { if (this.GetCore<HoodData>() .GetInvitedUsers(this.Id) .Any(x => x.Equals(this.PageContext.PageUserID))) { //was able to join this.GetCore<HoodData>().AddUserToHood(this.Id, this.PageContext.PageUserID); } } } }
/// <summary> /// Handles the Click event of the PostComment control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param> protected void PostComment_Click(object sender, EventArgs e) { if (this.PostEdit.ValidPost()) { var comments = new HoodComments(this.Id); comments.PostComment(this.PageContext.PageUserID, this.PostEdit.Editor.Text); this.AddLoadMessageSession(this.Text("COMMON", "COMMENT_POSTED")); this.GetService<UrlProvider>().RefreshPage(); } }