private void btnXoa_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { btnXacnhan.Enabled = btnSua.Enabled = btnLuu.Enabled = btnThem.Enabled = false; btnXoa.Enabled = txtTimkiem.Enabled = false; // xóa DialogResult dr = MessageBox.Show("Bạn có chắc chắc muốn xóa", "Xóa sinh viên", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information); if (dr == DialogResult.Yes) { bdsSinhVien.RemoveCurrent(); SinhVienTableAdapter.Update(TTN_DS.SINHVIEN); btnThem.Enabled = btnXoa.Enabled = btnSua.Enabled = true; } else { if (Program.mGroup == "TRUONG") { btnXacnhan.Enabled = btnSua.Enabled = btnXoa.Enabled = btnLuu.Enabled = btnThem.Enabled = false; // nhom truong ko duoc them moi 1 sv } else { btnXacnhan.Enabled = btnLuu.Enabled = false; btnSua.Enabled = btnXoa.Enabled = btnThem.Enabled = true; } } }
private void txtTimkiem_KeyUp(object sender, KeyEventArgs e) { this.bdsSinhVien.Filter = "MASV LIKE '%" + txtTimkiem.Text + "%'" + " OR TEN LIKE '%" + this.txtTimkiem.Text + "%'"; if (txtTimkiem.Text == "") { SinhVienTableAdapter.Fill(TTN_DS.SINHVIEN); } }
private void btnLuu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { btnXacnhan.Enabled = btnHuybo.Enabled = btnLuu.Enabled = false; btnXnSua.Visible = false; btnXacnhan.Visible = true; lOPGridControl.Enabled = true; TrangThaiButtonLop(true); btnXacnhanlop.Enabled = false; TrangThaiButton(false); btnSua.Enabled = btnXoa.Enabled = btnThem.Enabled = true; sINHVIENGridControl.Enabled = txtTimkiem.Enabled = true; SinhVienTableAdapter.Update(TTN_DS.SINHVIEN); SinhVienTableAdapter.Fill(TTN_DS.SINHVIEN); MessageBox.Show("Cập nhật danh sách thành công"); }