private void button_Accept_Click(object sender, EventArgs e) { if (Convert.ToInt32(textBox_grade.Text) < 0 || Convert.ToInt32(textBox_grade.Text) > 100) { MessageBox.Show("Invalid grade"); } else if (SQLFunctions.isStudentGraded(Convert.ToInt32(textBox1.Text), SQLFunctions.covertCourseNametoCourseID(comboBox_CourseList.Text)) == true) { SQLFunctions.updateGradeToStudent(Convert.ToInt32(textBox1.Text), SQLFunctions.covertCourseNametoCourseID(comboBox_CourseList.Text), Convert.ToInt32(textBox_grade.Text)); MessageBox.Show("Student with the ID " + textBox1.Text + " old grade was override, with the grade " + textBox_grade.Text + " in course " + comboBox_CourseList.Text); this.Hide(); FormMenuExamDepartment examDepartment = new FormMenuExamDepartment(); examDepartment.Show(); } else { SQLFunctions.addGradeToStudent(Convert.ToInt32(textBox1.Text), SQLFunctions.covertCourseNametoCourseID(comboBox_CourseList.Text), Convert.ToInt32(textBox_grade.Text)); MessageBox.Show("Student with the ID " + textBox1.Text + " was graded " + textBox_grade.Text + " in course " + comboBox_CourseList.Text); this.Hide(); FormMenuExamDepartment examDepartment = new FormMenuExamDepartment(); examDepartment.Show(); } }