private void btnUpdate_Click(object sender, EventArgs e) { AdminModel model = new AdminModel(); string id = txtExam.Text; string date = dateTimePicker1.Value.ToShortDateString(); string status = txtStatus.Text; if (model.UpdateExam(id, date, status)) { LoadExam(); ResetControl(); } }
private void btnAdd_Click(object sender, EventArgs e) { string id = txtExam.Text; string date = dateTimePicker1.Value.ToShortDateString(); AdminModel model = new AdminModel(); model.AddExam(id, date); for (int i = 0; i < list.Count; i++) { model.AddQuestion2Exam(id, list[i].ID); } MessageBox.Show("Added"); }
private void btnCheck_Click(object sender, EventArgs e) { string id = txtExam.Text; AdminModel model = new AdminModel(); if (model.CheckExist(id) == false) { MessageBox.Show("this exam is da ton tai!!!"); } else { //btnAdd.Enabled = true; btnLoad.Enabled = true; } }
private void btnLogin_Click(object sender, EventArgs e) { string user = txtUser.Text; string pass = txtPass.Text; AdminModel model = new AdminModel(); currentUser = model.CheckLogin(user, pass); if (currentUser == null) { MessageBox.Show("Login failed"); } else { MessageBox.Show("Login Success"); this.Dispose(); } }
private void LoadExam() { AdminModel model = new AdminModel(); grvExam.DataSource = model.GetExams(); }