private void DBImport(List <string> files) { CSVParser parser = new CSVParser(); foreach (var file in files) { var headers = parser.GetHeaders(Path.Combine(DownloadPath, file), CsvSeparator); var data = parser.GetData(Path.Combine(DownloadPath, file), CsvSeparator); string datePattern = "20[0-9]*.CSV"; var datePart = Regex.Match(file, datePattern).Value; var tableName = file.Replace(datePart, string.Empty); ImportRepository.CleanTable(tableName); ImportRepository.SaveData(headers, data, tableName); } ImportRepository.MergeData(); /* foreach (var file in files) * { * string datePattern = "20[0-9]*.CSV"; * var datePart = Regex.Match(file, datePattern).Value; * var tableName = file.Replace(datePart, string.Empty); * ImportRepository.CleanTable(tableName); * }*/ }