Esempio n. 1
0
        private void FindUserInfo(string username)
        {
            User user = _stregsystem.GetUserByUsername(username);

            if (user != null)
            {
                _ui.DisplayUserInfo(user);
                // maks 10 tranaktioner må vises i følge opg beskrivelsen
                IEnumerable <Transaction> userTransactions = _stregsystem.GetTransactions(user, 10);
                foreach (Transaction transaction in userTransactions)
                {
                    _ui.DisplayTransaction(transaction);
                }
                if (user.Balance < 50)
                {
                    _ui.DisplayUserBalanceWarning(user, user.Balance);
                }
            }
            else
            {
                _ui.DisplayUserNotFound(username);
            }
        }
Esempio n. 2
0
 void HandleUserCommand(string username)
 {
     try
     {
         User user = _stregsystem.GetUserByUsername(username);
         IEnumerable <Transaction> transactions = _stregsystem.GetTransactions(user, 10);
         _stregsystemUI.DisplayUserInfo(user.ToString() + $"Saldo: {user.Balance * 0.01f}");
         foreach (Transaction t in transactions)
         {
             _stregsystemUI.DisplayTransaction(t);
         }
     }
     catch (UserNotFoundException)
     {
         _stregsystemUI.DisplayUserNotFound(username);
     }
 }