123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using PP_Ven_MosS.Classes;
- 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;
- using PP_Ven_MosS.ModelBase;
- using PP_Ven_MosS.Pages;
- namespace PP_Ven_MosS
- {
- /// <summary>
- /// Логика взаимодействия для Avtorization.xaml
- /// </summary>
- public partial class Avtorization : Page
- {
- public Avtorization()
- {
- InitializeComponent();
- }
- public void Registration_Click(object sender, RoutedEventArgs e)
- {
- FrameClass.MainFrame.Navigate(new Registration());
- }
- public void Sign_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- string GHCPass = PBPass.Password.GetHashCode().ToString();
- User user = Database.entities.User.FirstOrDefault(x => x.Login == TBLog.Text && x.Password == GHCPass);
- if (user != null)
- {
- if (user.Id_role == 1)
- {
- UserRole.userrole = user.Id_role;
- UserID.userid = user.Id_user;
- FrameClass.MainFrame.Navigate(new MenuAdmin());
- }
- else if (user.Id_role == 2)
- {
- UserRole.userrole = user.Id_role;
- UserID.userid = user.Id_user;
- FrameClass.MainFrame.Navigate(new ApplicationsListAdmin());
- }
- else if (user.Id_role == 3)
- {
- UserRole.userrole = user.Id_role;
- UserID.userid = user.Id_user;
- FrameClass.MainFrame.Navigate(new ApplicationsListUser());
- }
- }
- else
- {
- MessageBox.Show("Неверный логин или пароль,\n попробуйте еще раз\n, или зарегистрируйтесь");
- }
- }
- catch
- {
- MessageBox.Show("Ошибка");
- }
- }
- }
- }
|