private void bunifuThinButton21_Click(object sender, EventArgs e) { try { if (id.SelectedItem.ToString() == "" || precio.Text == "") { MessageBox.Show("Llene todos los campos Requeridos!", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { Herencia_TVuelos tv = new Herencia_TVuelos(); tv.Id = Convert.ToInt32(id.SelectedItem.ToString()); tv.Idruta = Convert.ToInt32(rutas.CurrentRow.Cells[0].Value.ToString()); tv.Precio = Convert.ToInt32(precio.Text); pv.insertarTarifa(tv.Id, tv.Precio, tv.Idruta); } } catch (Exception error) { MessageBox.Show("Seleccione una ruta! " + error.Message, "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } id.Items.Clear(); id.Text = ""; pv.llenarCombo(id, "SELECT ru.id FROM ruta as ru where ru.id not in (select tv.ruta from tarifa_vuelo as tv)"); id.SelectedIndex = -1; precio.Text = ""; pv.llenarRutas(rutas); rutas.ClearSelection(); }
private void bunifuThinButton22_Click(object sender, EventArgs e) { try { if (newprecio.Text == "") { errorProvider1.SetError(newprecio, "Ingrese un Precio!"); } else { errorProvider1.Clear(); Herencia_TVuelos tv = new Herencia_TVuelos(); tv.Id = Convert.ToInt32(newid.Text); tv.Idruta = Convert.ToInt32(newruta.CurrentRow.Cells[0].Value.ToString()); tv.Precio = Convert.ToInt32(newprecio.Text); pv.modificarTarifa(Convert.ToInt32(tv.Id), Convert.ToInt32(tv.Precio), Convert.ToInt32(tv.Idruta)); pv.mostrarInfo(modificarinfo); } } catch (Exception error) { MessageBox.Show("Ha ocurrido un error! " + error.Message, "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Error); } newid.Text = ""; newprecio.Text = ""; newruta.ClearSelection(); }