Avtor.xaml.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15. namespace Детский_сад
  16. {
  17. /// <summary>
  18. /// Логика взаимодействия для Avtor.xaml
  19. /// </summary>
  20. public partial class Avtor : Page
  21. {
  22. public Avtor()
  23. {
  24. InitializeComponent();
  25. }
  26. private void btnAvtor_Click(object sender, RoutedEventArgs e)
  27. {
  28. Employees emp = Base.KE.Employees.FirstOrDefault(x => x.Login_user == tboxLogin.Text);
  29. if (emp == null)
  30. {
  31. MessageBox.Show("Пользователя с таким логином не существует", "Авторизация", MessageBoxButton.OK, MessageBoxImage.Information);
  32. }
  33. else if (emp.Password_user != pbPassword.Password.GetHashCode())
  34. {
  35. MessageBox.Show("Неверный пароль", "Авторизация", MessageBoxButton.OK, MessageBoxImage.Information);
  36. }
  37. else if (emp.Id_role == 1)
  38. {
  39. Base.User = emp;
  40. Base.mainFrame.Navigate(new Account());
  41. }
  42. else if (emp.Id_role == 2)
  43. {
  44. Base.User = emp;
  45. Base.mainFrame.Navigate(new Account());
  46. }
  47. }
  48. }
  49. }