public void ViewFirstPlaceTextBox() { string firstPlace = ""; Student firstPlacestu = Student.sortByRating()[0]; FirstPlace.Text = "First Place:" + " " + firstPlacestu.getRating().ToString(); firstPlace = firstPlacestu.getFullName() + " Group Number: " + firstPlacestu.getStudentGroup().getId().ToString(); FirstPlaceTextBox.Text = firstPlace; }
public void ViewSecondPlaceTextBox() { string secondPlace = ""; Student secondPlacestu = Student.sortByRating()[1]; SecondPlace.Text = "Second Place:" + " " + secondPlacestu.getRating().ToString(); secondPlace = secondPlacestu.getFullName() + " Group Number: " + secondPlacestu.getStudentGroup().getId().ToString(); SecondPlaceTextBox.Text = secondPlace; }
public void ViewThirdPlaceTextBox() { string thirdPlace = ""; Student thirdPlaceStu = Student.sortByRating()[2]; ThirdPlace.Text = "Third Place:" + " " + thirdPlaceStu.getRating().ToString(); thirdPlace = thirdPlaceStu.getFullName() + " Group Number: " + thirdPlaceStu.getStudentGroup().getId().ToString(); ThirdPlaceTextBox.Text = thirdPlace; }
public static void Update_Student_Rating_In_DB(Student s) { SqlCommand c = new SqlCommand(); c.CommandText = "EXECUTE dbo.SP_Update_Student_Rating @ID, @Rating "; c.Parameters.AddWithValue("@ID", s.getId()); c.Parameters.AddWithValue("@Rating", s.getRating()); SQL_CON SC = new SQL_CON(); SC.execute_non_query(c); }
private void button1_Click(object sender, EventArgs e) { for (int rows = 0; rows < ratingReportTable.Rows.Count; rows++) { if (ratingReportTable.Rows[rows].Cells[3].Value != null) { try { int newRating = int.Parse(ratingReportTable.Rows[rows].Cells[3].Value.ToString()); Student s = Program.getStudentObject(ratingReportTable.Rows[rows].Cells[0].Value.ToString()); Console.WriteLine(s.getRating() + newRating); s.setRating(newRating); Program.Update_Student_Rating_In_DB(s); this.Hide(); } catch (Exception ex) { MessageBox.Show("The input must be a number", "Invalid Input", MessageBoxButtons.OK); } } } }