Beispiel #1
0
        /// <summary>
        /// 更新特殊票资源数
        /// </summary>
        /// <param name="pnrPair"></param>
        /// <param name="isFullFlight">是否所有航段都是实际航段【非弃程】</param>
        /// <param name="patPrice"></param>
        /// <param name="isStandby"></param>
        /// <param name="checkPat"></param>
        /// <param name="isthridRelation"></param>
        /// <returns></returns>
        internal bool UpdateContentForResource(PNRPair pnrPair, bool isFullFlight, decimal?patPrice, bool isStandby, Guid oemId, bool checkPat = false, bool isthridRelation = false)
        {
            bool result = false;

            if (!(_flights.First().Bunk is FreeBunk) && (checkPat || !isthridRelation))
            {
                if (!patPrice.HasValue)
                {
                    throw new CustomException("缺少编码价格信息");
                }
                checkFare(patPrice.Value);
                apportionFare(patPrice.Value);
                _passengers.ForEach(passenger => passenger.RefreshPrice());
                result = true;
            }
            Code = pnrPair;
            if (!isStandby && (!checkPat || !isthridRelation))
            {
                //if (string.IsNullOrEmpty(pnrPair.PNR))
                //{
                //    var firstFlight = _flights.First();
                //    var transferPNRResult = CommandService.TransferPNRCode(pnrPair, new FlightNumber(firstFlight.Carrier.Code, firstFlight.FlightNo), firstFlight.TakeoffTime.Date);
                //    if (!transferPNRResult.Success) throw new CustomException("提取编码信息失败");
                //    pnrPair.PNR = transferPNRResult.Result.PnrPair.PNR;
                //}

                ExecuteResult <ReservedPnr> pnrDetailExecResult = CommandService.GetReservedPnr(pnrPair, oemId);
                if (!pnrDetailExecResult.Success)
                {
                    throw new CustomException("提取编码信息失败");
                }
                if (pnrDetailExecResult.Result.HasCanceled)
                {
                    throw new CustomException("编码为取消状态");
                }
                checkPassengers(pnrDetailExecResult.Result.Passengers);
                checkFlights(pnrDetailExecResult.Result.Voyage.Segments, isFullFlight);
                updateFlights(pnrDetailExecResult.Result.Voyage.Segments);
                PNRContent = pnrDetailExecResult.Result.PnrRawData;
                var firstPassenger = Passengers.First();
                PatContent = Command.Domain.Utility.ContentBulider.GetPatString(Flights.First().Bunk.Code,
                                                                                firstPassenger.Price.Fare, firstPassenger.Price.AirportFee, firstPassenger.Price.BAF);
            }
            return(result);
        }