public void reload(int check) { if (check == 0) { dtMenu = BLAcc.getMenuAll(); } else { dtMenu = BLAcc.getMenuByLoai(check.ToString()); } cbBoxTenMon.Items.Clear(); foreach (DataRow x in dtMenu.Rows) { cbBoxTenMon.Items.Add(x[1].ToString()); } }
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 { } }