Пример #1
0
        private void btnZaloguj_Click(object sender, RoutedEventArgs e)
        {
            //UserManager _userManager = _managers.GetUserManager();
            MySQLManager _mySQLManager = _managers.GetMySQLManager();

            //string _login = this.txtLogin.Text.Trim().ToString();
            string _nfc = this.txtNFC.Text.Trim().ToString();

            if (!String.IsNullOrEmpty(_nfc) && !String.IsNullOrWhiteSpace(_nfc))
            {
                try
                {
                    User _user = _mySQLManager.GetUserByNFC(_nfc);//_userManager.GetUserByLogin(_login);
                    if (_user != null)
                    {
                        if (ParseFullHDInfoFromXML() == "YES")
                        {
                            MainWindowFullHD _mainWindowFullHD = new MainWindowFullHD(_user._login, _user.GetPermission());
                            //_mainWindowFullHD.Topmost = true;
                            _mainWindowFullHD.Show();
                            this.Close();
                        }
                        else
                        {
                            MainWindow _mainWindow = new MainWindow(_user._login, _user.GetPermission());
                            //_mainWindow.Topmost = true;
                            _mainWindow.Show();
                            this.Close();
                        }
                        //string _pass = this.txtPassword.Password.ToString().Trim();
                        //if (!String.IsNullOrEmpty(_pass) && !String.IsNullOrWhiteSpace(_pass))
                        //{
                        //if (CalculateMD5(_pass) == _user.GetPassword())
                        //{
                        //}
                        //}
                    }
                    else
                    {
                        this.lblError.Content = "BŁĄD: Brak użytkownika!";
                    }
                }
                catch (Exception)
                {
                    this.lblError.Content = "BŁĄD: Brak połączenia!";
                    Console.WriteLine("BŁĄD:: Użytkownik nie istnieje!!!");
                }
            }
        }