public List <TransactionInterface> ListTransactions(long acct_id) { List <TransactionInterface> transaction_list = new List <TransactionInterface>(); dbcmd.CommandText = "SELECT * from transactions where acct_to=@id OR acct_from=@id ORDER BY date DESC"; dbcmd.Parameters.AddWithValue("id", acct_id); var reader = dbcmd.ExecuteReader(); while (reader.Read()) { TransactionInterface temp = new TransactionInterface((int)reader["acct_to"], (int)reader["acct_from"], Convert.ToDecimal(reader["amount"]), reader["note"].ToString(), reader["date"].ToString()); transaction_list.Add(temp); } reader.Close(); return(transaction_list); }
//add transaction to the list public void addTransaction(TransactionInterface transaction) { transactionList.Add(transaction); }