public void LogUserIn() { if (string.IsNullOrEmpty(Username.Text) || string.IsNullOrEmpty(Password.Password)) { errM.Message = "All Fields Are Required, check your username and password."; errM.Show(); //MessageBox.Show("All Details Are Required", "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation); Password.Password = ""; Username.Text = ""; Username.Focus(); // } //catch (Exception ) { } } else { valid = UserLoggedIn.VerifyUser(Username.Text, Password.Password); CurrentUserLoggedInData userData = new CurrentUserLoggedInData(); if (valid == 1) { ID = UserLoggedIn.USerType(Username.Text, Password.Password); FullName = UserLoggedIn.Username(Username.Text, Password.Password); Dashboard cashier = new Dashboard(); SalePerson sales = new SalePerson(); if (Id == 1) { cashier.Show(); } else if (Id == 2) { sales.Show(); } Hide(); } else { errM.Message = "Invalid Username or Password provided, try again."; errM.ShowDialog(); Password.Password = ""; Username.Text = ""; Username.Focus(); } } }
private async void Logout_OnClick(object sender, RoutedEventArgs e) { MessageDialogResult result = await this.ShowMessageAsync("Exit Application", "Do You really want to Exit?", MessageDialogStyle.AffirmativeAndNegative); if (result == MessageDialogResult.Negative) { return; } else { CurrentUserLoggedInData.ClearUserData(); new MainWindow().Show(); Hide(); // Application.Current.Shutdown(); } }
private async void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { e.Cancel = true; MessageDialogResult result = await this.ShowMessageAsync("Exit Application", "Do You really want to Exit?", MessageDialogStyle.AffirmativeAndNegative); if (result == MessageDialogResult.Negative) { e.Cancel = false; } else { CurrentUserLoggedInData.ClearUserData(); new MainWindow().Show(); Hide(); // Application.Current.Shutdown(); } }