12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- using ProjectCafe.Properties;
- 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 ProjectCafe
- {
- /// <summary>
- /// Логика взаимодействия для Authorisation.xaml
- /// </summary>
- public partial class Authorisation : Page
- {
- gr672_bdaEntities db = new gr672_bdaEntities();
- public Authorisation()
- {
- InitializeComponent();
- }
- private void Auth_Ckick(object sender, RoutedEventArgs e)
- {
- if (txtLogin == null || txtPassword == null)
- {
- MessageBox.Show("Не все поля заполнены");
- }
- using (var db = new gr672_bdaEntities())
- {
- var user = db.EmployeeCafe
- .AsNoTracking()
- .FirstOrDefault(u => u.Login == txtLogin.Text && u.Password == txtPassword.Password);
- if (user == null)
- {
- MessageBox.Show("Пользователь с таким именем не найден!");
- }
- int IdEmployee = user.IdEmployee;
- Application.Current.Properties["IdEmployee"] = IdEmployee;
- switch (user.RoleEmployee.IdRole)
- {
- case 1:
- FrameClass.MainFrame.Navigate(new Cook());
-
- break;
- case 2:
- FrameClass.MainFrame.Navigate(new EmployeePage());
- break;
- case 3:
- FrameClass.MainFrame.Navigate(new Administrator());
- break;
- }
- }
- }
- }
- }
|