12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- 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 WpfApp1.Pages
- {
- /// <summary>
- /// Логика взаимодействия для TestPage.xaml
- /// </summary>
- public partial class TestPage : Page
- {
- public TestPage()
- {
- InitializeComponent();
- QR.Source = QRClass.QR();
- }
- private void Autor_Click(object sender, RoutedEventArgs e)
- {
- try
- {
-
- Users user = DataBaseClass.entities.Users.FirstOrDefault(x => x.Login == TBLogin.Text && x.Password == TBPassword.Password);
- if(user != null)
- {
- TextWriterTraceListener[] listeners = new TextWriterTraceListener[]
- {
- new TextWriterTraceListener("debug.txt"),
- new TextWriterTraceListener(Console.Out)
- };
- Debug.Listeners.AddRange(listeners);
- Debug.WriteLine("ID роли пользователя: "+user.UserRoleId);
- Debug.Flush();
- switch (user.UserRoleId)
- {
- case 1: MessageBox.Show("Добро пожаловать администратор!"); FrameClass.mainFrame.Navigate(new Pages.ShowPage()); break;
- case 2: MessageBox.Show("Добро пожаловать пользователь!"); FrameClass.mainFrame.Navigate(new Pages.ShowPage()); break;
- }
- }
- }
- catch
- {
- MessageBox.Show("Ошибка");
- }
- }
- }
- }
|