private void button4_Click_1(object sender, EventArgs e) { string id = TxtId.Text; AdminModel ad = new AdminModel(); if (ad.CheckExist(id) == false) { MessageBox.Show(" ID question Da ton tai Existed"); } else { addCheck = true; MessageBox.Show("ID nay co the dung"); } }
private void btnDelete_Click_1(object sender, EventArgs e) { string id = TxtId.Text; AdminModel ad = new AdminModel(); if (ad.DeleteQuetion(id) == true) { dataGridView1.DataSource = ad.GetQuestions(); ResetGUI(); MessageBox.Show("xoa roi"); } else { MessageBox.Show("khong xoa duoc, xem lai"); } }
private void btnlogin_Click(object sender, EventArgs e) { txtUser.Focus(); string user = txtUser.Text; string pass = txtPass.Text; AdminModel model = new AdminModel(); currentUser = model.CheckLogin(user, pass); if (currentUser == null) { MessageBox.Show("login sai"); txtPass.Text = ""; txtUser.Text = ""; txtUser.Focus(); } else { MessageBox.Show("Login sucess"); this.Dispose(); } }
private void btnUpdate_Click(object sender, EventArgs e) { string id = TxtId.Text; string subject = cb1.Text; string content = rtContent.Text; string a = radioButtonA.Text; string b = radioButtonB.Text; string c = radioButtonC.Text; string d = radioButtonD.Text; string correct = ""; if (radioButtonA.Checked) { correct = "_a"; } if (radioButtonB.Checked) { correct = "_b"; } if (radioButtonC.Checked) { correct = "_c"; } if (radioButtonD.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("Chuc mung may UPADTE thanh cong", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { MessageBox.Show("that bai"); } }
private void btnViewall_Click(object sender, EventArgs e) { AdminModel ad = new AdminModel(); dataGridView1.DataSource = ad.GetQuestions(); }
private void btnADD_Click_1(object sender, EventArgs e) { if (!addFlag) { ResetControl(); btnADD.Text = "Save"; } else { if (addCheck) { string id = TxtId.Text; string A = txtA.Text; string B = txtB.Text; string C = txtC.Text; string D = txtD.Text; string sid = cb1.SelectedItem.ToString(); string content = rtContent.Text; string correct = ""; if (sid.Equals("Top Notch 1")) { sid = "TN1"; } if (sid.Equals("Top Notch 2")) { sid = "TN2"; } if (sid.Equals("Top Notch 3")) { sid = "TN3"; } if (sid.Equals("SumMit1")) { sid = "SM1"; } if (radioButtonA.Checked) { correct = "_a"; } if (radioButtonB.Checked) { correct = "_b"; } if (radioButtonC.Checked) { correct = "_c"; } if (radioButtonD.Checked) { correct = "_d"; } AdminModel ad = new AdminModel(); if (ad.AddnewQuestion(id, content, A, B, C, D, correct, sid)) { MessageBox.Show("Add thanh cong"); } else { MessageBox.Show("add That bai roi "); } btnADD.Text = "Add New"; ResetControl(); } } addFlag = !addFlag; }