示例#1
0
        static void Main(string[] args)
        {
            if (UserData.TestUsersIfEmpty())
            {
                UserData.CopyTestUsers();
            }

            LoginValidation login = BuildValidator();

            while (Logger.CanUserLogIn(LoginValidation.currentUserUsername))
            {
                User user = null;

                if (LoginValidation.ValidateUserInput(ref user))
                {
                    Console.WriteLine(user.ToString());
                    PrintCurrentUserRole();

                    if (user.Role == UserRoles.ADMIN)
                    {
                        OpenAdminMenu();
                    }
                    else
                    {
                        Console.WriteLine("Hello, " + user.Username);
                        Console.ReadKey();
                        return;
                    }
                }
                else
                {
                    Logger.IncrementLoginAttemts(LoginValidation.currentUserUsername);
                    login = BuildValidator();
                }
            }

            Console.WriteLine("Exiting... Press anykey to continue");
            Console.ReadKey();
        }