示例#1
0
        private void SignUp_Click(object sender, RoutedEventArgs e)
        {
            var username = Username.Text;
            var password = Password.Password;

            AuthenticationManager auth = new AuthenticationManager();
            var authCred = auth.AuthIsCorrect(username, password);

            if (authCred == "Incorrect Credentials")
            {
                MessageBox.Show("Incorrect Credentials. Please input valid credentials");
                Username.Text = "";
                Password.Clear();
            }
            else
            {
                Cred = authCred;

                switch (auth.GetRole(Cred))
                {
                case 'C':
                    Home windowHome = new Home();
                    Application.Current.MainWindow.Close();
                    windowHome.Show();
                    break;

                case 'A':
                    Portal windowPortal = new Portal();
                    Application.Current.MainWindow.Close();
                    windowPortal.Show();
                    break;

                default:
                    break;
                }
            }
        }