示例#1
0
 public virtual void RemoveMarineSegments(MarineSegment __item)
 {
     if (__item != null && marineSegments != null && marineSegments.Contains(__item))
     {
         marineSegments.Remove(__item);
     }
 }
示例#2
0
 public virtual void AddMarineSegments(MarineSegment __item)
 {
     if (__item != null && marineSegments != null && !marineSegments.Contains(__item))
     {
         marineSegments.Add(__item);
     }
 }
示例#3
0
 public virtual void SetMarineSegmentsAt(MarineSegment __item, int __index)
 {
     if (__item == null)
     {
         marineSegments[__index] = null;
     }
     else
     {
         marineSegments[__index] = __item;
     }
 }
示例#4
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 [MarineSegment] instance to use as the destination.</param>
/// <returns>A copy of the object</returns>
        public virtual MarineSegment Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, MarineSegment copy = null)
        {
            if (copiedObjects == null)
            {
                copiedObjects = new Hashtable();
            }
            if (copy == null && copiedObjects.Contains(this))
            {
                return((MarineSegment)copiedObjects[this]);
            }
            copy = copy ?? new MarineSegment();
            if (!asNew)
            {
                copy.TransientId = this.TransientId;
            }
            copy.ScheduledDeparture   = this.ScheduledDeparture;
            copy.ScheduledArrival     = this.ScheduledArrival;
            copy.NonStandardDeparture = this.NonStandardDeparture;
            copy.NonStandardArrival   = this.NonStandardArrival;
            if (!copiedObjects.Contains(this))
            {
                copiedObjects.Add(this, copy);
            }
            if (deep && this.marineRoute != null)
            {
                if (!copiedObjects.Contains(this.marineRoute))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.MarineRoute = this.MarineRoute;
                    }
                    else if (asNew)
                    {
                        copy.MarineRoute = this.MarineRoute.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.marineRoute = this.marineRoute.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.MarineRoute = (MarineRoute)copiedObjects[this.MarineRoute];
                    }
                    else
                    {
                        copy.marineRoute = (MarineRoute)copiedObjects[this.MarineRoute];
                    }
                }
            }
            copy.vehiclesOnboard = new List <Vehicle>();
            if (deep && this.vehiclesOnboard != null)
            {
                foreach (var __item in this.vehiclesOnboard)
                {
                    if (!copiedObjects.Contains(__item))
                    {
                        if (asNew && reuseNestedObjects)
                        {
                            copy.AddVehiclesOnboard(__item);
                        }
                        else
                        {
                            copy.AddVehiclesOnboard(__item.Copy(deep, copiedObjects, asNew));
                        }
                    }
                    else
                    {
                        copy.AddVehiclesOnboard((Vehicle)copiedObjects[__item]);
                    }
                }
            }
            if (deep && this.shipFacilities != null)
            {
                if (!copiedObjects.Contains(this.shipFacilities))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.ShipFacilities = this.ShipFacilities;
                    }
                    else if (asNew)
                    {
                        copy.ShipFacilities = this.ShipFacilities.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.shipFacilities = this.shipFacilities.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.ShipFacilities = (ShipFacilities)copiedObjects[this.ShipFacilities];
                    }
                    else
                    {
                        copy.shipFacilities = (ShipFacilities)copiedObjects[this.ShipFacilities];
                    }
                }
            }
            copy.accomodationDetails = new List <AccomodationDetails>();
            if (deep && this.accomodationDetails != null)
            {
                foreach (var __item in this.accomodationDetails)
                {
                    if (!copiedObjects.Contains(__item))
                    {
                        if (asNew && reuseNestedObjects)
                        {
                            copy.AddAccomodationDetails(__item);
                        }
                        else
                        {
                            copy.AddAccomodationDetails(__item.Copy(deep, copiedObjects, asNew));
                        }
                    }
                    else
                    {
                        copy.AddAccomodationDetails((AccomodationDetails)copiedObjects[__item]);
                    }
                }
            }
            copy.onBoardDetails = new List <OnBoardDetails>();
            if (deep && this.onBoardDetails != null)
            {
                foreach (var __item in this.onBoardDetails)
                {
                    if (!copiedObjects.Contains(__item))
                    {
                        if (asNew && reuseNestedObjects)
                        {
                            copy.AddOnBoardDetails(__item);
                        }
                        else
                        {
                            copy.AddOnBoardDetails(__item.Copy(deep, copiedObjects, asNew));
                        }
                    }
                    else
                    {
                        copy.AddOnBoardDetails((OnBoardDetails)copiedObjects[__item]);
                    }
                }
            }
            base.Copy(deep, copiedObjects, asNew, reuseNestedObjects, copy);
            return(copy);
        }