private void ClickOnLogin(object sender, RoutedEventArgs e) { _user.Password = ((PasswordBox)(sender as Button).CommandParameter).Password; UserDataLayer _layer = new UserDataLayer(); decimal? Id = _layer.SearchByLogin(_user.Login); if (Id.HasValue) { if (_layer.PasswordOK((int)Id, _user.Password)) { _user = _layer.GetOne((int)Id); MessageBox.Show($"Welcome aboard, {_user.Prenom} {_user.Nom}!"); } else { MessageBox.Show("Sorry, wrong password"); } } else { MessageBox.Show("Sorry, wrong login"); } }
private void DoLogin(PasswordBox box) { _user.Password = box.Password; UserDataLayer _layer = new UserDataLayer(); decimal? Id = _layer.SearchByLogin(_user.Login); if (Id.HasValue) { if (_layer.PasswordOK(Id.Value, _user.Password)) { _user = _layer.GetOne(Id.Value); MessageBox.Show($"Welcome aboard, {_user.Prenom} {_user.Nom}!"); } else { MessageBox.Show("Sorry, wrong password"); } } else { MessageBox.Show("Sorry, wrong login"); } }