Exemplo n.º 1
0
        private short[] GetPaxNumbers(dto.Booking booking, Leg leg, int journeyIndex, int segmentIndex, short?paxNumber, bool isUnassign)
        {
            var paxNumbers = new List <short>();

            if (!paxNumber.HasValue)
            {
                // Auto-assign seats for paxes who don't yet have a seat -OR- Auto-unassign paxes who have a seat and not already checked in and not yet flown.
                var segmentPaxSeats = booking.Journeys[journeyIndex].Segments[segmentIndex].PaxSeats;
                var paxSegments     = booking.Journeys[journeyIndex].Segments[segmentIndex].PaxSegments;
                foreach (var pax in booking.Passengers)
                {
                    var paxSegment = paxSegments.ToList().Find(p => p.PassengerNumber == pax.PassengerNumber);
                    if (paxSegment.LiftStatus == dto.Enumerations.LiftStatus.Default)
                    {
                        var paxSeat = segmentPaxSeats.ToList().Find(p => p.PassengerNumber == pax.PassengerNumber && p.DepartureStation == leg.DepartureStation && p.ArrivalStation == leg.ArrivalStation);
                        if (!isUnassign ? paxSeat == null : paxSeat != null)
                        {
                            paxNumbers.Add(pax.PassengerNumber);
                        }
                    }
                }
                if (paxNumbers.Count() == 0)
                {
                    throw !isUnassign ? new dto.ResponseErrorException(dto.Enumerations.ResponseErrorCode.AllSeatsAlreadyAssigned, "All paxes already have assigned seats. ")
                        : new dto.ResponseErrorException(dto.Enumerations.ResponseErrorCode.NoSeatsToUnAssign, "No paxes have seats to unassign. ");
                }
            }
            else
            {
                paxNumbers.Add(paxNumber.Value);
            }
            return(paxNumbers.ToArray());
        }
Exemplo n.º 2
0
        private bool PaxCountsAreTheSame(dto.Booking booking, dto.SellJourneyByKeyRequestData sellJourneyByKeyRequestData)
        {
            var adtCount        = sellJourneyByKeyRequestData.PaxTypeCounts.ToList().Find(p => p.PaxTypeCode == Global.ADULT_CODE)?.PaxCount;
            var chdCount        = sellJourneyByKeyRequestData.PaxTypeCounts.ToList().Find(p => p.PaxTypeCode == Global.CHILD_CODE)?.PaxCount;
            var infCount        = sellJourneyByKeyRequestData.PaxTypeCounts.ToList().Find(p => p.PaxTypeCode == Global.INFANT_CODE)?.PaxCount;
            var bookingAdtCount = booking.Passengers.ToList().FindAll(p => p.PassengerTypeInfo.PaxType == "ADT").Count();
            var bookingChdCount = booking.Passengers.ToList().FindAll(p => p.PassengerTypeInfo.PaxType == "CHD").Count();
            var bookingInfCount = booking.Passengers.ToList().FindAll(p => p.Infant != null).Count();

            return((adtCount.HasValue ? adtCount.Value : 0) == bookingAdtCount &&
                   (chdCount.HasValue ? chdCount.Value : 0) == bookingChdCount &&
                   (infCount.HasValue ? infCount.Value : 0) == bookingInfCount);
        }
Exemplo n.º 3
0
        private dto.PaxTypeCount[] GetPaxTypeCounts(dto.Booking booking)
        {
            var adtCount          = booking.Passengers.ToList().FindAll(p => p.PassengerTypeInfo.PaxType == Global.ADULT_CODE).Count();
            var chdCount          = booking.Passengers.ToList().FindAll(p => p.PassengerTypeInfo.PaxType == Global.CHILD_CODE).Count();
            var paxTypeCountsList = new List <dto.PaxTypeCount>();

            if (adtCount > 0)
            {
                paxTypeCountsList.Add(new dto.PaxTypeCount {
                    PaxTypeCode = Global.ADULT_CODE, PaxCount = (short)adtCount
                });
            }
            if (chdCount > 0)
            {
                paxTypeCountsList.Add(new dto.PaxTypeCount {
                    PaxTypeCode = Global.CHILD_CODE, PaxCount = (short)chdCount
                });
            }
            return(paxTypeCountsList.ToArray());
        }