public InsertCashTransaction(User currentUser, decimal amount) { _transactionID = ++_transactionIDCounter; _currentUser = currentUser; _date = DateTime.Now; _amount = amount; }
public BuyTransaction(User currentUser, Product selectedProduct) { _transactionID = ++_transactionIDCounter; _currentUser = currentUser; _date = DateTime.Now; _selectedProduct = selectedProduct; _amount = selectedProduct.price; }
public User AddUser() { string firstName = DisplayAddUserExecutor("fornavn"); string lastName = DisplayAddUserExecutor("efternavn"); string userName = DisplayAddUserExecutor("brugernavn"); string email = DisplayAddUserExecutor("email"); User newUser = new User(firstName, lastName, userName, email); Console.Clear(); Console.WriteLine("Brugeren {0} er tilføjet", userName); return newUser; }
static void Main(string[] args) { LineSystem lineSystem = new LineSystem(); LineSystemCLI CLI = new LineSystemCLI(lineSystem); LineSystemCommandParser cmdParser = new LineSystemCommandParser(CLI, lineSystem); //2 hardcodede brugere. en med masser af penge og en med under advarselsgrænsen på 50 kr. User u = new User("Mathias", "Leding", "mledin14", "*****@*****.**"); User u1 = new User("Lars", "Larsen", "llarse14", "*****@*****.**"); u.balance = 100; u1.balance = 49; lineSystem.userList.Add(u); lineSystem.userList.Add(u1); CLI.RunProgram(cmdParser); }
public void BuyProduct(User currentUser, Product chosenProduct) { BuyTransaction transaction = new BuyTransaction(currentUser, chosenProduct); ExecuteTransaction(transaction); }
public void AddCreditsToAccount(User currentUser, decimal amount) { InsertCashTransaction insert = new InsertCashTransaction(currentUser, amount); ExecuteTransaction(insert); }