Esempio n. 1
0
 private void txtBuscar_KeyUp(object sender, KeyEventArgs e)
 {
     try
     {
         Animal_Negocio animalNegocio = new Animal_Negocio();
         if (this.cbBuscar.SelectedIndex == -1)
         {
             this.txtBuscar.Enabled = false;
             //MessageBox.Show("Debe seleccionar un parámetro a buscar en el combo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else if (this.cbBuscar.SelectedItem.ToString() == "Nombre animal")
         {
             this.dgvAnimales.DataSource = animalNegocio.FiltrarPorNombre(this.txtBuscar.Text, idtambo);
         }
         else if (this.cbBuscar.SelectedItem.ToString() == "Estado")
         {
             this.dgvAnimales.DataSource = animalNegocio.FiltrarPorEstado(this.txtBuscar.Text, idtambo);
         }
         else if (this.cbBuscar.SelectedItem.ToString() == "Caravana")
         {
             this.dgvAnimales.DataSource = animalNegocio.FiltrarPorCaravana(this.txtBuscar.Text, idtambo);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ocurrió un error", MessageBoxButtons.OK);
     }
 }
Esempio n. 2
0
 private void toolStripTextBox1_KeyUp(object sender, KeyEventArgs e)
 {
     try
     {
         Animal_Negocio animalNegocio = new Animal_Negocio();
         this.dgvAnimales.DataSource = animalNegocio.FiltrarPorCaravana(this.tstxtBuscar.Text, idtambo);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ocurrió un error", MessageBoxButtons.OK);
     }
 }