public PassengerTypePriceBreakdown Copy()
        {
            var result = new PassengerTypePriceBreakdown();

            result.PricingType     = this.PricingType;
            result.FareCalc        = this.FareCalc;
            result.AgencyFare      = this.AgencyFare?.Copy();
            result.BaseFare        = this.BaseFare?.Copy();
            result.EquiveFare      = this.EquiveFare?.Copy();
            result.TotalFare       = this.TotalFare?.Copy();
            result.Markup          = this.Markup?.Copy();
            result.MarkupRound     = this.MarkupRound?.Copy();
            result.TotalAgencyFare = this.TotalAgencyFare?.Copy();

            if (this.ChargeBreakdown != null)
            {
                result.ChargeBreakdown = new ChargePartList();

                foreach (var chargePart in this.ChargeBreakdown)
                {
                    result.ChargeBreakdown.Add(chargePart.Copy());
                }
            }

            if (this.TravellerRef != null)
            {
                result.TravellerRef = new RefList <int>(this.TravellerRef);
            }

            if (this.Taxes != null)
            {
                result.Taxes = new TaxList();

                foreach (var tax in this.Taxes)
                {
                    result.Taxes.Add(tax.Copy());
                }
            }

            if (this.Tariffs != null)
            {
                result.Tariffs = new TariffList();

                foreach (var tariff in this.Tariffs)
                {
                    var airTariff = tariff as AirTariff;
                    if (airTariff != null)
                    {
                        result.Tariffs.Add(airTariff.Copy());
                    }
                }
            }

            return(result);
        }
Exemple #2
0
 /// <summary>
 /// Вычисление и проставление полных стоимостей цены и её частей на основании подробностей цены
 /// </summary>
 public void CalculateTotalPrice()
 {
     if (PassengerTypePriceBreakdown != null)
     {
         TotalPrice = new Money(PassengerTypePriceBreakdown.Sum(passTypePrice => passTypePrice.TotalFare.Value * passTypePrice.TravellerRef.Count), PassengerTypePriceBreakdown[0].TotalFare.Currency);
     }
     else if (TotalPrice == null)
     {
         TotalPrice = new Money(0, "RUB");
     }
 }
 /// <summary>
 /// Вычисление и проставление полных стоимостей цены и её частей на основании подробностей цены
 /// </summary>
 public void CalculateTotalPrice()
 {
     if (PassengerTypePriceBreakdown != null)
     {
         TotalPrice = PassengerTypePriceBreakdown.Sum(ptp => ptp.TotalFare * ptp.TravellerRef.Count);
     }
     else if (TotalPrice == null)
     {
         TotalPrice = new Money(0, "RUB");
     }
 }
Exemple #4
0
        /// <summary>
        /// Получение имени семейства авиа тарифа для определённого пассажира
        /// </summary>
        /// <param name="travellerID">ID пассажира в брони, для которого нужно получить имя семейства цен</param>
        /// <returns>Имя семейства авиа тарифа</returns>
        public string GetAirTariffFareFamily(int travellerID)
        {
            if (PassengerTypePriceBreakdown != null)
            {
                var passengerPrice = PassengerTypePriceBreakdown.Find(pt => pt.IsLinkedToTraveller(travellerID));
                if (passengerPrice.Tariffs != null && passengerPrice.Tariffs.Count > 0 && passengerPrice.Tariffs[0] is AirTariff)
                {
                    return((passengerPrice.Tariffs[0] as AirTariff).FareFamilyCode != null ? (passengerPrice.Tariffs[0] as AirTariff).FareFamilyCode : (passengerPrice.Tariffs[0] as AirTariff).FareFamilyName);
                }
            }

            return(null);
        }
        public PriceBreakdown DeepCopy()
        {
            PriceBreakdown result = new PriceBreakdown();

            result.Brand = Brand;
            result.IncludedInMainServicePrice = IncludedInMainServicePrice;
            result.PrivateFareInd             = PrivateFareInd;
            result.Refundable        = Refundable;
            result.ValidatingCompany = ValidatingCompany;
            result.PricingData       = PricingData?.Copy();
            result.PricingDebug      = PricingDebug?.DeepCopy();

            if (TotalPrice != null)
            {
                result.TotalPrice = new Money(TotalPrice);
            }

            if (AgencyMarkup != null)
            {
                result.AgencyMarkup = new Money(AgencyMarkup);
            }

            if (RoundingChargePart != null)
            {
                result.RoundingChargePart = new Money(RoundingChargePart);
            }
            ;
            if (DiscountByPromoAction != null)
            {
                result.DiscountByPromoAction = new Money(DiscountByPromoAction);
            }

            if (SubAgentMarkup != null)
            {
                result.SubAgentMarkup = new Money(SubAgentMarkup);
            }

            if (!ChargeBreakdown.IsNullOrEmpty())
            {
                result.ChargeBreakdown = new ChargePartList(ChargeBreakdown.Select(c => c.Copy()));
            }

            if (!SubAgentChargeBreakdown.IsNullOrEmpty())
            {
                result.SubAgentChargeBreakdown = new ChargePartList(SubAgentChargeBreakdown.Select(s => s.Copy()));
            }

            if (!ServiceRef.IsNullOrEmpty())
            {
                result.ServiceRef = new RefList <int>(ServiceRef);
            }

            if (!SegmentRef.IsNullOrEmpty())
            {
                result.SegmentRef = new RefList <int>(SegmentRef);
            }

            if (!PassengerTypePriceBreakdown.IsNullOrEmpty())
            {
                result.PassengerTypePriceBreakdown = new PassengerTypePriceBreakdownList(PassengerTypePriceBreakdown.Select(p => p.Copy()));
            }

            return(result);
        }
 /// <summary>
 /// Получение авиа тарифов для определённого пассажира
 /// </summary>
 /// <param name="travellerID">ID пассажира, чьи тарифы требуется получить</param>
 public IEnumerable <AirTariff> GetAirTariffsForTraveller(int travellerID)
 {
     return(PassengerTypePriceBreakdown.GetAirTariffsForTraveller(travellerID));
 }