//Cần code mở ra xem private void txtTimKiem_TextChanged(object sender, EventArgs e) { String str = txtTimKiem.Text.ToString(); if (lblHienHanh.Text.Equals(HOADON)) { if (str == "" || str == null) { dataGridView2.DataSource = _hdService.DanhSachHoaDon(); dataGridDetail.DataSource = null; } else { dataGridView2.DataSource = _hdService.TimKiemHoaDon(str); try { if (dataGridView2.DataSource != null) { String mahd = dataGridView2.CurrentRow.Cells[0].Value.ToString(); String manv = dataGridView2.CurrentRow.Cells[1].Value.ToString(); String makh = dataGridView2.CurrentRow.Cells[2].Value.ToString(); dataGridDetail.DataSource = _hdService.DanhSachCTHoaDon(mahd, manv, makh); } } catch { dataGridDetail.DataSource = null; } } } if (lblHienHanh.Text.Equals(PHIEUNHAP)) { if (str == "" || str == null) { dataGridView2.DataSource = _pnService.DanhSachPhieuNhap(); dataGridDetail.DataSource = null; } else { dataGridView2.DataSource = _pnService.TimKiemPhieuNhap(str); try { if (dataGridView2.DataSource != null) { String mapn = dataGridView2.CurrentRow.Cells[0].Value.ToString(); String manv = dataGridView2.CurrentRow.Cells[1].Value.ToString(); String mancc = dataGridView2.CurrentRow.Cells[2].Value.ToString(); dataGridDetail.DataSource = _pnService.DanhSachCTPhieuNhap(mapn, manv, mancc); } } catch { dataGridDetail.DataSource = null; } } } if (lblHienHanh.Text.Equals(HANGHOA)) { if (str == "" || str == null) { dataGridView.DataSource = _spService.DanhSachSanPham(); } else { dataGridView.DataSource = _spService.TimKiemSanPham(str); } } if (lblHienHanh.Text.Equals(KHACHHANG)) { if (str == "" || str == null) { dataGridView.DataSource = _khService.DanhSachKhachHang(); } else { dataGridView.DataSource = _khService.TimKiemKhachHang(str); } } if (lblHienHanh.Text.Equals(NHACUNGCAP)) { if (str == "" || str == null) { dataGridView.DataSource = _nccService.DanhSachNhaCungCap(); } else { dataGridView.DataSource = _nccService.TimKiemNhaCungCap(str); } } if (lblHienHanh.Text.Equals(NHANVIEN)) { if (str == "" || str == null) { dataGridView.DataSource = _nvService.DanhSachNhanVien(); } else { dataGridView.DataSource = _nvService.TimKiemNhanVien(str); } } }