Пример #1
0
 private static void AddCalculatedColumns(DataTable table, Share share)
 {
     foreach(var calculation in share.Calculations)
     {
         table.Columns.Add(calculation.ToString(), typeof(Decimal));
     }
 }
Пример #2
0
 //todo explore parralelization here
 public int Import(string[] files)
 {
     var totalRecords = 0;
     engine.Reset();
     foreach(var file in files)
     {
         var share = new Share(
             file.ToShareId(),
             file.ReadFile(),
             engine
         );
         repo.Save(share);
         totalRecords += share.ProcessedQuotes.Count;
     }
     return totalRecords;
 }
Пример #3
0
 private static DataTable AsDataTable(Share share)
 {
     var table = new DataTable();
     AddQuoteColumns(table);
     AddCalculatedColumns(table, share);
     foreach (var pq in share.ProcessedQuotes)
     {
         DataRow row = table.NewRow();
         AddQuoteRowData(share.Id, row, pq);
         AddCalculatedRowData(row, pq);
         table.Rows.Add(row);
     }
     return table;
 }
Пример #4
0
 public void Save(Share share)
 {
     var data = AsDataTable(share);
     this.BulkInsertStock(data);
 }