private void btnDelete_Click(object sender, EventArgs e) { StudentDAL potentialStudentDAL = new StudentDAL(); SignupDAL sgDAL = new SignupDAL(); potentialStudentDAL.ConnectToDatabase(); StudentDTO currentObject = (StudentDTO)dgvListStudent.CurrentRow.DataBoundItem; DialogResult rs = MessageBox.Show("Bạn muốn xoá học viên: " + currentObject.StudentId, "Thông báo", MessageBoxButtons.YesNo); if (rs == DialogResult.Yes) { try { if (sgDAL.DeleteSignupStudent(currentObject.StudentId) && potentialStudentDAL.DeleteStudent(currentObject.StudentId)) { MessageBox.Show("Xoá học viên thành công!!!"); this.Close(); OfficalStudentForm f = new OfficalStudentForm(); f.Show(); } } catch (Exception) { MessageBox.Show("Xoá học viên thất bại!!!"); } } }
public static bool DeleteStdBusiness(int entity) { if (entity >= 0) { return(StudentDAL.DeleteStudent(entity)); } return(false); }
private void btnConfirm_Click(object sender, EventArgs e) { StudentDTO currentObject = (StudentDTO)dgvListStudent.CurrentRow.DataBoundItem; StudentDAL potentialStudentDAL = new StudentDAL(); potentialStudentDAL.ConnectToDatabase(); potentialStudentDAL.DeleteStudent(currentObject.StudentId); }
public void DeleteStudent(int id) { try { Student student = _context.Student.Find(id); if (student != null) { _studentDAL.DeleteStudent(student); } } catch (Exception ex) { throw new Exception("Error from StudentBLL: " + ex.Message.ToString()); } }
private void button4_Click(object sender, EventArgs e) { int row = dataGridView1.CurrentRow.Index; if (row >= 0) { string syudNo = dataGridView1.Rows[row].Cells[0].Value.ToString(); if (studentDAL.DeleteStudent(syudNo) > 0) { getData(); } else { MessageBox.Show("删除失败!"); } } else { MessageBox.Show("请先选择学生!"); } }
public int Delete(int id) { return(obj.DeleteStudent(id)); }
public int DeleteStudent(int studentId) { return objStudentDAL.DeleteStudent(studentId); }
public void DeleteStudent(int studentID) { StudentDAL.DeleteStudent(studentID); }