Пример #1
0
        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!!!");
                }
            }
        }
Пример #2
0
 public static bool DeleteStdBusiness(int entity)
 {
     if (entity >= 0)
     {
         return(StudentDAL.DeleteStudent(entity));
     }
     return(false);
 }
Пример #3
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            StudentDTO currentObject       = (StudentDTO)dgvListStudent.CurrentRow.DataBoundItem;
            StudentDAL potentialStudentDAL = new StudentDAL();

            potentialStudentDAL.ConnectToDatabase();
            potentialStudentDAL.DeleteStudent(currentObject.StudentId);
        }
Пример #4
0
 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());
     }
 }
Пример #5
0
        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("请先选择学生!");
            }
        }
Пример #6
0
 public int Delete(int id)
 {
     return(obj.DeleteStudent(id));
 }
Пример #7
0
 public int DeleteStudent(int studentId)
 {
     return objStudentDAL.DeleteStudent(studentId);
 }
Пример #8
0
 public void DeleteStudent(int studentID)
 {
     StudentDAL.DeleteStudent(studentID);
 }