private void btnAdd_Click(object sender, EventArgs e) { try { if (cbxService.SelectedIndex == -1) { MessageBox.Show("Bạn chưa chọn dịch vụ!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); cbxService.Focus(); } else if (cbxMAPHONG.SelectedIndex == -1) { MessageBox.Show("Bạn chưa chọn phòng!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); cbxMAPHONG.Focus(); } else if (txtQuantity.Text == "") { MessageBox.Show("Bạn chưa nhập số lượng!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); txtQuantity.Focus(); } else if (lblMADV.Text == "") { MessageBox.Show("Bạn chưa chọn dịch vụ!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { string sql = @"INSERT INTO SUDUNGDV(MAKH,MADV,SOLUONG,GIADV) VALUES ('" + lblMAKH.Text + "','" + lblMADV.Text + "', '" + txtQuantity.Text + "', '" + Convert.ToInt32(txtQuantity.Text) * Convert.ToInt32(txtPrice.Text) + "')"; int kq = KetNoiCSDL.Change(sql); if (kq > 0) { MessageBox.Show("Thêm thành công!", "Inform", MessageBoxButtons.OK); } else { MessageBox.Show("Thất bại, xin kiểm tra lại thông tin vừa nhập!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } } //////////////////REFESH string ListServiceOld = @"Select DICHVU.TENDV,SUDUNGDV.SOLUONG,SUDUNGDV.GIADV From DICHVU,SUDUNGDV Where DICHVU.MADV = SUDUNGDV.MADV and SUDUNGDV.MAKH='" + lblMAKH.Text + "'"; DataTable dtgv = KetNoiCSDL.LoadCSDL(ListServiceOld); dgvService.DataSource = dtgv; if (dtgv.Rows.Count == 0) { MessageBox.Show("Bạn chưa nhập đầy đủ thông tin!", "Thông báo", MessageBoxButtons.OK); } cbxService.Text = ""; txtPrice.Text = ""; txtQuantity.Text = ""; cbxService.Items.Clear(); //////////////////////////////////////////// } catch (Exception) { MessageBox.Show("Lỗi", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAdd_Click(object sender, EventArgs e) { try { if (txtTENDV.Text == "") { MessageBox.Show("Bạn chưa nhập tên dịch vụ!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); txtTENDV.Focus(); } else if (txtDONGIA.Text == "") { MessageBox.Show("Bạn chưa nhập giá dịch vụ!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); txtDONGIA.Focus(); } else { string sql = @"INSERT INTO DICHVU(MADV,TENDV,DONGIA) VALUES ('" + lblMADV.Text + "',N'" + txtTENDV.Text + "', '" + txtDONGIA.Text + "')"; int kq = KetNoiCSDL.Change(sql); if (kq > 0) { MessageBox.Show("Thêm thành công!", "Thông báo", MessageBoxButtons.OK); } else { MessageBox.Show("Thất bại, xin kiểm tra lại thông tin!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } } //////////////////////REFESH string LayDanhSachPhong = @"Select * From DICHVU"; DataTable dt = KetNoiCSDL.LoadCSDL(LayDanhSachPhong); dgvService.DataSource = dt; for (int i = 0; i < dt.Rows.Count; i++) { lblMADV.Text = dt.Rows[i][0].ToString(); } int MA = Convert.ToInt16((lblMADV.Text).Substring(2)) + 1; lblMADV.Text = "DV" + MA.ToString(); txtDONGIA.Text = ""; txtTENDV.Text = ""; txtTENDV.Focus(); if (dt.Rows.Count == 0) { MessageBox.Show("Bạn chưa nhập đầy đủ thông tin!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } /////////////////////////////////// } catch (Exception) { MessageBox.Show("Bạn đã thêm dịch vụ này rồi!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnEdit_Click(object sender, EventArgs e) { try { string sql = @"UPDATE SUDUNGDV SET SOLUONG = '" + txtQuantity.Text + "', GIADV ='" + Convert.ToInt32(txtQuantity.Text) * Convert.ToInt32(txtPrice.Text) + "' WHERE MADV = '" + lblTempMADV.Text + "'"; int kq = KetNoiCSDL.Change(sql); if (kq > 0) { MessageBox.Show("Chỉnh sửa thành công!", "Inform", MessageBoxButtons.OK); } else { MessageBox.Show("Thất bại, xin kiểm tra lại thông tin!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } //////////////////REFESH string ListServiceOld = @"Select DICHVU.TENDV,SUDUNGDV.SOLUONG,SUDUNGDV.GIADV From DICHVU,SUDUNGDV Where DICHVU.MADV = SUDUNGDV.MADV and SUDUNGDV.MAKH='" + lblMAKH.Text + "'"; DataTable dtgv = KetNoiCSDL.LoadCSDL(ListServiceOld); dgvService.DataSource = dtgv; if (dtgv.Rows.Count == 0) { MessageBox.Show("Không có dịch vụ nào cả!", "Inform", MessageBoxButtons.OK); } //////////////////////////////////////////// } catch (Exception) { MessageBox.Show("Lỗi", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnEdit_Click(object sender, EventArgs e) { try { if (txtTENDV.Text == "") { MessageBox.Show("Hãy chọn dịch vụ cần sửa ở bảng hiển thị!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); txtTENDV.Focus(); } else if (txtDONGIA.Text == "") { MessageBox.Show("Hãy chọn dịch vụ cần sửa ở bảng hiển thị!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); txtDONGIA.Focus(); } else { string sql = @"UPDATE DICHVU SET DONGIA = '" + txtDONGIA.Text + "',TENDV =N'" + txtTENDV.Text + "' WHERE MADV = '" + lblMADV.Text + "'"; int kq = KetNoiCSDL.Change(sql); if (kq > 0) { MessageBox.Show("Chỉnh sửa thành công!", "Thông báo", MessageBoxButtons.OK); } else { MessageBox.Show("Thất bại, xin kiểm tra lại thông tin dịch vụ!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } } //////////////////////REFESH string LayDanhSachPhong = @"Select * From DICHVU"; DataTable dt = KetNoiCSDL.LoadCSDL(LayDanhSachPhong); dgvService.DataSource = dt; for (int i = 0; i < dt.Rows.Count; i++) { lblMADV.Text = dt.Rows[i][0].ToString(); } int MA = Convert.ToInt16((lblMADV.Text).Substring(2)) + 1; lblMADV.Text = "DV" + MA.ToString(); txtDONGIA.Text = ""; txtTENDV.Text = ""; txtTENDV.Focus(); if (dt.Rows.Count == 0) { MessageBox.Show("Không có dịch vụ nào để bạn chọn cả, hãy thêm dịch vụ đi nào!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } /////////////////////////////////// } catch (Exception) { MessageBox.Show("No Information", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAdd_Click(object sender, EventArgs e) { try { if (txtTENPHONG.Text == "") { MessageBox.Show("Bạn chưa nhập tên phòng!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); txtTENPHONG.Focus(); } else if (txtGIAPHONG.Text == "") { MessageBox.Show("Bạn chưa nhập giá phòng!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); txtGIAPHONG.Focus(); } else { string sql = @"INSERT INTO PHONG(MAPHONG,TENPHONG,GIAPHONG) VALUES ('" + lblMAPHONG.Text + "',N'" + txtTENPHONG.Text + "', '" + txtGIAPHONG.Text + "')"; int kq = KetNoiCSDL.Change(sql); if (kq > 0) { MessageBox.Show("Thêm thành công!", "Inform", MessageBoxButtons.OK); } else { MessageBox.Show("Thất bại, xin kiểm tra lại thông tin vừa nhập!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } ///////////////////REFESH string LayDanhSachPhong = @"Select * From PHONG"; DataTable dt = KetNoiCSDL.LoadCSDL(LayDanhSachPhong); dgvRoom.DataSource = dt; for (int i = 0; i < dt.Rows.Count; i++) { lblMAPHONG.Text = dt.Rows[i][0].ToString(); } int MA = Convert.ToInt16((lblMAPHONG.Text).Substring(1)) + 1; lblMAPHONG.Text = "P" + MA.ToString(); txtGIAPHONG.Text = ""; txtTENPHONG.Text = ""; if (dt.Rows.Count == 0) { MessageBox.Show("Không có phòng nào cả!", "Thông báo", MessageBoxButtons.OK); } ////////////////////////////////////////// } catch (Exception) { MessageBox.Show("Mời bạn nhập thông tin phòng muốn thêm!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnEdit_Click(object sender, EventArgs e) { try { if (txtTENPHONG.Text == "") { MessageBox.Show("Bạn chưa nhập tên phòng!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); txtTENPHONG.Focus(); } else if (txtGIAPHONG.Text == "") { MessageBox.Show("Bạn chưa nhập giá phòng!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); txtGIAPHONG.Focus(); } else { string sql = @"UPDATE PHONG SET GIAPHONG = '" + txtGIAPHONG.Text + "',TENPHONG =N'" + txtTENPHONG.Text + "' WHERE MAPHONG = '" + lblMAPHONG.Text + "'"; int kq = KetNoiCSDL.Change(sql); if (kq > 0) { MessageBox.Show("Chỉnh sửa thành công!", "Inform", MessageBoxButtons.OK); } else { MessageBox.Show("Thất bại, xin kiểm tra lại thông tin!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } ///////////////////REFESH string LayDanhSachPhong = @"Select * From PHONG"; DataTable dt = KetNoiCSDL.LoadCSDL(LayDanhSachPhong); dgvRoom.DataSource = dt; for (int i = 0; i < dt.Rows.Count; i++) { lblMAPHONG.Text = dt.Rows[i][0].ToString(); } int MA = Convert.ToInt16((lblMAPHONG.Text).Substring(1)) + 1; lblMAPHONG.Text = "P" + MA.ToString(); txtGIAPHONG.Text = ""; txtTENPHONG.Text = ""; if (dt.Rows.Count == 0) { MessageBox.Show("Not Room", "Inform", MessageBoxButtons.OK); } ////////////////////////////////////////// } catch (Exception) { MessageBox.Show("Hãy chọn phòng muốn sửa thông tin từ bảng hiển thị!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnDelete_Click(object sender, EventArgs e) { try { try { int Selected = Convert.ToInt32(dgvService.CurrentCell.RowIndex); DialogResult dl; dl = MessageBox.Show("Bạn có thật sự muốn xóa?", "Chú ý", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dl == DialogResult.Yes) { string sql = @"DELETE FROM SUDUNGDV WHERE MAKH = '" + lblTempMAKH.Text + "' AND MADV = '" + lblTempMADV.Text + "'"; int kq = KetNoiCSDL.Change(sql); if (kq > 0) { MessageBox.Show("Xóa thành công!", "Inform", MessageBoxButtons.OK); } else { MessageBox.Show("Thất bại, xin kiểm tra lại thông tin!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception) { MessageBox.Show("Không có dịch vụ nào cả", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } //////////////////REFESH string ListServiceOld = @"Select DICHVU.TENDV,SUDUNGDV.SOLUONG,SUDUNGDV.GIADV From DICHVU,SUDUNGDV Where DICHVU.MADV = SUDUNGDV.MADV and SUDUNGDV.MAKH='" + lblMAKH.Text + "'"; DataTable dtgv = KetNoiCSDL.LoadCSDL(ListServiceOld); dgvService.DataSource = dtgv; if (dtgv.Rows.Count == 0) { MessageBox.Show("Không có dịch vụ nào cả", "Thông báo", MessageBoxButtons.OK); } //////////////////////////////////////////// } catch (Exception) { MessageBox.Show("Lỗi", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnDelete_Click(object sender, EventArgs e) { try { try { int Selected = Convert.ToInt32(dgvService.CurrentCell.RowIndex); string MADV = dgvService.Rows[Selected].Cells[0].Value.ToString(); DialogResult dl; dl = MessageBox.Show("Bạn có thật sự muốn xóa?", "Chú ý", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dl == DialogResult.Yes) { string sql1 = @"DELETE FROM SUDUNGDV WHERE MADV = '" + MADV + "'"; int kq1 = KetNoiCSDL.Change(sql1); string sql2 = @"DELETE FROM DICHVU WHERE MADV = '" + MADV + "'"; int kq2 = KetNoiCSDL.Change(sql2); if (kq2 > 0) { MessageBox.Show("Xóa thành công", "Thông báo", MessageBoxButtons.OK); } else { MessageBox.Show("Thất bại, xin kiểm tra lại thông tin", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception) { MessageBox.Show("Hãy chọn dịch vụ muốn xóa ở bảng hiển thị!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } //////////////////////REFESH string LayDanhSachPhong = @"Select * From DICHVU"; DataTable dt = KetNoiCSDL.LoadCSDL(LayDanhSachPhong); dgvService.DataSource = dt; for (int i = 0; i < dt.Rows.Count; i++) { lblMADV.Text = dt.Rows[i][0].ToString(); } int MA = Convert.ToInt16((lblMADV.Text).Substring(2)) + 1; lblMADV.Text = "DV" + MA.ToString(); txtDONGIA.Text = ""; txtTENDV.Text = ""; if (dt.Rows.Count == 0) { MessageBox.Show("Không có dịch vụ nào để bạn chọn cả, hãy thêm dịch vụ đi nào!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } /////////////////////////////////// } catch (Exception) { MessageBox.Show("No Information", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnDelete_Click(object sender, EventArgs e) { try { try { int Selected = Convert.ToInt32(dgvService.CurrentCell.RowIndex); string LayMaKH = @"Select MAKH From PHONG, KHACHHANG Where PHONG.MAPHONG=KHACHHANG.MAPHONG AND KHACHHANG.TENKH=N'" + dgvService.Rows[Selected].Cells[2].Value.ToString() + "'"; DataTable dtgv = KetNoiCSDL.LoadCSDL(LayMaKH); DialogResult dl; dl = MessageBox.Show("Bạn có thật sự muốn xóa?", "Chú ý", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dl == DialogResult.Yes) { string sql = @"DELETE FROM SUDUNGDV WHERE MAKH = '" + dtgv.Rows[0][0].ToString() + "'"; KetNoiCSDL.LoadCSDL(sql); string sql2 = @"DELETE FROM KHACHHANG WHERE MAKH = '" + dtgv.Rows[0][0].ToString() + "'"; int kq = KetNoiCSDL.Change(sql2); if (kq > 0) { MessageBox.Show("Xóa thành công!", "Thông báo", MessageBoxButtons.OK); } else { MessageBox.Show("Thất bại, xin kiểm tra lại thông tin!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception) { MessageBox.Show("Không có phòng nào cả!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } ////////////////////////REFESH cbxRoom.Text = ""; txtGIAPHONG.Text = ""; txtSDT.Text = ""; txtTENKH.Text = ""; cbxRoom.Focus(); cbxRoom.Items.Clear(); // đưa dữ liệu từ csdl load lên DataGV string LayDanhSachPhong = @"Select PHONG.MAPHONG,PHONG.TENPHONG,KHACHHANG.TENKH,KHACHHANG.NAMSINH,KHACHHANG.SDT,KHACHHANG.NGAYDEN From PHONG, KHACHHANG Where PHONG.MAPHONG=KHACHHANG.MAPHONG"; DataTable dt = KetNoiCSDL.LoadCSDL(LayDanhSachPhong); dgvService.DataSource = dt; // đưa dữ liệu lên listbox ROOM trống khách string ChonRoom = @"Select * from PHONG"; DataTable Room = KetNoiCSDL.LoadCSDL(ChonRoom); //cbxService.DataSource = DichVu; cbxRoom.SelectedIndex = -1; for (int i = 0; i < Room.Rows.Count; i++) { cbxRoom.Items.Add(Room.Rows[i][1].ToString()); for (int j = 0; j < dt.Rows.Count; j++) { if (dt.Rows[j][0].ToString() == Room.Rows[i][0].ToString()) { cbxRoom.Items.Remove(dt.Rows[j][1].ToString()); } } } //Tạo Mã KH ngẫu nhiên string LayMa = @"Select MAKH From PHONG, KHACHHANG Where PHONG.MAPHONG=KHACHHANG.MAPHONG"; DataTable dtgv1 = KetNoiCSDL.LoadCSDL(LayMa); for (int i = 0; i < dtgv1.Rows.Count; i++) { lblMAKH.Text = dtgv1.Rows[i][0].ToString(); } int MA = Convert.ToInt16((lblMAKH.Text).Substring(2)) + 1; lblMAKH.Text = "KH" + MA.ToString(); /////////////////////////////////////////////////////////////////////////// } catch (Exception) { MessageBox.Show("No Information", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAdd_Click(object sender, EventArgs e) { try { if (txtTENKH.Text == "") { MessageBox.Show("Bạn chưa nhập tên khách hàng!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); txtTENKH.Focus(); } else if (dpkNAMSINH.Value.ToString() == "") { MessageBox.Show("Bạn chưa chọn ngày sinh!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); dpkNAMSINH.Focus(); } else if (txtSDT.Text == "") { MessageBox.Show("Bạn chưa nhập SĐT khách hàng!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); txtSDT.Focus(); } else { string sql = @"INSERT INTO KHACHHANG(MAKH,MAPHONG,TENKH,NAMSINH,SDT,NGAYDEN) VALUES ('" + lblMAKH.Text + "','" + lblMAPHONG.Text + "',N'" + txtTENKH.Text + "', '" + dpkNAMSINH.Value.ToString() + "', '" + txtSDT.Text + "', '" + (DateTime.Now).ToString() + "')"; int kq = KetNoiCSDL.Change(sql); if (kq > 0) { MessageBox.Show("Thêm thành công!", "Thông báo", MessageBoxButtons.OK); } else { MessageBox.Show("Thất bại, xin kiểm tra lại thông tin!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } } ////////////////////////REFESH cbxRoom.Text = ""; txtGIAPHONG.Text = ""; txtSDT.Text = ""; txtTENKH.Text = ""; cbxRoom.Focus(); cbxRoom.Items.Clear(); // đưa dữ liệu từ csdl load lên DataGV string LayDanhSachPhong = @"Select PHONG.MAPHONG,PHONG.TENPHONG,KHACHHANG.TENKH,KHACHHANG.NAMSINH,KHACHHANG.SDT,KHACHHANG.NGAYDEN From PHONG, KHACHHANG Where PHONG.MAPHONG=KHACHHANG.MAPHONG"; DataTable dt = KetNoiCSDL.LoadCSDL(LayDanhSachPhong); dgvService.DataSource = dt; // đưa dữ liệu lên listbox ROOM trống khách string ChonRoom = @"Select * from PHONG"; DataTable Room = KetNoiCSDL.LoadCSDL(ChonRoom); //cbxService.DataSource = DichVu; cbxRoom.SelectedIndex = -1; for (int i = 0; i < Room.Rows.Count; i++) { cbxRoom.Items.Add(Room.Rows[i][1].ToString()); for (int j = 0; j < dt.Rows.Count; j++) { if (dt.Rows[j][0].ToString() == Room.Rows[i][0].ToString()) { cbxRoom.Items.Remove(dt.Rows[j][1].ToString()); } } } //Tạo Mã KH ngẫu nhiên string LayMaKH = @"Select MAKH From PHONG, KHACHHANG Where PHONG.MAPHONG=KHACHHANG.MAPHONG"; DataTable dtgv = KetNoiCSDL.LoadCSDL(LayMaKH); for (int i = 0; i < dtgv.Rows.Count; i++) { lblMAKH.Text = dtgv.Rows[i][0].ToString(); } int MA = Convert.ToInt16((lblMAKH.Text).Substring(2)) + 1; lblMAKH.Text = "KH" + MA.ToString(); /////////////////////////////////////////////////////////////////////////// } catch (Exception a) { MessageBox.Show("Hãy thêm tiếp khách hàng nữa nào!" + a, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnDelete_Click(object sender, EventArgs e) { try { try { int Selected = Convert.ToInt32(dgvRoom.CurrentCell.RowIndex); string MAPHONG = dgvRoom.Rows[Selected].Cells[0].Value.ToString(); DialogResult dl; dl = MessageBox.Show("Bạn có thật sự muốn xóa?", "Chú ý", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dl == DialogResult.Yes) { string sql2 = @"DELETE FROM KHACHHANG WHERE MAPHONG = '" + MAPHONG + "'"; int kq2 = KetNoiCSDL.Change(sql2); string sql = @"DELETE FROM PHONG WHERE MAPHONG = '" + MAPHONG + "'"; int kq = KetNoiCSDL.Change(sql); if (kq > 0) { MessageBox.Show("Xóa thành công!", "Thông báo", MessageBoxButtons.OK); } else { MessageBox.Show("Thất bại, xin kiểm tra lại thông tin!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception) { MessageBox.Show("Hãy chọn một phòng để xóa từ bảng hiển thị!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } ///////////////////REFESH string LayDanhSachPhong = @"Select * From PHONG"; DataTable dt = KetNoiCSDL.LoadCSDL(LayDanhSachPhong); dgvRoom.DataSource = dt; for (int i = 0; i < dt.Rows.Count; i++) { lblMAPHONG.Text = dt.Rows[i][0].ToString(); } int MA = Convert.ToInt16((lblMAPHONG.Text).Substring(1)) + 1; lblMAPHONG.Text = "P" + MA.ToString(); txtGIAPHONG.Text = ""; txtTENPHONG.Text = ""; if (dt.Rows.Count == 0) { MessageBox.Show("Không có phòng nào cả!", "Thông báo", MessageBoxButtons.OK); } ////////////////////////////////////////// } catch (Exception) { MessageBox.Show("Không có phòng nào để bạn xóa cả!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }