Пример #1
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            ListaPasajeros listPAux = new ListaPasajeros();

            if (textBoxBusqueda.Text == "")
            {
                actualizaListView();
            }
            else
            {
                listViewPasajeros.Items.Clear();

                for (int i = 0; i < listVuelos.Count; i++)
                {
                    for (int j = 0; j < listVuelos[i].getNumPasajeros(); j++)
                    {
                        bool band = true;
                        for (int k = 0; k < textBoxBusqueda.Text.Length && k < listVuelos[i].getPasajero(j).getNombreCompleto().Length; k++)
                        {
                            if (listVuelos[i].getPasajero(j).getNombreCompleto()[k] != textBoxBusqueda.Text[k])
                            {
                                band = false;
                                break;
                            }
                        }
                        if (band)
                        {
                            listPAux.Add(listVuelos[i].getPasajero(j));
                        }
                    }
                }

                for (int j = 0; j < listPAux.Count; j++)
                {
                    string[] cadenas = new string[3];

                    cadenas[0] = listPAux[j].getRuta();
                    cadenas[1] = listPAux[j].getNombreCompleto();
                    cadenas[2] = listPAux[j].getAsiento();
                    ListViewItem item = new ListViewItem(cadenas);
                    listViewPasajeros.Items.Add(item);
                }
            }
        }
Пример #2
0
 public void setPasajero(Pasajero pasajero)
 {
     listPasajeros.Add(pasajero);
 }