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(); }
public void ProofOfDelivery_persistence_test() { DateTime now = DateTime.Now; // Get datetime without milliseconds now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind); var _order_truckdriver_proofofdelivery = new DSS3_LogisticsPoolingForUrbanDistribution.BO.TruckDriver { UserName = "******", PasswordHash = "TruckDriver_PasswordHash", SecurityStamp = "TruckDriver_SecurityStamp", EmailConfirmed = true, LockoutEnabled = true, PhoneNumberConfirmed = true, TwoFactorEnabled = true, AccessFailedCount = 4146, Name = "TruckDriver_Name", Email = "TruckDriver_Email", PhoneNumber = "TruckDriver_PhoneNumber", LockoutEndDate = now, }; var _order_orderwms_proofofdelivery = new DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS { OrdID = 2278, OrdOrderID_Remote = 5488, OrdOrderExternalCode = "OrderWMS_OrdOrderExternalCode", OrdOrderDescr = "OrderWMS_OrdOrderDescr", OrdRegDateTime = now, OrdDateTime = now, OrdDeliveryDateTime = now, OrdDepositorCode = "OrderWMS_OrdDepositorCode", OrdDepositorFullName = "OrderWMS_OrdDepositorFullName", OrdCustomerCode = "OrderWMS_OrdCustomerCode", OrdCustomerFullName = "OrderWMS_OrdCustomerFullName", OrdStatus = 8366, OrdMemo = "OrderWMS_OrdMemo", OrdPurpose = "OrderWMS_OrdPurpose", OrdDeliveryValue = 222.222f, OrdDeliveryNotes = "OrderWMS_OrdDeliveryNotes", OrdIsReturn = 8057, OrdPrdTypeDescr = "OrderWMS_OrdPrdTypeDescr", OrdWrhRoutingCode = "OrderWMS_OrdWrhRoutingCode", OrdDlsId = 8986, OrdDlsDescr = "OrderWMS_OrdDlsDescr", OrdDlsAddress = "OrderWMS_OrdDlsAddress", OrdDlsZipCode = "OrderWMS_OrdDlsZipCode", OrdDlsCity = "OrderWMS_OrdDlsCity", OrdDlsArea = "OrderWMS_OrdDlsArea", OrdRoutingStatus = 1780, OrdLfdWeight = 222.222f, OrdLfdVol = 222.222f, OrdLfdCtn = 4656, OrdLfdBar = 5560, OrdLfdPalEuro = 125, OrdLfdPalInd = 5995, OrdLfdPalElsa = 7619, OrdLfdParOU = 9209, OrdLfdVar = 6875, OrdVoucherDateTime = now, OrdVoucherNumber = "OrderWMS_OrdVoucherN", OrdVoucherSeries = "OrderWMS_OrdVoucherS", OrdVoucherId = 8674, OrdAgencyCode = "OrderWMS_OrdAgencyCode", OrdAgencyDescr = "OrderWMS_OrdAgencyDescr", OrdAgencyAddress = "OrderWMS_OrdAgencyAddress", OrdTelRouteId = 8028, OrdVchPlateNr = "OrderWMS_OrdVchPlateNr", OrdVchRouteNr = 7075, OrdVhrDate = now, OrdVhrID = 8017, OrdLastUpdateDateTime = now, OrdReadyForLoading = 4850, Polyline = "OrderWMS_Polyline", Warehouse = "OrderWMS_Warehouse", Truck = "OrderWMS_Truck", WarehouseAddress = "OrderWMS_WarehouseAddress", ETA = "OrderWMS_ETA", ATA = now, DestLat = 222.222f, DestLong = 222.222f, COE = 222.222f, }; new PersistenceSpecification <DSS3_LogisticsPoolingForUrbanDistribution.BO.ProofOfDelivery>(Session) .CheckProperty(p => p.DateIssued, now) .CheckProperty(p => p.PODNumber, 3476) .CheckProperty(p => p.QualityStatus, "ProofOfDelivery_QualityStatus") .CheckProperty(p => p.QuantityStatus, "ProofOfDelivery_QuantityStatus") .CheckProperty(p => p.DeliveryStatus, "ProofOfDelivery_DeliveryStatus") .CheckProperty(p => p.PODAttachment, "ProofOfDelivery_PODAttachment") .CheckProperty(p => p.Comments, "ProofOfDelivery_Comments") .CheckProperty(p => p.DamagedPackaging, true) .CheckProperty(p => p.DamagedProducts, true) .CheckProperty(p => p.CloseToExpiry, true) .CheckReference(p => p.TruckDriver, _order_truckdriver_proofofdelivery) .CheckReference(p => p.OrderWMS, _order_orderwms_proofofdelivery) .VerifyTheMappings(); }
/// <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 [TruckDriver] instance to use as the destination.</param> /// <returns>A copy of the object</returns> public virtual TruckDriver Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, TruckDriver copy = null) { if (copiedObjects == null) { copiedObjects = new Hashtable(); } if (copy == null && copiedObjects.Contains(this)) { return((TruckDriver)copiedObjects[this]); } copy = copy ?? new TruckDriver(); if (!asNew) { copy.TransientId = this.TransientId; } if (!copiedObjects.Contains(this)) { copiedObjects.Add(this, copy); } copy.proofOfDelivery = new List <ProofOfDelivery>(); if (deep && this.proofOfDelivery != null) { foreach (var __item in this.proofOfDelivery) { if (!copiedObjects.Contains(__item)) { if (asNew && reuseNestedObjects) { copy.AddProofOfDelivery(__item); } else { copy.AddProofOfDelivery(__item.Copy(deep, copiedObjects, asNew)); } } else { copy.AddProofOfDelivery((ProofOfDelivery)copiedObjects[__item]); } } } if (deep && this.truck != null) { if (!copiedObjects.Contains(this.truck)) { if (asNew && reuseNestedObjects) { copy.Truck = this.Truck; } else if (asNew) { copy.Truck = this.Truck.Copy(deep, copiedObjects, true); } else { copy.truck = this.truck.Copy(deep, copiedObjects, false); } } else { if (asNew) { copy.Truck = (Truck)copiedObjects[this.Truck]; } else { copy.truck = (Truck)copiedObjects[this.Truck]; } } } base.Copy(deep, copiedObjects, asNew, reuseNestedObjects, copy); return(copy); }