private void sellbutton_Click(object sender, EventArgs e) { if (isValid(nomval, apeval, edavel)) { Pasajeros p = new Pasajeros(textBoxNombre.Text, textBoxApellidos.Text, textBoxEdad.Text, labelAsiento.Text); vuelo[ind].setPasajeros(p); vuelo[ind].setAsientos(Int32.Parse(labelAsiento.Text) - 1); vuelo[ind].contarDisponibles(); labelAsiento.Text = "Asientos Disponibles " + (count - 1); terminadoExito = true; this.Close(); } }
public void setPasajero(Pasajeros pasa) { this.listaP.Add(pasa); }
/* * public Vuelo(string datos) * { * this.listaP = new List<Pasajeros>(); * this.asientosDisp = new bool[type]; * inicializaAsientos(); * this.o = datos[0].ToString(); * this.d = datos[1].ToString(); * int z = 3; * string dia = ""; * string mes = ""; * string anio = ""; * string hora = ""; * string min = ""; * bool coma = true; * while (coma) * { * if (datos[z] != ',') * { * dia += datos[z]; * } * else * { * coma = false; * } * z++; * } * coma = true; * while (coma) * { * if (datos[z] != ',') * { * mes += datos[z]; * } * else * { * coma = false; * } * z++; * } * coma = true; * while (coma) * { * if (datos[z] != ',') * { * anio += datos[z]; * } * else * { * coma = false; * } * z++; * } * coma = true; * while (coma) * { * if (datos[z] != ',') * { * hora += datos[z]; * } * else * { * coma = false; * } * z++; * } * coma = true; * while (coma) * { * if (datos[z] != ',') * { * min += datos[z]; * } * else * { * coma = false; * } * z++; * } * this.fecha = new DateTime(Int32.Parse(anio), Int32.Parse(mes), Int32.Parse(dia), Int32.Parse(hora), Int32.Parse(min), 0); * coma = true; * dia = ""; * while (coma) * { * if (datos[z] != ',') * { * dia += datos[z]; * } * else * { * coma = false; * } * z++; * } * this.costo = Int32.Parse(dia); * coma = true; * dia = ""; * while (coma) * { * if (datos[z] != ',') * { * dia += datos[z]; * } * else * { * coma = false; * } * z++; * } * this.duracion = Int32.Parse(dia); * coma = true; * dia = ""; * dia += datos[z]; * z++; * dia += datos[z]; * z++; * int asientosO = Int32.Parse(dia); * for (int i = 0; i < asientosO; i++) * { * dia = ""; * dia += datos[z]; * z++; * dia += datos[z]; * this.asientosDisp[Int32.Parse(dia)] = false; * z++; * } * } */ public void setPasajeros(Pasajeros pas) { }