Beispiel #1
0
 public ParseTransactionResult Parse(Stream parsingContent)
 {
     try
     {
         var result = TryParse(parsingContent);
         return(result);
     }
     catch (Exception ex)
     {
         return(ParseTransactionResult.Error(ex.Message));
     }
 }
Beispiel #2
0
        protected override ParseTransactionResult TryParse(Stream parsingContent)
        {
            using (TextReader reader = new StreamReader(parsingContent))
                using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
                {
                    csv.Configuration.HasHeaderRecord  = false;
                    csv.Configuration.IgnoreBlankLines = true;
                    var records = csv.GetRecords <CsvParseRecords>().ToList();

                    var transactions = records.Select(ToTransaction).ToList();

                    return(ParseTransactionResult.Success(transactions));
                }
        }