Esempio n. 1
0
        private void enterButton_Click(object sender, RoutedEventArgs e)
        {
            UserContext DB;

            string login = loginTB.Text.Trim();
            string pass  = passwordTB.Password.Trim(); //Text.Trim();

            pass = GetHash(pass);

            if (pass.Length < 1)
            {
                //passwordTB.ToolTip = "Неверный пароль";
                //passwordTB.Background = Brushes.DarkRed;
            }
            else
            {
                //passwordTB.Background = Brushes.Transparent;

                DB = new UserContext();
                USERS authUser = null;
                authUser = DB.Users.Where(u => u.UserName == login && u.UserPass == pass).FirstOrDefault();

                if (authUser != null)
                {
                    if (authUser.adm == true)
                    {
                        AdminWindow AW = new AdminWindow();
                        AW.Show();
                        this.Close();
                    }
                    else
                    {
                        UserWindow UW = new UserWindow();
                        UW.UN = login;
                        UW.Show();
                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show("Такого пользователя не существует!");
                }
            }
        }
Esempio n. 2
0
        private void UserWindowButton_Click(object sender, RoutedEventArgs e)
        {
            UserWindow UW = new UserWindow();

            UW.Show();
        }