Example #1
0
 public virtual void RemoveLSPUsers(LSPUser __item)
 {
     if (__item != null)
     {
         __item.LSP = null;
     }
 }
Example #2
0
 public virtual void InternalRemoveLSPUsers(LSPUser __item)
 {
     if (__item == null)
     {
         return;
     }
     lSPUsers?.Remove(__item);
 }
Example #3
0
 public virtual void InternalAddLSPUsers(LSPUser __item)
 {
     if (__item == null || disableInternalAdditions)
     {
         return;
     }
     lSPUsers?.Add(__item);
 }
Example #4
0
 public virtual void AddLSPUsers(LSPUser __item)
 {
     if (__item == null)
     {
         return;
     }
     if (__item.LSP != this)
     {
         __item.LSP = this;
     }
 }
Example #5
0
 public virtual void SetLSPUsersAt(LSPUser __item, int __index)
 {
     if (__item == null)
     {
         lSPUsers[__index].LSP = null;
     }
     else
     {
         lSPUsers[__index] = __item;
         if (__item.LSP != this)
         {
             __item.LSP = this;
         }
     }
 }
Example #6
0
 public virtual void AddAtIndexLSPUsers(int index, LSPUser __item)
 {
     if (__item == null)
     {
         return;
     }
     lSPUsers?.Insert(index, __item);
     disableInternalAdditions = true;
     try
     {
         if (__item.LSP != this)
         {
             __item.LSP = this;
         }
     }
     finally
     {
         disableInternalAdditions = false;
     }
 }
Example #7
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 [LSPUser] instance to use as the destination.</param>
/// <returns>A copy of the object</returns>
        public virtual LSPUser Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, LSPUser copy = null)
        {
            if (copiedObjects == null)
            {
                copiedObjects = new Hashtable();
            }
            if (copy == null && copiedObjects.Contains(this))
            {
                return((LSPUser)copiedObjects[this]);
            }
            copy = copy ?? new LSPUser();
            if (!asNew)
            {
                copy.TransientId = this.TransientId;
            }
            if (!copiedObjects.Contains(this))
            {
                copiedObjects.Add(this, copy);
            }
            if (deep && this.lSP != null)
            {
                if (!copiedObjects.Contains(this.lSP))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.LSP = this.LSP;
                    }
                    else if (asNew)
                    {
                        copy.LSP = this.LSP.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.lSP = this.lSP.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.LSP = (LSP)copiedObjects[this.LSP];
                    }
                    else
                    {
                        copy.lSP = (LSP)copiedObjects[this.LSP];
                    }
                }
            }
            base.Copy(deep, copiedObjects, asNew, reuseNestedObjects, copy);
            return(copy);
        }
Example #8
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();
        }