示例#1
0
 private void BtnSearch_Click(object sender, EventArgs e)
 {
     try
     {
         if (cbBoxOptionSearch.SelectedIndex == 4)
         {
             if (cbBoxOptionIDName.SelectedIndex == 0)
             {
                 this.dataTable = BLAcc.getNVbyID(txtSearchBox.Text);
                 this.dgvThongTinNV.DataSource = dataTable;
             }
             else if (cbBoxOptionIDName.SelectedIndex == 1)
             {
                 this.dataTable = BLAcc.getNVbyName(txtSearchBox.Text);
                 this.dgvThongTinNV.DataSource = dataTable;
             }
             else
             {
                 this.dataTable = BLAcc.getStaffAll();
                 this.dgvThongTinNV.DataSource = dataTable;
             }
         }
         else if (cbBoxOptionSearch.SelectedIndex == 0)
         {
             if (cbBoxOptionIDName.SelectedIndex == 0)
             {
                 this.dataTable = BLAcc.getStaffByIDAndPosition(txtSearchBox.Text, "2");
                 this.dgvThongTinNV.DataSource = dataTable;
             }
             else if (cbBoxOptionIDName.SelectedIndex == 1)
             {
                 this.dataTable = BLAcc.getStaffByNameAndPosition(txtSearchBox.Text, "2");
                 this.dgvThongTinNV.DataSource = dataTable;
             }
             else
             {
                 this.dataTable = BLAcc.getChucVu("2");
                 this.dgvThongTinNV.DataSource = dataTable;
             }
         }
         else if (cbBoxOptionSearch.SelectedIndex == 1)
         {
             if (cbBoxOptionIDName.SelectedIndex == 0)
             {
                 this.dataTable = BLAcc.getStaffByIDAndPosition(txtSearchBox.Text, "1");
                 this.dgvThongTinNV.DataSource = dataTable;
             }
             else if (cbBoxOptionIDName.SelectedIndex == 1)
             {
                 this.dataTable = BLAcc.getStaffByNameAndPosition(txtSearchBox.Text, "1");
                 this.dgvThongTinNV.DataSource = dataTable;
             }
             else
             {
                 this.dataTable = BLAcc.getChucVu("1");
                 this.dgvThongTinNV.DataSource = dataTable;
             }
         }
         else if (cbBoxOptionSearch.SelectedIndex == 2)
         {
             if (cbBoxOptionIDName.SelectedIndex == 0)
             {
                 this.dataTable = BLAcc.getStaffByIDAndPosition(txtSearchBox.Text, "3");
                 this.dgvThongTinNV.DataSource = dataTable;
             }
             else if (cbBoxOptionIDName.SelectedIndex == 1)
             {
                 this.dataTable = BLAcc.getStaffByNameAndPosition(txtSearchBox.Text, "3");
                 this.dgvThongTinNV.DataSource = dataTable;
             }
             else
             {
                 this.dataTable = BLAcc.getChucVu("3");
                 this.dgvThongTinNV.DataSource = dataTable;
             }
         }
         else if (cbBoxOptionSearch.SelectedIndex == 3)
         {
             if (cbBoxOptionIDName.SelectedIndex == 0)
             {
                 this.dataTable = BLAcc.getStaffByIDAndPosition(txtSearchBox.Text, "4");
                 this.dgvThongTinNV.DataSource = dataTable;
             }
             else if (cbBoxOptionIDName.SelectedIndex == 1)
             {
                 this.dataTable = BLAcc.getStaffByNameAndPosition(txtSearchBox.Text, "4");
                 this.dgvThongTinNV.DataSource = dataTable;
             }
             else
             {
                 this.dataTable = BLAcc.getChucVu("4");
                 this.dgvThongTinNV.DataSource = dataTable;
             }
         }
     }
     catch
     {
     }
 }