Ejemplo n.º 1
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
 {
     switch (connectionId)
     {
     case 1:
         this.TeacherPanel = ((CMSUI.TeacherPanelWindow)(target));
         return;
     }
     this._contentLoaded = true;
 }
Ejemplo n.º 2
0
        private void LoginBtn_Click(object sender, RoutedEventArgs e)
        {
            errorUserName.Visibility = Visibility.Collapsed;
            errorPassword.Visibility = Visibility.Collapsed;
            User = new UserModel
            {
                UserName = usernameText.Text,
                Password = passwordText.Password
            };
            AuthenticationState authState = Login.Check(User);

            if (authState == AuthenticationState.UserNotFound)
            {
                errorUsernameText.Text   = "User not found";
                errorUserName.Visibility = Visibility.Visible;
            }
            else if (authState == AuthenticationState.WrongPassword)
            {
                errorPasswordText.Text   = "You've entered a wrong password";
                errorPassword.Visibility = Visibility.Visible;
            }
            else if (authState == AuthenticationState.Authenticated)
            {
                if (User.Role.Name == "Admin")
                {
                    AdminPanelWindow win = new AdminPanelWindow(this);
                    win.Show();
                }
                else
                {
                    TeacherPanelWindow win = new TeacherPanelWindow(this);
                    win.Show();
                }
                this.Hide();
            }
        }