private void btnUpdate_Click(object sender, EventArgs e) { string id = txtID.Text; string content = rtContent.Text; string A = rtA.Text; string B = rtA.Text; string C = rtC.Text; string D = rtD.Text; string crr = ""; if (rdA.Checked) { crr = "_a"; } if (rdB.Checked) { crr = "_b"; } if (rdC.Checked) { crr = "_c"; } if (rdD.Checked) { crr = "_d"; } string subject = cbSubject.Text; if (subject.Equals("Topnotch 1")) { subject = "TN1"; } if (subject.Equals("Topnotch 2")) { subject = "TN2"; } if (subject.Equals("Topnotch 3")) { subject = "TN3"; } if (subject.Equals("Summit 1")) { subject = "SUM1"; } AdminModel dt = new AdminModel(); if (dt.Update(id, content, A, B, C, D, subject, crr)) { dataGridView1.DataSource = dt.GetConnection(); ResetGUI(); MessageBox.Show("Update Success"); } else { MessageBox.Show("Update Fail"); } }
private void btnDelete_Click(object sender, EventArgs e) { string id = txtID.Text; AdminModel model = new AdminModel(); if (model.Delete(id) == true) { dataGridView1.DataSource = model.GetConnection(); MessageBox.Show("Delete success"); ResetGUI(); } else { MessageBox.Show("Delete fail"); } txtID.ReadOnly = false; }