public virtual void RemovePlanningQueries(PlanningQuery __item) { if (__item != null && planningQueries != null && planningQueries.Contains(__item)) { planningQueries.Remove(__item); } }
public virtual void AddPlanningQueries(PlanningQuery __item) { if (__item != null && planningQueries != null && !planningQueries.Contains(__item)) { planningQueries.Add(__item); } }
public virtual void SetPlanningQueriesAt(PlanningQuery __item, int __index) { if (__item == null) { planningQueries[__index] = null; } else { planningQueries[__index] = __item; } }
/// <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(PlanningQuery compareTo) { return(!this.IsTransient() && !compareTo.IsTransient() && this.Id.Equals(compareTo.Id)); }
/// <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 [PlanningQuery] instance to use as the destination.</param> /// <returns>A copy of the object</returns> public virtual PlanningQuery Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, PlanningQuery copy = null) { if (copiedObjects == null) { copiedObjects = new Hashtable(); } if (copy == null && copiedObjects.Contains(this)) { return((PlanningQuery)copiedObjects[this]); } copy = copy ?? new PlanningQuery(); if (!asNew) { copy.TransientId = this.TransientId; copy.Id = this.Id; } copy.NumberOfInfants = this.NumberOfInfants; copy.NumberOfChildren = this.NumberOfChildren; copy.NumberOfAdults = this.NumberOfAdults; copy.OneWay = this.OneWay; copy.PlusMinusOneWeek = this.PlusMinusOneWeek; copy.DepartureDateTime = this.DepartureDateTime; copy.ReturnDateTime = this.ReturnDateTime; if (!copiedObjects.Contains(this)) { copiedObjects.Add(this, copy); } if (deep && this.origin != null) { if (!copiedObjects.Contains(this.origin)) { if (asNew && reuseNestedObjects) { copy.Origin = this.Origin; } else if (asNew) { copy.Origin = this.Origin.Copy(deep, copiedObjects, true); } else { copy.origin = this.origin.Copy(deep, copiedObjects, false); } } else { if (asNew) { copy.Origin = (Location)copiedObjects[this.Origin]; } else { copy.origin = (Location)copiedObjects[this.Origin]; } } } if (deep && this.destination != null) { if (!copiedObjects.Contains(this.destination)) { if (asNew && reuseNestedObjects) { copy.Destination = this.Destination; } else if (asNew) { copy.Destination = this.Destination.Copy(deep, copiedObjects, true); } else { copy.destination = this.destination.Copy(deep, copiedObjects, false); } } else { if (asNew) { copy.Destination = (Location)copiedObjects[this.Destination]; } else { copy.destination = (Location)copiedObjects[this.Destination]; } } } copy.preferences = new List <Preference>(); if (deep && this.preferences != null) { foreach (var __item in this.preferences) { if (!copiedObjects.Contains(__item)) { if (asNew && reuseNestedObjects) { copy.AddPreferences(__item); } else { copy.AddPreferences(__item.Copy(deep, copiedObjects, asNew)); } } else { copy.AddPreferences((Preference)copiedObjects[__item]); } } } if (deep && this.person != null) { if (!copiedObjects.Contains(this.person)) { if (asNew && reuseNestedObjects) { copy.Person = this.Person; } else if (asNew) { copy.Person = this.Person.Copy(deep, copiedObjects, true); } else { copy.person = this.person.Copy(deep, copiedObjects, false); } } else { if (asNew) { copy.Person = (Person)copiedObjects[this.Person]; } else { copy.person = (Person)copiedObjects[this.Person]; } } } return(copy); }