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 { /// /// Логика взаимодействия для Authorisation.xaml /// 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; } } } } }