public KashFlow.Invoice ToData() { return(new KashFlow.Invoice() { Lines = Lines.Select(x => x.ToData()).ToArray(), DeliveryAddress = DeliveryAddress.ToData(), InvoiceDBID = InvoiceID, InvoiceNumber = Number, InvoiceDate = IssueDate, DueDate = DueDate, SuppressTotal = IsTotalSuppressed ? 1 : 0, ProjectID = ProjectID ?? 0, CurrencyCode = CurrencyCode, ExchangeRate = ExchangeRate, Paid = IsPaid ? 1 : 0, CustomerID = CustomerOrSupplierID, CustomerReference = Reference, EstimateCategory = EstimateCategory, NetAmount = NetAmount, VATAmount = VATAmount, AmountPaid = PaidAmount, PermaLink = Url, UseCustomDeliveryAddress = IsUsingCustomDeliveryAddress }); }
public Invoice(KashFlow.Invoice invoice) : base(invoice) { Lines = invoice.Lines.Select(x => new InvoiceLine((KashFlow.InvoiceLine)x)).ToList(); DeliveryAddress = new DeliveryAddress(invoice.DeliveryAddress); InvoiceID = invoice.InvoiceDBID; Number = invoice.InvoiceNumber; IssueDate = invoice.InvoiceDate; DueDate = invoice.DueDate; IsTotalSuppressed = invoice.SuppressTotal == 1; ProjectID = invoice.ProjectID > 0 ? (int?)invoice.ProjectID : null; CurrencyCode = invoice.CurrencyCode; ExchangeRate = invoice.ExchangeRate; IsPaid = invoice.Paid == 1; CustomerOrSupplierID = invoice.CustomerID; Reference = invoice.CustomerReference; EstimateCategory = invoice.EstimateCategory; NetAmount = invoice.NetAmount; VATAmount = invoice.VATAmount; PaidAmount = invoice.AmountPaid; Url = invoice.PermaLink; IsUsingCustomDeliveryAddress = invoice.UseCustomDeliveryAddress; }