private void btnDelete_Click(object sender, EventArgs e) { string id = txtID.Text; AdminModel ad = new AdminModel(); if (ad.DeleteQuestion(id) == true) { dataGridView1.DataSource = ad.GetQuestions(); resetGUI(); MessageBox.Show("delete question sucess"); } else { MessageBox.Show("failed"); } }
private void btnUpdate_Click(object sender, EventArgs e) { string id = txtID.Text; string subject = cbSubject.Text; string content = RtxtContent.Text; string a = txtA.Text; string b = txtB.Text; string c = txtC.Text; string d = txtD.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 SUCCES", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { MessageBox.Show("Update fail"); } }
private void tabControl1_Click(object sender, EventArgs e) { AdminModel ad = new AdminModel(); dataGridView1.DataSource = ad.GetQuestions(); }