示例#1
0
        static void Main(string[] args)
        {
            var dataLoader             = new CsvDataLoader();
            var dateProcessor          = new DateProcessor();
            var dataAggregator         = new DataAggregator();
            var dataExporter           = new CsvDataExporter();
            var excelReader            = new ExcelDataLoader();
            var csvFinancialDataLoader = new CsvFinancialDataLoader();

            var desktopFolder = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
            var result        = dataLoader.LoadDataFromFile(desktopFolder + "/Diplomovka_ESF/transformed_10000.csv");
            // var result = dataLoader.LoadDataFromFile(desktopFolder + "/Diplomovka_ESF/owners.csv");

            List <BusinessDataItem> parsedBusinessData = new List <BusinessDataItem>();

            result.ForEach(res => parsedBusinessData.AddRange(dateProcessor.SplitBusinessDataByYear(res)));

            var allLoadedIcos            = parsedBusinessData.Select(businessData => businessData.ICO).Distinct().OrderBy(ico => ico).ToList();
            var allIcosWithFinancialData = excelReader.LoadFinancialDataOfCompany(allLoadedIcos, desktopFolder + "/Data_DP/financial_data.xlsx");

            Console.WriteLine($"AllLoadedIcos size {allLoadedIcos.Count} vs. icos with financialData size {allIcosWithFinancialData.Count}");

            // var allIcosWithFinancialData = csvFinancialDataLoader.LoadFinancialDataOfCompany(allLoadedIcos, desktopFolder + "/Data_DP/financial_data_less_detail.csv");
            // Console.WriteLine($"AllLoadedIcos size {allLoadedIcos.Count} vs. icos with financialData from csv size {allIcosWithFinancialData.Count}");

            List <CompanyOutputData> ownersInfo = dataAggregator.AggregateDataByCompany(parsedBusinessData);

            dataExporter.ExportDataToCsv(ownersInfo);

            Console.WriteLine("Transformation finished");
        }
        public void CanCorrectlyImportXlsFiles()
        {
            var excelFileInfo = new ExcelFileInfo(new FileInfo(@"Excel\Resources\People.xls"));
            var mapping       = new MappingRules <Person, int>();

            mapping.AddMapping(0, p => p.Name);
            mapping.AddMapping(1, p => p.FriendsCount);
            mapping.AddMapping(2, p => p.DateOfBirth);
            mapping.AddMapping(3, p => p.Sex, value => Enum.Parse(typeof(Gender), value as string));

            var dataLoader = new ExcelDataLoader <Person>(excelFileInfo, mapping);
            var result     = dataLoader.LoadData();

            Assert.IsNotNull(result);
            Assert.AreEqual(4, result.Count());
        }
示例#3
0
 public void LoadFile(string cfgFileName)
 {
     ExcelDataLoader.LoadExcelFormCSV(cfgFileName, out m_DataDictionary);
 }