private void btnThem_Click(object sender, EventArgs e)
 {
     if (cbbSoLuong.Text.Length > 0 && txtMaBan.Text.Length > 0)
     {
         if (trangThaiBan == true)
         {
             // Update CTHD
             BLL.HoaDonBLL hoaDon    = new BLL.HoaDonBLL();
             DTO.HoaDonDTO hoaDonDTO = hoaDon.GetHoaDonChuaThanhToanByMaBan(txtMaBan.Text);
             BLL.CTHDBLL   cthd      = new BLL.CTHDBLL();
             if (cthd.KiemTraSanPhamTrongCTHD(hoaDonDTO.MaHD, txtMaSP.Text))
             {
                 // Đã có sản phẩm => Update CTHD
                 if (cthd.UpdateSoLuongByMaHDAndMaSp(hoaDonDTO.MaHD, txtMaSP.Text, Int32.Parse(cbbSoLuong.Text)))
                 {
                     BLL.SanPhamBLL sanPham = new BLL.SanPhamBLL();
                     int            soLuong = sanPham.GetSoLuongTonKhoByMaSP(txtMaSP.Text);
                     sanPham.UpdateSoLuongTonKhoByMaSP(txtMaSP.Text, soLuong, Int32.Parse(cbbSoLuong.Text));
                     MessageBox.Show("Thành công");
                 }
                 else
                 {
                     MessageBox.Show("Thất bại");
                 }
             }
             else
             {
                 // Chưa có sản phẩm => Tạo mới CTHD
                 // Thêm 1 CTHD
                 CreateCTHD(txtMaSP.Text, hoaDonDTO.MaHD, Int32.Parse(cbbSoLuong.Text));
                 // Update số lượng sau khi thêm CTHD
                 BLL.SanPhamBLL sanPham = new BLL.SanPhamBLL();
                 int            soLuong = sanPham.GetSoLuongTonKhoByMaSP(txtMaSP.Text);
                 sanPham.UpdateSoLuongTonKhoByMaSP(txtMaSP.Text, soLuong, Int32.Parse(cbbSoLuong.Text));
                 MessageBox.Show("Thành công");
             }
         }
         else
         {
             // Insert HD và thêm 1 bảng CTHD
             // Update trạng thái bàn
             bool check = CreateHoaDon(txtMaBan.Text);
             if (check == true)
             {
                 BLL.HoaDonBLL hoaDon    = new BLL.HoaDonBLL();
                 DTO.HoaDonDTO hoaDonDTO = hoaDon.GetHoaDonChuaThanhToanByMaBan(txtMaBan.Text);
                 // Thêm 1 CTHD
                 CreateCTHD(txtMaSP.Text, hoaDonDTO.MaHD, Int32.Parse(cbbSoLuong.Text));
                 // Update số lượng sau khi thêm CTHD
                 BLL.SanPhamBLL sanPham = new BLL.SanPhamBLL();
                 int            soLuong = sanPham.GetSoLuongTonKhoByMaSP(txtMaSP.Text);
                 sanPham.UpdateSoLuongTonKhoByMaSP(txtMaSP.Text, soLuong, Int32.Parse(cbbSoLuong.Text));
                 // thay đỗi trạng thái bàn => Có người
                 BLL.BanBLL ban = new BLL.BanBLL();
                 ban.UpdateBanKhiLapHoaDon(txtMaBan.Text);
                 MessageBox.Show("Thành công");
             }
         }
         BLL.BanBLL ban1 = new BLL.BanBLL();
         trangThaiBan = ban1.LoadTrangThaiBanByMaBan(txtMaBan.Text);
         if (trangThaiBan == true)
         {
             listViewHoaDon.Items.Clear();
             ShowHoaDon(txtMaBan.Text);
         }
     }
     else
     {
         MessageBox.Show("Chọn bàn và số lượng trước khi thêm dữ liệu", "Thông báo");
     }
     // Load lại ds sản phẩm và bàn
     LoadDanhSachSanPham();
     LoadTableList();
 }