Beispiel #1
0
        /// <summary>
        /// 构造舱位修改信息
        /// </summary>
        /// <param name="bunk"></param>
        /// <param name="fare"></param>
        /// <param name="basePrice"></param>
        /// <param name="useNewPrice"> 是否使用新价格,在为子舱位寻找载体的时候不修改舱位价格</param>
        /// <returns></returns>
        private static GeneralBunkView GeneralBunkView(GeneralBunk bunk, GraduatedFare fare, GraduatedFare basePrice, bool useNewPrice = true)
        {
            GeneralBunkView bunkView = fare.ServiceType == "Y"
                                           ? (GeneralBunkView) new EconomicBunkView()
            {
                Discount = useNewPrice?FoundationService.CalculateDiscount(basePrice.OneWayFare, fare.OneWayFare):bunk.Discount
            }
                                           : new FirstBusinessBunkView()
            {
                Description = fare.ServiceType == "C" ? "公务舱" : "头等舱",
                Discount    = useNewPrice?FoundationService.CalculateDiscount(basePrice.OneWayFare, fare.OneWayFare):bunk.Discount
            };

            bunkView.Departure         = bunk.Departure.Code.Value;
            bunkView.Arrival           = bunk.Arrival.Code.Value;
            bunkView.Code              = fare.ClassOfService;
            bunkView.Remarks           = bunk.Remarks;
            bunkView.Valid             = bunk.Valid;
            bunkView.Airline           = bunk.Airline.Code.Value;
            bunkView.Code              = bunk.Code.Value;
            bunkView.RefundRegulation  = bunk.RefundRegulation;
            bunkView.ChangeRegulation  = bunk.ChangeRegulation;
            bunkView.EndorseRegulation = bunk.EndorseRegulation;
            bunkView.FlightBeginDate   = fare.EffectiveDate;
            bunkView.FlightEndDate     = fare.ExpiryDate;
            bunkView.ETDZDate          = DateTime.Today < fare.EffectiveDate ? DateTime.Today : fare.EffectiveDate;
            bunkView.VoyageType        = bunk.VoyageType;
            bunkView.PassengerType     = bunk.PassengerType;
            bunkView.TravelType        = bunk.TravelType;
            foreach (ExtendedWithDiscountBunk extBunk in bunk.Extended)
            {
                bunkView.AddExtended(new ExtendedWithDiscountBunkView
                {
                    Code     = extBunk.Code.Value,
                    Discount = extBunk.Discount
                });
            }
            return(bunkView);
        }
Beispiel #2
0
        /// <summary>
        /// 构造新的舱位信息
        /// </summary>
        /// <param name="fare">舱位运价信息</param>
        /// <param name="arrival"> </param>
        /// <param name="basePrice"> </param>
        /// <param name="carrier"> </param>
        /// <param name="departure"> </param>
        /// <returns></returns>
        private static BunkView CreatBunkFromFDData(GraduatedFare fare, string carrier, string departure, string arrival, decimal basePrice)
        {
            decimal         bunkDiscount = FoundationService.CalculateDiscount(basePrice, fare.OneWayFare);
            GeneralBunkView bunkView     = fare.ServiceType == "Y"
                                           ? (GeneralBunkView) new EconomicBunkView()
            {
                Discount = bunkDiscount
            }
                                           : new FirstBusinessBunkView()
            {
                Description = fare.ServiceType == "C" ? "公务舱" : "头等舱",
                Discount    = bunkDiscount
            };

            bunkView.Departure         = departure;
            bunkView.Arrival           = arrival;
            bunkView.Code              = fare.ClassOfService;
            bunkView.Remarks           = string.Empty;
            bunkView.Valid             = true;
            bunkView.Airline           = carrier;
            bunkView.Code              = fare.ClassOfService;
            bunkView.RefundRegulation  = string.Empty;
            bunkView.ChangeRegulation  = string.Empty;
            bunkView.EndorseRegulation = string.Empty;
            bunkView.ETDZDate          = DateTime.Today < fare.EffectiveDate ? DateTime.Today : fare.EffectiveDate;
            bunkView.FlightBeginDate   = fare.EffectiveDate;
            bunkView.FlightEndDate     = fare.ExpiryDate;
            bunkView.PassengerType     = PassengerTypeValue.Adult;
            if (fare.OneWayFare >= basePrice)
            {
                bunkView.PassengerType |= PassengerTypeValue.Child;
            }
            bunkView.VoyageType = VoyageTypeValue.OneWay | VoyageTypeValue.RoundTrip
                                  | VoyageTypeValue.TransitWay | VoyageTypeValue.OneWayOrRound | VoyageTypeValue.Notch;
            bunkView.TravelType = TravelTypeValue.Individual | TravelTypeValue.Team;
            return(bunkView);
        }