private async void BtnLogin_Click(object sender, System.Windows.RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(Username.Text) && !string.IsNullOrWhiteSpace(Password.Password)) { try { var admin = await _electionConfigurationService.LoginAsync(new Commissioner { UserName = Username.Text, Password = Password.Password }); if (admin != null) { new MainWindow(admin).Show(); Hide(); } else { await this.ShowMessageAsync("Login Error", "Wrong username or password."); Util.Clear(this); BtnLogin.IsEnabled = true; Username.Focus(); } } catch (Exception) { await this.ShowMessageAsync("Connection Error", "Please check database configuration."); } } else { await this.ShowMessageAsync("Login Error", "Please Enter Username or password to Login."); Util.Clear(this); Username.Focus(); } }
private async void BtnLogin_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(Username.Text) && !string.IsNullOrWhiteSpace(Password.Password)) { var chairman = await _electionConfigurationService.LoginAsync(new Commissioner { UserName = Username.Text, Password = Password.Password, IsChairman = true }); if (chairman != null) { new ReportViewerWindow().Show(); Close(); } else { await this.ShowMessageAsync("Login Error", "Wrong username or password."); Util.Clear(this); BtnLogin.IsEnabled = true; Username.Focus(); } } else { await this.ShowMessageAsync("Login Error", "Wrong username or password."); Util.Clear(this); Username.Focus(); } }
private async void BtnLogin_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(Username.Text) && !string.IsNullOrWhiteSpace(Password.Password)) { BtnLogin.IsEnabled = false; var president = await _electionConfigurationService.LoginAsync(new Commissioner { UserName = Username.Text, Password = Password.Password, IsPresident = true }); if (president != null) { //interface var container = new BootStrapper().BootStrap(); var window = container.Resolve <EcChairmanLoginWindow>(); window.ShowDialog(); //BtnLogin.IsEnabled = true; Close(); } else { await this.ShowMessageAsync("Login Error", "Wrong username or password."); Util.Clear(this); BtnLogin.IsEnabled = true; } } else { await this.ShowMessageAsync("Login Error", "Wrong username or password."); Util.Clear(this); BtnLogin.IsEnabled = true; } }