private void ParseLine(string line) { TransactionStrings data = new TransactionStrings(splitCsv(line)); AddAnyNewAccounts(data.GetSender(), data.GetRecipient()); AddNewTransaction(data, lineCounter); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { reader.DateParseHandling = DateParseHandling.None; JObject jObject = JObject.Load(reader); string[] inputStrings = new string[5]; inputStrings[0] = (string)jObject["Date"]; inputStrings[1] = (string)jObject["FromAccount"]; inputStrings[2] = (string)jObject["ToAccount"]; inputStrings[3] = (string)jObject["Narrative"]; inputStrings[4] = (string)jObject["Amount"]; TransactionStrings transactionStrings = new TransactionStrings(inputStrings); return(transactionStrings); }
protected void AddNewTransaction(TransactionStrings data, int entry) { try { Date date = new Date(data.GetDate()); Account sender = accounts.GetAccount(data.GetSender()); Account recipient = accounts.GetAccount(data.GetRecipient()); Money amount = new Money(data.GetAmount()); Transaction transaction = new Transaction(date, sender, recipient, data.GetNarrative(), amount); transactions.AddTransaction(transaction); } catch (ArgumentException ae) { WriteErrorToConsoleFirstTime(); LogBadFormatTransaction(entry, ae.Message); } }
private void ParseEntry(TransactionStrings data, int entryNumber) { AddAnyNewAccounts(data.GetSender(), data.GetRecipient()); AddNewTransaction(data, entryNumber); }