Ejemplo n.º 1
0
        private void MainWindow_OnContentRendered(object sender, EventArgs e)
        {
            //LoginValidator
            bool loggedIn = false;

            while (!loggedIn)
            {
                LoginForm login = new LoginForm();
                if (login.ShowDialog() == true)
                {
                    loggedIn = LoginValidator.ValidateLoginInput(login.GetUsername(), login.GetPassword(), usersList);
                    try
                    {
                        currentUser = usersList.GetUser(login.GetUsername());
                    }
                    catch
                    {
                        // ignored
                    }
                }
            }

            ShowWorkShift();
            ShowUsers();

            if (currentUser.EmployeeType.Role != Role.Administrator)
            {
                AddUser.Visibility         = System.Windows.Visibility.Hidden;
                RemoveUser.Visibility      = System.Windows.Visibility.Hidden;
                AssignWorkShift.Visibility = System.Windows.Visibility.Hidden;
                RemoveWorkShift.Visibility = System.Windows.Visibility.Hidden;
            }
        }