Ejemplo n.º 1
0
 public virtual void RemoveUrbanRoutes(UrbanRoute __item)
 {
     if (__item != null && urbanRoutes != null && urbanRoutes.Contains(__item))
     {
         urbanRoutes.Remove(__item);
     }
 }
Ejemplo n.º 2
0
 public virtual void AddUrbanRoutes(UrbanRoute __item)
 {
     if (__item != null && urbanRoutes != null && !urbanRoutes.Contains(__item))
     {
         urbanRoutes.Add(__item);
     }
 }
Ejemplo n.º 3
0
 public virtual void RemoveUrbanLines(UrbanRoute __item)
 {
     if (__item != null && urbanLines != null && urbanLines.Contains(__item))
     {
         urbanLines.Remove(__item);
         __item.UrbanAgency = null;
     }
 }
Ejemplo n.º 4
0
 public virtual void AddUrbanLines(UrbanRoute __item)
 {
     if (__item != null && urbanLines != null && !urbanLines.Contains(__item))
     {
         urbanLines.Add(__item);
         if (__item.UrbanAgency != this)
         {
             __item.UrbanAgency = this;
         }
     }
 }
Ejemplo n.º 5
0
 public virtual void SetUrbanRoutesAt(UrbanRoute __item, int __index)
 {
     if (__item == null)
     {
         urbanRoutes[__index] = null;
     }
     else
     {
         urbanRoutes[__index] = __item;
     }
 }
Ejemplo n.º 6
0
 public virtual void SetUrbanLinesAt(UrbanRoute __item, int __index)
 {
     if (__item == null)
     {
         urbanLines[__index].UrbanAgency = null;
     }
     else
     {
         urbanLines[__index] = __item;
         if (__item.UrbanAgency != this)
         {
             __item.UrbanAgency = this;
         }
     }
 }
Ejemplo n.º 7
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(UrbanRoute compareTo)
        {
            return(!this.IsTransient() && !compareTo.IsTransient() && this.Id.Equals(compareTo.Id));
        }
Ejemplo n.º 8
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 [UrbanRoute] instance to use as the destination.</param>
/// <returns>A copy of the object</returns>
        public virtual UrbanRoute Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, UrbanRoute copy = null)
        {
            if (copiedObjects == null)
            {
                copiedObjects = new Hashtable();
            }
            if (copy == null && copiedObjects.Contains(this))
            {
                return((UrbanRoute)copiedObjects[this]);
            }
            copy = copy ?? new UrbanRoute();
            if (!asNew)
            {
                copy.TransientId = this.TransientId;
                copy.Id          = this.Id;
            }
            copy.GTFSId    = this.GTFSId;
            copy.Name      = this.Name;
            copy.ShortName = this.ShortName;
            copy.RouteType = this.RouteType;
            copy.TextColor = this.TextColor;
            if (!copiedObjects.Contains(this))
            {
                copiedObjects.Add(this, copy);
            }
            if (deep && this.transportMeans != null)
            {
                if (!copiedObjects.Contains(this.transportMeans))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.TransportMeans = this.TransportMeans;
                    }
                    else if (asNew)
                    {
                        copy.TransportMeans = this.TransportMeans.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.transportMeans = this.transportMeans.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.TransportMeans = (UrbanTransportMeans)copiedObjects[this.TransportMeans];
                    }
                    else
                    {
                        copy.transportMeans = (UrbanTransportMeans)copiedObjects[this.TransportMeans];
                    }
                }
            }
            if (deep && this.urbanAgency != null)
            {
                if (!copiedObjects.Contains(this.urbanAgency))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.UrbanAgency = this.UrbanAgency;
                    }
                    else if (asNew)
                    {
                        copy.UrbanAgency = this.UrbanAgency.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.urbanAgency = this.urbanAgency.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.UrbanAgency = (UrbanAgency)copiedObjects[this.UrbanAgency];
                    }
                    else
                    {
                        copy.urbanAgency = (UrbanAgency)copiedObjects[this.UrbanAgency];
                    }
                }
            }
            copy.urbanTrips = new List <UrbanTrip>();
            if (deep && this.urbanTrips != null)
            {
                foreach (var __item in this.urbanTrips)
                {
                    if (!copiedObjects.Contains(__item))
                    {
                        if (asNew && reuseNestedObjects)
                        {
                            copy.AddUrbanTrips(__item);
                        }
                        else
                        {
                            copy.AddUrbanTrips(__item.Copy(deep, copiedObjects, asNew));
                        }
                    }
                    else
                    {
                        copy.AddUrbanTrips((UrbanTrip)copiedObjects[__item]);
                    }
                }
            }
            if (deep && this.routeColor != null)
            {
                if (!copiedObjects.Contains(this.routeColor))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.RouteColor = this.RouteColor;
                    }
                    else if (asNew)
                    {
                        copy.RouteColor = this.RouteColor.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.routeColor = this.routeColor.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.RouteColor = (Color)copiedObjects[this.RouteColor];
                    }
                    else
                    {
                        copy.routeColor = (Color)copiedObjects[this.RouteColor];
                    }
                }
            }
            return(copy);
        }