Ejemplo n.º 1
0
        public void ResolveReferences(Booking booking)
        {
            ResolveCustomerReferences(booking.Customer);
            ResolveCurrency(booking);
            ResolveGeneralReferences(booking.BookingGeneral);
            if (booking.BookingIdentifier != null)
            {
                var sourceMarket = sourceMarketBucket.GetBy(booking.BookingIdentifier.SourceMarket);
                if (sourceMarket != null)
                {
                    booking.BookingIdentifier.SourceMarket = sourceMarket.Id;
                    if (!string.IsNullOrWhiteSpace(sourceMarket.TeamId))
                    {
                        booking.Owner = sourceMarket.TeamId;
                    }
                }
                else
                {
                    booking.BookingIdentifier.SourceMarket = null;
                }
            }

            if (booking.Services != null)
            {
                ResolveTransportReferences(booking.Services.Transport);
                ResolveTransferReferences(booking.Services.Transfer);
                ResolveAccommodationReferences(booking);
            }
        }
Ejemplo n.º 2
0
        public void ResolveCountryReferences(Customer customer)
        {
            if (customer == null)
            {
                return;
            }

            if (customer.Address != null)
            {
                foreach (var address in customer.Address)
                {
                    address.Country = countryBucket.GetBy(address.Country);
                }
            }

            if (customer.CustomerIdentifier != null)
            {
                var sourceMarket = sourceMarketBucket.GetBy(customer.CustomerIdentifier.SourceMarket);
                if (sourceMarket != null)
                {
                    customer.CustomerIdentifier.SourceMarket = sourceMarket.Id;
                    if (!string.IsNullOrWhiteSpace(sourceMarket.TeamId))
                    {
                        customer.Owner = sourceMarket.TeamId;
                    }
                }
                else
                {
                    customer.CustomerIdentifier.SourceMarket = null;
                }
            }
        }