using PPPISI52.Pages; 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.Shapes; using PPPISI52.Pages; namespace PPPISI52.Windows { /// /// Логика взаимодействия для AutorisationWindow.xaml /// public partial class AutorisationWindow : Window { User user; public AutorisationWindow() { InitializeComponent(); Base.MyBase = new PP_PISIEntities(); 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()); } } }