void LoadData()
        {
            List<KhachHang> khachHang = new List<KhachHang>();
            KhachHangBUS busKhachHang = new KhachHangBUS();

            khachHang = busKhachHang.GetList();

            dataGrid.Items.Clear();

            tbMaKhachHang.Clear();
            tbTenKhachHang.Clear();
            tbDiaChi.Clear();
            tbSoDienThoai.Clear();
            tbEmail.Clear();

            id = 1;
            foreach (KhachHang i in khachHang)
            {
                ThongTinKhachHang thongTinKhachHang = new ThongTinKhachHang();

                thongTinKhachHang.MaKhachHang = int.Parse(i.MaKH);
                thongTinKhachHang.TenKhachHang = i.TenKH;
                thongTinKhachHang.DiaChi = i.DiaChiKH;
                thongTinKhachHang.SoDienThoai = i.SoDienThoai;
                thongTinKhachHang.Email = i.Email;

                dataGrid.IsReadOnly = true;
                dataGrid.Items.Add(thongTinKhachHang);

                if (id < int.Parse(i.MaKH))
                {
                    id = int.Parse(i.MaKH);
                }
            }
        }
        private void btTim_Click(object sender, RoutedEventArgs e)
        {
            List<KhachHang> khachHang = new List<KhachHang>();
            KhachHangBUS busKhachHang = new KhachHangBUS();

            khachHang = busKhachHang.GetList();

            dataGrid.Items.Clear();

            foreach(KhachHang i in khachHang)
            {
                if (String.Compare(tbTenKhachHang.Text, i.TenKH, true) == 0)
                {
                    ThongTinKhachHang thongTinKhachHang = new ThongTinKhachHang();

                    thongTinKhachHang.MaKhachHang = int.Parse(i.MaKH);
                    thongTinKhachHang.TenKhachHang = i.TenKH;
                    thongTinKhachHang.DiaChi = i.DiaChiKH;
                    thongTinKhachHang.SoDienThoai = i.SoDienThoai;
                    thongTinKhachHang.Email = i.Email;

                    dataGrid.IsReadOnly = true;
                    dataGrid.Items.Add(thongTinKhachHang);
                }
            }
        }
        private void btThem_Click(object sender, RoutedEventArgs e)
        {
            KhachHang khachHang = new KhachHang() { MaKH = (++id).ToString(), TenKH = tbTenKhachHang.Text, DiaChiKH = tbDiaChi.Text, SoDienThoai = tbSoDienThoai.Text, Email = tbEmail.Text };

            KhachHangBUS bus = new KhachHangBUS();

            try
            {
                bus.Insert(khachHang);

                MessageBox.Show("Thêm thành công !");
            }
            catch (Exception)
            {
                MessageBox.Show("Thêm thất bại !");
            }

            LoadData();
        }
        private void btSua_Click(object sender, RoutedEventArgs e)
        {
            KhachHang khachHang = new KhachHang() { MaKH = tbMaKhachHang.Text, TenKH = tbTenKhachHang.Text, DiaChiKH = tbDiaChi.Text, SoDienThoai = tbSoDienThoai.Text, Email = tbEmail.Text };

            KhachHangBUS bus = new KhachHangBUS();

            try
            {
                bus.Update(khachHang);

                MessageBox.Show("Sửa thành công !");
            }
            catch (Exception)
            {
                MessageBox.Show("Sửa thất bại !");
            }

            LoadData();
        }
        private void btXoa_Click(object sender, RoutedEventArgs e)
        {
            KhachHangBUS bus = new KhachHangBUS();

            try
            {
                bus.Delete(tbMaKhachHang.Text);

                MessageBox.Show("Xóa thành công !");
            }
            catch (Exception)
            {
                MessageBox.Show("Xóa thất bại !");
            }


            LoadData();
        }