123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- using MyWpfApp.models;
- 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 MyWpfApp.Pages
- {
- /// <summary>
- /// Логика взаимодействия для Auth.xaml
- /// </summary>
- public partial class Auth : Page
- {
- List<User> users;
- public Auth()
- {
- InitializeComponent();
-
- // users = new List<User>() { new User { Name = "Ivan", Login = "123", Password = "123", Id = 1 }, new User() { Name = "Petr", Login = "456", Password = "456", Id = 2 } };
- }
- private void btnEnter_Click(object sender, RoutedEventArgs e)
- {
-
- int pass = TxtPassword.Password.GetHashCode();
- LoginedTable currentUser = Globals.MyGlobalConnection.LoginedTable.FirstOrDefault(x=>x.Login == TxtLogin.Text && x.Password == pass);
- if (currentUser != null)
- {
- MessageBox.Show("Здравствуйте, "+ currentUser.Roles.Role);
- if (currentUser.IDRole==1)
- {
- Globals.MyGlobalFrame.Navigate(new PageUserList());
- }
- else
- {
- Globals.MyGlobalFrame.Navigate(new PageUserInfo(currentUser));
- }
-
- }
- else
- {
- MessageBox.Show("Вы не зарегистрированы");
- }
- }
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- MessageBox.Show("Сработало");
- }
-
- }
- }
|