// Detail question private void MTxtDetailQuestionId_TextChanged(object sender, EventArgs e) { if (bsQuestionList.Count > 0) { EditQuestionId = int.Parse(mTxtDetailQuestionId.Text); LoadDetailQuestionExamCode?.Invoke(this, null); bsDetailQuestionExamCodeList.DataSource = ListDetailQuestionExamCode; SetHeaderMGridDetailQuestionExamCode(); } }
private void FrmQuestion_Load(object sender, EventArgs e) { presenter = new TeacherQuestionPresenter(this); // Tab question bsQuestionList = new BindingSource(); bsQuestionList.DataSource = ListQuestion; mGridListQuestion.DataSource = bsQuestionList; // --- Load combobox difficultLevel var difficulLevels = new List <object> { new { DifficultLevel = 1, Value = "Dễ" }, new { DifficultLevel = 2, Value = "Trung bình" }, new { DifficultLevel = 3, Value = "Khó" }, new { DifficultLevel = 4, Value = "Nâng cao" }, }; mCbbEditQuestionDifficultLevel.ValueMember = "DifficultLevel"; mCbbEditQuestionDifficultLevel.DisplayMember = "Value"; mCbbEditQuestionDifficultLevel.DataSource = difficulLevels; // --- Load detail question examcode bsDetailQuestionExamCodeList = new BindingSource(); bsDetailQuestionExamCodeList.DataSource = ListDetailQuestionExamCode; mGridDetailQuestionExamCode.DataSource = bsDetailQuestionExamCodeList; // --- Approve question LoadApproveQuestion?.Invoke(this, null); bsApproveQuestionList = new BindingSource(); bsApproveQuestionList.DataSource = ListQuestionDistributed; mGridApproveQuestion.DataSource = bsApproveQuestionList; // --- Add question mCbbAddQuestionDifficultLevel.ValueMember = "DifficultLevel"; mCbbAddQuestionDifficultLevel.DisplayMember = "Value"; mCbbAddQuestionDifficultLevel.DataSource = difficulLevels; mCbbAddQuestionSubject.DisplayMember = "SubjectName"; mCbbAddQuestionSubject.DataSource = Subjects; if (mCbbAddQuestionSubject.SelectedItem != null) { var subject = mCbbAddQuestionSubject.SelectedItem as Subject; mTxtAddQuestionSubjectId.Text = subject.SubjectId; mTxtAddQuestionGradeId.Text = subject.GradeId.ToString(); } // Set data bindings SetHeaderMGridListQuestion(); SetHeaderMGridApproveQuestion(); SetDataBinding(); // Set validations RequiredValidatingControls(); // Register events // --- List question mBtnReloadListQuestion.Click += MBtnReloadListQuestion_Click; // --- Edit question mTileEditAnswer.Click += MTileEditAnswer_Click; mBtnSaveEditQuestion.Click += MBtnSaveEditQuestion_Click; // --- Detail question mTxtDetailQuestionId.TextChanged += MTxtDetailQuestionId_TextChanged; // --- Approve question mBtnApproveQuestion.Click += MBtnApproveQuestion_Click; // --- Add question mCbbAddQuestionSubject.SelectedIndexChanged += MCbbAddQuestionSubject_SelectedIndexChanged; mBtnAddQuestion.Click += MBtnAddQuestion_Click; // --- Import/Export question mBtnImportChosePath.Click += MBtnImportChosePath_Click; mBtnImportQuestion.Click += MBtnImportQuestion_Click; mBtnExportChosePath.Click += MBtnExportChosePath_Click; mBtnExportQuestion.Click += MBtnExportQuestion_Click; // Select tab first startup mTabQuestion.SelectTab(0); if (bsQuestionList.Count > 0) { EditQuestionId = int.Parse(mTxtDetailQuestionId.Text); LoadDetailQuestionExamCode?.Invoke(this, null); bsDetailQuestionExamCodeList.DataSource = ListDetailQuestionExamCode; SetHeaderMGridDetailQuestionExamCode(); } }