/// <summary> /// Gets Debate Id, Score1, and Score2 from the DropDownBoxes and updates the debate with the correct Id. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { int DebateID = Int32.Parse(DropDownList3.SelectedValue); int Score1 = Int32.Parse(DropDownList1.SelectedValue); int Score2 = Int32.Parse(DropDownList2.SelectedValue); Debate debate = DatabaseHandler.GetDebate(DebateID); debate.Team1Score = Score1; debate.Team2Score = Score2; DatabaseHandler.UpdateDebate(Session, debate); }
protected void UpdateButton_Click(object sender, EventArgs e) { User loggedUser = Help.GetUserSession(Session); for (int rowNum = 1; rowNum < Table1.Rows.Count; rowNum++) //Starts at row 1 since row 0 is header row. { int id; bool success = int.TryParse(Table1.Rows[rowNum].Cells[7].Text, NumberStyles.Any, CultureInfo.InvariantCulture, out id); Debate debate = DatabaseHandler.GetDebate(id); DropDownList TeamScore1Control = Table1.Rows[rowNum].Cells[3].FindControl("ddl" + rowNum) as DropDownList; DropDownList TeamScore2Control = Table1.Rows[rowNum].Cells[4].FindControl("ddl#" + rowNum) as DropDownList; debate.Team1Score = Int32.Parse(TeamScore1Control.SelectedValue); debate.Team2Score = Int32.Parse(TeamScore2Control.SelectedValue); bool result = DatabaseHandler.UpdateDebate(Session, debate); } if (loggedUser.PermissionLevel == 2) { Response.Redirect(Request.RawUrl); } else { //Do nothing because you should be the Super. } }