コード例 #1
0
 private void Btnsearch_Click(object sender, EventArgs e)
 {
     try
     {
         if (cbBoxSelect.SelectedIndex == 2)
         {
             if (cbBoxIDTen.SelectedIndex == 0)
             {
                 this.dataTable = BLAcc.getStaffDHaveAccbyID(txtsearch.Text);
                 this.dgvTaiKhoan.DataSource = dataTable;
             }
             else if (cbBoxIDTen.SelectedIndex == 1)
             {
                 this.dataTable = BLAcc.getStaffDHaveAccbyName(txtsearch.Text);
                 this.dgvTaiKhoan.DataSource = dataTable;
             }
             else
             {
                 this.dataTable = BLAcc.getStaffDHaveAcc();
                 this.dgvTaiKhoan.DataSource = dataTable;
             }
         }
         else if (cbBoxSelect.SelectedIndex == 0)
         {
             if (cbBoxIDTen.SelectedIndex == 0)
             {
                 this.dataTable = BLAcc.getStaffDHaveAccByIDAndPosition(txtsearch.Text, "1");
                 this.dgvTaiKhoan.DataSource = dataTable;
             }
             else if (cbBoxIDTen.SelectedIndex == 1)
             {
                 this.dataTable = BLAcc.getStaffDHaveAccByNameAndPosition(txtsearch.Text, "1");
                 this.dgvTaiKhoan.DataSource = dataTable;
             }
             else
             {
                 this.dataTable = BLAcc.getStaffDHaveAccByPosition("1");
                 this.dgvTaiKhoan.DataSource = dataTable;
             }
         }
         else if (cbBoxSelect.SelectedIndex == 1)
         {
             if (cbBoxIDTen.SelectedIndex == 0)
             {
                 this.dataTable = BLAcc.getStaffDHaveAccByIDAndPosition(txtsearch.Text, "2");
                 this.dgvTaiKhoan.DataSource = dataTable;
             }
             else if (cbBoxSelect.SelectedIndex == 1)
             {
                 this.dataTable = BLAcc.getStaffDHaveAccByNameAndPosition(txtsearch.Text, "2");
                 this.dgvTaiKhoan.DataSource = dataTable;
             }
             else
             {
                 this.dataTable = BLAcc.getStaffDHaveAccByPosition("2");
                 this.dgvTaiKhoan.DataSource = dataTable;
             }
         }
     }
     catch
     {
     }
 }