public virtual void RemoveWorkContracts(WorkContract __item) { if (__item != null) { __item.LSP = null; } }
public virtual void RemoveWorkContract(WorkContract __item) { if (__item != null) { __item.RegionalAgent = null; } }
public virtual void InternalRemoveWorkContract(WorkContract __item) { if (__item == null) { return; } workContract?.Remove(__item); }
public virtual void InternalAddWorkContract(WorkContract __item) { if (__item == null || disableInternalAdditions) { return; } workContract?.Add(__item); }
public virtual void AddWorkContract(WorkContract __item) { if (__item == null) { return; } if (__item.RegionalAgent != this) { __item.RegionalAgent = this; } }
public virtual void AddWorkContracts(WorkContract __item) { if (__item == null) { return; } if (__item.LSP != this) { __item.LSP = this; } }
public virtual void SetWorkContractAt(WorkContract __item, int __index) { if (__item == null) { workContract[__index].RegionalAgent = null; } else { workContract[__index] = __item; if (__item.RegionalAgent != this) { __item.RegionalAgent = this; } } }
public virtual void SetWorkContractsAt(WorkContract __item, int __index) { if (__item == null) { workContracts[__index].LSP = null; } else { workContracts[__index] = __item; if (__item.LSP != this) { __item.LSP = this; } } }
public virtual void AddAtIndexWorkContract(int index, WorkContract __item) { if (__item == null) { return; } workContract?.Insert(index, __item); disableInternalAdditions = true; try { if (__item.RegionalAgent != this) { __item.RegionalAgent = this; } } finally { disableInternalAdditions = false; } }
public void ScheduledRoute_persistence_test() { DateTime now = DateTime.Now; // Get datetime without milliseconds now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind); var _workcontract_workcontract_scheduledroutes = new DSS3_LogisticsPoolingForUrbanDistribution.BO.WorkContract { CreationDate = now, LastUpdate = now, }; new PersistenceSpecification <DSS3_LogisticsPoolingForUrbanDistribution.BO.ScheduledRoute>(Session) .CheckProperty(p => p.Origin, "ScheduledRoute_Origin") .CheckProperty(p => p.Destination, "ScheduledRoute_Destination") .CheckProperty(p => p.DaysOfWeek, "ScheduledRoute_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.Revision, 4080) .CheckProperty(p => p.GUID, "ScheduledRoute_GUID") .CheckProperty(p => p.ReservedCapacityLaden, 5177) .CheckProperty(p => p.BaseId, 7525) .CheckProperty(p => p.TotalAvailableCapacityM3, 222222.22M) .CheckProperty(p => p.TotalAvailableCapacityLaden, 4642) .CheckProperty(p => p.ReservedCapacityKG, 222222.22M) .CheckProperty(p => p.ReservedCapacityM3, 222222.22M) .CheckProperty(p => p.FixedPrice, 222222.22M) .CheckProperty(p => p.OriginComments, "ScheduledRoute_OriginComments") .CheckProperty(p => p.DestinationComments, "ScheduledRoute_DestinationComments") .CheckProperty(p => p.TruckPlate, "ScheduledRoute_TruckPlate") .CheckProperty(p => p.DeliveryDate, now) .CheckReference(p => p.WorkContract, _workcontract_workcontract_scheduledroutes) .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(WorkContract 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 [WorkContract] instance to use as the destination.</param> /// <returns>A copy of the object</returns> public virtual WorkContract Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, WorkContract copy = null) { if (copiedObjects == null) { copiedObjects = new Hashtable(); } if (copy == null && copiedObjects.Contains(this)) { return((WorkContract)copiedObjects[this]); } copy = copy ?? new WorkContract(); if (!asNew) { copy.TransientId = this.TransientId; copy.Id = this.Id; } copy.CreationDate = this.CreationDate; copy.LastUpdate = this.LastUpdate; copy.Status = this.Status; if (!copiedObjects.Contains(this)) { copiedObjects.Add(this, copy); } if (deep && this.regionalAgent != null) { if (!copiedObjects.Contains(this.regionalAgent)) { if (asNew && reuseNestedObjects) { copy.RegionalAgent = this.RegionalAgent; } else if (asNew) { copy.RegionalAgent = this.RegionalAgent.Copy(deep, copiedObjects, true); } else { copy.regionalAgent = this.regionalAgent.Copy(deep, copiedObjects, false); } } else { if (asNew) { copy.RegionalAgent = (RegionalAgent)copiedObjects[this.RegionalAgent]; } else { copy.regionalAgent = (RegionalAgent)copiedObjects[this.RegionalAgent]; } } } copy.scheduledRoutes = new List <ScheduledRoute>(); if (deep && this.scheduledRoutes != null) { foreach (var __item in this.scheduledRoutes) { if (!copiedObjects.Contains(__item)) { if (asNew && reuseNestedObjects) { copy.AddScheduledRoutes(__item); } else { copy.AddScheduledRoutes(__item.Copy(deep, copiedObjects, asNew)); } } else { copy.AddScheduledRoutes((ScheduledRoute)copiedObjects[__item]); } } } 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]; } } } return(copy); }
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(); }
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(); }