private void barLargeButtonItem4_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (MessageBox.Show("Bạn Muốn Xóa Phòng Ban Này?", "Cảnh Báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { if (gridView1.RowCount > 0) { int rs = -1; string id = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[0]).ToString(); rs = new DEPARTMENTController().XoaDEPARTMENT(id); if (rs < 1) { MessageBox.Show("Phòng Ban không được xóa", "Thông báo"); } else { MessageBox.Show("Phòng Ban đã được xóa", "Thông báo"); } gridControl1.DataSource = new DEPARTMENTController().LayDSDEPARTMENT_GROUP(); } else { MessageBox.Show("Dữ liệu không tồn tại", "Thông báo"); } } }
private void barLargeButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (gridView1.FocusedRowHandle >= 0) { string id = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[0]).ToString(); //MessageBox.Show(id); DEPARTMENT objunit = new DEPARTMENT(); objunit = new DEPARTMENTController().LayTTDEPARTMENT_ByID(id); frmCapNhatBoPhan frm = new frmCapNhatBoPhan(); frm.Load_Data(objunit); frm.ShowDialog(); } }
private void simpleButton1_Click(object sender, EventArgs e) { int rs = -1; objunit.Department_ID = txtMa.Text; objunit.Department_Name = txtTenKV.Text; objunit.Description = txtGhiChu.Text; objunit.Active = checkactive.Checked; rs = new DEPARTMENTController().DEPARTMENT_Update(objunit, objunit.Department_ID); if (rs < 1) { MessageBox.Show("Cập nhật thất bại", "Thông báo"); } else { MessageBox.Show("Cập nhật thành công", "Thông báo"); Close(); } }
private void simpleButton2_Click(object sender, EventArgs e) { int rs = -1; objdepartment.Department_ID = txtMa.Text; objdepartment.Department_Name = txtten.Text; objdepartment.Description = txtGhiChu.Text; objdepartment.Active = chkquanly.Checked; rs = new DEPARTMENTController().ThemDEPARTMENT(objdepartment); if (rs < 1) { MessageBox.Show("Bộ phận đã tồn tại", "Thông báo"); } else { MessageBox.Show("Bộ phận mới đã được lưu", "Thông báo"); txtMa.Text = SinhMaBoPhan(); txtten.Text = ""; txtGhiChu.Text = ""; } }