private void gridControl_Employee_ProcessGridKey(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Delete && gridView_Employee.State != DevExpress.XtraGrid.Views.Grid.GridState.Editing) { if (XtraMessageBox.Show("Bạn có muốn xóa chức danh này hay không?", "BioNet - Chương trình sàng lọc sơ sinh", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.No) { try { if (BioBLL.DelEmployeePosition(Convert.ToInt32(gridView_Employee.GetRowCellValue(gridView_Employee.FocusedRowHandle, "PositionCode").ToString()))) { gridControl_Employee.DataSource = BioBLL.DTEmployeePosition(); } else { XtraMessageBox.Show("Không thể xóa chức danh này!", "BioNet - Chương trình sàng lọc sơ sinh", MessageBoxButtons.YesNo, MessageBoxIcon.Information); } } catch { XtraMessageBox.Show("Lỗi khi xóa chức danh này!", "BioNet - Chương trình sàng lọc sơ sinh", MessageBoxButtons.YesNo, MessageBoxIcon.Error); return; } } } }