private void btnLogin_Click(object sender, RoutedEventArgs e) { if (txtLogin.Text == "123" && txtPass.Password == "123") { ActionWin actionWin = new ActionWin(); this.Hide(); actionWin.ShowDialog(); this.Show(); } else { MessageBox.Show("Логин или пароль введены не верно"); } }
private void btnLogin_Click(object sender, RoutedEventArgs e) { try { Employee user = context.Employee .ToList().Where(i => i.Login == txtLogin.Text && i.Password == pswPassword.Password) .FirstOrDefault(); // поиск записи в БД с логином и паролем введенным пользователем if (user != null) { HelperClass.DataUser.User = user; if (user.IdRole == 1) { ActionWin actionWin = new ActionWin(user); this.Hide(); actionWin.ShowDialog(); this.Show(); } else if (user.IdRole == 2) { Windows.AdminWin adminWinxaml = new Windows.AdminWin(); adminWinxaml.Show(); this.Close(); } } else { MessageBox.Show("Логин или пароль введены неверно"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }