12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- 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 Cafe
- {
- /// <summary>
- /// Логика взаимодействия для MainPage.xaml
- /// </summary>
- public partial class MainPage : Page
- {
- public MainPage()
- {
- InitializeComponent();
- }
- private void LoginBtn_Click(object sender, RoutedEventArgs e)
- {
- if(LoginTBox.Text != "" && PsswrdBox.Password != "")
- {
- var AuthorizedUser = DbConnect.gr672_SdaEntities1.User.SingleOrDefault(u => u.Login == LoginTBox.Text && u.Password == PsswrdBox.Password);
- if (AuthorizedUser != null)
- {
- switch (AuthorizedUser.Role.NameOfRole)
- {
- case "Administrator":
- FramePages.MainFrame.Navigate(new AdminPage(AuthorizedUser));
- break;
- case "Waiter":
- FramePages.MainFrame.Navigate(new WaiterPage(AuthorizedUser));
- break;
- case "Cook":
- FramePages.MainFrame.Navigate(new CookPage(AuthorizedUser));
- break;
- }
- }
- }
- }
- }
- }
|