예제 #1
0
        private static void TestCsvParsing()
        {
            string path = @"D:\Downloads\1253a5fc75280025995fa7f3cb61000e-6b4989b6cf20ddc619c28a2e51eb9e27eb185709\fuel.csv";

            //string path = @"D:\Downloads\582e9c044eee5882d54a6e5997c0be52-1c6cd2fe0bda9c63178fda1f313370479ff0bc8a\manufacturers.csv";

            ConsoleUtils.WriteTableFromCSV(path);


            var dt = CSVUtils.ParseCSVToDataTable(path);

            ConsoleUtils.WriteDataTable(dt);

            if (!path.EndsWith("fuel.csv"))
            {
                return;
            }

            var customers = CSVUtils.ParseCSV <Customer, CustomerMap>(path);

            ConsoleUtils.WriteLine(customers.Last().Name);


            var customers2 = CSVUtils.ParseCSV <Customer>(path);

            ConsoleUtils.WriteLine(customers2.First().Name);
        }
예제 #2
0
        private static void TestParseCSVToObjectAndDisplayObject()
        {
            const string filePathFormat = @"D:\Users\User\OneDrive\Magisterka\Semestr 2\Business Intelligence w przedsięborstwie\Laboratoria\Zadanie 3\Zadanie\Dane\{0}_DATA_TABLE.csv";

            string tableName = "klient";

            string filePath = string.Format(filePathFormat, tableName.ToUpper());


            var customers = CSVUtils.ParseCSV <Customer>(filePath);

            var customersFromMap = CSVUtils.ParseCSV <Customer, CustomerMap>(filePath, false);


            ConsoleUtils.WriteTableFromObjects(customers, false);

            ConsoleUtils.WriteTableFromObjects(customersFromMap, false);
        }