/// <summary> /// Prints the order list items. /// </summary> /// <returns></returns> protected override string PrintOrderListItems() { var orderListItems = string.Join(string.Empty, InvoiceLines .Select(L => $"<li style='margin-top:.75em;'><span style='font-size:medium;'>" + $"{L.Quantity} x {L.Description} = {L.TotalAmount.ToCurrencyPrecision()}</span>" + $"<br/><span style='font-size:smaller;'>" + $"<strong>[{nameof(L.Price)}]:</strong> {L.Price.ToCurrencyPrecision()};" + $"{(L.Discount > 0 ? $" <strong>[{nameof(L.Discount)}]:</strong> {L.Discount * 100}%" : "")}" + $"</span></li>")); var result = $"<ul>{orderListItems}</ul>"; return(result); }
public void OrderByAnonymousEntityTest() { var result = Session.Query.All <InvoiceLine>() .Select(il => new { InvoiceLine = il, Invoice = il.Invoice }) .OrderBy(x => new { x, x.Invoice.Customer }) .Select(x => new { x, x.Invoice.Customer }); var expected = InvoiceLines .Select(il => new { InvoiceLine = il, Invoice = il.Invoice }) .OrderBy(x => x.InvoiceLine.InvoiceLineId) .ThenBy(x => x.Invoice.InvoiceId) .ThenBy(x => x.Invoice.Customer.CustomerId) .Select(x => new { x, x.Invoice.Customer }); Assert.That(result, Is.Not.Empty); Assert.IsTrue(expected.SequenceEqual(result)); }
public InvoiceEntity(Invoice Invoice, params object[] args) : base(Invoice) { foreach (object arg in args) { if (arg is Order Order) { OrderEntity = new OrderEntity(Order); } if (arg is ICollection <InvoiceLine> InvoiceLines) { InvoiceLineEntities = InvoiceLines.Select(model => new InvoiceLineEntity(model)).ToList(); } if (arg is ICollection <IssueNote> IssueNotes) { IssueNoteEntities = IssueNotes.Select(model => new IssueNoteEntity(model, model.Customer, model.WareHouse)).ToList(); } } }
public InvoiceBuilder WithInvoiceLines(params InvoiceLineBuilder[] lines) { this.lines = new InvoiceLines(lines.Select(l => l.Build()).ToArray()); return(this); }