Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        private void dgvService_MouseClick(object sender, MouseEventArgs e)
        {
            try
            {
                // Tạo con trỏ khi nhấp chọn thuộc tính trên DataGV
                int Selected = Convert.ToInt32(dgvService.CurrentCell.RowIndex);

                lblTempMAPHONG.Text = dgvService.Rows[Selected].Cells[0].Value.ToString();
                cbxRoom.Text        = dgvService.Rows[Selected].Cells[1].Value.ToString();
                txtTENKH.Text       = dgvService.Rows[Selected].Cells[2].Value.ToString();
                dpkNAMSINH.Text     = dgvService.Rows[Selected].Cells[3].Value.ToString();
                txtSDT.Text         = dgvService.Rows[Selected].Cells[4].Value.ToString();

                // Trả về Giá phòng và mã KH để truy suất trong previewPrint
                string    Temp  = @"Select PHONG.GIAPHONG
                            From PHONG
                            where PHONG.TENPHONG=N'" + dgvService.Rows[Selected].Cells[1].Value.ToString() + "'";
                DataTable dtgv  = KetNoiCSDL.LoadCSDL(Temp);
                string    Temp1 = @"Select KHACHHANG.MAKH
                            From KHACHHANG
                            where KHACHHANG.TENKH=N'" + dgvService.Rows[Selected].Cells[2].Value.ToString() + "'";
                DataTable dtgv1 = KetNoiCSDL.LoadCSDL(Temp1);

                // Đổ dữ liệu tại vị trí đang click trên DataGV lên các lable và textbox
                if (dtgv.Rows.Count != 0)
                {
                    txtGIAPHONG.Text = dtgv.Rows[0][0].ToString();
                    lblTempMAKH.Text = dtgv1.Rows[0][0].ToString();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("No Information", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 5
0
        private void FrDichVu_Load(object sender, EventArgs e)
        {
            try
            {
                lblMADV.Text = "Code";
                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();
                }

                if (lblMADV.Text == "Code")
                {
                    lblMADV.Text = "DV0";
                    int MA = Convert.ToInt16((lblMADV.Text).Substring(2)) + 1;
                    lblMADV.Text = "DV" + MA.ToString();
                }
                else
                {
                    int MA = Convert.ToInt16((lblMADV.Text).Substring(2)) + 1;
                    lblMADV.Text = "DV" + MA.ToString();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Hãy thêm dịch vụ đầu tiên cho khách sạn của bạn!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 6
0
        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);
            }
        }
Ejemplo n.º 7
0
        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);
            }
        }
Ejemplo n.º 8
0
        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);
            }
        }
Ejemplo n.º 9
0
        private void cbxMAPHONG_SelectionChangeCommitted(object sender, EventArgs e)
        {
            try
            {
                cbxService.Items.Clear();
                txtPrice.Text    = "";
                txtQuantity.Text = "";
                string    ClientName = @"Select PHONG.TENPHONG,KHACHHANG.TENKH,KHACHHANG.MAKH
                                    From PHONG,KHACHHANG
                                    Where PHONG.MAPHONG = KHACHHANG.MAPHONG and PHONG.MAPHONG='" + cbxMAPHONG.SelectedValue.ToString() + "'";
                DataTable dtRoom     = KetNoiCSDL.LoadCSDL(ClientName);

                lblRoom.Text       = dtRoom.Rows[0][0].ToString();
                txtClientName.Text = dtRoom.Rows[0][1].ToString();
                lblMAKH.Text       = dtRoom.Rows[0][2].ToString();

                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, MessageBoxIcon.Information);
                }

                // Đưa dữ liệu list service chưa được chọn vào combobox khi chọn phòng

                string    ChonDICHVU = @"Select * 
                                    from DICHVU";
                DataTable DichVu     = KetNoiCSDL.LoadCSDL(ChonDICHVU);
                //cbxService.DataSource = DichVu;

                cbxService.SelectedIndex = -1;

                for (int i = 0; i < DichVu.Rows.Count; i++)
                {
                    cbxService.Items.Add(DichVu.Rows[i][1].ToString());

                    for (int j = 0; j < dtgv.Rows.Count; j++)
                    {
                        if (dtgv.Rows[j][0].ToString() == DichVu.Rows[i][1].ToString())
                        {
                            cbxService.Items.Remove(dtgv.Rows[j][0].ToString());
                        }
                    }
                }
                cbxService.Text = "";
            }
            catch (Exception)
            {
                MessageBox.Show("Lỗi", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 10
0
        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);
            }
        }
Ejemplo n.º 11
0
        private void cbxService_SelectionChangeCommitted(object sender, EventArgs e)
        {
            try
            {
                string    temp   = @"Select DICHVU.DONGIA,DICHVU.MADV
                                 From DICHVU
                                 Where DICHVU.MADV='" + cbxService.SelectedValue.ToString() + "'";
                DataTable dttemp = KetNoiCSDL.LoadCSDL(temp);

                txtPrice.Text = dttemp.Rows[0][0].ToString();
                lblMADV.Text  = dttemp.Rows[0][1].ToString();
            }
            catch (Exception)
            {
                MessageBox.Show("Lỗi", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 12
0
        private void FrAddOrder_Load(object sender, EventArgs e)
        {
            try
            {
                string ChonMAPHONG = @"Select * 
                                    from PHONG,KHACHHANG
                                    where PHONG.MAPHONG=KHACHHANG.MAPHONG ";

                cbxMAPHONG.DataSource    = KetNoiCSDL.LoadCSDL(ChonMAPHONG);
                cbxMAPHONG.DisplayMember = "MAPHONG";
                cbxMAPHONG.ValueMember   = "MAPHONG";
                cbxMAPHONG.SelectedIndex = -1;
            }
            catch (Exception)
            {
                MessageBox.Show("Hãy thêm dịch vụ đầu tiên cho khách đi nào!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 13
0
 private void cbxRoom_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         // khi chọn giá trị trong combobox sẽ lấy ra mã phòng tương ứng để Add
         string    LayMAPHONG = @"Select *
                                     From PHONG";
         DataTable dtgv       = KetNoiCSDL.LoadCSDL(LayMAPHONG);
         for (int i = 0; i < dtgv.Rows.Count; i++)
         {
             if (dtgv.Rows[i][1].ToString() == cbxRoom.Text)
             {
                 lblMAPHONG.Text = dtgv.Rows[i][0].ToString();
             }
         }
     }
     catch (Exception)
     {
         MessageBox.Show("No Information", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 14
0
 private void cbxService_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         txtQuantity.Text = "";
         string    LayPrice = @"Select *
                             From DICHVU";
         DataTable dtgv     = KetNoiCSDL.LoadCSDL(LayPrice);
         for (int i = 0; i < dtgv.Rows.Count; i++)
         {
             if (dtgv.Rows[i][1].ToString() == cbxService.Text)
             {
                 txtPrice.Text = dtgv.Rows[i][2].ToString();
                 lblMADV.Text  = dtgv.Rows[i][0].ToString();
             }
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Lỗi", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 15
0
        private void dgvService_MouseClick(object sender, MouseEventArgs e)
        {
            try
            {
                // Tạo con trỏ khi nhấp chọn thuộc tính trên DataGV
                int Selected = Convert.ToInt32(dgvService.CurrentCell.RowIndex);

                string    Temp = @"Select SUDUNGDV.MAKH,SUDUNGDV.MADV
                                    From DICHVU,SUDUNGDV
                                    Where DICHVU.TENDV=N'" + dgvService.Rows[Selected].Cells[0].Value.ToString() + "' AND DICHVU.MADV = SUDUNGDV.MADV";
                DataTable dtgv = KetNoiCSDL.LoadCSDL(Temp);
                // Đổ dữ liệu tại vị trí đang click trên DataGV lên các lable và textbox
                if (dtgv.Rows.Count != 0)
                {
                    lblTempMAKH.Text = dtgv.Rows[0][0].ToString();
                    lblTempMADV.Text = dtgv.Rows[0][1].ToString();

                    // var ViTri = this.cbxService.GetItemText(this.cbxService.FindStringExact(dgvService.Rows[Selected].Cells[0].Value.ToString()));
                    // cbxService.SelectedIndex = Convert.ToInt16(ViTri);
                    cbxService.Text = dgvService.Rows[Selected].Cells[0].Value.ToString();

                    txtQuantity.Text = dgvService.Rows[Selected].Cells[1].Value.ToString();
                    txtPrice.Text    = (Convert.ToInt32(dgvService.Rows[Selected].Cells[2].Value.ToString()) / Convert.ToInt32(dgvService.Rows[Selected].Cells[1].Value.ToString())).ToString();
                    ;
                }
                else
                {
                    txtQuantity.Text = "";
                    txtPrice.Text    = "";
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Lỗi", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 16
0
        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);
            }
        }
Ejemplo n.º 17
0
        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);
            }
        }
Ejemplo n.º 18
0
        private void PrintDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            try
            {
                if (txtExchange.Text == "")
                {
                    MessageBox.Show("Bạn chưa nhập tỷ giá!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtExchange.Focus();
                }
                else if (txtSoDem.Text == "")
                {
                    MessageBox.Show("Bạn chưa nhập số đêm!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtSoDem.Focus();
                }
                else if (txtGIAPHONG.Text == "")
                {
                    MessageBox.Show("Bạn chưa chọn phòng cần in hóa đơn trong bảng hiển thị!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    //Desigh Page Print
                    Bitmap    bmp         = Properties.Resources.Sleep_in_tent1;
                    Image     newImage    = bmp;
                    double    TotalPay    = 0;
                    double    SoDem       = Convert.ToDouble(txtSoDem.Text);
                    double    DonGiaPhong = Convert.ToDouble(txtGIAPHONG.Text);
                    double    GiaPhong    = Convert.ToDouble(txtGIAPHONG.Text) * Convert.ToDouble(txtSoDem.Text);
                    string    NgayDen     = "";
                    string    LayNgayDen  = @"Select *
                                            From KHACHHANG";
                    DataTable LAYNGAY     = KetNoiCSDL.LoadCSDL(LayNgayDen);
                    for (int i = 0; i < LAYNGAY.Rows.Count; i++)
                    {
                        if (LAYNGAY.Rows[i][0].ToString() == lblTempMAKH.Text)
                        {
                            NgayDen = LAYNGAY.Rows[i][5].ToString();
                        }
                    }
                    string Gach = "---------------------------------------------------------------------------------------------------------------------------------";
                    e.Graphics.DrawImage(newImage, 180, 20, newImage.Width, newImage.Height);
                    e.Graphics.DrawString("Room Name: " + cbxRoom.Text, new Font("Time New Roman", 13, FontStyle.Regular), Brushes.Black, new Point(30, 280));
                    e.Graphics.DrawString("Client Name: " + txtTENKH.Text, new Font("Time New Roman", 13, FontStyle.Regular), Brushes.Black, new Point(30, 310));
                    e.Graphics.DrawString("Check-in: " + NgayDen, new Font("Time New Roman", 13, FontStyle.Regular), Brushes.Black, new Point(30, 340));
                    e.Graphics.DrawString("Check-out: " + DateTime.Now, new Font("Time New Roman", 13, FontStyle.Regular), Brushes.Black, new Point(30, 370));
                    // ( Exchange Rate: " + txtExchange.Text + " ₫/$)

                    e.Graphics.DrawString(Gach, new Font("Time New Roman", 13, FontStyle.Regular), Brushes.Black, new Point(30, 390));
                    e.Graphics.DrawString("Service Name", new Font("Time New Roman", 13, FontStyle.Regular), Brushes.Black, new Point(60, 430));
                    e.Graphics.DrawString("Quantity", new Font("Time New Roman", 13, FontStyle.Regular), Brushes.Black, new Point(260, 430));
                    e.Graphics.DrawString("Unit Price(₫)", new Font("Time New Roman", 13, FontStyle.Regular), Brushes.Black, new Point(460, 430));
                    e.Graphics.DrawString("Amount(₫)", new Font("Time New Roman", 13, FontStyle.Regular), Brushes.Black, new Point(660, 430));

                    e.Graphics.DrawString("Day", new Font("Time New Roman", 13, FontStyle.Regular), Brushes.Black, new Point(40, 460));
                    e.Graphics.DrawString(SoDem.ToString("#,#"), new Font("Time New Roman", 13, FontStyle.Regular), Brushes.Black, new Point(280, 460));
                    e.Graphics.DrawString(DonGiaPhong.ToString("#,#") + " ₫", new Font("Time New Roman", 13, FontStyle.Regular), Brushes.Black, new Point(460, 460));
                    e.Graphics.DrawString(GiaPhong.ToString("#,#") + " ₫", new Font("Time New Roman", 13, FontStyle.Regular), Brushes.Black, new Point(660, 460));

                    string    Temp = @"Select DICHVU.TENDV,SUDUNGDV.SOLUONG,DICHVU.DONGIA,SUDUNGDV.GIADV
                            From DICHVU,SUDUNGDV
                            where DICHVU.MADV=SUDUNGDV.MADV and SUDUNGDV.MAKH = '" + lblTempMAKH.Text + "'";
                    DataTable dtgv = KetNoiCSDL.LoadCSDL(Temp);

                    int Location = 460;

                    // Dữ liệu từ sử dụng dịch vụ và dịch vụ ứng với phòng đó
                    for (int i = 0; i < dtgv.Rows.Count; i++)
                    {
                        double DonGiaDV  = Convert.ToDouble(dtgv.Rows[i][2].ToString());
                        double GiaDV     = Convert.ToDouble(dtgv.Rows[i][3].ToString());
                        double SoLuongDV = Convert.ToDouble(dtgv.Rows[i][1].ToString());
                        Location += 30;
                        e.Graphics.DrawString(dtgv.Rows[i][0].ToString(), new Font("Time New Roman", 13, FontStyle.Regular), Brushes.Black, new Point(40, Location));
                        e.Graphics.DrawString(SoLuongDV.ToString("#,#"), new Font("Time New Roman", 13, FontStyle.Regular), Brushes.Black, new Point(280, Location));
                        e.Graphics.DrawString(DonGiaDV.ToString("#,#") + " ₫", new Font("Time New Roman", 13, FontStyle.Regular), Brushes.Black, new Point(460, Location));
                        e.Graphics.DrawString(GiaDV.ToString("#,#") + " ₫", new Font("Time New Roman", 13, FontStyle.Regular), Brushes.Black, new Point(660, Location));
                        TotalPay += GiaDV;
                    }

                    //Tổng tiền
                    TotalPay += GiaPhong;

                    e.Graphics.DrawString(Gach, new Font("Time New Roman", 13, FontStyle.Regular), Brushes.Black, new Point(30, Location + 30));

                    //Quy đổi ra USD theo tỷ giá Exchange
                    double QuyDoi = Convert.ToDouble(txtExchange.Text);
                    e.Graphics.DrawString("Exchange Rate: " + QuyDoi.ToString("#,#") + " ₫/$", new Font("Time New Roman", 13, FontStyle.Regular), Brushes.Black, new Point(30, Location + 60));
                    e.Graphics.DrawString("Total Pay: " + TotalPay.ToString("#,#") + " ₫" + " ≈ " + Math.Round((TotalPay / QuyDoi), 1).ToString("#,#.#") + " $ ", new Font("Time New Roman", 13, FontStyle.Regular), Brushes.Black, new Point(540, Location + 60));
                }
            }
            catch (Exception)
            {
                MessageBox.Show("No Information", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 19
0
        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);
            }
        }
Ejemplo n.º 20
0
        private void FrMaster_Load(object sender, EventArgs e)
        {
            try
            {
                cbxRoom.Items.Clear();
                cbxRoom.Focus();
                // đư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
                lblMAKH.Text = "Code";
                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();
                }
                if (lblMAKH.Text == "Code")
                {
                    lblMAKH.Text = "KH0";
                    int MA = Convert.ToInt16((lblMAKH.Text).Substring(2)) + 1;
                    lblMAKH.Text = "KH" + MA.ToString();
                }
                else
                {
                    int MA = Convert.ToInt16((lblMAKH.Text).Substring(2)) + 1;
                    lblMAKH.Text = "KH" + MA.ToString();
                }
            }
            catch (Exception)
            {
                lblMAKH.Text = "Code";
                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();
                }
                if (lblMAKH.Text == "Code")
                {
                    lblMAKH.Text = "KH0";
                    int MA = Convert.ToInt16((lblMAKH.Text).Substring(2)) + 1;
                    lblMAKH.Text = "KH" + MA.ToString();
                }
                else
                {
                    int MA = Convert.ToInt16((lblMAKH.Text).Substring(2)) + 1;
                    lblMAKH.Text = "KH" + MA.ToString();
                }
                MessageBox.Show("Thêm khách hàng mới nào!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 21
0
        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);
            }
        }