public FormRegistoVenta(ref ListaVuelos listVuelos, char origen, char destino, Pasajero pasajero)
        {
            InitializeComponent();

            this.listVuelos           = listVuelos;
            this.indiceSeleccionado   = new int();
            this.pasajeroAux          = pasajero;
            this.textBoxNombre.Text   = pasajero.Nombre;
            this.textBoxApellido.Text = pasajero.Apellido;
            this.textBoxEdad.Text     = pasajero.Edad.ToString();

            this.textBoxNombre.Enabled   = false;
            this.textBoxApellido.Enabled = false;
            this.textBoxEdad.Enabled     = false;

            for (int i = 0; i < listVuelos.Count; i++)
            {
                if (listVuelos[i].getOrigen() == origen && listVuelos[i].getDestino() == destino)
                {
                    indiceSeleccionado = i;
                }
            }

            identificadorAsiento = -1;
            labelVuelo.Text      = "Vuelo " + listVuelos[indiceSeleccionado].getCodigo() +
                                   "\nOrigen: " + listVuelos[indiceSeleccionado].getOrigen() +
                                   "\nDestino: " + listVuelos[indiceSeleccionado].getDestino() +
                                   "\nTiempo de Vuelo: " + listVuelos[indiceSeleccionado].getTiempo().ToString() + " min" +
                                   "\nCosto: $" + listVuelos[indiceSeleccionado].getCosto().ToString();

            if (identificadorAsiento == -1)
            {
                buttonVenta.Enabled = false;
            }
        }
        private void buttonVenta_MouseClick(object sender, MouseEventArgs e)
        {
            if (pasajeroAux == null)
            {
                this.pasajeroAux = new Pasajero(textBoxNombre.Text, textBoxApellido.Text, Int32.Parse(textBoxEdad.Text),
                                                identificadorAsiento, listVuelos[indiceSeleccionado].getCodigo());
            }

            this.listVuelos[indiceSeleccionado].setPasajero(pasajeroAux);
            this.listVuelos[indiceSeleccionado].reducirAsiento(identificadorAsiento);
            this.Close();
        }
Beispiel #3
0
 public void setPasajero(Pasajero pasajero)
 {
     listPasajeros.Add(pasajero);
 }