Beispiel #1
0
        private void BtnTim_Click(object sender, EventArgs e)
        {
            KhachHangBAL bal = new KhachHangBAL();
            string       s   = txtTimNguoiThue.Text;
            KhachHang    k   = new KhachHang();

            k = bal.TimTheoCM(s);
            if (string.IsNullOrWhiteSpace(s) == false)
            {
                if (string.IsNullOrWhiteSpace(k.CMND) != true)
                {
                    dgvNguoiThue.DataSource = bal.Tai1KHTheoCM(k.CMND);
                    txtCMND.Text            = k.CMND;
                    txtDienThoai.Text       = k.SDT;
                    txtHoKhau.Text          = k.HoKhau;
                    txtHoTen.Text           = k.TenKH;
                    txtNgaySinh.Text        = k.NamSinh.ToString();
                    comboBox1.Text          = k.GioiTinh;

                    ThongTinHopDong(txtCMND.Text);
                    return;
                }
                k = bal.TimTheoTen(s);
                if (string.IsNullOrWhiteSpace(k.TenKH) != true)
                {
                    dgvNguoiThue.DataSource = bal.Tai1KHTheoTen(k.TenKH);
                    txtCMND.Text            = k.CMND;
                    txtDienThoai.Text       = k.SDT;
                    txtHoKhau.Text          = k.HoKhau;
                    txtHoTen.Text           = k.TenKH;
                    comboBox1.Text          = k.GioiTinh;
                    txtNgaySinh.Text        = k.NamSinh.ToString();
                    ThongTinHopDong(txtCMND.Text);
                    return;
                }
                else
                {
                    MessageBox.Show("Không Tìm Thấy");
                    return;
                }
            }
        }
Beispiel #2
0
 private void BtnTim_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(txtCMND.Text))
     {
         MessageBox.Show("Vui lòng nhập thông tin để tìm");
     }
     else
     {
         KhachHangBAL     bal = new KhachHangBAL();
         List <KhachHang> kq  = bal.TimTheoTen(txtCMND.Text);
         if (kq != null)
         {
             dgvTimNguoiThue.DataSource = kq;
         }
         else
         {
             MessageBox.Show("Không tìm thấy !", "Thông báo", MessageBoxButtons.OK);
         }
     }
 }