Example #1
0
        public User Display()
        {
            bool loginSucceeded = false;

            User user;

            do
            {
                Console.Clear();
                Console.WriteLine("Please login.\n\n");

                Console.Write("Username: "******"Password: "******"\nIs this correct? [Y]es [N]o");

                var keyInfo = Console.ReadKey(true);

                if (keyInfo.Key == ConsoleKey.Y)
                {
                    if (user == null)
                    {
                        Console.WriteLine("Wrong! Try again.");
                        Thread.Sleep(2000);
                    }
                    else
                    {
                        loginSucceeded = true;
                    }
                }
            } while (!loginSucceeded);

            return(user);
        }
Example #2
0
        static void Main(string[] args)
        {
            var receptionistView = new ReceptionistMainView();
            var adminView        = new AdminMainView();

            Console.Write("Username: "******"Password: "******"Succesfully logged in");

                Console.WriteLine($"Role {user.Role}");
                if (user.Role == "Receptionist")
                {
                    receptionistView.Display();
                }
                if (user.Role == "Admin")
                {
                    adminView.Display();
                }
                if (user.Role == "Vetrinarian")
                {
                }
            }
            else
            {
                Console.WriteLine("Access denied!");
            }
        }