public Seat(string rowName, uint number, PricingCategory pricingCategory, SeatAvailability seatAvailability, int distanceFromRowCentroid = 0) { RowName = rowName; Number = number; PricingCategory = pricingCategory; SeatAvailability = seatAvailability; DistanceFromRowCentroid = distanceFromRowCentroid; }
public bool MatchCategory(PricingCategory pricingCategory) { if (pricingCategory == PricingCategory.Mixed) { return(true); } return(PricingCategory == pricingCategory); }
public static IEnumerable <Seat> BuildSeats(PricingCategory pricingCategory, params string[] seats) { var result = new List <Seat>(); foreach (var seat in seats) { result.Add(new Seat(pricingCategory, seat, SeatAvailability.Available, 0)); } return(result); }
private static int ComputeUnitaryPrice(PricingCategory pricingCategory, PricingMatrix pricingMatrix) { switch (pricingCategory) { case PricingCategory.First: return(pricingMatrix.Cat1Price); case PricingCategory.Second: return(pricingMatrix.Cat2Price); case PricingCategory.Third: return(pricingMatrix.Cat3Price); default: throw new ArgumentOutOfRangeException(nameof(pricingCategory), pricingCategory, null); } }
public Seat(PricingCategory pricingCategory, string seatName, SeatAvailability seatAvailability, int distanceFromRowCentroid) : this(seatName, seatName[0].ToString(), uint.Parse(seatName.Substring(1)), pricingCategory, seatAvailability, distanceFromRowCentroid) { }
private static IEnumerable <SuggestionMade> GiveMeSuggestionsFor(AuditoriumSeating auditoriumSeating, PartyRequested partyRequested, PricingCategory pricingCategory) { var foundedSuggestions = new List <SuggestionMade>(); for (var i = 0; i < NumberOfSuggestionsPerPricingCategory; i++) { var seatOptionsSuggested = auditoriumSeating.SuggestSeatingOptionFor(new SuggestionRequest(partyRequested, pricingCategory)); if (seatOptionsSuggested.MatchExpectation()) { // We get the new version of the Auditorium after the allocation auditoriumSeating = auditoriumSeating.Allocate(seatOptionsSuggested); foundedSuggestions.Add(new SuggestionMade(partyRequested, pricingCategory, seatOptionsSuggested.Seats)); } } return(foundedSuggestions); }
public SuggestionRequest(PartyRequested partyRequested, PricingCategory pricingCategory) { PartyRequested = partyRequested; PricingCategory = pricingCategory; }
public static IEnumerable <Seat> SelectAvailableSeatsCompliant(this IEnumerable <Seat> seats, PricingCategory pricingCategory) { return(seats.Where(s => s.IsAvailable() && s.MatchCategory(pricingCategory))); }
public SuggestionMade(PartyRequested partyRequested, PricingCategory pricingCategory, List <Seat> seats) { PartyRequested = partyRequested; PricingCategory = pricingCategory; _suggestedSeats = seats; }
public IEnumerable <string> SeatNames(PricingCategory pricingCategory) { var suggestionsMade = ForCategory[pricingCategory]; return(suggestionsMade.Select(s => string.Join("-", s.SeatNames()))); }
public bool MatchCategory(PricingCategory pricingCategory) { return(PricingCategory == pricingCategory); }