Beispiel #1
0
 private void textBoxBuscar_TextChanged(object sender, EventArgs e)
 {
     foreach (Vuelo v in lv)
     {
         foreach (Pasajero p in v.getLp())
         {
             if (textBoxBuscar.Text == "")
             {
                 actializarListBoxt(lpO);
             }
             else
             {
                 if (radioButtonNombre.Checked)
                 {
                     lpF = lpO.busquedaPasajeros(1, textBoxBuscar.Text);
                 }
                 else if (radioButtonVuelo.Checked)
                 {
                     lpF = lpO.busquedaPasajeros(2, textBoxBuscar.Text);
                 }
                 else
                 {
                     lpF = lpO.busquedaPasajeros(3, textBoxBuscar.Text);
                 }
                 actializarListBoxt(lpF);
             }
         }
     }
 }
Beispiel #2
0
 public Vuelo(string origen, string destino, int costo, int tiempo)
 {
     this.origen  = origen.ToUpper();
     this.destino = destino.ToUpper();
     this.costo   = costo;
     this.tiempo  = tiempo;
     this.ruta    = "SK1" + origen.ToUpper() + destino.ToUpper();
     lp           = new ListaPasajeros();
 }
Beispiel #3
0
 private void actializarListBoxt(ListaPasajeros lp)
 {
     lisBoxPasajeros.Items.Clear();
     for (int i = 0; i < lp.Count; i++)
     {
         lisBoxPasajeros.Items.Add(lp[i].getNomAp() + "\t" + lp[i].getRuta() + "\t" + lp[i].getAsiento());
     }
     lisBoxPasajeros.Refresh();
     buttonEliminar.Enabled = false;
 }
Beispiel #4
0
 private void cargaPasajeros(ListaVuelos lv)
 {
     lpO.Clear();
     foreach (Vuelo v in lv)
     {
         foreach (Pasajero p in v.getLp())
         {
             lpO.Add(p);
             actializarListBoxt(lpO);
         }
     }
     lpF = lpO;
 }
Beispiel #5
0
        public ListaPasajeros busquedaPasajeros(int opc, string dato)
        {
            ListaPasajeros lpF = new ListaPasajeros();

            dato = dato.ToUpper();
            int aux;

            switch (opc)
            {
            case 1:

                for (int i = 0; i < this.Count; i++)
                {
                    int j;
                    for (j = 0; j < dato.Length; j++)
                    {
                        if (this[i].getNomAp()[j] != dato[j])
                        {
                            break;
                        }
                    }
                    if (j == dato.Length)
                    {
                        lpF.Add(this[i]);
                    }
                }

                break;

            case 2:

                for (int i = 0; i < this.Count; i++)
                {
                    int j;
                    for (j = 0; j < dato.Length; j++)
                    {
                        if (this[i].getRuta()[j] != dato[j])
                        {
                            break;
                        }
                    }
                    if (j == dato.Length)
                    {
                        lpF.Add(this[i]);
                    }
                }
                break;

            case 3:
                Int32.TryParse(dato, out aux);

                for (int i = 0; i < this.Count; i++)
                {
                    int j;
                    for (j = 0; j < dato.Length; j++)
                    {
                        if (this[i].getAsiento() != aux)
                        {
                            break;
                        }
                    }
                    if (j == dato.Length)
                    {
                        lpF.Add(this[i]);
                    }
                }


                break;
            }

            return(lpF);
        }