12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- 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 practice
- {
- /// <summary>
- /// Логика взаимодействия для MainWindow.xaml
- /// </summary>
- public partial class MainWindow : Window
- {
- private gr692_pavContext _context;
- public MainWindow()
- {
- InitializeComponent();
- _context = new gr692_pavContext();
- }
- private void Auth_Click(object sender, RoutedEventArgs e)
- {
- if(string.IsNullOrWhiteSpace(log.Text) || string.IsNullOrWhiteSpace(pas.Password))
- {
- MessageBox.Show("Поля должны быть заполнены");
- return;
- }
- List<auth> users;
- try
- {
- users = _context.auth.Where(u => u.auth_login == log.Text && u.auth_password == pas.Password).ToList();
- }
- catch
- {
- MessageBox.Show("Произошла ошибка");
- return;
- }
- if (users.Count == 1)
- {
- // если все ок
- Window1 wnd = new Window1();
- wnd.Show();
- Close();
- }
- else
- {
- MessageBox.Show("Неверный логин или пароль");
- return;
- }
- }
- }
- }
|