private void btnRegister_Click(object sender, RoutedEventArgs e) { try { if (txbLogin.Text != String.Empty && txbPassword1.Password != String.Empty && txbPassword2.Password != String.Empty) { if (txbPassword1.Password == txbPassword2.Password) { if (UserСreate(txbLogin.Text, txbPassword1.Password)) { MessageBox.Show("User successfully added!"); login login = new login(); login.Show(); Close(); } else { MessageBox.Show("User not created"); txbLogin.Text = ""; txbPassword1.Password = ""; txbPassword2.Password = ""; } } else { MessageBox.Show("Passwords do not match!"); txbLogin.Text = ""; txbPassword1.Password = ""; txbPassword2.Password = ""; } } else { MessageBox.Show("Fill in all the fields!"); txbLogin.Text = ""; txbPassword1.Password = ""; txbPassword2.Password = ""; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void exitUser_Click(object sender, RoutedEventArgs e) { try { if (UserLogOut()) { Windows.login login = new Windows.login(); login.Show(); Close(); } else { MessageBox.Show("No such user!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void exitAdmin_Click(object sender, RoutedEventArgs e) { Windows.login login = new Windows.login(); login.Show(); Close(); }