/* UPDATE existing Exam */ private void ctrl_btn_updateExam_Click(object sender, EventArgs e) { //Set the add/update form to update by seeing the bool parameter as false //and pass in the exam to update AddUpdateExamForm updateForm = new AddUpdateExamForm(false, exam); /* Opens ADD/UPDATE form */ var result = updateForm.ShowDialog(); //Refresh the exam selection to the updated exam with the newly set duration if (result == DialogResult.OK) { RefreshExams(updateForm.Exam.ExamID); } }
/* ADD a new exam */ private void ctrl_btn_addExam_Click(object sender, EventArgs e) { AddUpdateExamForm addForm = new AddUpdateExamForm(true, new Exam { Administrator = adminID }); /* Opens ADD/UPDATE form */ var result = addForm.ShowDialog(); //When adding is successful, refresh the exam list to the //newly created exam and enable delete and update buttons if (result == DialogResult.OK) { RefreshExams(addForm.Exam.ExamID); ctrl_btn_delete.Enabled = true; ctrl_btn_updateExam.Enabled = true; } }