private void buttonSignIn_Click(object sender, RoutedEventArgs e) { int status; ModelClass model = new ModelClass(); status = model.SignIn(textBoxEmail.Text, passwordBoxPassword.Password); switch (status) { case 0: labelAlert.Content = "Wrong Username or Password!"; textBoxEmail.Text = null; passwordBoxPassword.Password = null; break; case 1: View_Home home = new View_Home(); App.Current.MainWindow = home; this.Close(); home.Show(); model.UserKey(textBoxEmail.Text); break; case 911: System.Windows.MessageBox.Show("Can not Sign Up because of a severe Database problem! Please try later."); break; default: labelAlert.Content = "Duplicate Username and Password!"; break; } }
private void buttonSignUp_Click(object sender, RoutedEventArgs e) { if (textBoxFirstName.Text != "" && textBoxLastName.Text != "" && textBoxEmail.Text != "" && textBoxConfirmEmail.Text != "" && passwordBoxPassword.Password != "" && passwordBoxConfirmPassword.Password != "") { ModelClass model = new ModelClass(); if (model.SignUpInsertion(textBoxFirstName.Text, textBoxLastName.Text, textBoxEmail.Text, passwordBoxPassword.Password)) { System.Windows.MessageBox.Show("Congratulation! You have successfully signed up for My Study Life."); View_Home home = new View_Home(); App.Current.MainWindow = home; this.Close(); home.Show(); } else { System.Windows.MessageBox.Show("Can not Sign Up because of a severe Database problem! Please try later."); } } else { System.Windows.MessageBox.Show("Fields can not be empty. All fields are required. Please try again."); } }