protected void GridViewThreads_DataBound(object sender, EventArgs e) { GridView gridTemp = new GridView(); gridTemp.DataSource = this.SqlDataSourceThreads; gridTemp.DataBind(); for (int i = 0; i < this.GridViewThreads.Rows.Count; i++) { //Assigns thread names to linkButtons. ((LinkButton)this.GridViewThreads.Rows[i].Cells[0].FindControl("LinkButtonThread")).Text = gridTemp.Rows[i].Cells[0].Text; //GridView gridReplies = new GridView(); string selectQuery = "SELECT * FROM [Post] WHERE (Category = '" + Session["Category"].ToString() + "' AND TopicTitle = '" + Session["Topic"] + "' AND ThreadNumber = " + gridTemp.Rows[i].Cells[2].Text + ")"; GridView gridReplies = GlobalFunctions.Instance().getGridView(selectQuery); //Update number of replies in each thread. this.GridViewThreads.Rows[i].Cells[1].Text = Convert.ToString(gridReplies.Rows.Count); } }
protected void LinkButtonSignOut_Click(object sender, EventArgs e) { GlobalFunctions.Instance().signOut(this.LinkButtonAccount, this.LinkButtonRegister, this.LinkButtonSignIn, this.LinkButtonSignOut); }
protected void Page_Load(object sender, EventArgs e) { GlobalFunctions.Instance().showControllers(this.LinkButtonAccount, this.LinkButtonRegister, this.LinkButtonSignIn, this.LinkButtonSignOut); }
protected void CustomValidatorEmail_ServerValidate(object source, ServerValidateEventArgs args) { GlobalFunctions.Instance().CustomValidatorEmail(args); }
protected void Page_Load(object sender, EventArgs e) { GlobalFunctions.Instance().showControllers(this.LinkButtonAccount, this.LinkButtonRegister, this.LinkButtonSignIn, this.LinkButtonSignOut); this.LinkButtonAccount.Visible = false; if (Session["APUserName"] == null) { Response.Redirect("AccessDeniedPage.aspx"); } if (Session["UserName"] == null) { Session["UserName"] = ""; } //Don't allow to change information if entering another user's account page. if (!Session["APUserName"].ToString().Equals(Session["UserName"].ToString())) { this.LinkButtonUploadFile.Visible = false; this.LinkButtonChangeMail.Visible = false; this.LinkButtonChangePassword.Visible = false; this.LinkButtonInbox.Visible = false; this.LinkButtonOutbox.Visible = false; //Don't allow guests to send PMs. if ((USERTYPE)Session["UserType"] == USERTYPE.GUEST) { this.LinkButtonShowPMDialog.Visible = false; } //Enable admin to delete other users. if ((USERTYPE)Session["UserType"] == USERTYPE.ADMIN) { this.ButtonDeleteUser.Visible = true; } } //Print message if needed. GlobalFunctions.Instance().showMessage(); //Get all user's information. GridView gridUser = new GridView(); gridUser.DataSource = this.SqlDataSourceUsers; gridUser.DataBind(); GridView gridPosts = new GridView(); gridPosts.DataSource = this.SqlDataSourcePosts; gridPosts.DataBind(); //Update controllers. this.LabelAccountName.Text = Session["APUserName"].ToString(); this.LabelJoinedIn.Text = gridUser.Rows[0].Cells[3].Text.ToString(); this.LabelPosts.Text = Convert.ToString(gridPosts.Rows.Count); this.LabelEmail.Text = gridUser.Rows[0].Cells[4].Text.ToString(); this.ImageAvatar.ImageUrl = gridUser.Rows[0].Cells[6].Text.ToString(); if (this.ImageAvatar.ImageUrl.StartsWith("&")) { this.ImageAvatar.Visible = false; } this.LabelThreadsUserName.Text = Session["APUserName"].ToString(); }