12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Security.Cryptography;
- 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 SSS
- {
- /// <summary>
- /// Логика взаимодействия для Page1.xaml
- /// </summary>
- public partial class Page1 : Page
- {
- public Page1()
- {
- InitializeComponent();
- }
- public void Go(object sender, RoutedEventArgs e)
- {
- MainFrame.Name1.Navigate(new Reg());
- }
- public void GoVhod(object sender, RoutedEventArgs e)
- {
- string CurPass = Pass.Password;
- using (SHA256 hash = SHA256.Create())
- {
- CurPass =
- BitConverter.ToString(hash.ComputeHash(Encoding.UTF8.GetBytes(CurPass))).Replace("-", "");
- {
- using (Entities DB = new Entities())
- {
- Client client = DB.Client.FirstOrDefault(x => x.Login == Login.Text && x.Password == CurPass);
- if (client != null)
- {
- switch (client.id_Role)
- {
- case 1:
- MainFrame.Name1.Navigate(new PageAdmin());
- break;
- case 2:
- MainFrame.Name1.Navigate(new Page2());
- break;
- default:
- MessageBox.Show("Вы не зарегистрированы");
- break;
- }
- }
- else
- {
- MessageBox.Show("Вы не зарегистрированы");
- }
- }
- }
- }
- }
- }
- }
|