Пример #1
0
 public virtual void RemoveVisibleToRAs(RegionalAgent __item)
 {
     if (__item != null)
     {
         InternalRemoveVisibleToRAs(__item);
     }
 }
Пример #2
0
 public virtual void InternalRemoveVisibleToRAs(RegionalAgent __item)
 {
     if (__item == null)
     {
         return;
     }
     visibleToRAs?.Remove(__item);
 }
Пример #3
0
 public virtual void InternalRemoveRegionalAgentsService(RegionalAgent __item)
 {
     if (__item == null)
     {
         return;
     }
     regionalAgentsService?.Remove(__item);
 }
Пример #4
0
 public virtual void InternalAddRegionalAgentsService(RegionalAgent __item)
 {
     if (__item == null || disableInternalAdditions)
     {
         return;
     }
     regionalAgentsService?.Add(__item);
 }
Пример #5
0
 public virtual void InternalAddVisibleToRAs(RegionalAgent __item)
 {
     if (__item == null || disableInternalAdditions)
     {
         return;
     }
     visibleToRAs?.Add(__item);
 }
Пример #6
0
 public virtual void SetVisibleToRAsAt(RegionalAgent __item, int __index)
 {
     if (__item == null)
     {
         visibleToRAs[__index] = null;
     }
     else
     {
         visibleToRAs[__index] = __item;
     }
 }
Пример #7
0
 public virtual void AddAtIndexVisibleToRAs(int index, RegionalAgent __item)
 {
     if (__item == null)
     {
         return;
     }
     if (!visibleToRAs.Contains(__item))
     {
         visibleToRAs.Insert(index, __item);
     }
 }
Пример #8
0
 public virtual void AddVisibleToRAs(RegionalAgent __item)
 {
     if (__item == null)
     {
         return;
     }
     if (!visibleToRAs.Contains(__item))
     {
         InternalAddVisibleToRAs(__item);
     }
 }
Пример #9
0
 public virtual void RemoveRegionalAgentsService(RegionalAgent __item)
 {
     if (__item != null)
     {
         if (regionalAgentsService.Contains(__item))
         {
             InternalRemoveRegionalAgentsService(__item);
         }
         if (__item.WarehousesSupport.Contains(this))
         {
             __item.RemoveWarehousesSupport(this);
         }
     }
 }
Пример #10
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);
     }
 }
Пример #11
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);
         }
     }
 }
Пример #12
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);
     }
 }
        public void Truck_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _regionalagent_currentlocation_truck = new DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoCoordinates
            {
                Latitude  = 222.222f,
                Longitude = 222.222f,
            };
            var _regionalagent_regionalagent_trucks = new DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent
            {
                AgencyCode        = "RegionalAgent_AgencyCode",
                AgencyDescription = "RegionalAgent_AgencyDescription",
                AgencyAddress     = "RegionalAgent_AgencyAddress",
                IsSelected        = true,
                Rating            = 2190,
            };
            var _truck_truckdriver_truck = new DSS3_LogisticsPoolingForUrbanDistribution.BO.TruckDriver
            {
                UserName             = "******",
                PasswordHash         = "TruckDriver_PasswordHash",
                SecurityStamp        = "TruckDriver_SecurityStamp",
                EmailConfirmed       = true,
                LockoutEnabled       = true,
                PhoneNumberConfirmed = true,
                TwoFactorEnabled     = true,
                AccessFailedCount    = 3282,
                Name           = "TruckDriver_Name",
                Email          = "TruckDriver_Email",
                PhoneNumber    = "TruckDriver_PhoneNumber",
                LockoutEndDate = now,
            };

            new PersistenceSpecification <DSS3_LogisticsPoolingForUrbanDistribution.BO.Truck>(Session)
            .CheckProperty(p => p.PlateNumber, "Truck_PlateNumber")
            .CheckProperty(p => p.Type, "Truck_Type")
            .CheckReference(p => p.CurrentLocation, _regionalagent_currentlocation_truck)
            .CheckReference(p => p.RegionalAgent, _regionalagent_regionalagent_trucks)
            .CheckReference(p => p.TruckDriver, _truck_truckdriver_truck)
            .VerifyTheMappings();
        }
