public frmTeacherEditExamCodeQuestions(string teacherId, ExamCodeListViewModel examCode, IList <int> examCodeQuestionIds) { TeacherId = teacherId; ExamCode = examCode; ExamCodeQuestionIds = examCodeQuestionIds; InitializeComponent(); Load += FrmEditExamCodeQuestions_Load; FormClosing += FrmEditExamCodeQuestions_FormClosing; }
private void MBtnAddExamCodeQuestions_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(mTxtAddExamCodeNumberOfQuestions.Text)) { var examCode = new ExamCodeListViewModel { NumberOfQuestions = int.Parse(mTxtAddExamCodeNumberOfQuestions.Text), SubjectId = mTxtAddExamCodeSubjectId.Text, GradeId = int.Parse(mTxtAddExamCodeGradeId.Text), IsPracticeExam = mToggleAddExamCodeIsPracticeExam.Checked }; var frmEditExamCodeQuestions = new frmTeacherEditExamCodeQuestions(CurrentUser.TeacherId, examCode, AddExamCodeQuestionIds); frmEditExamCodeQuestions.ShowDialog(); } else { MessageBox.Show("Chưa đủ dữ liệu!"); } }
private void MBtnAddExamCode_Click(object sender, EventArgs e) { if (mCbbAddExamCodeSubject.SelectedItem != null) { if (!rqAddNumberOfQuestions.IsValid || !rgAddNumberOfQuestions.IsValid) { if (!rqAddNumberOfQuestions.IsValid) { rqAddNumberOfQuestions.ControlToValidate.Focus(); } else { rgAddNumberOfQuestions.ControlToValidate.Focus(); } return; } var examCode = new ExamCodeListViewModel { NumberOfQuestions = int.Parse(mTxtAddExamCodeNumberOfQuestions.Text), SubjectId = mTxtAddExamCodeSubjectId.Text, GradeId = int.Parse(mTxtAddExamCodeGradeId.Text), IsPracticeExam = mToggleAddExamCodeIsPracticeExam.Checked }; if (examCode.NumberOfQuestions == AddExamCodeQuestionIds.Count()) { AddExamCode?.Invoke(examCode, null); } else { MessageBox.Show("Số lượng câu hỏi phải đúng với số câu hỏi đã quy định!"); } } else { MessageBox.Show("Chưa đủ dữ liệu!"); } }