Пример #1
0
 public void updateUserBalance(TuscUser loggedInUser)
 {
     if (loggedInUser != null)
     {
         foreach (var user in this.UserList)
         {
             if (user.Name == loggedInUser.Name && user.Pwd == loggedInUser.Password)
             {
                 user.Bal = loggedInUser.Balance;
             }
         }
     }
 }
Пример #2
0
 public TuscUser getValidUser(string userName, string password)
 {
     TuscUser tuscUser = null;
     foreach (var user in this.UserList)
     {                
         if (user.Name == userName && user.Pwd == password)
         {
             tuscUser = new TuscUser();
             tuscUser.Name = userName;
             tuscUser.Password = password;
             tuscUser.Balance = user.Bal;
         }
     }
     return tuscUser;
 }
Пример #3
0
        private void logIn()
                    {
            while (loggedInUser == null)
            {
                string name = promptForUserName();

                if (!string.IsNullOrEmpty(name))
                        {
                    string pwd = GetUserInputFromConsole("Enter Password:"******"\nYou entered an invalid username or password.", ConsoleColor.Red);
                }
            }
        }
Пример #4
0
 public void updateUser(TuscUser loggedInUser)
 {
     this.Users.updateUserBalance(loggedInUser);
 }
Пример #5
0
 public Tusc(DataStore dataStoreIn)
 {
     this.dataStore = dataStoreIn;
     this.loggedInUser = null;
 }
Пример #6
0
 private static void showPurchaseMessage(List<Product> prods, TuscUser loggedInUser, int productIndex, int qty)
                         {
                             Console.Clear();
     Console.ForegroundColor = ConsoleColor.Green;
     Console.WriteLine("You bought " + qty + " " + prods[productIndex].Name);
     Console.WriteLine("Your new balance is " + loggedInUser.Balance.ToString("C"));
                             Console.ResetColor();
                         }