Пример #14
0
        public void Warehouse_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _order_geocoordinates_warehouse = new DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoCoordinates
            {
                Latitude  = 222.222f,
                Longitude = 222.222f,
            };
            var _order_regionalagentsservice_warehousessupport = new DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent
            {
                AgencyCode        = "RegionalAgent_AgencyCode",
                AgencyDescription = "RegionalAgent_AgencyDescription",
                AgencyAddress     = "RegionalAgent_AgencyAddress",
                IsSelected        = true,
                Rating            = 8544,
            };
            var _order_regionalagentsservice_warehousessupport2 = new DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent
            {
                AgencyCode        = "RegionalAgent_AgencyCode",
                AgencyDescription = "RegionalAgent_AgencyDescription",
                AgencyAddress     = "RegionalAgent_AgencyAddress",
                IsSelected        = true,
                Rating            = 3652,
            };

            new PersistenceSpecification <DSS3_LogisticsPoolingForUrbanDistribution.BO.Warehouse>(Session)
            .CheckProperty(p => p.Description, "Warehouse_Description")
            .CheckProperty(p => p.Title, "Warehouse_Title")
            .CheckProperty(p => p.Address, "Warehouse_Address")
            .CheckProperty(p => p.Telephone, "Warehouse_Telephone")
            .CheckReference(p => p.GeoCoordinates, _order_geocoordinates_warehouse)
            .CheckBag(p => p.RegionalAgentsService, (new List <DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent>
            {
                _order_regionalagentsservice_warehousessupport,
                _order_regionalagentsservice_warehousessupport2
            }))
            .VerifyTheMappings();
        }
 public static void InitRegionalAgentsImplementation()
 {
     try
     {
         foreach (var order in new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAll <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>() ?? Enumerable.Empty <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>())
         {
             string racode = (order?.OrdAgencyCode ?? "");
             DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent ra = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAsQueryable <DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent>((r) => r.AgencyCode == racode)?.FirstOrDefault();
             if ((ra == null))
             {
                 ra                   = new DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent();
                 ra.AgencyCode        = racode;
                 ra.AgencyAddress     = (order?.OrdAgencyAddress ?? "");
                 ra.AgencyDescription = (order?.OrdAgencyDescr ?? "");
                 new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Save <DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent>(ra);
             }
         }
     }
     catch (System.Exception x)
     {
         throw x;
         zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Error, "API", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, x);
     }
 }
        public void ScheduledRouteTemplate_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _scheduledroutes_owner_scheduledroutetemplates = new DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent
            {
                AgencyCode        = "RegionalAgent_AgencyCode",
                AgencyDescription = "RegionalAgent_AgencyDescription",
                AgencyAddress     = "RegionalAgent_AgencyAddress",
                IsSelected        = true,
                Rating            = 680,
            };
            var _scheduledroutes_visibleto_privatetemplates = new DSS3_LogisticsPoolingForUrbanDistribution.BO.LSP
            {
                LSPName        = "LSP_LSPName",
                LSPDescription = "LSP_LSPDescription",
            };
            var _scheduledroutes_visibleto_privatetemplates2 = new DSS3_LogisticsPoolingForUrbanDistribution.BO.LSP
            {
                LSPName        = "LSP_LSPName",
                LSPDescription = "LSP_LSPDescription",
            };
            var _scheduledroutes_ownerlsp_scheduledroutetemplate = new DSS3_LogisticsPoolingForUrbanDistribution.BO.LSP
            {
                LSPName        = "LSP_LSPName",
                LSPDescription = "LSP_LSPDescription",
            };
            var _scheduledroutes_visibletoras_scheduledroutetemplate = new DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent
            {
                AgencyCode        = "RegionalAgent_AgencyCode",
                AgencyDescription = "RegionalAgent_AgencyDescription",
                AgencyAddress     = "RegionalAgent_AgencyAddress",
                IsSelected        = true,
                Rating            = 5290,
            };
            var _scheduledroutes_visibletoras_scheduledroutetemplate2 = new DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent
            {
                AgencyCode        = "RegionalAgent_AgencyCode",
                AgencyDescription = "RegionalAgent_AgencyDescription",
                AgencyAddress     = "RegionalAgent_AgencyAddress",
                IsSelected        = true,
                Rating            = 8490,
            };

            new PersistenceSpecification <DSS3_LogisticsPoolingForUrbanDistribution.BO.ScheduledRouteTemplate>(Session)
            .CheckProperty(p => p.Origin, "ScheduledRouteTemplate_Origin")
            .CheckProperty(p => p.Destination, "ScheduledRouteTemplate_Destination")
            .CheckProperty(p => p.DaysOfWeek, "ScheduledRouteTemplate_DaysOfWeek")
            .CheckProperty(p => p.PricePerPallet, 222222.22M)
            .CheckProperty(p => p.PricePerKilogram, 222222.22M)
            .CheckProperty(p => p.PricePerCubicMeter, 222222.22M)
            .CheckProperty(p => p.TotalAvailableCapacityKG, 222222.22M)
            .CheckProperty(p => p.EffectiveFrom, now)
            .CheckProperty(p => p.EffectiveTo, now)
            .CheckProperty(p => p.AvailableCapacityLaden, 9757)
            .CheckProperty(p => p.CreatedOn, now)
            .CheckProperty(p => p.IsPrivate, true)
            .CheckProperty(p => p.TotalAvailableCapacityLaden, 6829)
            .CheckProperty(p => p.TotalAvailableCapacityM3, 222222.22M)
            .CheckProperty(p => p.AvailableCapacityKG, 222222.22M)
            .CheckProperty(p => p.AvailableCapacityM3, 222222.22M)
            .CheckProperty(p => p.FixedPrice, 222222.22M)
            .CheckProperty(p => p.TruckPlate, "ScheduledRouteTemplate_TruckPlate")
            .CheckProperty(p => p.DeliveryDate, now)
            .CheckProperty(p => p.ByRA, true)
            .CheckReference(p => p.Owner, _scheduledroutes_owner_scheduledroutetemplates)
            .CheckBag(p => p.VisibleTo, (new List <DSS3_LogisticsPoolingForUrbanDistribution.BO.LSP>
            {
                _scheduledroutes_visibleto_privatetemplates,
                _scheduledroutes_visibleto_privatetemplates2
            }))
            .CheckReference(p => p.OwnerLSP, _scheduledroutes_ownerlsp_scheduledroutetemplate)
            .CheckBag(p => p.VisibleToRAs, (new List <DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent>
            {
                _scheduledroutes_visibletoras_scheduledroutetemplate,
                _scheduledroutes_visibletoras_scheduledroutetemplate2
            }))
            .VerifyTheMappings();
        }
        public void WorkContract_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _workcontract_regionalagent_workcontract = new DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent
            {
                AgencyCode        = "RegionalAgent_AgencyCode",
                AgencyDescription = "RegionalAgent_AgencyDescription",
                AgencyAddress     = "RegionalAgent_AgencyAddress",
                IsSelected        = true,
                Rating            = 7607,
            };
            var _workcontract_scheduledroutes_workcontract = new DSS3_LogisticsPoolingForUrbanDistribution.BO.ScheduledRoute
            {
                Origin                   = "ScheduledRoute_Origin",
                Destination              = "ScheduledRoute_Destination",
                DaysOfWeek               = "ScheduledRoute_DaysOfWeek",
                PricePerPallet           = 222222.22M,
                PricePerKilogram         = 222222.22M,
                PricePerCubicMeter       = 222222.22M,
                TotalAvailableCapacityKG = 222222.22M,
                EffectiveFrom            = now,
                EffectiveTo              = now,
                Revision                 = 248,
                GUID = "ScheduledRoute_GUID",
                ReservedCapacityLaden = 6260,
                BaseId = 440,
                TotalAvailableCapacityM3    = 222222.22M,
                TotalAvailableCapacityLaden = 1650,
                ReservedCapacityKG          = 222222.22M,
                ReservedCapacityM3          = 222222.22M,
                FixedPrice          = 222222.22M,
                OriginComments      = "ScheduledRoute_OriginComments",
                DestinationComments = "ScheduledRoute_DestinationComments",
                TruckPlate          = "ScheduledRoute_TruckPlate",
                DeliveryDate        = now,
            };
            var _workcontract_scheduledroutes_workcontract2 = new DSS3_LogisticsPoolingForUrbanDistribution.BO.ScheduledRoute
            {
                Origin                   = "ScheduledRoute_Origin",
                Destination              = "ScheduledRoute_Destination",
                DaysOfWeek               = "ScheduledRoute_DaysOfWeek",
                PricePerPallet           = 222222.22M,
                PricePerKilogram         = 222222.22M,
                PricePerCubicMeter       = 222222.22M,
                TotalAvailableCapacityKG = 222222.22M,
                EffectiveFrom            = now,
                EffectiveTo              = now,
                Revision                 = 2434,
                GUID = "ScheduledRoute_GUID",
                ReservedCapacityLaden = 710,
                BaseId = 4463,
                TotalAvailableCapacityM3    = 222222.22M,
                TotalAvailableCapacityLaden = 3119,
                ReservedCapacityKG          = 222222.22M,
                ReservedCapacityM3          = 222222.22M,
                FixedPrice          = 222222.22M,
                OriginComments      = "ScheduledRoute_OriginComments",
                DestinationComments = "ScheduledRoute_DestinationComments",
                TruckPlate          = "ScheduledRoute_TruckPlate",
                DeliveryDate        = now,
            };
            var _workcontract_lsp_workcontracts = new DSS3_LogisticsPoolingForUrbanDistribution.BO.LSP
            {
                LSPName        = "LSP_LSPName",
                LSPDescription = "LSP_LSPDescription",
            };

            new PersistenceSpecification <DSS3_LogisticsPoolingForUrbanDistribution.BO.WorkContract>(Session)
            .CheckProperty(p => p.CreationDate, now)
            .CheckProperty(p => p.LastUpdate, now)
            .CheckReference(p => p.RegionalAgent, _workcontract_regionalagent_workcontract)
            .CheckBag(p => p.ScheduledRoutes, (new List <DSS3_LogisticsPoolingForUrbanDistribution.BO.ScheduledRoute>
            {
                _workcontract_scheduledroutes_workcontract,
                _workcontract_scheduledroutes_workcontract2
            }))
            .CheckReference(p => p.LSP, _workcontract_lsp_workcontracts)
            .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(RegionalAgent 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 [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);
        }