1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- 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 UP43P_Krupina.Pages;
- namespace UP43P_Krupina.Windows
- {
- /// <summary>
- /// Логика взаимодействия для AutorisationWindow.xaml
- /// </summary>
- public partial class AutorisationWindow : Window
- {
- User user;
- public AutorisationWindow()
- {
- InitializeComponent();
- Base.MyBase = new UP_KrupinaEntities();
- this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
- }
- private void Autorisation_Click(object sender, RoutedEventArgs e)
- {
- if (CheckingData())
- {
- SPMain.Visibility = Visibility.Hidden;
- frame.Navigate(new MainUserPage(user));
- }
- else
- {
- UsialWindow win = new UsialWindow("Неверные логин или пароль.");
- win.ShowDialog();
- }
- }
- private bool CheckingData()
- {
- user = Base.MyBase.User.FirstOrDefault(x => x.UserLogin == TBLogin.Text && x.UserPassword == TBPassword.Password.ToString());
- if (user == null) return false;
- return true;
- }
- private void WithoutAutorisation_Click(object sender, RoutedEventArgs e)
- {
- SPMain.Visibility = Visibility.Hidden;
- frame.Navigate(new MainUserPage());
- }
- }
- }
|