public virtual void RemoveScheduledRouteTemplates(ScheduledRouteTemplate __item)
 {
     if (__item != null)
     {
         __item.Owner = null;
     }
 }
 public virtual void InternalRemoveScheduledRouteTemplates(ScheduledRouteTemplate __item)
 {
     if (__item == null)
     {
         return;
     }
     scheduledRouteTemplates?.Remove(__item);
 }
 public virtual void InternalAddScheduledRouteTemplates(ScheduledRouteTemplate __item)
 {
     if (__item == null || disableInternalAdditions)
     {
         return;
     }
     scheduledRouteTemplates?.Add(__item);
 }
 public virtual void AddScheduledRouteTemplates(ScheduledRouteTemplate __item)
 {
     if (__item == null)
     {
         return;
     }
     if (__item.Owner != this)
     {
         __item.Owner = this;
     }
 }
Example #5
0
 public virtual void RemovePrivateTemplates(ScheduledRouteTemplate __item)
 {
     if (__item != null)
     {
         if (privateTemplates.Contains(__item))
         {
             InternalRemovePrivateTemplates(__item);
         }
         if (__item.VisibleTo.Contains(this))
         {
             __item.RemoveVisibleTo(this);
         }
     }
 }
 public virtual void SetScheduledRouteTemplatesAt(ScheduledRouteTemplate __item, int __index)
 {
     if (__item == null)
     {
         scheduledRouteTemplates[__index].Owner = null;
     }
     else
     {
         scheduledRouteTemplates[__index] = __item;
         if (__item.Owner != this)
         {
             __item.Owner = this;
         }
     }
 }
Example #7
0
 public virtual void SetPrivateTemplatesAt(ScheduledRouteTemplate __item, int __index)
 {
     if (__item == null)
     {
         privateTemplates[__index].RemoveVisibleTo(this);
     }
     else
     {
         privateTemplates[__index] = __item;
         if (!__item.VisibleTo.Contains(this))
         {
             __item.AddVisibleTo(this);
         }
     }
 }
Example #8
0
 public virtual void AddAtIndexPrivateTemplates(int index, ScheduledRouteTemplate __item)
 {
     if (__item == null)
     {
         return;
     }
     if (!privateTemplates.Contains(__item))
     {
         privateTemplates.Insert(index, __item);
     }
     if (!__item.VisibleTo.Contains(this))
     {
         __item.AddVisibleTo(this);
     }
 }
Example #9
0
 public virtual void AddPrivateTemplates(ScheduledRouteTemplate __item)
 {
     if (__item == null)
     {
         return;
     }
     if (!privateTemplates.Contains(__item))
     {
         InternalAddPrivateTemplates(__item);
     }
     if (!__item.VisibleTo.Contains(this))
     {
         __item.AddVisibleTo(this);
     }
 }
 public virtual void AddAtIndexScheduledRouteTemplates(int index, ScheduledRouteTemplate __item)
 {
     if (__item == null)
     {
         return;
     }
     scheduledRouteTemplates?.Insert(index, __item);
     disableInternalAdditions = true;
     try
     {
         if (__item.Owner != this)
         {
             __item.Owner = this;
         }
     }
     finally
     {
         disableInternalAdditions = false;
     }
 }
        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();
        }
