Пример #1
0
        public static void PrintAutos(IEnumerable <Auto> autos)
        {
            Console.WriteLine("The whole list of autos\n");

            var table = new TableFramer("Name", "Miles_per_Gallon", "Cylinders", "Displacement", "Horsepower", "Weight_in_lbs", "Acceleration", "Year");

            foreach (var auto in autos)
            {
                table.AddRow(auto.Name, auto.Miles_per_Gallon, auto.Cylinders, auto.Displacement, auto.Horsepower, auto.Weight_in_lbs, auto.Acceleration, auto.Year.ToString("ddd, dd MMMM yyyy", CultureInfo.GetCultureInfo("en-en")));
            }
            table.Write();
        }
Пример #2
0
        public static void PrinttimeFlows(IEnumerable <CargotimeFlow> pushCargotimeFlows)
        {
            Console.WriteLine("The whole list of cargotimeFlows \n");

            var table = new TableFramer("TimeStamp", "LastUpdate", "Role", "Worklist");

            foreach (var cargotimeFlow in pushCargotimeFlows)
            {
                table.AddRow(cargotimeFlow.Document_registered, cargotimeFlow.Document_updated, cargotimeFlow.Role, cargotimeFlow.Object_status);
            }
            table.Write();
        }
        public static TableFramer From <T>(IEnumerable <T> values)
        {
            var table = new TableFramer
            {
                ColumnTypes = GetColumnsType <T>().ToArray()
            };

            var columns = GetColumns <T>();

            table.AddColumn(columns);

            foreach (
                var propertyValues
                in values.Select(value => columns.Select(column => GetColumnValue <T>(value, column)))
                )
            {
                table.AddRow(propertyValues.ToArray());
            }

            return(table);
        }