Exemple #1
0
 public virtual void RemoveRailSegments(RailSegment __item)
 {
     if (__item != null && railSegments != null && railSegments.Contains(__item))
     {
         railSegments.Remove(__item);
     }
 }
Exemple #2
0
 public virtual void AddRailSegments(RailSegment __item)
 {
     if (__item != null && railSegments != null && !railSegments.Contains(__item))
     {
         railSegments.Add(__item);
     }
 }
Exemple #3
0
 public virtual void SetRailSegmentsAt(RailSegment __item, int __index)
 {
     if (__item == null)
     {
         railSegments[__index] = null;
     }
     else
     {
         railSegments[__index] = __item;
     }
 }
/// <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 [RailSegment] instance to use as the destination.</param>
/// <returns>A copy of the object</returns>
        public virtual RailSegment Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, RailSegment copy = null)
        {
            if (copiedObjects == null)
            {
                copiedObjects = new Hashtable();
            }
            if (copy == null && copiedObjects.Contains(this))
            {
                return((RailSegment)copiedObjects[this]);
            }
            copy = copy ?? new RailSegment();
            if (!asNew)
            {
                copy.TransientId = this.TransientId;
            }
            copy.TrainNumber = this.TrainNumber;
            copy.RequiresCrossBorderDocuments = this.RequiresCrossBorderDocuments;
            if (!copiedObjects.Contains(this))
            {
                copiedObjects.Add(this, copy);
            }
            if (deep && this.railRoute != null)
            {
                if (!copiedObjects.Contains(this.railRoute))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.RailRoute = this.RailRoute;
                    }
                    else if (asNew)
                    {
                        copy.RailRoute = this.RailRoute.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.railRoute = this.railRoute.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.RailRoute = (RailRoute)copiedObjects[this.RailRoute];
                    }
                    else
                    {
                        copy.railRoute = (RailRoute)copiedObjects[this.RailRoute];
                    }
                }
            }
            base.Copy(deep, copiedObjects, asNew, reuseNestedObjects, copy);
            return(copy);
        }