Пример #1
0
        private void loginButton_Click(object sender, RoutedEventArgs e)
        {
            SQLQuery mSqlQuery = new SQLQuery();

            if (!mSqlQuery.checkForUsername(username.Text))
            {
                usernameError.Visibility = Visibility.Visible;
                passwordError.Visibility = Visibility.Visible;
            }
            else if (!mSqlQuery.serachForUser(username.Text, password.Password))
            {
                usernameError.Visibility = Visibility.Hidden;
                passwordError.Visibility = Visibility.Visible;
            }
            else
            {
                usernameError.Visibility = Visibility.Hidden;
                passwordError.Visibility = Visibility.Hidden;

                if (GlobalVariables.globalType.Equals("Staff"))
                {
                    //open staff form

                    staffWindow mStaffWindow = new staffWindow();

                    mStaffWindow.Show();
                }
                else if (GlobalVariables.globalType.Equals("Admin"))
                {
                    //open admin form

                    adminWindow adminForm = new adminWindow();
                    adminForm.Show();
                }
                else if (GlobalVariables.globalType.Equals("Parent"))
                {
                    //open parent form
                    parentWindow mParentWindow = new parentWindow();
                    mParentWindow.Show();
                }
                this.Close();
            }
        }
Пример #2
0
        private void loginButton_Click(object sender, RoutedEventArgs e)
        {
            SQLQuery mSqlQuery = new SQLQuery();

            if (mSqlQuery.checkForUsername(username.Text) == false)
            {
                usernameError.Visibility = Visibility.Visible;
                passwordError.Visibility = Visibility.Visible;
            }
            else if (!mSqlQuery.serachForUser(username.Text, password.Password) == false)
            {
                usernameError.Visibility = Visibility.Hidden;
                passwordError.Visibility = Visibility.Visible;
            }
            else
            {
                usernameError.Visibility = Visibility.Hidden;
                passwordError.Visibility = Visibility.Hidden;

                MessageBox.Show("Hello, " + username.Text + "!", "Logged In Successfully", MessageBoxButton.OK, MessageBoxImage.None);

                if (GlobalVariables.globalType.Equals("Staff"))
                {
                    //open staff form
                    staffWindow mStaffWindow = new staffWindow();
                    mStaffWindow.Show();
                }
                else if (GlobalVariables.globalType.Equals("Admin"))
                {
                    //open admin form
                    adminWindow adminForm = new adminWindow();
                    adminForm.Show();
                }
                else if (GlobalVariables.globalType.Equals("Parent"))
                {
                    //open parent form
                    parentWindow mParentWindow = new parentWindow();
                    mParentWindow.Show();
                }
                this.Close();
            }
        }