Ejemplo n.º 1
0
 public virtual void AddAtIndexRegionalAgentsService(int index, RegionalAgent __item)
 {
     if (__item == null)
     {
         return;
     }
     if (!regionalAgentsService.Contains(__item))
     {
         regionalAgentsService.Insert(index, __item);
     }
     if (!__item.WarehousesSupport.Contains(this))
     {
         __item.AddWarehousesSupport(this);
     }
 }
Ejemplo n.º 2
0
 public virtual void SetRegionalAgentsServiceAt(RegionalAgent __item, int __index)
 {
     if (__item == null)
     {
         regionalAgentsService[__index].RemoveWarehousesSupport(this);
     }
     else
     {
         regionalAgentsService[__index] = __item;
         if (!__item.WarehousesSupport.Contains(this))
         {
             __item.AddWarehousesSupport(this);
         }
     }
 }
Ejemplo n.º 3
0
 public virtual void AddRegionalAgentsService(RegionalAgent __item)
 {
     if (__item == null)
     {
         return;
     }
     if (!regionalAgentsService.Contains(__item))
     {
         InternalAddRegionalAgentsService(__item);
     }
     if (!__item.WarehousesSupport.Contains(this))
     {
         __item.AddWarehousesSupport(this);
     }
 }
/// <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 [RegionalAgent] instance to use as the destination.</param>
/// <returns>A copy of the object</returns>
        public virtual RegionalAgent Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, RegionalAgent copy = null)
        {
            if (copiedObjects == null)
            {
                copiedObjects = new Hashtable();
            }
            if (copy == null && copiedObjects.Contains(this))
            {
                return((RegionalAgent)copiedObjects[this]);
            }
            copy = copy ?? new RegionalAgent();
            if (!asNew)
            {
                copy.TransientId = this.TransientId;
                copy.Id          = this.Id;
            }
            copy.AgencyCode        = this.AgencyCode;
            copy.AgencyDescription = this.AgencyDescription;
            copy.AgencyAddress     = this.AgencyAddress;
            copy.IsSelected        = this.IsSelected;
            copy.Rating            = this.Rating;
            if (!copiedObjects.Contains(this))
            {
                copiedObjects.Add(this, copy);
            }
            copy.warehousesSupport = new List <Warehouse>();
            if (deep && this.warehousesSupport != null)
            {
                foreach (var __item in this.warehousesSupport)
                {
                    if (!copiedObjects.Contains(__item))
                    {
                        if (asNew && reuseNestedObjects)
                        {
                            copy.AddWarehousesSupport(__item);
                        }
                        else
                        {
                            copy.AddWarehousesSupport(__item.Copy(deep, copiedObjects, asNew));
                        }
                    }
                    else
                    {
                        copy.AddWarehousesSupport((Warehouse)copiedObjects[__item]);
                    }
                }
            }
            copy.rAUsers = new List <RegionalAgentUser>();
            if (deep && this.rAUsers != null)
            {
                foreach (var __item in this.rAUsers)
                {
                    if (!copiedObjects.Contains(__item))
                    {
                        if (asNew && reuseNestedObjects)
                        {
                            copy.AddRAUsers(__item);
                        }
                        else
                        {
                            copy.AddRAUsers(__item.Copy(deep, copiedObjects, asNew));
                        }
                    }
                    else
                    {
                        copy.AddRAUsers((RegionalAgentUser)copiedObjects[__item]);
                    }
                }
            }
            if (deep && this.addressCoordinates != null)
            {
                if (!copiedObjects.Contains(this.addressCoordinates))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.AddressCoordinates = this.AddressCoordinates;
                    }
                    else if (asNew)
                    {
                        copy.AddressCoordinates = this.AddressCoordinates.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.addressCoordinates = this.addressCoordinates.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.AddressCoordinates = (GeoCoordinates)copiedObjects[this.AddressCoordinates];
                    }
                    else
                    {
                        copy.addressCoordinates = (GeoCoordinates)copiedObjects[this.AddressCoordinates];
                    }
                }
            }
            copy.areaSupport = new List <GeoArea>();
            if (deep && this.areaSupport != null)
            {
                foreach (var __item in this.areaSupport)
                {
                    if (!copiedObjects.Contains(__item))
                    {
                        if (asNew && reuseNestedObjects)
                        {
                            copy.AddAreaSupport(__item);
                        }
                        else
                        {
                            copy.AddAreaSupport(__item.Copy(deep, copiedObjects, asNew));
                        }
                    }
                    else
                    {
                        copy.AddAreaSupport((GeoArea)copiedObjects[__item]);
                    }
                }
            }
            copy.trucks = new List <Truck>();
            if (deep && this.trucks != null)
            {
                foreach (var __item in this.trucks)
                {
                    if (!copiedObjects.Contains(__item))
                    {
                        if (asNew && reuseNestedObjects)
                        {
                            copy.AddTrucks(__item);
                        }
                        else
                        {
                            copy.AddTrucks(__item.Copy(deep, copiedObjects, asNew));
                        }
                    }
                    else
                    {
                        copy.AddTrucks((Truck)copiedObjects[__item]);
                    }
                }
            }
            copy.scheduledRouteTemplates = new List <ScheduledRouteTemplate>();
            if (deep && this.scheduledRouteTemplates != null)
            {
                foreach (var __item in this.scheduledRouteTemplates)
                {
                    if (!copiedObjects.Contains(__item))
                    {
                        if (asNew && reuseNestedObjects)
                        {
                            copy.AddScheduledRouteTemplates(__item);
                        }
                        else
                        {
                            copy.AddScheduledRouteTemplates(__item.Copy(deep, copiedObjects, asNew));
                        }
                    }
                    else
                    {
                        copy.AddScheduledRouteTemplates((ScheduledRouteTemplate)copiedObjects[__item]);
                    }
                }
            }
            copy.workContract = new List <WorkContract>();
            if (deep && this.workContract != null)
            {
                foreach (var __item in this.workContract)
                {
                    if (!copiedObjects.Contains(__item))
                    {
                        if (asNew && reuseNestedObjects)
                        {
                            copy.AddWorkContract(__item);
                        }
                        else
                        {
                            copy.AddWorkContract(__item.Copy(deep, copiedObjects, asNew));
                        }
                    }
                    else
                    {
                        copy.AddWorkContract((WorkContract)copiedObjects[__item]);
                    }
                }
            }
            return(copy);
        }