private void btnXoa_Click(object sender, EventArgs e) { DialogResult dialog = new DialogResult(); dialog = XtraMessageBox.Show("Bạn có muốn xóa công việc này không ?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialog == DialogResult.Yes) { bool kq = cvBLL.xoaCongViec(dataGridView3.CurrentRow.Cells[0].Value.ToString()); if (kq) { XtraMessageBox.Show("Xóa công việc thành công"); dataGridView3.DataSource = null; dataGridView3.DataSource = cvBLL.getAllCongViec(); dataGridView2.DataSource = null; dataGridView2.DataSource = cvBLL.getCongViecByIdCongTrinh(dataGridView1.CurrentRow.Cells[0].Value.ToString()); loadDataDetailCongViec(); } else { XtraMessageBox.Show("Xóa công việc thất bại !!"); dataGridView3.DataSource = null; dataGridView3.DataSource = cvBLL.getAllCongViec(); dataGridView2.DataSource = null; dataGridView2.DataSource = cvBLL.getCongViecByIdCongTrinh(dataGridView1.CurrentRow.Cells[0].Value.ToString()); loadDataDetailCongViec(); } } else { dialog = DialogResult.Cancel; } }
public Form_QLCongViec() { InitializeComponent(); cvBLL = new CongViecBLL(); ctBLL = new CongTrinhBLL(); dataGridView1.AutoGenerateColumns = dataGridView2.AutoGenerateColumns = dataGridView3.AutoGenerateColumns = false; dataGridView3.DataSource = cvBLL.getAllCongViec(); dataGridView1.DataSource = ctBLL.getAllCongTrinh_DangThucHien_QuaHan(); dataGridView2.DataSource = cvBLL.getCongViecByIdCongTrinh(ctBLL.getIdCongTrinhFirst()); }
private void loadDataCongViec() { dataGridView1.DataSource = null; dataGridView1.DataSource = cvBLL.getAllCongViec(); }