Пример #1
0
        static void Main(string[] args)
        {
            User Admin = UserData.TestUser;

            LoginValidation validation = new LoginValidation();

            if (validation.ValidateUserInput())
            {
                Console.WriteLine(Admin.Username + ", " + Admin.Password + ", " + Admin.FakNum + ", " + Admin.Role);
            }
            Console.WriteLine(LoginValidation.CurrentUserRole);
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Enter faculty number: ");
            String facultyNumber = Console.ReadLine();



//User Admin = UserData.TestUsers;
            Console.WriteLine("Enter username:"******"Enter password:"******", " + user.Password + ", " + user.FakNum + ", " + user.Role);
                switch (user.Role)
                {
                case 0: Console.WriteLine("Welcome, ANONYMOUS!"); break;

                case 1: Console.WriteLine("Welcome, ADMIN!");
                    String adminOption = "-1";
                    while (adminOption != "0")
                    {
                        Console.WriteLine("Choose an option:");
                        Console.WriteLine("0: Exit");
                        Console.WriteLine("1: Change User Role");
                        Console.WriteLine("2: Change User Activity");
                        Console.WriteLine("3: User List");
                        Console.WriteLine("4: Display Activity Log");
                        Console.WriteLine("5: Display Current Activity Logs");
                        adminOption = Console.ReadLine();

                        switch (adminOption)
                        {
                        case "1": changeUserRole(); break;

                        case "2": changeUserActivity(); break;

                        case "3": Dictionary <String, int> allusers = UserData.AllUsersUsernames();
                            foreach (var currentUser in allusers)
                            {
                                Console.WriteLine(currentUser.Key);
                                Console.WriteLine(UserData.TestUsers[currentUser.Value]);
                            }
                            break;

                        case "4":
                            LoadActivityLogs();

                            break;

                        case "5":
                            Console.WriteLine("Enter log filter:");
                            String filter         = Console.ReadLine();
                            String currentLogData = Logger.GetCurrentSessionActivities(filter);
                            Console.WriteLine(currentLogData); break;
                        }
                    }

                    break;

                case 2: Console.WriteLine("Welcome, INSPECTOR!"); break;

                case 3: Console.WriteLine("Welcome, PROFESSOR!"); break;

                case 4: Console.WriteLine("Welcome, STUDENT!"); break;
                }
            }

            else
            {
                Console.WriteLine("Validation Failed!");
                Console.WriteLine(LoginValidation.CurrentUserRole);
            }

            Console.ReadLine();
        }