private void button1_Click(object sender, EventArgs e) { string id = txtSearchEdit.Text; DataProcess dt = new DataProcess(); dataGridView1.DataSource = dt.SearchById(id); }
private void btnDelete_Click(object sender, EventArgs e) { string id = txtIdQuestionEdit.Text; DataProcess dt = new DataProcess(); if (dt.DeleteQuestion(id) == true) { dataGridView1.DataSource = dt.GetQuestions(); ResetGUI(); MessageBox.Show("DELETE QUESTION SUCCESS", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("DELETE QUESTION FAIL"); } }
private void btnLogin_Click(object sender, EventArgs e) { string user = txtUser.Text; string pass = txtPass.Text; DataProcess dt = new DataProcess(); if (dt.CheckLogin(user, pass) == true) { MnAdmin mn = new MnAdmin(); this.Hide(); mn.ShowDialog(); this.Show(); } else { MessageBox.Show(this, "Login Failed ", "Result ", MessageBoxButtons.OK, MessageBoxIcon.Error); txtUser.Text = ""; txtPass.Text = ""; txtUser.Focus(); } }
private void btnUpdate_Click(object sender, EventArgs e) { string id = txtIdQuestionEdit.Text; string level = cbLevelEdit.Text; string content = rtContentEdit.Text; string correct = txtCorrect.Text; string a = rtAEdit.Text; string b = rtBEdit.Text; string c = rtCEdit.Text; string d = rtDEdit.Text; DataProcess dt = new DataProcess(); if (dt.UpdateQuestion(id, level, content, correct, a, b, c, d) == true) { dataGridView1.DataSource = dt.GetQuestions(); ResetGUI(); MessageBox.Show("UPDATE QUESTION SUCCESSFULLY", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { MessageBox.Show("UPDATE FAIL"); } }
private void btnViewall_Click(object sender, EventArgs e) { DataProcess dt = new DataProcess(); dataGridView1.DataSource = dt.GetQuestions(); }
private void btnAddnew_Click(object sender, EventArgs e) { string id = txtIdQuestion.Text; string A = rtA.Text; string B = rtB.Text; string C = rtC.Text; string D = rtD.Text; string sid = cbLevel.SelectedItem.ToString(); string crr = ""; string content = rtContent.Text; if (sid.Equals("Topnotch 1")) { sid = "TN1"; } if (sid.Equals("Topnotch 2")) { sid = "TN2"; } if (sid.Equals("Topnotch 3")) { sid = "TN3"; } if (sid.Equals("Summit 1")) { sid = "SM1"; } if (rdA.Checked) { crr = "_a"; } if (rdB.Checked) { crr = "_b"; } if (rdC.Checked) { crr = "_c"; } if (rdD.Checked) { crr = "_d"; } DataProcess dt = new DataProcess(); if (dt.AddQuestion(id, content, A, B, C, D, crr, sid)) { string result = ""; result += "Id : " + txtIdQuestion.Text + "\n"; result += "Subject : " + cbLevel.SelectedItem.ToString() + "\n"; result += "Content : " + rtContent.Text + "\n"; MessageBox.Show(result, "Detail"); } else { MessageBox.Show("FAILED"); } }