Exemplo n.º 1
0
 public virtual void RemoveQueries(ShoppingQuery __item)
 {
     if (__item != null && queries != null && queries.Contains(__item))
     {
         queries.Remove(__item);
         __item.Transaction = null;
     }
 }
Exemplo n.º 2
0
 public virtual void RemoveQuery(ShoppingQuery __item)
 {
     if (__item != null && query != null && query.Contains(__item))
     {
         query.Remove(__item);
         __item.ReducedMobilityDescription = null;
     }
 }
Exemplo n.º 3
0
 public virtual void RemoveShoppingQueries(ShoppingQuery __item)
 {
     if (__item != null && shoppingQueries != null && shoppingQueries.Contains(__item))
     {
         shoppingQueries.Remove(__item);
         __item.Trip = null;
     }
 }
Exemplo n.º 4
0
 public virtual void AddQueries(ShoppingQuery __item)
 {
     if (__item != null && queries != null && !queries.Contains(__item))
     {
         queries.Add(__item);
         if (__item.Transaction != this)
         {
             __item.Transaction = this;
         }
     }
 }
Exemplo n.º 5
0
 public virtual void AddShoppingQueries(ShoppingQuery __item)
 {
     if (__item != null && shoppingQueries != null && !shoppingQueries.Contains(__item))
     {
         shoppingQueries.Add(__item);
         if (__item.Trip != this)
         {
             __item.Trip = this;
         }
     }
 }
Exemplo n.º 6
0
 public virtual void AddQuery(ShoppingQuery __item)
 {
     if (__item != null && query != null && !query.Contains(__item))
     {
         query.Add(__item);
         if (__item.ReducedMobilityDescription != this)
         {
             __item.ReducedMobilityDescription = this;
         }
     }
 }
Exemplo n.º 7
0
 public virtual void SetQueriesAt(ShoppingQuery __item, int __index)
 {
     if (__item == null)
     {
         queries[__index].Transaction = null;
     }
     else
     {
         queries[__index] = __item;
         if (__item.Transaction != this)
         {
             __item.Transaction = this;
         }
     }
 }
Exemplo n.º 8
0
 public virtual void SetShoppingQueriesAt(ShoppingQuery __item, int __index)
 {
     if (__item == null)
     {
         shoppingQueries[__index].Trip = null;
     }
     else
     {
         shoppingQueries[__index] = __item;
         if (__item.Trip != this)
         {
             __item.Trip = this;
         }
     }
 }
Exemplo n.º 9
0
 public virtual void SetQueryAt(ShoppingQuery __item, int __index)
 {
     if (__item == null)
     {
         query[__index].ReducedMobilityDescription = null;
     }
     else
     {
         query[__index] = __item;
         if (__item.ReducedMobilityDescription != this)
         {
             __item.ReducedMobilityDescription = this;
         }
     }
 }
