Esempio n. 1
0
/// <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(MeanOfTransport compareTo)
        {
            return(!this.IsTransient() && !compareTo.IsTransient() && this.Id.Equals(compareTo.Id));
        }
Esempio n. 2
0
        public void BillOfLanding_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _billoflanding_meanoftransport_billoflading = new DSS5_SupplyChainFinancialsOptimisation.BO.MeanOfTransport
            {
                LicensePlate = "MeanOfTransport_LicensePlate",
                ContainerId  = "MeanOfTransport_ContainerId",
                ShipId       = "MeanOfTransport_ShipId",
                TrainId      = "MeanOfTransport_TrainId",
            };
            var _order_orders_billoflandings = new DSS5_SupplyChainFinancialsOptimisation.BO.Order
            {
                OrderNumber             = "Order_OrderNumber",
                EstimatedDateOfDelivery = now,
                PaymentTerms            = "Order_PaymentTerms",
                IntermediateParty       = true,
                IsCancelled             = true,
                DateOfOrder             = now,
                OrderAmount             = 2222222222.22222M,
                TotalPrice      = 2222222222.22222M,
                From            = "Order_From",
                DeliveryTo      = "Order_DeliveryTo",
                OrderAttachment = "Order_OrderAttachment",
            };
            var _order_orders_billoflandings2 = new DSS5_SupplyChainFinancialsOptimisation.BO.Order
            {
                OrderNumber             = "Order_OrderNumber",
                EstimatedDateOfDelivery = now,
                PaymentTerms            = "Order_PaymentTerms",
                IntermediateParty       = true,
                IsCancelled             = true,
                DateOfOrder             = now,
                OrderAmount             = 2222222222.22222M,
                TotalPrice      = 2222222222.22222M,
                From            = "Order_From",
                DeliveryTo      = "Order_DeliveryTo",
                OrderAttachment = "Order_OrderAttachment",
            };
            var _transaction_transaction_billoflandings = new DSS5_SupplyChainFinancialsOptimisation.BO.Transaction
            {
                TransactionDateOccured = now,
                TransactionValue       = 2222222222.22222M,
                FundedAmount           = 2222222222.22222M,
                ToBePaidAmount         = 2222222222.22222M,
                InvoicedDate           = now,
                PaymentStatus          = "Transaction_PaymentStatus",
                PaymentDate            = now,
                RestPaymentAmount      = 2222222222.22222M,
                PaidByBuyer            = true,
            };

            new PersistenceSpecification <DSS5_SupplyChainFinancialsOptimisation.BO.BillOfLanding>(Session)
            .CheckProperty(p => p.LandingPlace, "BillOfLanding_LandingPlace")
            .CheckProperty(p => p.LandingDate, now)
            .CheckProperty(p => p.DeliveryPlace, "BillOfLanding_DeliveryPlace")
            .CheckProperty(p => p.DeliveryDate, now)
            .CheckProperty(p => p.DOCNumber, 9936)
            .CheckProperty(p => p.ReceivingPartyId, 1800)
            .CheckProperty(p => p.IsBuyerReceiving, true)
            .CheckReference(p => p.MeanOfTransport, _billoflanding_meanoftransport_billoflading)
            .CheckBag(p => p.Orders, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.Order>
            {
                _order_orders_billoflandings,
                _order_orders_billoflandings2
            }))
            .CheckReference(p => p.Transaction, _transaction_transaction_billoflandings)
            .VerifyTheMappings();
        }
Esempio n. 3
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 [MeanOfTransport] instance to use as the destination.</param>
/// <returns>A copy of the object</returns>
        public virtual MeanOfTransport Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, MeanOfTransport copy = null)
        {
            if (copiedObjects == null)
            {
                copiedObjects = new Hashtable();
            }
            if (copy == null && copiedObjects.Contains(this))
            {
                return((MeanOfTransport)copiedObjects[this]);
            }
            copy = copy ?? new MeanOfTransport();
            if (!asNew)
            {
                copy.TransientId = this.TransientId;
                copy.Id          = this.Id;
            }
            copy.LicensePlate = this.LicensePlate;
            copy.ContainerId  = this.ContainerId;
            copy.ShipId       = this.ShipId;
            copy.TrainId      = this.TrainId;
            if (!copiedObjects.Contains(this))
            {
                copiedObjects.Add(this, copy);
            }
            return(copy);
        }