private void button_confirm_Click(object sender, EventArgs e) { if (checkBox_grade.Checked == false && checkBox_test.Checked == false) { MessageBox.Show("You have to pick type of request"); return; } DbContextDal dal = new DbContextDal(); Enrollment studentCourse = dal.Enrollments.Where(x => x.CourseId == currentCourse.ID && x.StudentId == student.ID).FirstOrDefault(); if (checkBox_grade.Checked == true) { if (studentCourse.gradeAppeal != null) { MessageBox.Show("You allready requested grade appeal"); } else if (studentCourse.additionalTest != null) { if (!(studentCourse.additionalTest.Equals(requestState.testPassed.ToString()))) { MessageBox.Show("You allready requested for additional test, you cant request until final grade received"); } } else if (studentCourse.Grade == -1) { MessageBox.Show("You don't have grade for this course yet. You can make request after you get the grade"); } else { studentCourse.gradeAppeal = requestState.Submitted.ToString(); SettingDatabase.Change_Grade_Status_Request(student, studentCourse); Reload(); } } else if (checkBox_test.Checked == true) { if (studentCourse.additionalTest != null) { MessageBox.Show("You allready requested for additional test"); } else if (studentCourse.Grade == -1) { MessageBox.Show("You don't have grade for this course yet. You can make request after you get the grade"); } else { studentCourse.additionalTest = requestState.Submitted.ToString(); SettingDatabase.Change_Test_Status_Request(student, studentCourse); Reload(); } } }
private void button_confirm_Click(object sender, EventArgs e) { if (gradeAppeal == false) { if (waitingForGrade == true) { currentCourse.additionalTest = requestState.testPassed.ToString(); SettingDatabase.ChangeGradeOfStudentInCourse(currentStudent, currentCourse.Course, newGrade); } else { if (checkBox_approve.Checked == true) { currentCourse.additionalTest = requestState.Approved.ToString(); } else { currentCourse.additionalTest = requestState.NotApproved.ToString(); } } SettingDatabase.Change_Test_Status_Request(currentStudent, currentCourse); } else { if (checkBox_approve.Checked == true) { currentCourse.Grade = newGrade; currentCourse.gradeAppeal = requestState.Approved.ToString(); SettingDatabase.ChangeGradeOfStudentInCourse(currentStudent, currentCourse.Course, newGrade); } else { currentCourse.gradeAppeal = requestState.NotApproved.ToString(); } SettingDatabase.Change_Grade_Status_Request(currentStudent, currentCourse); } Reload(); }