public virtual void RemoveAreaSupport(GeoArea __item)
 {
     if (__item != null)
     {
         InternalRemoveAreaSupport(__item);
     }
 }
 public virtual void AddAreaSupport(GeoArea __item)
 {
     if (__item == null)
     {
         return;
     }
     InternalAddAreaSupport(__item);
 }
 public virtual void AddAtIndexAreaSupport(int index, GeoArea __item)
 {
     if (__item == null)
     {
         return;
     }
     areaSupport?.Insert(index, __item);
 }
 public virtual void InternalRemoveAreaSupport(GeoArea __item)
 {
     if (__item == null)
     {
         return;
     }
     areaSupport?.Remove(__item);
 }
 public virtual void InternalAddAreaSupport(GeoArea __item)
 {
     if (__item == null || disableInternalAdditions)
     {
         return;
     }
     areaSupport?.Add(__item);
 }
 public virtual void SetAreaSupportAt(GeoArea __item, int __index)
 {
     if (__item == null)
     {
         areaSupport[__index] = null;
     }
     else
     {
         areaSupport[__index] = __item;
     }
 }
        public void RegionalAgent_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _order_warehousessupport_regionalagentsservice = new DSS3_LogisticsPoolingForUrbanDistribution.BO.Warehouse
            {
                Description = "Warehouse_Description",
                Title       = "Warehouse_Title",
                Address     = "Warehouse_Address",
                Telephone   = "Warehouse_Telephone",
            };
            var _order_warehousessupport_regionalagentsservice2 = new DSS3_LogisticsPoolingForUrbanDistribution.BO.Warehouse
            {
                Description = "Warehouse_Description",
                Title       = "Warehouse_Title",
                Address     = "Warehouse_Address",
                Telephone   = "Warehouse_Telephone",
            };
            var _regionalagent_rausers_regionalagent = new DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgentUser
            {
                UserName             = "******",
                PasswordHash         = "RegionalAgentUser_PasswordHash",
                SecurityStamp        = "RegionalAgentUser_SecurityStamp",
                EmailConfirmed       = true,
                LockoutEnabled       = true,
                PhoneNumberConfirmed = true,
                TwoFactorEnabled     = true,
                AccessFailedCount    = 3368,
                Name           = "RegionalAgentUser_Name",
                Email          = "RegionalAgentUser_Email",
                PhoneNumber    = "RegionalAgentUser_PhoneNumber",
                LockoutEndDate = now,
            };
            var _regionalagent_rausers_regionalagent2 = new DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgentUser
            {
                UserName             = "******",
                PasswordHash         = "RegionalAgentUser_PasswordHash",
                SecurityStamp        = "RegionalAgentUser_SecurityStamp",
                EmailConfirmed       = true,
                LockoutEnabled       = true,
                PhoneNumberConfirmed = true,
                TwoFactorEnabled     = true,
                AccessFailedCount    = 4194,
                Name           = "RegionalAgentUser_Name",
                Email          = "RegionalAgentUser_Email",
                PhoneNumber    = "RegionalAgentUser_PhoneNumber",
                LockoutEndDate = now,
            };
            var _regionalagent_addresscoordinates_regionalagent = new DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoCoordinates
            {
                Latitude  = 222.222f,
                Longitude = 222.222f,
            };
            var _regionalagent_areasupport_regionalagent = new DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoArea
            {
                Area       = "GeoArea_Area",
                PostalCode = "GeoArea_PostalCode",
                County     = "GeoArea_County",
            };
            var _regionalagent_areasupport_regionalagent2 = new DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoArea
            {
                Area       = "GeoArea_Area",
                PostalCode = "GeoArea_PostalCode",
                County     = "GeoArea_County",
            };
            var _regionalagent_trucks_regionalagent = new DSS3_LogisticsPoolingForUrbanDistribution.BO.Truck
            {
                PlateNumber = "Truck_PlateNumber",
                Type        = "Truck_Type",
            };
            var _regionalagent_trucks_regionalagent2 = new DSS3_LogisticsPoolingForUrbanDistribution.BO.Truck
            {
                PlateNumber = "Truck_PlateNumber",
                Type        = "Truck_Type",
            };
            var _scheduledroutes_scheduledroutetemplates_owner = new DSS3_LogisticsPoolingForUrbanDistribution.BO.ScheduledRouteTemplate
            {
                Origin                      = "ScheduledRouteTemplate_Origin",
                Destination                 = "ScheduledRouteTemplate_Destination",
                DaysOfWeek                  = "ScheduledRouteTemplate_DaysOfWeek",
                PricePerPallet              = 222222.22M,
                PricePerKilogram            = 222222.22M,
                PricePerCubicMeter          = 222222.22M,
                TotalAvailableCapacityKG    = 222222.22M,
                EffectiveFrom               = now,
                EffectiveTo                 = now,
                AvailableCapacityLaden      = 1530,
                CreatedOn                   = now,
                IsPrivate                   = true,
                TotalAvailableCapacityLaden = 9815,
                TotalAvailableCapacityM3    = 222222.22M,
                AvailableCapacityKG         = 222222.22M,
                AvailableCapacityM3         = 222222.22M,
                FixedPrice                  = 222222.22M,
                TruckPlate                  = "ScheduledRouteTemplate_TruckPlate",
                DeliveryDate                = now,
                ByRA = true,
            };
            var _scheduledroutes_scheduledroutetemplates_owner2 = new DSS3_LogisticsPoolingForUrbanDistribution.BO.ScheduledRouteTemplate
            {
                Origin                      = "ScheduledRouteTemplate_Origin",
                Destination                 = "ScheduledRouteTemplate_Destination",
                DaysOfWeek                  = "ScheduledRouteTemplate_DaysOfWeek",
                PricePerPallet              = 222222.22M,
                PricePerKilogram            = 222222.22M,
                PricePerCubicMeter          = 222222.22M,
                TotalAvailableCapacityKG    = 222222.22M,
                EffectiveFrom               = now,
                EffectiveTo                 = now,
                AvailableCapacityLaden      = 7445,
                CreatedOn                   = now,
                IsPrivate                   = true,
                TotalAvailableCapacityLaden = 4976,
                TotalAvailableCapacityM3    = 222222.22M,
                AvailableCapacityKG         = 222222.22M,
                AvailableCapacityM3         = 222222.22M,
                FixedPrice                  = 222222.22M,
                TruckPlate                  = "ScheduledRouteTemplate_TruckPlate",
                DeliveryDate                = now,
                ByRA = true,
            };
            var _workcontract_workcontract_regionalagent = new DSS3_LogisticsPoolingForUrbanDistribution.BO.WorkContract
            {
                CreationDate = now,
                LastUpdate   = now,
            };
            var _workcontract_workcontract_regionalagent2 = new DSS3_LogisticsPoolingForUrbanDistribution.BO.WorkContract
            {
                CreationDate = now,
                LastUpdate   = now,
            };

            new PersistenceSpecification <DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent>(Session)
            .CheckProperty(p => p.AgencyCode, "RegionalAgent_AgencyCode")
            .CheckProperty(p => p.AgencyDescription, "RegionalAgent_AgencyDescription")
            .CheckProperty(p => p.AgencyAddress, "RegionalAgent_AgencyAddress")
            .CheckProperty(p => p.IsSelected, true)
            .CheckProperty(p => p.Rating, 2288)
            .CheckBag(p => p.WarehousesSupport, (new List <DSS3_LogisticsPoolingForUrbanDistribution.BO.Warehouse>
            {
                _order_warehousessupport_regionalagentsservice,
                _order_warehousessupport_regionalagentsservice2
            }))
            .CheckBag(p => p.RAUsers, (new List <DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgentUser>
            {
                _regionalagent_rausers_regionalagent,
                _regionalagent_rausers_regionalagent2
            }))
            .CheckReference(p => p.AddressCoordinates, _regionalagent_addresscoordinates_regionalagent)
            .CheckBag(p => p.AreaSupport, (new List <DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoArea>
            {
                _regionalagent_areasupport_regionalagent,
                _regionalagent_areasupport_regionalagent2
            }))
            .CheckBag(p => p.Trucks, (new List <DSS3_LogisticsPoolingForUrbanDistribution.BO.Truck>
            {
                _regionalagent_trucks_regionalagent,
                _regionalagent_trucks_regionalagent2
            }))
            .CheckBag(p => p.ScheduledRouteTemplates, (new List <DSS3_LogisticsPoolingForUrbanDistribution.BO.ScheduledRouteTemplate>
            {
                _scheduledroutes_scheduledroutetemplates_owner,
                _scheduledroutes_scheduledroutetemplates_owner2
            }))
            .CheckBag(p => p.WorkContract, (new List <DSS3_LogisticsPoolingForUrbanDistribution.BO.WorkContract>
            {
                _workcontract_workcontract_regionalagent,
                _workcontract_workcontract_regionalagent2
            }))
            .VerifyTheMappings();
        }
/// <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(GeoArea 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 [GeoArea] instance to use as the destination.</param>
/// <returns>A copy of the object</returns>
        public virtual GeoArea Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, GeoArea copy = null)
        {
            if (copiedObjects == null)
            {
                copiedObjects = new Hashtable();
            }
            if (copy == null && copiedObjects.Contains(this))
            {
                return((GeoArea)copiedObjects[this]);
            }
            copy = copy ?? new GeoArea();
            if (!asNew)
            {
                copy.TransientId = this.TransientId;
                copy.Id          = this.Id;
            }
            copy.Area       = this.Area;
            copy.PostalCode = this.PostalCode;
            copy.County     = this.County;
            if (!copiedObjects.Contains(this))
            {
                copiedObjects.Add(this, copy);
            }
            return(copy);
        }