/// <summary> /// Método para crear la instancia de la clase DAOVuelo y usa el método ConsultarLugarOrigen /// </summary> /// <returns>Retorna true si la accion se realizo</returns> public override List <Entidad> ejecutar() { try { DAOVuelo exec = (DAOVuelo)FabricaDAO.instanciarDAOVuelo(); return(exec.ConsultarLugarOrigen()); } catch (ReservaExceptionM04 ex) { Log.EscribirError(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name, ex); throw ex; } catch (SqlException ex) { Log.EscribirError(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name, ex); throw ex; } catch (Exception ex) { Log.EscribirError(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name, ex); throw ex; } }
public int obtener_vueloID() { string matricula = ((Aeronave)cmbMatricula.SelectedItem).matricula; //bool arribo_correcto = false; DAOVuelo daoVuelo = new DAOVuelo(); List<Vuelo> LsVuelos = new List<Vuelo>(); LsVuelos = daoVuelo.search(DAOAeronave.getAeronaveFromMatricula(matricula).id); int vuelo_id =0; DateTime fecha_llegada_form = new DateTime(dateLlegada.Value.Year, dateLlegada.Value.Month, dateLlegada.Value.Day, horaLlegada.Value.Hour, horaLlegada.Value.Minute, horaLlegada.Value.Second); foreach (Vuelo velo in LsVuelos) { TimeSpan dif_horas = new TimeSpan(); dif_horas = fecha_llegada_form - velo.fechaSalida; if(DateTime.Compare(fecha_llegada_form,velo.fechaSalida)>0) { if(dif_horas.TotalHours < 24){ vuelo_id = (int)velo.id; //Console.WriteLine(velo.id); // arribo_correcto = true; } } // else { MessageBox.Show("¡La Aeronave no tenia vuelo Planificado a esa HORA, Call 911!", "Error", MessageBoxButtons.OK); } } return vuelo_id; }
public bool validarRuta() { string matricula = ((Aeronave)cmbMatricula.SelectedItem).matricula; bool ruta_correcta = false; DAOVuelo daoVuelo = new DAOVuelo(); List<Vuelo> LsVuelos = new List<Vuelo>(); Ruta ruta = new Ruta(); string origen = ((Ciudad)cmbAOrigen.SelectedItem).nombre; string destino = ((Ciudad)cmbASalia.SelectedItem).nombre; LsVuelos = daoVuelo.search(DAOAeronave.getAeronaveFromMatricula(matricula).id); int ruta_elex = ruta.getRuta(origen, destino); foreach (Vuelo velo in LsVuelos) { if (velo.ruta.Equals(ruta_elex)) { ruta_correcta = true; } } return ruta_correcta; }
public bool validarMatricula() { // matricula, hora de llegada y ruta string matricula = ((Aeronave)cmbMatricula.SelectedItem).matricula; bool existe = false; DAOVuelo daoVuelo = new DAOVuelo(); List<Vuelo> LsVuelos = new List<Vuelo>(); LsVuelos = daoVuelo.search(DAOAeronave.getAeronaveFromMatricula(matricula).id); if (LsVuelos.Count > 0) { existe = true; } // else { MessageBox.Show("¡La Aeronave no tenia vuelo Planificado, Call 911!", "Error", MessageBoxButtons.OK); } return existe; }