Example #12
0
        public void LSP_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _lsp_lspusers_lsp = new DSS3_LogisticsPoolingForUrbanDistribution.BO.LSPUser
            {
                UserName             = "******",
                PasswordHash         = "LSPUser_PasswordHash",
                SecurityStamp        = "LSPUser_SecurityStamp",
                EmailConfirmed       = true,
                LockoutEnabled       = true,
                PhoneNumberConfirmed = true,
                TwoFactorEnabled     = true,
                AccessFailedCount    = 6324,
                Name           = "LSPUser_Name",
                Email          = "LSPUser_Email",
                PhoneNumber    = "LSPUser_PhoneNumber",
                LockoutEndDate = now,
            };
            var _lsp_lspusers_lsp2 = new DSS3_LogisticsPoolingForUrbanDistribution.BO.LSPUser
            {
                UserName             = "******",
                PasswordHash         = "LSPUser_PasswordHash",
                SecurityStamp        = "LSPUser_SecurityStamp",
                EmailConfirmed       = true,
                LockoutEnabled       = true,
                PhoneNumberConfirmed = true,
                TwoFactorEnabled     = true,
                AccessFailedCount    = 3787,
                Name           = "LSPUser_Name",
                Email          = "LSPUser_Email",
                PhoneNumber    = "LSPUser_PhoneNumber",
                LockoutEndDate = now,
            };
            var _scheduledroutes_privatetemplates_visibleto = 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      = 2667,
                CreatedOn                   = now,
                IsPrivate                   = true,
                TotalAvailableCapacityLaden = 8573,
                TotalAvailableCapacityM3    = 222222.22M,
                AvailableCapacityKG         = 222222.22M,
                AvailableCapacityM3         = 222222.22M,
                FixedPrice                  = 222222.22M,
                TruckPlate                  = "ScheduledRouteTemplate_TruckPlate",
                DeliveryDate                = now,
                ByRA = true,
            };
            var _scheduledroutes_privatetemplates_visibleto2 = 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      = 3835,
                CreatedOn                   = now,
                IsPrivate                   = true,
                TotalAvailableCapacityLaden = 2143,
                TotalAvailableCapacityM3    = 222222.22M,
                AvailableCapacityKG         = 222222.22M,
                AvailableCapacityM3         = 222222.22M,
                FixedPrice                  = 222222.22M,
                TruckPlate                  = "ScheduledRouteTemplate_TruckPlate",
                DeliveryDate                = now,
                ByRA = true,
            };
            var _workcontract_workcontracts_lsp = new DSS3_LogisticsPoolingForUrbanDistribution.BO.WorkContract
            {
                CreationDate = now,
                LastUpdate   = now,
            };
            var _workcontract_workcontracts_lsp2 = new DSS3_LogisticsPoolingForUrbanDistribution.BO.WorkContract
            {
                CreationDate = now,
                LastUpdate   = now,
            };

            new PersistenceSpecification <DSS3_LogisticsPoolingForUrbanDistribution.BO.LSP>(Session)
            .CheckProperty(p => p.LSPName, "LSP_LSPName")
            .CheckProperty(p => p.LSPDescription, "LSP_LSPDescription")
            .CheckBag(p => p.LSPUsers, (new List <DSS3_LogisticsPoolingForUrbanDistribution.BO.LSPUser>
            {
                _lsp_lspusers_lsp,
                _lsp_lspusers_lsp2
            }))
            .CheckBag(p => p.PrivateTemplates, (new List <DSS3_LogisticsPoolingForUrbanDistribution.BO.ScheduledRouteTemplate>
            {
                _scheduledroutes_privatetemplates_visibleto,
                _scheduledroutes_privatetemplates_visibleto2
            }))
            .CheckBag(p => p.WorkContracts, (new List <DSS3_LogisticsPoolingForUrbanDistribution.BO.WorkContract>
            {
                _workcontract_workcontracts_lsp,
                _workcontract_workcontracts_lsp2
            }))
            .VerifyTheMappings();
        }
