Пример #1
0
 private void btn_buscar_Click(object sender, EventArgs e)
 {
     comportamientos.limpiar_grilla(dgv_proveedores);
     if (txt_CUIT.Text.Trim() == "" && txt_RazonSocial.Text.Trim() == "" && chk_todos.Checked == false && txt_Nombre.Text == "" &&
         txt_Apellido.Text == "")
     {
         MessageBox.Show("No se ingresaron parámetros.");
     }
     else
     {
         NG_Proveedores prov  = new NG_Proveedores();
         DataTable      tabla = new DataTable();
         if (chk_todos.Checked)
         {
             tabla = prov.buscar_todos();
             cargar_grilla(tabla);
             limpiar();
         }
         else if (txt_RazonSocial.Text.Trim() != "")
         {
             //Buscar por razon Social.
             tabla = prov.buscar_razonSocial(txt_RazonSocial.Text);
             cargar_grilla(tabla);
             limpiar();
         }
         else if (txt_CUIT.Text != "")
         {
             // Buscar por CUIT
             tabla = prov.buscar_CUIT(txt_CUIT.Text);
             cargar_grilla(tabla);
             limpiar();
         }
         else if (txt_Apellido.Text != "" && txt_Nombre.Text != "")
         {
             // Buscar nombre y apellido
             tabla = prov.buscar_nombre_apellido(txt_Nombre.Text, txt_Apellido.Text);
             cargar_grilla(tabla);
             limpiar();
         }
         else if (txt_Apellido.Text != "")
         {
             // Buscar apellido
             tabla = prov.buscar_apellido(txt_Apellido.Text);
             cargar_grilla(tabla);
             limpiar();
         }
         else if (txt_Nombre.Text != "")
         {
             // Buscar nombre
             tabla = prov.buscar_nombre(txt_Nombre.Text);
             cargar_grilla(tabla);
             limpiar();
         }
         if (tabla.Rows.Count == 0)
         {
             MessageBox.Show("No se encontraron resultados");
         }
     }
 }
Пример #2
0
 private void btn_eliminar_Click(object sender, EventArgs e)
 {
     if (dgv_proveedores.SelectedRows.Count == 0)
     {
         MessageBox.Show("No ha seleccionado ningún provedor.");
     }
     else
     {
         DialogResult result = MessageBox.Show("¿Seguro que desea eliminar?", "Aviso", MessageBoxButtons.YesNo);
         if (result == DialogResult.Yes)
         {
             NG_Proveedores prov = new NG_Proveedores();
             prov.eliminar(dgv_proveedores.CurrentRow.Cells[0].Value.ToString());
         }
     }
 }