Ejemplo n.º 1
0
        private ReportTable GenerateShapeQuanitityTable(OrderItemsCollection orderItems)
        {
            var blocks = orderItems.GetAllShapes();
            var table  = new ReportTable(new List <string> {
                ColumnHeader
            });

            table.ConstructTableBody(orderItems, blocks);

            return(table);
        }
        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);
        }
        public string FormatTable(ReportTable reportTable)
        {
            var header = new List <string>(reportTable.Header);

            header.Insert(0, " ");
            var table = new ConsoleTable(header.ToArray());

            foreach (var row in reportTable.Body)
            {
                object[] tableRow = new object[row.Value.Count + 1];
                tableRow[0] = row.Key;
                for (var i = 0; i < row.Value.Count; i++)
                {
                    tableRow[i + 1] = row.Value[i];
                }
                ;
                table.AddRow(tableRow);
            }

            return(table.ToString() + "\n");
        }
Ejemplo n.º 4
0
 private string ConvertTable(ReportTable table)
 {
     return(_tableParser.FormatTable(table));
 }