Esempio n. 1
0
        private void spNinos_ValueChanged(object sender, EventArgs e)
        {
            Codigo_Interfaz_Vuelo civ = new Codigo_Interfaz_Vuelo();

            txtHabitaciones.Text = civ.Cantidad_Habitaciones(Decimal.ToInt32(spAdultos.Value), Decimal.ToInt32(spNinos.Value));
            Cambiar_Vehiculos();
        }
Esempio n. 2
0
 /// <summary>
 /// This method looks for hotels
 /// </summary>
 public void Hotel()
 {
     string[] lugar = txtDestino.Text.Split(',');
     if (chbHotel.Checked && !lugar[0].Equals(String.Empty) && !txtHabitaciones.Text.Equals(String.Empty))
     {
         Codigo_Interfaz_Vuelo civ = new Codigo_Interfaz_Vuelo();
         hoteles = civ.Cargar_AutoCompletar_Hoteles(dataHoteles, lugar[0], int.Parse(txtHabitaciones.Text));
     }
     pbHotel.Image = null;
 }
Esempio n. 3
0
 private void btnBuscar_Click(object sender, EventArgs e)
 {
     if (!txtOrigen.Text.Equals(String.Empty) && !txtDestino.Text.Equals(String.Empty) && txtOrigen.Text != txtDestino.Text)
     {
         Codigo_Interfaz_Vuelo civ = new Codigo_Interfaz_Vuelo();
         civ.Buscar_Vuelos(dataAeropuertos, txtOrigen.Text.ToString(), txtDestino.Text.ToString());
     }
     else
     {
         MessageBox.Show("Rellene los espacios");
     }
 }
Esempio n. 4
0
 /// <summary>
 /// This method looks for cars
 /// </summary>
 public void Cambiar_Vehiculos()
 {
     if (chbVehiculo.Checked)
     {
         Codigo_Interfaz_Vuelo civ = new Codigo_Interfaz_Vuelo();
         civ.Buscar_Vehiculos(dataVehiculo, (decimal.ToInt32(spAdultos.Value) + decimal.ToInt32(spNinos.Value)));
     }
     else
     {
         dataVehiculo.Columns.Clear();
     }
 }
Esempio n. 5
0
 private void btnBuscarHotel_Click(object sender, EventArgs e)
 {
     if (chbHotel.Checked)
     {
         if (cbTipo.SelectedItem.Equals("Ciudad"))
         {
             Codigo_Interfaz_Vuelo civ = new Codigo_Interfaz_Vuelo();
             hoteles = civ.Cargar_Buscar_HotelesCiudad(dataHoteles, txtBuscar.Text, int.Parse(txtHabitaciones.Text));
             this.dataHoteles.Columns["foto_hotel"].Visible = false;
             pbHotel.Image = null;
         }
         else
         {
             Codigo_Interfaz_Vuelo civ = new Codigo_Interfaz_Vuelo();
             hoteles = civ.Cargar_Buscar_Hotel(dataHoteles, txtBuscar.Text, int.Parse(txtHabitaciones.Text));
             this.dataHoteles.Columns["foto_hotel"].Visible = false;
             pbHotel.Image = null;
         }
     }
     else
     {
         MessageBox.Show("Coloque el check de agregar hotel");
     }
 }
Esempio n. 6
0
        private void Interfaz_Vuelos_Load(object sender, EventArgs e)
        {
            Codigo_Interfaz_Vuelo civ = new Codigo_Interfaz_Vuelo();

            civ.Cargar_AutoCompletar(txtOrigen, txtDestino);
        }
