예제 #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (dgvDocGia.SelectedRows.Count > 0)
            {
                DialogResult result = MessageBox.Show("Khi bạn nhấn \"Yes\" đối tượng sẽ bị xóa vĩnh viễn.\nBạn có chắc chắn muốn xóa?", "Xác nhận xóa", MessageBoxButtons.YesNo);

                if (result == DialogResult.Yes)
                {
                    DataGridViewRow row = dgvDocGia.CurrentRow;

                    string maDocGia = row.Cells[0].Value.ToString();

                    if (busDG.deleteDocGia(maDocGia))
                    {
                        MessageBox.Show("Xóa thành công !");
                        dgvDocGia.DataSource = busDG.getDocGia();
                    }
                    else
                    {
                        MessageBox.Show("Xóa không thành công !");
                    }
                }
            }
            else
            {
                MessageBox.Show("Vui lòng chọn một đối tượng !");
            }
        }
예제 #2
0
        private bool deleteDocGia()
        {
            try
            {
                BUS_DocGia deleteAuthor = new BUS_DocGia();

                deleteAuthor.deleteDocGia(this.authorId);
                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }