示例#1
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     string key = this.txtSearch.Text;
     if (key == "".Trim())
     {
         MessageBox.Show("Please enter keyword!", "Notice");
         return;
     }
     string catalog = "";
     //MessageBox.Show(this.cboSearch.SelectedItem.ToString());
     if (this.cboSearch.SelectedItem.ToString() == "Voucher")
     {
         catalog += "phieutra.maphieutra";
         //MessageBox.Show(catalog);
     }
     else if (this.cboSearch.SelectedItem.ToString() == "Certificate")
     {
         catalog += "sachmuon.maphieumuon";
         //MessageBox.Show(catalog);
     }
     VoucherBLL bookStatusBLL = new VoucherBLL();
     List<VoucherBLL> voucherStatusArr = new List<VoucherBLL>();
     voucherStatusArr = VoucherDAL.search(key, catalog);
     this.dgvVoucherStt.Rows.Clear();
     if (voucherStatusArr != null)
     {
         //MessageBox.Show("ok");
         foreach (VoucherBLL row in voucherStatusArr)
         {
             this.dgvVoucherStt.Rows.Add(row.Phieutra, row.Phieumuon, row.Ngaytra, row.Docgia, row.Doituong);
         }
     }
     else
     {
         MessageBox.Show("Sorry! Can't find this voucher/certificate");
         return;
     }
     this.GetSelectedValue();
     this.dgvVoucherStt.SelectionChanged += new EventHandler(dgvCertificateStt_SelectionChanged);
 }
示例#2
0
 private void LoadDataToGridView()
 {
     this.dgvVoucherStt.Rows.Clear();
     VoucherBLL manageVoucherBLL = new VoucherBLL();
     List<VoucherBLL> manageVoucherArr = new List<VoucherBLL>();
     manageVoucherArr = VoucherDAL.getManageVoucherList();
     //MessageBox.Show("ok");
     foreach (VoucherBLL row in manageVoucherArr)
     {
         this.dgvVoucherStt.Rows.Add(row.Phieutra, row.Phieumuon, row.Ngaytra, row.Docgia, row.Doituong);
     }
     this.GetSelectedValue();
     this.dgvVoucherStt.SelectionChanged += new EventHandler(dgvCertificateStt_SelectionChanged);
 }