Exemplo n.º 1
0
        private void btConfim_Click(object sender, EventArgs e)
        {
            PotentialStudentDTO currentObject       = (PotentialStudentDTO)dgvListPotentialStudent.CurrentRow.DataBoundItem;
            PotentialStudentDAL potentialStudentDAL = new PotentialStudentDAL();

            potentialStudentDAL.ConnectToDatabase();
            // string idd = currentObject.PotentialStudentId;
            DialogResult dialogResult = MessageBox.Show("Bạn có chắc xoá học viên:" + currentObject.PotentialStudentId, "", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                potentialStudentDAL.DeletePotentialStudent(currentObject.PotentialStudentId);

                MessageBox.Show("Xoá học viên thành công!!!");
                this.Close();
                DeletePotentialStudentForm f = new DeletePotentialStudentForm();
                f.Show();
            }
            else if (dialogResult == DialogResult.No)
            {
            }
        }
Exemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            //xoá học viên
            //if (this.dgvListPotentialStudent.SelectedRows.Count > 0)
            //{
            //    PotentialStudentDAL potentialStudentDAL = new PotentialStudentDAL();
            //    potentialStudentDAL.ConnectToDatabase();
            //    PotentialStudentDTO currentObject = (PotentialStudentDTO)dgvListPotentialStudent.CurrentRow.DataBoundItem;
            //    if (potentialStudentDAL.DeletePotentialStudent(currentObject.PotentialStudentId))
            //    {
            //        potentialStudentDAL = new PotentialStudentDAL();
            //        potentialStudentDAL.ConnectToDatabase();
            //        dgvListPotentialStudent.DataSource = potentialStudentDAL.GetAllPotentialStudent();
            //        dgvListPotentialStudent.Update();
            //        dgvListPotentialStudent.Refresh();
            //    }
            //}
            DeletePotentialStudentForm f = new DeletePotentialStudentForm();

            this.Close();
            f.Show();
        }