public virtual void RemoveInvoiceProducts(InvoiceProduct __item) { if (__item != null) { __item.Invoice = null; } }
public virtual void InternalRemoveInvoiceProducts(InvoiceProduct __item) { if (__item == null) { return; } invoiceProducts?.Remove(__item); }
public virtual void InternalAddInvoiceProducts(InvoiceProduct __item) { if (__item == null || disableInternalAdditions) { return; } invoiceProducts?.Add(__item); }
public virtual void AddInvoiceProducts(InvoiceProduct __item) { if (__item == null) { return; } if (__item.Invoice != this) { __item.Invoice = this; } }
public virtual void SetInvoiceProductsAt(InvoiceProduct __item, int __index) { if (__item == null) { invoiceProducts[__index].Invoice = null; } else { invoiceProducts[__index] = __item; if (__item.Invoice != this) { __item.Invoice = this; } } }
public virtual void AddAtIndexInvoiceProducts(int index, InvoiceProduct __item) { if (__item == null) { return; } invoiceProducts?.Insert(index, __item); disableInternalAdditions = true; try { if (__item.Invoice != this) { __item.Invoice = this; } } finally { disableInternalAdditions = false; } }
public void Invoice_persistence_test() { DateTime now = DateTime.Now; // Get datetime without milliseconds now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind); var _invoice_products_invoice = new DSS5_SupplyChainFinancialsOptimisation.BO.OrderProduct { Code = "OrderProduct_Code", Quantity = 222222.22M, Description = "OrderProduct_Description", UnitValue = "OrderProduct_UnitValue", MeasurementUnit = "OrderProduct_MeasurementUnit", Price = 222222.22M, LineTotalPrice = 222222.22M, }; var _invoice_products_invoice2 = new DSS5_SupplyChainFinancialsOptimisation.BO.OrderProduct { Code = "OrderProduct_Code", Quantity = 222222.22M, Description = "OrderProduct_Description", UnitValue = "OrderProduct_UnitValue", MeasurementUnit = "OrderProduct_MeasurementUnit", Price = 222222.22M, LineTotalPrice = 222222.22M, }; var _invoice_invoiceproducts_invoice = new DSS5_SupplyChainFinancialsOptimisation.BO.InvoiceProduct { Code = "InvoiceProduct_Code", Quantity = 222222.22M, Description = "InvoiceProduct_Description", UnitValue = "InvoiceProduct_UnitValue", MeasurementUnit = "InvoiceProduct_MeasurementUnit", Price = 222222.22M, LineTotalPrice = 222222.22M, }; var _invoice_invoiceproducts_invoice2 = new DSS5_SupplyChainFinancialsOptimisation.BO.InvoiceProduct { Code = "InvoiceProduct_Code", Quantity = 222222.22M, Description = "InvoiceProduct_Description", UnitValue = "InvoiceProduct_UnitValue", MeasurementUnit = "InvoiceProduct_MeasurementUnit", Price = 222222.22M, LineTotalPrice = 222222.22M, }; var _order_orders_invoices = 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_invoices2 = 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_invoices = 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.Invoice>(Session) .CheckProperty(p => p.InvoiceNumber, "Invoice_InvoiceNumber") .CheckProperty(p => p.Description, "Invoice_Description") .CheckProperty(p => p.DateIssued, now) .CheckProperty(p => p.Amount, 2222222222222.22M) .CheckProperty(p => p.CustomerType, "Invoice_CustomerType") .CheckProperty(p => p.CumulativeBalance, 222222.22M) .CheckProperty(p => p.TotalPrice, 222222.22M) .CheckProperty(p => p.DescriptionTwo, "Invoice_DescriptionTwo") .CheckProperty(p => p.Attribute, "Invoice_Attribute") .CheckProperty(p => p.InvoiceAttachment, "Invoice_InvoiceAttachment") .CheckBag(p => p.Products, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.OrderProduct> { _invoice_products_invoice, _invoice_products_invoice2 })) .CheckBag(p => p.InvoiceProducts, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.InvoiceProduct> { _invoice_invoiceproducts_invoice, _invoice_invoiceproducts_invoice2 })) .CheckBag(p => p.Orders, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.Order> { _order_orders_invoices, _order_orders_invoices2 })) .CheckReference(p => p.Transaction, _transaction_transaction_invoices) .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(InvoiceProduct 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 [InvoiceProduct] instance to use as the destination.</param> /// <returns>A copy of the object</returns> public virtual InvoiceProduct Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, InvoiceProduct copy = null) { if (copiedObjects == null) { copiedObjects = new Hashtable(); } if (copy == null && copiedObjects.Contains(this)) { return((InvoiceProduct)copiedObjects[this]); } copy = copy ?? new InvoiceProduct(); if (!asNew) { copy.TransientId = this.TransientId; copy.Id = this.Id; } copy.Code = this.Code; copy.Quantity = this.Quantity; copy.Description = this.Description; copy.UnitValue = this.UnitValue; copy.MeasurementUnit = this.MeasurementUnit; copy.Price = this.Price; copy.LineTotalPrice = this.LineTotalPrice; if (!copiedObjects.Contains(this)) { copiedObjects.Add(this, copy); } if (deep && this.invoice != null) { if (!copiedObjects.Contains(this.invoice)) { if (asNew && reuseNestedObjects) { copy.Invoice = this.Invoice; } else if (asNew) { copy.Invoice = this.Invoice.Copy(deep, copiedObjects, true); } else { copy.invoice = this.invoice.Copy(deep, copiedObjects, false); } } else { if (asNew) { copy.Invoice = (Invoice)copiedObjects[this.Invoice]; } else { copy.invoice = (Invoice)copiedObjects[this.Invoice]; } } } if (deep && this.supplierProduct != null) { if (!copiedObjects.Contains(this.supplierProduct)) { if (asNew && reuseNestedObjects) { copy.SupplierProduct = this.SupplierProduct; } else if (asNew) { copy.SupplierProduct = this.SupplierProduct.Copy(deep, copiedObjects, true); } else { copy.supplierProduct = this.supplierProduct.Copy(deep, copiedObjects, false); } } else { if (asNew) { copy.SupplierProduct = (SupplierProduct)copiedObjects[this.SupplierProduct]; } else { copy.supplierProduct = (SupplierProduct)copiedObjects[this.SupplierProduct]; } } } return(copy); }