public virtual void RemoveLegs(LegVolumeDetails __item)
 {
     if (__item != null)
     {
         InternalRemoveLegs(__item);
     }
 }
 public virtual void AddAtIndexLegs(int index, LegVolumeDetails __item)
 {
     if (__item == null)
     {
         return;
     }
     legs?.Insert(index, __item);
 }
 public virtual void AddLegs(LegVolumeDetails __item)
 {
     if (__item == null)
     {
         return;
     }
     InternalAddLegs(__item);
 }
 public virtual void InternalRemoveLegs(LegVolumeDetails __item)
 {
     if (__item == null)
     {
         return;
     }
     legs?.Remove(__item);
 }
 public virtual void InternalAddLegs(LegVolumeDetails __item)
 {
     if (__item == null || disableInternalAdditions)
     {
         return;
     }
     legs?.Add(__item);
 }
 public virtual void SetLegsAt(LegVolumeDetails __item, int __index)
 {
     if (__item == null)
     {
         legs[__index] = null;
     }
     else
     {
         legs[__index] = __item;
     }
 }
Пример #7
0
        public void PathVolumeDetail_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _utilsbo_legs_pathvolumedetail = new DSS3_LogisticsPoolingForUrbanDistribution.BO.LegVolumeDetails
            {
                FreeSpace   = 222222.22M,
                Time        = "LegVolumeDetails_Time",
                Distance    = 5449,
                CurrentLoad = 222222.22M,
            };
            var _utilsbo_legs_pathvolumedetail2 = new DSS3_LogisticsPoolingForUrbanDistribution.BO.LegVolumeDetails
            {
                FreeSpace   = 222222.22M,
                Time        = "LegVolumeDetails_Time",
                Distance    = 9672,
                CurrentLoad = 222222.22M,
            };
            var _utilsbo_shipment_pathvolumedetail = new DSS3_LogisticsPoolingForUrbanDistribution.BO.Shipment
            {
                Owner          = "Shipment_Owner",
                DepartureTime  = now,
                CurrentStatus  = "Shipment_CurrentStatus",
                Temperature    = "Shipment_Temperature",
                LoadPercentage = 9004,
                TotalVolume    = 222222.22M,
                AverageVolume  = 222222.22M,
                MaxTravelTime  = 6166,
            };

            new PersistenceSpecification <DSS3_LogisticsPoolingForUrbanDistribution.BO.PathVolumeDetail>(Session)
            .CheckProperty(p => p.TotalTime, "PathVolumeDetail_TotalTime")
            .CheckBag(p => p.Legs, (new List <DSS3_LogisticsPoolingForUrbanDistribution.BO.LegVolumeDetails>
            {
                _utilsbo_legs_pathvolumedetail,
                _utilsbo_legs_pathvolumedetail2
            }))
            .CheckReference(p => p.Shipment, _utilsbo_shipment_pathvolumedetail)
            .VerifyTheMappings();
        }
Пример #8
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(LegVolumeDetails compareTo)
        {
            return(!this.IsTransient() && !compareTo.IsTransient() && this.Id.Equals(compareTo.Id));
        }
Пример #9
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 [LegVolumeDetails] instance to use as the destination.</param>
/// <returns>A copy of the object</returns>
        public virtual LegVolumeDetails Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, LegVolumeDetails copy = null)
        {
            if (copiedObjects == null)
            {
                copiedObjects = new Hashtable();
            }
            if (copy == null && copiedObjects.Contains(this))
            {
                return((LegVolumeDetails)copiedObjects[this]);
            }
            copy = copy ?? new LegVolumeDetails();
            if (!asNew)
            {
                copy.TransientId = this.TransientId;
                copy.Id          = this.Id;
            }
            copy.FreeSpace   = this.FreeSpace;
            copy.Time        = this.Time;
            copy.Distance    = this.Distance;
            copy.CurrentLoad = this.CurrentLoad;
            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];
                    }
                }
            }
            return(copy);
        }