示例#1
0
 private void btnTim_Click(object sender, EventArgs e)
 {
     try
     {
         if (CbBoxSelectLoai.SelectedIndex == 2)
         {
             if (cbBoxOptionSearch.SelectedIndex == 0)
             {
                 this.dataTable = BLAcc.getMenuByID(txtSearchBox.Text);
                 this.dgvThongtin.DataSource = dataTable;
             }
             else if (cbBoxOptionSearch.SelectedIndex == 1)
             {
                 this.dataTable = BLAcc.getMenuByName(txtSearchBox.Text);
                 this.dgvThongtin.DataSource = dataTable;
             }
             else
             {
                 this.dataTable = BLAcc.getMenuAll();
                 this.dgvThongtin.DataSource = dataTable;
             }
         }
         else if (CbBoxSelectLoai.SelectedIndex == 0)
         {
             if (cbBoxOptionSearch.SelectedIndex == 0)
             {
                 this.dataTable = BLAcc.getMenuByIDAndLoai(txtSearchBox.Text, "1");
                 this.dgvThongtin.DataSource = dataTable;
             }
             else if (cbBoxOptionSearch.SelectedIndex == 1)
             {
                 this.dataTable = BLAcc.getMenuByNameAndLoai(txtSearchBox.Text, "1");
                 this.dgvThongtin.DataSource = dataTable;
             }
             else
             {
                 this.dataTable = BLAcc.getMenuByLoai("1");
                 this.dgvThongtin.DataSource = dataTable;
             }
         }
         else if (CbBoxSelectLoai.SelectedIndex == 1)
         {
             if (cbBoxOptionSearch.SelectedIndex == 0)
             {
                 this.dataTable = BLAcc.getMenuByIDAndLoai(txtSearchBox.Text, "2");
                 this.dgvThongtin.DataSource = dataTable;
             }
             else if (cbBoxOptionSearch.SelectedIndex == 1)
             {
                 this.dataTable = BLAcc.getMenuByNameAndLoai(txtSearchBox.Text, "2");
                 this.dgvThongtin.DataSource = dataTable;
             }
             else
             {
                 this.dataTable = BLAcc.getMenuByLoai("2");
                 this.dgvThongtin.DataSource = dataTable;
             }
         }
     }
     catch
     {
     }
 }