private void button1_Click(object sender, EventArgs e) { int resultado = new ViajesRepository().generarViaje( ( RutaAerea ) ruta.SelectedItem, ( Aeronave ) aeronave.SelectedItem, Convert.ToDateTime( salida.Value ), Convert.ToDateTime( llegadaEstimada.Value )); if (resultado == -1) MessageBox.Show("Fechas Ingresadas invalidas"); else if (resultado == -2) MessageBox.Show("El servicio de la Aeronave y la ruta no concuerdan"); else { MessageBox.Show("Viaje dado de alta exitosamente"); this.Close(); } }
public ViajesService() { conexion = new SqlConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=CoomulsoftApp;Integrated Security=True"); viajesrepository = new ViajesRepository(conexion); }