public ImportBatch CreateImportBatch(Account account, Stream input) { if (_fileHandler == null) { throw new ApplicationException("No file handler in transaction import"); } if (_parser == null) { throw new ApplicationException("No parser in transaction import"); } if (_matcher == null) { throw new ApplicationException("No transaction matcher in transaction import"); } var batch = new ImportBatch() { Id = Guid.Empty, DateImported = DateTime.Now, AccountId = account.Id, // Transactions = new List<ImportedTransaction>() }; try { batch.Transactions = new List<ImportedTransaction>( _matcher.Match( _parser.Parse( _fileHandler.GetImportRecords(input, (s) => !MatchSuncorpHeaders(s) ) ) , account.Transactions) ); } catch (Exception) { throw; } return batch; }
public bool SetBatch(ImportBatch batch) { throw new NotImplementedException(); }
public bool SetBatch(ImportBatch batch) { return ImportBatches.Save(batch, SafeMode.True).Ok; }
public bool CreateBatch(ImportBatch batch) { foreach (var t in batch.Transactions) { if (t.Id == Guid.Empty) { t.Id = Guid.NewGuid(); } } return ImportBatches.Insert(batch, SafeMode.True).Ok; }