Example #13
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 [ScheduledRouteTemplate] instance to use as the destination.</param>
/// <returns>A copy of the object</returns>
        public virtual ScheduledRouteTemplate Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, ScheduledRouteTemplate copy = null)
        {
            if (copiedObjects == null)
            {
                copiedObjects = new Hashtable();
            }
            if (copy == null && copiedObjects.Contains(this))
            {
                return((ScheduledRouteTemplate)copiedObjects[this]);
            }
            copy = copy ?? new ScheduledRouteTemplate();
            if (!asNew)
            {
                copy.TransientId = this.TransientId;
                copy.Id          = this.Id;
            }
            copy.Origin                      = this.Origin;
            copy.Destination                 = this.Destination;
            copy.DaysOfWeek                  = this.DaysOfWeek;
            copy.PricePerPallet              = this.PricePerPallet;
            copy.PricePerKilogram            = this.PricePerKilogram;
            copy.PricePerCubicMeter          = this.PricePerCubicMeter;
            copy.TotalAvailableCapacityKG    = this.TotalAvailableCapacityKG;
            copy.EffectiveFrom               = this.EffectiveFrom;
            copy.EffectiveTo                 = this.EffectiveTo;
            copy.TypeOfGoods                 = this.TypeOfGoods;
            copy.AvailableCapacityLaden      = this.AvailableCapacityLaden;
            copy.CreatedOn                   = this.CreatedOn;
            copy.Frequency                   = this.Frequency;
            copy.IsPrivate                   = this.IsPrivate;
            copy.TotalAvailableCapacityLaden = this.TotalAvailableCapacityLaden;
            copy.TotalAvailableCapacityM3    = this.TotalAvailableCapacityM3;
            copy.AvailableCapacityKG         = this.AvailableCapacityKG;
            copy.AvailableCapacityM3         = this.AvailableCapacityM3;
            copy.FixedPrice                  = this.FixedPrice;
            copy.TruckPlate                  = this.TruckPlate;
            copy.DeliveryDate                = this.DeliveryDate;
            copy.ByRA = this.ByRA;
            if (!copiedObjects.Contains(this))
            {
                copiedObjects.Add(this, copy);
            }
            if (deep && this.owner != null)
            {
                if (!copiedObjects.Contains(this.owner))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.Owner = this.Owner;
                    }
                    else if (asNew)
                    {
                        copy.Owner = this.Owner.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.owner = this.owner.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.Owner = (RegionalAgent)copiedObjects[this.Owner];
                    }
                    else
                    {
                        copy.owner = (RegionalAgent)copiedObjects[this.Owner];
                    }
                }
            }
            copy.visibleTo = new List <LSP>();
            if (deep && this.visibleTo != null)
            {
                foreach (var __item in this.visibleTo)
                {
                    if (!copiedObjects.Contains(__item))
                    {
                        if (asNew && reuseNestedObjects)
                        {
                            copy.AddVisibleTo(__item);
                        }
                        else
                        {
                            copy.AddVisibleTo(__item.Copy(deep, copiedObjects, asNew));
                        }
                    }
                    else
                    {
                        copy.AddVisibleTo((LSP)copiedObjects[__item]);
                    }
                }
            }
            if (deep && this.ownerLSP != null)
            {
                if (!copiedObjects.Contains(this.ownerLSP))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.OwnerLSP = this.OwnerLSP;
                    }
                    else if (asNew)
                    {
                        copy.OwnerLSP = this.OwnerLSP.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.ownerLSP = this.ownerLSP.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.OwnerLSP = (LSP)copiedObjects[this.OwnerLSP];
                    }
                    else
                    {
                        copy.ownerLSP = (LSP)copiedObjects[this.OwnerLSP];
                    }
                }
            }
            copy.visibleToRAs = new List <RegionalAgent>();
            if (deep && this.visibleToRAs != null)
            {
                foreach (var __item in this.visibleToRAs)
                {
                    if (!copiedObjects.Contains(__item))
                    {
                        if (asNew && reuseNestedObjects)
                        {
                            copy.AddVisibleToRAs(__item);
                        }
                        else
                        {
                            copy.AddVisibleToRAs(__item.Copy(deep, copiedObjects, asNew));
                        }
                    }
                    else
                    {
                        copy.AddVisibleToRAs((RegionalAgent)copiedObjects[__item]);
                    }
                }
            }
            return(copy);
        }
Example #14
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(ScheduledRouteTemplate compareTo)
        {
            return(!this.IsTransient() && !compareTo.IsTransient() && this.Id.Equals(compareTo.Id));
        }