private void aceptardatos_Click(object sender, EventArgs e) { if (nombre.Text != "" && apellido1.Text != "" && apellido2.Text != "" && edad.Text != "" && v.confirmable) { name = this.nombre.Text.ToString().ToUpper(); lastname = this.apellido1.Text.ToString().ToUpper(); age = this.edad.Text.ToString(); int ageint; ageint = Convert.ToInt32(age); asientoSeleccionado = v.getNumeroAsiento() + 1; vuelo = v.ToString(); //tostring sobrecargado Pasajero p = new Pasajero(name, lastname, ageint, asientoSeleccionado, vuelo); v.setPasajero(p); foreach (int num_asiento in v.AO) { v.setAsientoOcupado(true, num_asiento); v.setAsientosDisponibles(v.getAsientos() - 1); } v.confirmable = false; Close(); } else { MessageBox.Show("COMPLETE TODOS LOS CAMPOS Y SELECCIONE UN ASIENTO"); } }
private void cancelar_Click(object sender, EventArgs e) { foreach (int element in asientoTemporal) { v.setAsientoOcupado(false, element); v.setAsientosDisponibles(v.getAsientos() + 1); } v.AO.Clear(); asientoTemporal.Clear(); v.confirmable = false; this.Close(); }