Example #1
0
 // Enables user to purchase a product
 public BuyTransaction BuyProduct(User user, Product product, int count)
 {
     BuyTransaction buyTransaction = new BuyTransaction(user, product.productPriceTag, product);
     buyTransaction.executeBuyMethod(user, product);
     writeTransactionsToLog.WriteTransactionFileToLog(buyTransaction);
     return buyTransaction;
 }
Example #2
0
 public decimal executeBuyMethod(User _user, Product _product)
 {
     if (_user.Balance < _product.productPriceTag)
     {
         throw new InsufficientCreditsException(_user, _product);
     }
     else
     {
         return _user.Balance -= amountTransaction;
     }
 }
Example #3
0
 public BuyTransaction(User _user, decimal _price, Product producttobuy) : base(_user, _price)
 {
     productItem = producttobuy;
     userTransaction = _user;
 }
Example #4
0
 public void DisplayInsufficientCash(User user, Product product) // not implemented
 {
     throw new NotImplementedException();
 }