Exemplo n.º 10
0
/// <summary>
/// Copies the current object to a new instance
/// </summary>
/// <param name="deep">Copy members that refer to objects external to this class (not dependent)</param>
/// <param name="copiedObjects">Objects that should be reused</param>
/// <param name="asNew">Copy the current object as a new one, ready to be persisted, along all its members.</param>
/// <param name="reuseNestedObjects">If asNew is true, this flag if set, forces the reuse of all external objects.</param>
/// <param name="copy">Optional - An existing [ShoppingQuery] instance to use as the destination.</param>
/// <returns>A copy of the object</returns>
        public virtual ShoppingQuery Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, ShoppingQuery copy = null)
        {
            if (copiedObjects == null)
            {
                copiedObjects = new Hashtable();
            }
            if (copy == null && copiedObjects.Contains(this))
            {
                return((ShoppingQuery)copiedObjects[this]);
            }
            copy = copy ?? new ShoppingQuery();
            if (!asNew)
            {
                copy.TransientId = this.TransientId;
                copy.Id          = this.Id;
            }
            copy.NumberOfAdults     = this.NumberOfAdults;
            copy.NumberOfChildren   = this.NumberOfChildren;
            copy.NumberOfElders     = this.NumberOfElders;
            copy.NumberOfPRMs       = this.NumberOfPRMs;
            copy.NumberOfInfants    = this.NumberOfInfants;
            copy.DepartureDate      = this.DepartureDate;
            copy.ArrivalDate        = this.ArrivalDate;
            copy.NumberOfVehicles   = this.NumberOfVehicles;
            copy.Direct             = this.Direct;
            copy.NumberOfStops      = this.NumberOfStops;
            copy.MaxPrice           = this.MaxPrice;
            copy.NumberOfResults    = this.NumberOfResults;
            copy.CommunicationToken = this.CommunicationToken;
            copy.Timestamp          = this.Timestamp;
            if (!copiedObjects.Contains(this))
            {
                copiedObjects.Add(this, copy);
            }
            if (deep && this.transaction != null)
            {
                if (!copiedObjects.Contains(this.transaction))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.Transaction = this.Transaction;
                    }
                    else if (asNew)
                    {
                        copy.Transaction = this.Transaction.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.transaction = this.transaction.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.Transaction = (Transaction)copiedObjects[this.Transaction];
                    }
                    else
                    {
                        copy.transaction = (Transaction)copiedObjects[this.Transaction];
                    }
                }
            }
            if (deep && this.reducedMobilityDescription != null)
            {
                if (!copiedObjects.Contains(this.reducedMobilityDescription))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.ReducedMobilityDescription = this.ReducedMobilityDescription;
                    }
                    else if (asNew)
                    {
                        copy.ReducedMobilityDescription = this.ReducedMobilityDescription.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.reducedMobilityDescription = this.reducedMobilityDescription.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.ReducedMobilityDescription = (ReducedMobility)copiedObjects[this.ReducedMobilityDescription];
                    }
                    else
                    {
                        copy.reducedMobilityDescription = (ReducedMobility)copiedObjects[this.ReducedMobilityDescription];
                    }
                }
            }
            copy.includedAirlines = new List <Airline>();
            if (deep && this.includedAirlines != null)
            {
                foreach (var __item in this.includedAirlines)
                {
                    if (!copiedObjects.Contains(__item))
                    {
                        if (asNew && reuseNestedObjects)
                        {
                            copy.AddIncludedAirlines(__item);
                        }
                        else
                        {
                            copy.AddIncludedAirlines(__item.Copy(deep, copiedObjects, asNew));
                        }
                    }
                    else
                    {
                        copy.AddIncludedAirlines((Airline)copiedObjects[__item]);
                    }
                }
            }
            copy.excludedAirlines = new List <Airline>();
            if (deep && this.excludedAirlines != null)
            {
                foreach (var __item in this.excludedAirlines)
                {
                    if (!copiedObjects.Contains(__item))
                    {
                        if (asNew && reuseNestedObjects)
                        {
                            copy.AddExcludedAirlines(__item);
                        }
                        else
                        {
                            copy.AddExcludedAirlines(__item.Copy(deep, copiedObjects, asNew));
                        }
                    }
                    else
                    {
                        copy.AddExcludedAirlines((Airline)copiedObjects[__item]);
                    }
                }
            }
            if (deep && this.currency != null)
            {
                if (!copiedObjects.Contains(this.currency))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.Currency = this.Currency;
                    }
                    else if (asNew)
                    {
                        copy.Currency = this.Currency.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.currency = this.currency.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.Currency = (Currency)copiedObjects[this.Currency];
                    }
                    else
                    {
                        copy.currency = (Currency)copiedObjects[this.Currency];
                    }
                }
            }
            if (deep && this.travelClass != null)
            {
                if (!copiedObjects.Contains(this.travelClass))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.TravelClass = this.TravelClass;
                    }
                    else if (asNew)
                    {
                        copy.TravelClass = this.TravelClass.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.travelClass = this.travelClass.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.TravelClass = (TravelClass)copiedObjects[this.TravelClass];
                    }
                    else
                    {
                        copy.travelClass = (TravelClass)copiedObjects[this.TravelClass];
                    }
                }
            }
            if (deep && this.geoCoordinates != null)
            {
                if (!copiedObjects.Contains(this.geoCoordinates))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.GeoCoordinates = this.GeoCoordinates;
                    }
                    else if (asNew)
                    {
                        copy.GeoCoordinates = this.GeoCoordinates.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.geoCoordinates = this.geoCoordinates.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.GeoCoordinates = (GeoCoordinates)copiedObjects[this.GeoCoordinates];
                    }
                    else
                    {
                        copy.geoCoordinates = (GeoCoordinates)copiedObjects[this.GeoCoordinates];
                    }
                }
            }
            if (deep && this.shoppingResponse != null)
            {
                if (!copiedObjects.Contains(this.shoppingResponse))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.ShoppingResponse = this.ShoppingResponse;
                    }
                    else if (asNew)
                    {
                        copy.ShoppingResponse = this.ShoppingResponse.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.shoppingResponse = this.shoppingResponse.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.ShoppingResponse = (ShoppingResponse)copiedObjects[this.ShoppingResponse];
                    }
                    else
                    {
                        copy.shoppingResponse = (ShoppingResponse)copiedObjects[this.ShoppingResponse];
                    }
                }
            }
            if (deep && this.trip != null)
            {
                if (!copiedObjects.Contains(this.trip))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.Trip = this.Trip;
                    }
                    else if (asNew)
                    {
                        copy.Trip = this.Trip.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.trip = this.trip.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.Trip = (Trip)copiedObjects[this.Trip];
                    }
                    else
                    {
                        copy.trip = (Trip)copiedObjects[this.Trip];
                    }
                }
            }
            return(copy);
        }
Exemplo n.º 11
0
/// <summary>
///     Returns true if self and the provided entity have the same Id values
///     and the Ids are not of the default Id value
/// </summary>
        protected bool HasSameNonDefaultIdAs(ShoppingQuery compareTo)
        {
            return(!this.IsTransient() && !compareTo.IsTransient() && this.Id.Equals(compareTo.Id));
        }