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 button1_Click(object sender, EventArgs e) { string id = IdQuestionDetail.Text; AdminModel ad = new AdminModel(); if (ad.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 btnDelete_Click(object sender, EventArgs e) { string id = IdQuestionDetail.Text; AdminModel ad = new AdminModel(); if (ad.DeleteQuestion(id) == true) { dataGridView1.DataSource = ad.GetQuestions(); ResetGUI(); MessageBox.Show("Delete Question Success", " Notification ", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Delete Question Failed ", " Notification ", MessageBoxButtons.OK, MessageBoxIcon.Error); } IdQuestionDetail.ReadOnly = false; }
private void btnUpdate_Click(object sender, EventArgs e) { string id = IdQuestionDetail.Text; string subject = cbSubject.Text; string content = rtContent.Text; string a = rtA.Text; string b = rtB.Text; string c = rtC.Text; string d = rtD.Text; string correct = ""; if (rdA.Checked) { correct = "_a"; } if (rdB.Checked) { correct = "_b"; } if (rdC.Checked) { correct = "_c"; } if (rdD.Checked) { correct = "_d"; } AdminModel ad = new AdminModel(); if (ad.UpdateQuestion(id, subject, content, correct, a, b, c, d)) { dataGridView1.DataSource = ad.GetQuestions(); ResetGUI(); MessageBox.Show("Update Question Success", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Update Question Failed ", " Notification ", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnLogin_Click_1(object sender, EventArgs e) { string user = txtUsername.Text; string password = txtPass.Text; AdminModel model = new AdminModel(); currentUser = model.CheckLogin(user, password); if (currentUser == null) { MessageBox.Show("Login Failed"); } else { //MessageBox.Show("Login Success"); this.Dispose(); txtUsername.Text = ""; txtPass.Text = ""; txtUsername.Focus(); } }
private void btnAddNew_Click(object sender, EventArgs e) { if (!addFlag) { ResetControl(); btnAddNew.Text = "Save"; } else { if (addCheck) { string id = IdQuestionDetail.Text; string A = rtA.Text; string B = rtB.Text; string C = rtC.Text; string D = rtD.Text; string sid = cbSubject.SelectedItem.ToString(); string content = rtContent.Text; string correct = ""; if (sid.Equals("Top notch1")) { sid = "TN1"; } if (sid.Equals("Top notch2")) { sid = "TN2"; } if (sid.Equals("Top notch3")) { sid = "TN3"; } if (sid.Equals("Summit1")) { sid = "SM1"; } if (rdA.Checked) { correct = "_a"; } if (rdB.Checked) { correct = "_b"; } if (rdC.Checked) { correct = "_c"; } if (rdD.Checked) { correct = "_d"; } AdminModel ad = new AdminModel(); if (ad.AddNewQuestion(id, content, A, B, C, D, correct, sid)) { MessageBox.Show("Add New Success", " Notification ", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Add New Failed ", " Notification ", MessageBoxButtons.OK, MessageBoxIcon.Error); } btnAddNew.Text = "Add New "; ResetControl(); } } addFlag = !addFlag; }
private void button2_Click_1(object sender, EventArgs e) { AdminModel ad = new AdminModel(); dataGridView1.DataSource = ad.GetQuestions(); }