示例#1
0
        public AncillaryServicePrice DeepCopy()
        {
            var result = new AncillaryServicePrice();

            result.Value           = Value?.Copy();
            result.ServiceRef      = ServiceRef?.DeepCopy();
            result.SegmentRef      = SegmentRef?.DeepCopy();
            result.LoyaltyCardRef  = LoyaltyCardRef?.DeepCopy();
            result.TravellersTypes = TravellersTypes != null ? new HashSet <PassTypes>(TravellersTypes) : null;
            result.TravellerRef    = TravellerRef?.DeepCopy();

            return(result);
        }
 /// <summary>
 /// Выполняет проверку привязки данной услуги к определённому сегменту
 /// </summary>
 /// <param name="segmentID">ИД сегмента</param>
 /// <returns>Признак привязки указанного сегмента к данной услуге</returns>
 public bool IsLinkedToSegment(int segmentID)
 {
     return(SegmentRef != null && SegmentRef.Contains(segmentID));
 }
 /// <summary>
 /// Выполняет проверку что данный элемент привязан к одному из указанных сегментов
 /// </summary>
 /// <param name="segmentRefs">Список ИД сегментов брони, привязку элемента к которому требуется проверить</param>
 /// <returns>Результат проверки</returns>
 public bool IsLinkedToSegments(IEnumerable <int> segmentRefs)
 {
     return((segmentRefs == null || !segmentRefs.Any()) || (SegmentRef == null || !segmentRefs.Any()) || SegmentRef.Intersect(segmentRefs).Any());
 }
        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);
        }