public void ConstructTableBody(OrderItemsCollection orderItems, List <Block> blocks)
 {
     foreach (var block in blocks)
     {
         var quantities = new List <int> {
             orderItems.GetQuantityByShape(block)
         };
         AddRow(block.Shape.ToString(), quantities);
     }
 }
Example #2
0
        private List <InvoiceItem> GetShapeRelatedInvoiceItems(OrderItemsCollection orderItems)
        {
            var itemsList = new List <InvoiceItem>();
            var blocks    = orderItems.GetAllShapes();

            foreach (var block in blocks)
            {
                var name         = block.Shape.ToString();
                var quantity     = orderItems.GetQuantityByShape(block);
                var pricePerItem = block.Price;
                var totalCost    = quantity * block.Price;
                var invoiceItem  = new InvoiceItem(name, quantity, pricePerItem, totalCost);

                itemsList.Add(invoiceItem);
            }
            return(itemsList);
        }