Ejemplo n.º 1
0
        public void tblZslCarrier_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _zanardobo_carrier_tblzslcarrier = new DSS3_LogisticsPoolingForUrbanDistribution.BO.tblZslCarrier
            {
                CarrierName = "tblZslCarrier_CarrierName",
            };

            new PersistenceSpecification <DSS3_LogisticsPoolingForUrbanDistribution.BO.tblZslCarrier>(Session)
            .CheckProperty(p => p.CarrierName, "tblZslCarrier_CarrierName")
            .CheckReference(p => p.Carrier, _zanardobo_carrier_tblzslcarrier)
            .VerifyTheMappings();
        }
        public void tblZslTransportExecutionPlan_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _zanardobo_tblzslcarrier_tblzsltransportexecutionplan = new DSS3_LogisticsPoolingForUrbanDistribution.BO.tblZslCarrier
            {
                CarrierName = "tblZslCarrier_CarrierName",
            };
            var _zanardobo_tblzslplatformbookingorder_tblzsltransportexecutionplan = new DSS3_LogisticsPoolingForUrbanDistribution.BO.tblZslPlatformBookingOrder
            {
                BookingDate      = now,
                OrderNo          = "tblZslPlatformBookingOrder_OrderNo",
                NoIdentity       = "tblZslPlatformBookingOrder_NoIdentity",
                FromExtTime      = now,
                ToExtTime        = now,
                BookStatus       = "tblZslPlatformBookingOrder_BookStatus",
                NoPlatform       = "tblZslPlatformBookingOrder_NoPlatform",
                NoCourier        = "tblZslPlatformBookingOrder_NoCourier",
                Warehouse        = "tblZslPlatformBookingOrder_Warehouse",
                Driver           = "tblZslPlatformBookingOrder_Driver",
                DriverTelephone  = "tblZslPlatformBookingOrder_DriverTelephone",
                Plate            = "tblZslPlatformBookingOrder_Plate",
                Trailerplate     = "tblZslPlatformBookingOrder_Trailerplate",
                PalletIN         = 780,
                TotalPallet      = 7780,
                DateArrived      = now,
                TimeArrived      = now,
                DateExit         = now,
                TImeExit         = now,
                RouteTracking_ID = 7596,
            };
            var _zanardobo_tblzsldeliverystatus_tblzsltransportexecutionplan = new DSS3_LogisticsPoolingForUrbanDistribution.BO.tblZslDeliveryStatus
            {
                DeliveryStatusName = "tblZslDeliveryStatus_DeliveryStatusName",
            };

            new PersistenceSpecification <DSS3_LogisticsPoolingForUrbanDistribution.BO.tblZslTransportExecutionPlan>(Session)
            .CheckProperty(p => p.Notes, "tblZslTransportExecutionPlan_Notes")
            .CheckProperty(p => p.ETA, now)
            .CheckProperty(p => p.ActualArrivalTime, now)
            .CheckReference(p => p.tblZslCarrier, _zanardobo_tblzslcarrier_tblzsltransportexecutionplan)
            .CheckReference(p => p.tblZslPlatformBookingOrder, _zanardobo_tblzslplatformbookingorder_tblzsltransportexecutionplan)
            .CheckReference(p => p.tblZslDeliveryStatus, _zanardobo_tblzsldeliverystatus_tblzsltransportexecutionplan)
            .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(tblZslCarrier 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 [tblZslCarrier] instance to use as the destination.</param>
/// <returns>A copy of the object</returns>
        public virtual tblZslCarrier Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, tblZslCarrier copy = null)
        {
            if (copiedObjects == null)
            {
                copiedObjects = new Hashtable();
            }
            if (copy == null && copiedObjects.Contains(this))
            {
                return((tblZslCarrier)copiedObjects[this]);
            }
            copy = copy ?? new tblZslCarrier();
            if (!asNew)
            {
                copy.TransientId = this.TransientId;
                copy.Id          = this.Id;
            }
            copy.CarrierName = this.CarrierName;
            if (!copiedObjects.Contains(this))
            {
                copiedObjects.Add(this, copy);
            }
            if (deep && this.carrier != null)
            {
                if (!copiedObjects.Contains(this.carrier))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.Carrier = this.Carrier;
                    }
                    else if (asNew)
                    {
                        copy.Carrier = this.Carrier.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.carrier = this.carrier.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.Carrier = (tblZslCarrier)copiedObjects[this.Carrier];
                    }
                    else
                    {
                        copy.carrier = (tblZslCarrier)copiedObjects[this.Carrier];
                    }
                }
            }
            return(copy);
        }