Esempio n. 7
0
        /// <summary>
        /// Check if is a purchase or reservation and send to the database
        /// </summary>
        /// <param name="compra_reserva"></param>
        /// <returns>A boolean for know if it is a purchase or reservation</returns>
        private bool Comprar_Reservar(bool compra_reserva)
        {
            bool     comprado_reservado = false;
            string   datestart          = dateTimePicker1.Value.ToString("yyyy-MM-dd");
            DateTime fecha_ini          = DateTime.Parse(datestart);
            string   datefinal          = dateTimePicker2.Value.ToString("yyyy-MM-dd");
            DateTime fecha_fin          = DateTime.Parse(datefinal);

            if (dataAeropuertos.SelectedRows.Count > 0 && chVuelo.Checked)
            {
                if (dataHoteles.SelectedRows.Count > 0 && chbHotel.Checked)
                {
                    if (dataVehiculo.SelectedRows.Count > 0 && chbVehiculo.Checked)
                    {
                        hotel      = (Hotel)dataHoteles.CurrentRow.DataBoundItem;
                        aeropuerto = (Vuelo)dataAeropuertos.CurrentRow.DataBoundItem;
                        vehiculo   = (Vehiculos)dataVehiculo.CurrentRow.DataBoundItem;
                        Compra_Reserva compra_reserva_ = new Compra_Reserva(0,
                                                                            usuario.getCedula,
                                                                            aeropuerto.pais_origen,
                                                                            aeropuerto.pais_destino,
                                                                            aeropuerto.escala,
                                                                            aeropuerto.duracion,
                                                                            aeropuerto.precio,
                                                                            fecha_ini,
                                                                            fecha_fin,
                                                                            (int)spAdultos.Value,
                                                                            (int)spNinos.Value,
                                                                            int.Parse(txtHabitaciones.Text),
                                                                            hotel.id_hotel,
                                                                            hotel.precio,
                                                                            vehiculo.id_vehiculo,
                                                                            vehiculo.precio,
                                                                            true,
                                                                            true,
                                                                            true,
                                                                            compra_reserva
                                                                            );
                        if (compra_reserva_.reserva_compra)
                        {
                            Puntuacion_Hotel ph = new Puntuacion_Hotel(compra_reserva_);
                            ph.ShowDialog();
                        }
                        Codigo_Interfaz_Vuelo civ = new Codigo_Interfaz_Vuelo();
                        comprado_reservado = civ.Agregar_Compra_Reserva(compra_reserva_);
                    }
                    else
                    {
                        hotel      = (Hotel)dataHoteles.CurrentRow.DataBoundItem;
                        aeropuerto = (Vuelo)dataAeropuertos.CurrentRow.DataBoundItem;
                        Compra_Reserva compra_reserva_ = new Compra_Reserva(0,
                                                                            usuario.getCedula,
                                                                            aeropuerto.pais_origen,
                                                                            aeropuerto.pais_destino,
                                                                            aeropuerto.escala,
                                                                            aeropuerto.duracion,
                                                                            aeropuerto.precio,
                                                                            fecha_ini,
                                                                            fecha_fin,
                                                                            (int)spAdultos.Value,
                                                                            (int)spNinos.Value,
                                                                            int.Parse(txtHabitaciones.Text),
                                                                            hotel.id_hotel,
                                                                            hotel.precio,
                                                                            vehiculo.id_vehiculo,
                                                                            vehiculo.precio,
                                                                            true,
                                                                            true,
                                                                            false,
                                                                            compra_reserva
                                                                            );
                        if (compra_reserva_.reserva_compra)
                        {
                            Puntuacion_Hotel ph = new Puntuacion_Hotel(compra_reserva_);
                            ph.ShowDialog();
                        }
                        Codigo_Interfaz_Vuelo civ = new Codigo_Interfaz_Vuelo();
                        comprado_reservado = civ.Agregar_Compra_Reserva(compra_reserva_);
                    }
                }
                else
                {
                    if (dataVehiculo.SelectedRows.Count > 0 && chbVehiculo.Checked)
                    {
                        aeropuerto = (Vuelo)dataAeropuertos.CurrentRow.DataBoundItem;
                        vehiculo   = (Vehiculos)dataVehiculo.CurrentRow.DataBoundItem;
                        Compra_Reserva compra_reserva_ = new Compra_Reserva(0,
                                                                            usuario.getCedula,
                                                                            aeropuerto.pais_origen,
                                                                            aeropuerto.pais_destino,
                                                                            aeropuerto.escala,
                                                                            aeropuerto.duracion,
                                                                            aeropuerto.precio,
                                                                            fecha_ini,
                                                                            fecha_fin,
                                                                            (int)spAdultos.Value,
                                                                            (int)spNinos.Value,
                                                                            int.Parse(txtHabitaciones.Text),
                                                                            hotel.id_hotel,
                                                                            hotel.precio,
                                                                            vehiculo.id_vehiculo,
                                                                            vehiculo.precio,
                                                                            true,
                                                                            false,
                                                                            true,
                                                                            compra_reserva
                                                                            );
                        Codigo_Interfaz_Vuelo civ = new Codigo_Interfaz_Vuelo();
                        comprado_reservado = civ.Agregar_Compra_Reserva(compra_reserva_);
                    }
                    else
                    {
                        aeropuerto = (Vuelo)dataAeropuertos.CurrentRow.DataBoundItem;
                        Compra_Reserva compra_reserva_ = new Compra_Reserva(0,
                                                                            usuario.getCedula,
                                                                            aeropuerto.pais_origen,
                                                                            aeropuerto.pais_destino,
                                                                            aeropuerto.escala,
                                                                            aeropuerto.duracion,
                                                                            aeropuerto.precio,
                                                                            fecha_ini,
                                                                            fecha_fin,
                                                                            (int)spAdultos.Value,
                                                                            (int)spNinos.Value,
                                                                            int.Parse(txtHabitaciones.Text),
                                                                            hotel.id_hotel,
                                                                            hotel.precio,
                                                                            vehiculo.id_vehiculo,
                                                                            vehiculo.precio,
                                                                            true,
                                                                            false,
                                                                            false,
                                                                            compra_reserva
                                                                            );
                        Codigo_Interfaz_Vuelo civ = new Codigo_Interfaz_Vuelo();
                        comprado_reservado = civ.Agregar_Compra_Reserva(compra_reserva_);
                    }
                }
            }
            else
            {
                if (dataHoteles.SelectedRows.Count > 0 && chbHotel.Checked)
                {
                    if (dataVehiculo.SelectedRows.Count > 0 && chbVehiculo.Checked)
                    {
                        hotel    = (Hotel)dataHoteles.CurrentRow.DataBoundItem;
                        vehiculo = (Vehiculos)dataVehiculo.CurrentRow.DataBoundItem;
                        Compra_Reserva compra_reserva_ = new Compra_Reserva(0,
                                                                            usuario.getCedula,
                                                                            aeropuerto.pais_origen,
                                                                            aeropuerto.pais_destino,
                                                                            aeropuerto.escala,
                                                                            aeropuerto.duracion,
                                                                            aeropuerto.precio,
                                                                            fecha_ini,
                                                                            fecha_fin,
                                                                            (int)spAdultos.Value,
                                                                            (int)spNinos.Value,
                                                                            int.Parse(txtHabitaciones.Text),
                                                                            hotel.id_hotel,
                                                                            hotel.precio,
                                                                            vehiculo.id_vehiculo,
                                                                            vehiculo.precio,
                                                                            false,
                                                                            true,
                                                                            true,
                                                                            compra_reserva
                                                                            );
                        if (compra_reserva_.reserva_compra)
                        {
                            Puntuacion_Hotel ph = new Puntuacion_Hotel(compra_reserva_);
                            ph.ShowDialog();
                        }
                        Codigo_Interfaz_Vuelo civ = new Codigo_Interfaz_Vuelo();
                        comprado_reservado = civ.Agregar_Compra_Reserva(compra_reserva_);
                    }
                }
                else
                {
                    if (dataVehiculo.SelectedRows.Count > 0 && chbVehiculo.Checked)
                    {
                        vehiculo = (Vehiculos)dataVehiculo.CurrentRow.DataBoundItem;
                        Compra_Reserva compra_reserva_ = new Compra_Reserva(0,
                                                                            usuario.getCedula,
                                                                            aeropuerto.pais_origen,
                                                                            aeropuerto.pais_destino,
                                                                            aeropuerto.escala,
                                                                            aeropuerto.duracion,
                                                                            aeropuerto.precio,
                                                                            fecha_ini,
                                                                            fecha_fin,
                                                                            (int)spAdultos.Value,
                                                                            (int)spNinos.Value,
                                                                            int.Parse(txtHabitaciones.Text),
                                                                            hotel.id_hotel,
                                                                            hotel.precio,
                                                                            vehiculo.id_vehiculo,
                                                                            vehiculo.precio,
                                                                            false,
                                                                            false,
                                                                            true,
                                                                            compra_reserva
                                                                            );
                        Codigo_Interfaz_Vuelo civ = new Codigo_Interfaz_Vuelo();
                        comprado_reservado = civ.Agregar_Compra_Reserva(compra_reserva_);
                    }
                    else
                    {
                        MessageBox.Show("Seleccione algun vuelo o hotel o vehiculo");
                    }
                }
            }
            return(comprado_reservado);
        }