public ReportTable Generate(OrderItemsCollection orderItems)
        {
            var colors = orderItems.GetAllColors();
            var blocks = orderItems.GetAllShapes();

            var table = new ReportTable(ConvertColorToString(colors));

            table.ConstructTableBody(orderItems, blocks, colors);

            return(table);
        }
示例#2
0
        private List <InvoiceItem> GetColorRelatedInvoiceItems(OrderItemsCollection orderItems)
        {
            var itemsList = new List <InvoiceItem>();
            var colors    = orderItems.GetAllColors();

            foreach (var color in colors)
            {
                if (color.Price != 0)
                {
                    var name         = $"{color.Name} color surcharge";
                    var quantity     = orderItems.GetQuantityByColor(color);
                    var pricePerItem = color.Price;
                    var totalCost    = quantity * color.Price;
                    var invoiceItem  = new InvoiceItem(name, quantity, pricePerItem, totalCost);

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