123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- namespace kursach_2._0
- {
- /// <summary>
- /// Логика взаимодействия для MainWindow.xaml
- /// </summary>
- public partial class MainWindow : Window
- {
- private dealerContext _context;
- public MainWindow()
- {
- InitializeComponent();
- _context = new dealerContext();
- }
- private void AuthClick(object sender, RoutedEventArgs e)
- {
- if(string.IsNullOrWhiteSpace(log.Text) || string.IsNullOrWhiteSpace(pas.Password))
- {
- MessageBox.Show("Поля должны быть заполнены");
- return;
- }
- List<employees> users;
- try
- {
- users = _context.employees.Where(u => u.login == log.Text && u.password == pas.Password).ToList();
- }
- catch
- {
- MessageBox.Show("Произошла ошибка");
- return;
- }
- if (users.Count == 1)
- {
- // если все ок
- Windows.Menu menu = new Windows.Menu();
- menu.Show();
- Close();
- }
- else
- {
- MessageBox.Show("Неверный логин или пароль");
- return;
- }
- }
- }
- }
|