public Transaction(User user, DateTime date) { User = user; Date = DateTime.Now; this._transactionID = Transaction.Counter; Transaction.Counter++; }
public InsertCashTransaction AddCreditsToAccount(User user, decimal amount) { InsertCashTransaction addcreditstoaccount = new InsertCashTransaction(user, DateTime.Now, amount); addcreditstoaccount.Execute(); transactionlog.WriteTransactionLog(addcreditstoaccount); // Bruger ToString() i Transaction CompletedTransactions.Add(addcreditstoaccount); return addcreditstoaccount; }
public InsertCashTransaction(User user, DateTime date, decimal amount) : base(user, date) { Amount = amount; }
public BuyTransaction(User user, DateTime date, Product product) : base(user, date) { Product = product; }
public void DisplayUserInfo(User user) { Console.WriteLine($"{user}"); }
public static void PrintLowBalance(User user, decimal balance) { Console.WriteLine($"User: {user}, with {balance} is getting low on funds."); }
public BuyTransaction BuyProduct(User user, Product product) { BuyTransaction buyproduct = new BuyTransaction(user, DateTime.Now, product); buyproduct.Execute(); transactionlog.WriteTransactionLog(buyproduct); CompletedTransactions.Add(buyproduct); return buyproduct; }
public IEnumerable<Transaction> GetTransactions(User user, int count) { // Lambda udtryk List<Transaction> gettransactions = CompletedTransactions.Where(transaction => string.Equals(transaction.User, user.Username)).ToList(); if (gettransactions.Count > 10) { gettransactions.RemoveRange(count, gettransactions.Count - 1); } return gettransactions; }