private void DgvNguoiThue_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { btnXoa.Enabled = true; KhachHangBAL bal = new KhachHangBAL(); dgvTimNguoiThue.DataSource = bal.TimTheoCM(dgvNguoiThue.SelectedRows[0].Cells[1].Value.ToString()); } catch { } }
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; } } }