Beispiel #1
0
 public virtual void RemoveRouteTimeDetails(RouteTimeDetails __item)
 {
     if (__item != null && routeTimeDetails != null && routeTimeDetails.Contains(__item))
     {
         routeTimeDetails.Remove(__item);
         __item.Schedule = null;
     }
 }
Beispiel #2
0
 public virtual void AddRouteTimeDetails(RouteTimeDetails __item)
 {
     if (__item != null && routeTimeDetails != null && !routeTimeDetails.Contains(__item))
     {
         routeTimeDetails.Add(__item);
         if (__item.Schedule != this)
         {
             __item.Schedule = this;
         }
     }
 }
Beispiel #3
0
 public virtual void SetRouteTimeDetailsAt(RouteTimeDetails __item, int __index)
 {
     if (__item == null)
     {
         routeTimeDetails[__index].Schedule = null;
     }
     else
     {
         routeTimeDetails[__index] = __item;
         if (__item.Schedule != this)
         {
             __item.Schedule = this;
         }
     }
 }
/// <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(RouteTimeDetails 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 [RouteTimeDetails] instance to use as the destination.</param>
/// <returns>A copy of the object</returns>
        public virtual RouteTimeDetails Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, RouteTimeDetails copy = null)
        {
            if (copiedObjects == null)
            {
                copiedObjects = new Hashtable();
            }
            if (copy == null && copiedObjects.Contains(this))
            {
                return((RouteTimeDetails)copiedObjects[this]);
            }
            copy = copy ?? new RouteTimeDetails();
            if (!asNew)
            {
                copy.TransientId = this.TransientId;
                copy.Id          = this.Id;
            }
            copy.DepartureTime    = this.DepartureTime;
            copy.ArrivalTime      = this.ArrivalTime;
            copy.ArrivalOnNextDay = this.ArrivalOnNextDay;
            copy.Duration         = this.Duration;
            if (!copiedObjects.Contains(this))
            {
                copiedObjects.Add(this, copy);
            }
            if (deep && this.schedule != null)
            {
                if (!copiedObjects.Contains(this.schedule))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.Schedule = this.Schedule;
                    }
                    else if (asNew)
                    {
                        copy.Schedule = this.Schedule.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.schedule = this.schedule.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.Schedule = (Schedule)copiedObjects[this.Schedule];
                    }
                    else
                    {
                        copy.schedule = (Schedule)copiedObjects[this.Schedule];
                    }
                }
            }
            copy.stopTimeDetails = new List <StopTimeDetails>();
            if (deep && this.stopTimeDetails != null)
            {
                foreach (var __item in this.stopTimeDetails)
                {
                    if (!copiedObjects.Contains(__item))
                    {
                        if (asNew && reuseNestedObjects)
                        {
                            copy.AddStopTimeDetails(__item);
                        }
                        else
                        {
                            copy.AddStopTimeDetails(__item.Copy(deep, copiedObjects, asNew));
                        }
                    }
                    else
                    {
                        copy.AddStopTimeDetails((StopTimeDetails)copiedObjects[__item]);
                    }
                }
            }
            return(copy);
        }