/** * Mmodify a search leg to use economy class of service as preferred. * * @param outbound the leg to modify */ public static void AddEconomyPreferred(SearchAirLeg outbound) { AirLegModifiers modifiers = new AirLegModifiers(); AirLegModifiersPreferredCabins cabins = new AirLegModifiersPreferredCabins(); CabinClass cabinClass = new CabinClass(); cabinClass.Type = "Economy"; cabins.CabinClass = cabinClass; modifiers.PreferredCabins = cabins; outbound.AirLegModifiers = modifiers; }
public Seat(string seatNumber, CabinClass cabinClass, bool isReserved) { #region Sanity Check if (seatNumber == null || seatNumber.Trim().Length == 0) { throw new ArgumentNullException("seatNumber", "The 'seatNumber' argument is required."); } #endregion this.seatNumber = seatNumber; this.cabinClass = cabinClass; this.isReserved = isReserved; }
public FlightSearchRequest(int adults, int children, int seniors, int infantsWithSeat, int infantsWithoutSeat, int youths, CabinClass cabinClass, string airline, bool flexibleDates, bool isDirect, SearchCriteria[] searchCriteria) : base(searchCriteria) { Adults = adults; Children = children; Seniors = seniors; InfantsWithSeat = infantsWithSeat; InfantsWithoutSeat = infantsWithoutSeat; Youths = youths; CabinClass = cabinClass; Airline = airline; FlexibleDates = flexibleDates; ProductType = ProductType.Flight; SearchCriteria = searchCriteria; FindFlightSearchRequestType(); }
public Cabin(CabinClass cabinClass, int startRow, int endRow, string seatLetters, IList reservedSeats) { this.cabinClass = cabinClass; this.startRow = startRow; this.endRow = endRow; this.seatLetters = seatLetters; for (int i = startRow; i <= endRow; i++) { foreach (char c in seatLetters) { string seatNumber = i.ToString() + c; bool isReserved = reservedSeats.Contains(seatNumber); seats.Add(seatNumber, new Seat(seatNumber, cabinClass, isReserved)); if (!isReserved) { availableSeats++; } } } }
public string ReserveSeat(CabinClass cabinClass, string seatNumber) { if (cabins.Contains(cabinClass)) { return ((Cabin) cabins[cabinClass]).ReserveSeat(seatNumber); } CalculateSeatPlan(); throw new ArgumentException("Specified cabin class does not exist on this flight.", "cabinClass"); }
public Cabin(CabinClass cabinClass, int startRow, int endRow, string seatLetters) : this(cabinClass, startRow, endRow, seatLetters, new ArrayList()) {}
/// <summary> /// Initializes a new instance of the FlightRequestSettings with the specified parameters /// </summary> /// <param name="origin">The origin city or airport</param> /// <param name="destination">The destination city or airport</param> /// <param name="outboundDate">The departure date</param> /// <param name="inboundDate">The return date if the query is for a two-way flight</param> /// <param name="adults">Number of adults traveling (min 0, max 8)</param> /// <param name="children">Number of children traveling (min 0, max 8)</param> /// <param name="infants">Number of infants traveling (min 0, max number of adults)</param> /// <param name="groupPricing">Show price-per-adult (false), or price for all passengers (true)</param> /// <param name="cabinClass">Cabin class of the flight</param> /// <param name="marketCountry">The user’s market country</param> /// <param name="currency">The user’s currency</param> /// <param name="locale">The user’s localization preference</param> /// <param name="locationSchema">The code schema used for locations</param> public FlightRequestSettings(Location origin, Location destination, LocalDate outboundDate, LocalDate? inboundDate = null, int adults = 1, int children = 0, int infants = 0, bool groupPricing = true, CabinClass cabinClass = CabinClass.Economy, Market marketCountry = null, Currency currency = null, Locale locale = null, LocationSchema locationSchema = LocationSchema.Iata) { if (origin == null) { throw new ArgumentNullException(nameof(origin)); } if (destination == null) { throw new ArgumentNullException(nameof(destination)); } if (origin.PlaceId == destination.PlaceId) { throw new ArgumentException("Origin and destination are the same", nameof(destination)); } if (inboundDate.HasValue && inboundDate.Value < outboundDate) { throw new ArgumentException("Return flight cannot be earlier than the outbound flight", nameof(outboundDate)); } if (adults < 0 || adults > 8) { throw new ArgumentException("The number of adults traveling must be between 0 and 8", nameof(adults)); } if (children < 0 || children > 8) { throw new ArgumentException("The number of children traveling must be between 0 and 8", nameof(children)); } if (infants < 0 || infants > adults) { throw new ArgumentException("The number of infants traveling must be between 0 and the number of adults", nameof(infants)); } if (adults == 0 && children == 0) { throw new ArgumentException("Can't search for 0 person", nameof(adults)); } Origin = origin; Destination = destination; OutboundDate = outboundDate; InboundDate = inboundDate; Adults = adults; Children = children; Infants = infants; GroupPricing = groupPricing; CabinClass = cabinClass; MarketCountry = marketCountry ?? Market.Default; Currency = currency ?? Currency.Default; Locale = locale ?? Locale.Default; LocationSchema = locationSchema; }