private void bunifuFlatButton1_Click(object sender, EventArgs e) { try { if (id_inruta.Text == "") { MessageBox.Show("Ingrese un Identificador!", "Aviso!"); } else if (bd.MostrarDatos("SELECT id FROM ruta WHERE id = '" + id_inruta.Text + "'") == id_inruta.Text) { MessageBox.Show("Ese Identificador de Ruta ya Existe!", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { Herencia_Rutas hr = new Herencia_Rutas(); hr.Id = Convert.ToInt32(id_inruta.Text); hr.Origen = pais_origenin.SelectedItem.ToString(); hr.Destino = pais_destinoin.SelectedItem.ToString(); hr.Duracion = duracionin.Text; pr.registrarRuta(hr.Id, hr.Origen, hr.Destino, hr.Duracion); MessageBox.Show("Se ha registrado Correctamente!", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception error) { MessageBox.Show("Ha ocurrido un error! " + error.Message, "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Error); } id_inruta.Text = ""; pais_origenin.SelectedIndex = -1; pais_destinoin.SelectedIndex = -1; duracionin.SelectedIndex = 0; }
private void bunifuFlatButton2_Click(object sender, EventArgs e) { Herencia_Rutas hr = new Herencia_Rutas(); hr.Id = Convert.ToInt32(id_modi.Text); hr.Origen = neworigen.SelectedItem.ToString(); hr.Destino = newdestiny.SelectedItem.ToString(); hr.Duracion = newduration.Text; pr.modificarRuta(hr.Id, hr.Origen, hr.Destino, hr.Duracion); pr.mostrarInfoDataGrid(modify_info); id_modi.Text = ""; neworigen.Text = ""; newdestiny.Text = ""; newduration.Text = "0:00"; }