Beispiel #1
0
        private static void administrator()
        {
            User u = getSuccessfulLogInUser();

            if (u != null)
            {
                Console.WriteLine("Username: "******"Password: "******"Faculty Number: " + u.fNumber);
                Console.WriteLine("Date: " + u.Created);
                Console.WriteLine("Active until: " + u.expiryDate);



                String type = LoginValidation.currentUserRole.ToString();
                switch (type)
                {
                case "ANONYMOUS":
                    Console.WriteLine("This person is an anonymous.");
                    break;

                case "ADMIN":
                    Console.WriteLine("This person is an admin.");
                    break;

                case " INSPECTOR":
                    Console.WriteLine("This person is an inspector.");
                    break;

                case " PROFESSOR":
                    Console.WriteLine("This person is a professor.");
                    break;

                case "STUDENT":
                    Console.WriteLine("This person is a student.");
                    break;
                }

                showMenu();
                Console.WriteLine("Enter person name for search: ");
                String searchedName = Console.ReadLine();
                User   searchedUser = UserData.getUserByName(searchedName);
                Console.WriteLine("Enter choice from menu options:");
                String choice = Console.ReadLine();

                switch (choice)
                {
                case "0":
                    return;

                case "1":
                    Console.WriteLine("You choose to set new role to user " + u.name);
                    Console.WriteLine("New role:");
                    String newRole = Console.ReadLine();
                    UserData.AssignUserRole(searchedName, newRole);
                    break;

                case "2":
                    Console.WriteLine("New expiry date: ");
                    DateTime date = new DateTime(Console.Read(), Console.Read(), Console.Read());
                    searchedUser.expiryDate = date;
                    break;

                case "3":
                    UserData.ListAllUsers();
                    break;

                case "4":
                    Logger.GetLogFileActivities();
                    break;

                case "5":
                    Logger.GetCurrentSessionActivities();
                    break;

                default:
                    Console.WriteLine("Your choice does not exist.");
                    break;
                }
            }
        }
Beispiel #2
0
 private static void ListUsers()
 {
     UserData.ListAllUsers();
 }