private void btnThemMon_Click_1(object sender, EventArgs e)
        {
            try
            {
                using (var k = new AppCode.QuanCafe())
                {
                    //Kiem tra trang thai ban
                    var kqtimban = k.TimBan(AppCode.STBan.idBan);
                    if (kqtimban.TrangThai == "Trống")
                    {
                        if (MessageBox.Show("Bạn muốn mỡ bàn này?", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
                        {
                            var o = new Ban()
                            {
                                IDBan     = kqtimban.IDBan,
                                TenBan    = kqtimban.TenBan,
                                TrangThai = "Có người"
                            };
                            //cap nhat trang thai ban
                            k.CapNhatBan(o);
                            flpDSBan.Controls.Clear();
                            LoadDSBan();
                        }
                        else
                        {
                            return;
                        }
                    }



                    int rowSelected = grvDSDoUongF.CurrentRow.Index;
                    // dataGridView.Rows[rowSelected].Cells[i].Value;
                    var hd = k.TimHoaDonTheoIDBan(AppCode.STBan.idBan);
                    //Ban chua co hoa don
                    if (hd == null)
                    {
                        MessageBox.Show("dat tao hd");

                        hd = new HoaDon()
                        {
                            TrangThai     = false,
                            NgayLap       = DateTime.Now,
                            IDNhanVienLap = AppCode.STNhanVien.idNhanVien,
                            IDBan         = AppCode.STBan.idBan,
                        };


                        //var hd = new HoaDonADO(
                        //    0,
                        //    AppCode.STBan.idBan,
                        //    DateTime.Now,
                        //    AppCode.STNhanVien.idNhanVien,
                        //   false
                        //);

                        var kq1 = k.ThemHoaDon(hd);
                        AppCode.STHoaDon.idHoaDon = hd.IDHoaDon;
                    }


                    if (hd != null)
                    {
                        var cthd = new CTHoaDonADO()
                        {
                            IDHoaDon = hd.IDHoaDon,
                            IDDoUong = k.TimDoUongTheoTen(grvDSDoUongF.Rows[rowSelected].Cells[0].Value.ToString()).IDDoUong,
                            SoLuong  = int.Parse(nudSoLuong.Value.ToString()),
                            GiaGoc   = k.TimDoUongTheoTen(grvDSDoUongF.Rows[rowSelected].Cells[0].Value.ToString()).GiaGoc,
                            GiaBan   = double.Parse(grvDSDoUongF.Rows[rowSelected].Cells[3].Value.ToString())
                        };


                        string sql = @"SP_GOIMON '" + cthd.IDHoaDon + "', '" + cthd.IDDoUong + "','" + cthd.SoLuong + "','" + cthd.GiaGoc + "','" + cthd.GiaBan + "' ";
                        var    gt  = XuLyDuLieu.ThucThiThemXoaSua(sql);
                        MessageBox.Show(gt.ToString());
                        LoadDSCTHD(hd.IDHoaDon);
                        LoadTongTien();
                        LoadDSDoUong();
                    }
                }
            }
            catch
            {
                return;
            }
        }