private void Avios_seleccion_Load(object sender, EventArgs e) { if (comboBox1.SelectedIndex >= 0) { DAO.AviosDAO aviosdao = new GrupoSM_Recepcion.DAO.AviosDAO(); aviosdao.tipo = comboBox1.SelectedIndex; dataGridView1.DataSource = aviosdao.busca_aviosportipobase(); } else { DAO.AviosDAO aviosdao = new GrupoSM_Recepcion.DAO.AviosDAO(); dataGridView1.DataSource = aviosdao.devuelveaviostipobase(); } }
private void textBox5_TextChanged(object sender, EventArgs e) { //if (comboBox1.SelectedIndex == 0) //{ // campo = "nombre_prenda"; //} //else //{ // campo = "modelo"; //} string campo = "nombre"; DAO.AviosDAO aviosdao = new GrupoSM_Recepcion.DAO.AviosDAO(); DataView dv; if (label1.Text == "Catalogo avios") { if (comboBox1.SelectedIndex != -1) { aviosdao.tipo = comboBox1.SelectedIndex; dv = new DataView(aviosdao.busca_aviosportipobase()); } else { dv = new DataView(aviosdao.devuelveaviostipobase()); } } else { if (comboBox1.SelectedIndex != -1) { aviosdao.tipo = comboBox1.SelectedIndex; dv = new DataView(aviosdao.buscatipobodega()); } else { dv = new DataView(aviosdao.aviosbodega()); } } dv.RowFilter = campo + " like '%" + textBox5.Text + "%'"; dataGridView1.DataSource = dv; }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { try { if (comboBox1.SelectedIndex >= 0) { DAO.AviosDAO aviosdao = new GrupoSM_Recepcion.DAO.AviosDAO(); aviosdao.tipo = comboBox1.SelectedIndex; dataGridView1.DataSource = aviosdao.busca_aviosportipobase(); } else { DAO.AviosDAO aviosdao = new GrupoSM_Recepcion.DAO.AviosDAO(); dataGridView1.DataSource = aviosdao.devuelveaviostipobase(); } } catch { MessageBox.Show("Por favor, escoja una categoria"); } }