/// <summary> /// Sets the passangers. /// </summary> /// <param name="passangers">The passangers.</param> public void SetPassangers(InterJetPassangers passangers) { int paxCounter = 0; var controlsStack = new Stack <ucInterJetPassangerConfirmationUserControl>(); foreach (InterJetPassanger pax in passangers.GetAll()) { var newPaxConfirmation = new ucInterJetPassangerConfirmationUserControl(); if (paxCounter == 0) { int X_DefaultCoordinate = 16; int Y_DefaultCoordinate = 19; newPaxConfirmation.Location = new Point(X_DefaultCoordinate, Y_DefaultCoordinate); } else { var previousControl = controlsStack.Pop(); int yDisplacement = 30;// deberia ser 38 newPaxConfirmation.Location = new Point(previousControl.Location.X, previousControl.Location.Y + yDisplacement); } newPaxConfirmation.SetPassanger(pax); this.MainContainer.Controls.Add(newPaxConfirmation); controlsStack.Push(newPaxConfirmation); paxCounter += 1; } }
/// <summary> /// Gets the passangers. /// </summary> /// <returns></returns> public InterJetPassangers GetPassangers() { var passangers = new List <InterJetPassanger>(); var userInput = (InterJetAvailabilityUserInput)this.Session["UserInput"]; if (userInput != null) { if (userInput.HasAdultsPassangers) { passangers.AddRange(this.GetPassangers(this.PassangerGroupBox, InterJetPassangerType.Adult)); } if (userInput.HasChildrenPassangers) { passangers.AddRange(this.GetPassangers(this.PassangerGroupBox, InterJetPassangerType.Child)); } if (userInput.HasSeniorsPassangers) { passangers.AddRange(this.GetPassangers(this.PassangerGroupBox, InterJetPassangerType.Senior)); } } var interJetPassangers = new InterJetPassangers(); interJetPassangers.AddPassangers(passangers); foreach (var pax in interJetPassangers.GetAll()) { pax.Nationality = this.NationalityComboBox.SelectedValue.ToString(); } return(interJetPassangers); }