public void LogAccountTransactionEvent(AccountTransactionEvent accountTransactionEvent) { using (var command = new NpgsqlCommand("log_account_transaction_event")) { Log.DebugFormat("Inserting account transaction event {0} into databse...", accountTransactionEvent.Id); command.CommandType = System.Data.CommandType.StoredProcedure; AddCommonEventPropertyParametersToCommand(command, accountTransactionEvent); command.Parameters.Add(new NpgsqlParameter { Value = accountTransactionEvent.AccountAction }); command.Parameters.Add(new NpgsqlParameter { NpgsqlDbType = NpgsqlDbType.Money, Value = accountTransactionEvent.Funds }); int id = ExecuteInsertCommand(command); Log.DebugFormat(CultureInfo.InvariantCulture, "Successfully inserted account transaction event {0} (database id = {1}).", accountTransactionEvent.Id, id); } }
private AccountTransactionEvent GetAccountTransactionEventFromRecord(NpgsqlDataReader reader) { var accountTransactionEvent = new AccountTransactionEvent { AccountAction = (AccountAction)reader.GetValue(13), Funds = reader.GetDecimal(10) }; FillBaseEventPropertiesFromRecord(accountTransactionEvent, reader); return(accountTransactionEvent); }