private void btnRandom_Click(object sender, EventArgs e) { ManageExam md = new ManageExam(); string type = cbsubject2.SelectedItem.ToString(); if (type.Equals("Top notch1")) { type = "TN1"; } if (type.Equals("Top notch2")) { type = "TN2"; } if (type.Equals("Top notch3")) { type = "TN3"; } if (type.Equals("Summit1")) { type = "SM1"; } list = md.GetRanDomQuestion(type); MessageBox.Show(" Load Question Success ", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); btnCreate.Enabled = true; }
private void btnCreate_Click(object sender, EventArgs e) { string examcode = txtExamcode.Text; string date = dtDate.Text; ManageExam model = new ManageExam(); if (model.AddNewExam(examcode, date)) { foreach (var item in list) { model.AddExamDetail(examcode, item.ID); } string result = ""; result += "Exam Code : " + txtExamcode.Text + "\n"; result += "Date : " + dtDate.Text + "\n"; result += "Subject : " + cbsubject2.SelectedItem.ToString(); MessageBox.Show("Add New Exam Sucess", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show(result, "Detail Exam "); } else { MessageBox.Show("Add New Exam Failed ", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button5_Click(object sender, EventArgs e) { string id = txtExamSearch.Text; ManageExam mn = new ManageExam(); dataGridView2.DataSource = mn.SearchByIdExam(id); }
private void tabControl1_Click(object sender, EventArgs e) { AdminModel ad = new AdminModel(); dataGridView1.DataSource = ad.GetQuestions(); ManageExam mn = new ManageExam(); dataGridView2.DataSource = mn.GetExams(); }
private void btnCheckExam_Click_1(object sender, EventArgs e) { string id = txtExamcode.Text; ManageExam mn = new ManageExam(); if (mn.CheckExist(id) == false) { MessageBox.Show(" ID Question Existed ", " Notification ", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { addCheck = true; MessageBox.Show("This ID Question Can Use ", " Notification ", MessageBoxButtons.OK); } }
private void btnUpdate1_Click(object sender, EventArgs e) { string idExam = txtExamcode2.Text; string Date = dtDate2.Text; string Status = cbStatus.Text; ManageExam mn = new ManageExam(); if (mn.UpdateExam(idExam, Date, Status)) { dataGridView2.DataSource = mn.GetExams(); ResetGUI(); MessageBox.Show("Update Exam Success", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); string result = ""; result += "Exam Code : " + txtExamcode2.Text + "\n"; result += "Date : " + dtDate2.Text + "\n"; result += "Status : " + cbStatus.Text + "\n"; MessageBox.Show(result, "Detail Exam After Update"); } else { MessageBox.Show("Update Exam Failed ", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Error); } }