示例#1
0
        private void LoginDown(object sender, RoutedEventArgs e)
        {
            var canContinue = true;
            var userPass    = true;
            var studentPass = true;
            var password    = PasswordBox.Password;

            var user = UserName.Text;

            //Check user in database//// Idk How XD

            if (GlobalVariables.isUsernameInPeople(user) == false)
            {
                ErrorBox.Foreground = new BrushConverter().ConvertFromString("#3dff11") as SolidColorBrush;
                ErrorBox.Text       = "User not found";
                userPass            = false;
            }
            if (GlobalVariables.isEmailInPeople(user) == false)
            {
                ErrorBox.Foreground = new BrushConverter().ConvertFromString("#3dff11") as SolidColorBrush;
                ErrorBox.Text       = "Student Code not found";
                studentPass         = false;
            }

            if (GlobalVariables.IsDigitsOnly(user))
            {
                if (GlobalVariables.isCorrectPasswordEmail(password, int.Parse(user)) == false)
                {
                    ErrorBox.Foreground = new BrushConverter().ConvertFromString("#3dff11") as SolidColorBrush;
                    ErrorBox.Text       = "Incorrect Password";
                    canContinue         = false;
                }
            }
            else
            {
                if (GlobalVariables.isCorrectPasswordUsername(password, user) == false)
                {
                    ErrorBox.Foreground = new BrushConverter().ConvertFromString("#3dff11") as SolidColorBrush;
                    ErrorBox.Text       = "Incorrect Password";
                    canContinue         = false;
                }
            }



            if (canContinue == true && (userPass || studentPass))
            {
                NavigationService navService = NavigationService.GetNavigationService(this);
                Groups_Page       nextPage   = new Groups_Page();
                navService.Navigate(nextPage);
            }
        }