private void btnChinhSua_Click(object sender, EventArgs e)
 {
     if (texMaKhachHang.Text == "" || texMaKhachHang.Text == null)
     {
         MessageBox.Show("Bạn Cần Nhập Mã Khách Hàng Trước Khi Thêm");
         return;
     }
     else if (cbLoaiKhachHang.SelectedIndex == -1)
     {
         MessageBox.Show("Bạn Cần Chọn Loại Khách Hàng Trước Khi Thêm");
         return;
     }
     else
     {
         HienThiKhachHangBLL hienThiKhachHangBLL = new HienThiKhachHangBLL();
         KhachHang           khachHang           = new KhachHang()
         {
             MaKhachHang  = texMaKhachHang.Text,
             TenKhachHang = texTenKhachHang.Text,
             DiaChi       = texDiaChi.Text,
             ChungMinhThu = texSoChungMinh.Text,
             DienThoai    = texDienThoai.Text,
             GioiTinh     = cbGioiTinh.Text,
             NgaySinh     = dateNgaySinh.Value
         };
         if (cbLoaiKhachHang.SelectedIndex != -1)
         {
             LoaiKhachHang loaiKhachHang = cbLoaiKhachHang.SelectedItem as LoaiKhachHang;
             khachHang.LoaiKhachHang = loaiKhachHang.MaLoaiKhachHang;
         }
         hienThiKhachHangBLL.SuaThongTinKhachHang(khachHang);
         if (LKH == null)
         {
             HienThiDanhSachKhachHang();
         }
         else
         {
             List <KhachHang> DanhSachKhachHang = new List <KhachHang>();
             DanhSachKhachHang = hienThiKhachHangBLL.HienThiDanhSachKhachHangTheoLoai(LKH.MaLoaiKhachHang);
             HienThiDanhSachKH(DanhSachKhachHang);
         }
     }
 }
 private void tvPhanLoaiKhachHang_AfterSelect(object sender, TreeViewEventArgs e)
 {
     if (e.Node != null)
     {
         if (e.Node == tvPhanLoaiKhachHang.Nodes[0].Nodes[0])
         {
             HienThiDanhSachKhachHang();
         }
     }
     if (e.Node.Level == 2)
     {
         LoaiKhachHang       loaikhachHang       = e.Node.Tag as LoaiKhachHang;
         HienThiKhachHangBLL hienThiKhachHangBLL = new HienThiKhachHangBLL();
         List <KhachHang>    DanhSachKhachHang   = hienThiKhachHangBLL.HienThiDanhSachKhachHangTheoLoai(loaikhachHang.MaLoaiKhachHang);
         HienThiDanhSachKH(DanhSachKhachHang);
         LKH = loaikhachHang;
     }
     else
     {
         LKH = null;
         return;
     }
 }