Example #1
0
 private void txttracuu_TextChanged(object sender, EventArgs e)
 {
     //if (cbotimkiem.Text == "Mã sách")
     //{
     //    dgvSach.DataSource = HienDL(" select * from SACH where MaSach like '%" + txttracuu.Text.Trim() + "%' ");
     //}
     //if (cbotimkiem.Text == "Tên sách")
     //{
     //    dgvSach.DataSource = HienDL(" select * from SACH where TenSach like N'%" + txttracuu.Text.Trim() + "%' ");
     //}
     //if (cbotimkiem.Text == "Năm xuất bản")
     //{
     //    dgvSach.DataSource = HienDL(" select * from SACH where NamXB like '%" + txttracuu.Text.Trim() + "%' ");
     //}
     //if (cbotimkiem.Text == "Tác giả")
     //{
     //    dgvSach.DataSource = HienDL(" select * from SACH where TacGia like N'%" + txttracuu.Text.Trim() + "%' ");
     //}
     if (txttracuu.Text.Trim() == "")
     {
         List <Sach_DTO> lstSach = Sach_BUS.LayDSSach();
         dgvSach.DataSource = lstSach;
     }
     else
     {
         List <Sach_DTO> lstTimKiem = Sach_BUS.TimSach(dieukien, txttracuu.Text);
         dgvSach.DataSource = lstTimKiem;
     }
 }
Example #2
0
 private void btnBook_Search_Click(object sender, EventArgs e)
 {
     if (txtBook_Search.Text != "")
     {
         dtgBook.AutoGenerateColumns = false;
         dtgBook.DataSource          = sach_BUS.TimSach(txtBook_Search.Text);
     }
     else
     {
         frmBook_Load(sender, e);
     }
 }
Example #3
0
 private void btnXem_Click(object sender, EventArgs e)
 {
     if (cboMaThe.Text == "Tất cả")
     {
         Sach_DTOBindingSource.DataSource = Sach_BUS.LayDSSach();
         this.reportViewer1.RefreshReport();
     }
     else if (cboDieuKien.Text == "Tên sách")
     {
         dieukien = "TenSach";
         Sach_DTOBindingSource.DataSource = Sach_BUS.TimSach(dieukien, cboMaThe.Text);
         this.reportViewer1.RefreshReport();
     }
     else if (cboDieuKien.Text == "Mã sách")
     {
         dieukien = "MaSach";
         Sach_DTOBindingSource.DataSource = Sach_BUS.TimSach(dieukien, cboMaThe.Text);
         //dieukien = cboMaThe.SelectedValue.ToString();
         //List<SachMuon_DTO> lstTimKiem = SachMuon_BUS.TimSach(dieukien, txttracuu.Text);
         //DgvSachMuon.DataSource = lstTimKiem;
         this.reportViewer1.RefreshReport();
     }
     else if (cboDieuKien.Text == "Năm xuất bản")
     {
         dieukien = "NamXB";
         Sach_DTOBindingSource.DataSource = Sach_BUS.TimSach(dieukien, cboMaThe.Text);
         //dieukien = cboMaThe.SelectedValue.ToString();
         //List<SachMuon_DTO> lstTimKiem = SachMuon_BUS.TimSach(dieukien, txttracuu.Text);
         //DgvSachMuon.DataSource = lstTimKiem;
         this.reportViewer1.RefreshReport();
     }
     else if (cboDieuKien.Text == "Tác giả")
     {
         dieukien = "TacGia";
         Sach_DTOBindingSource.DataSource = Sach_BUS.TimSach(dieukien, cboMaThe.Text);
         //dieukien = cboMaThe.SelectedValue.ToString();
         //List<SachMuon_DTO> lstTimKiem = SachMuon_BUS.TimSach(dieukien, txttracuu.Text);
         //DgvSachMuon.DataSource = lstTimKiem;
         this.reportViewer1.RefreshReport();
     }
 }