示例#1
0
 public Transaction(User user, DateTime date)
 {
     User = user;
     Date = DateTime.Now;
     this._transactionID = Transaction.Counter;
     Transaction.Counter++;
 }
示例#2
0
        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;
 }
示例#4
0
 public BuyTransaction(User user, DateTime date, Product product) : base(user, date)
 {
     Product = product;
 }
示例#5
0
 public void DisplayUserInfo(User user)
 {
     Console.WriteLine($"{user}");
 }
示例#6
0
 public static void PrintLowBalance(User user, decimal balance)
 {
     Console.WriteLine($"User: {user}, with {balance} is getting low on funds.");
 }
示例#7
0
        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;
        }
示例#8
0
        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;
        }