コード例 #1
0
        private void BtnLogin_Click(object sender, RoutedEventArgs e)
        {
            var user = DataAccess.GetAllUsers().FirstOrDefault(x => x.Username.ToLower() == this.TxtUsername.Text.ToLower());

            if (String.IsNullOrEmpty(this.TxtUsername.Text) || String.IsNullOrEmpty(this.TxtPassword.Password))
            {
                MessageBox.Show("Username or password empty!");
            }
            else if(user != null && PasswordHash.ValidatePassword(this.TxtPassword.Password,user.PasswordHash))
            {
                if (user.IsAdmin)
                {
                    AdminLoggedIn window = new AdminLoggedIn();
                    this.Close();
                    window.ShowDialog();
                }
                else
                {
                    UserLoggedIn window = new UserLoggedIn();
                    this.Close();
                    window.ShowDialog();
                }
            }
            else
            {
                MessageBox.Show("Username or password is incorrect!");
            }
        }
コード例 #2
0
 private void BtnBuyTicket_OnClick(object sender, RoutedEventArgs e)
 {
     if (true)
     {
         MessageBox.Show("You have successfully bought a ticket!");
         UserLoggedIn windows = new UserLoggedIn();
         this.Close();
         windows.ShowDialog();
     }
 }
コード例 #3
0
 private void Hyperlink_OnClick(object sender, RoutedEventArgs e)
 {
     UserLoggedIn window = new UserLoggedIn();
     window.ShowDialog();
 }
コード例 #4
0
 private void BtnBack_OnClick(object sender, RoutedEventArgs e)
 {
     UserLoggedIn windows = new UserLoggedIn();
     this.Close();
     windows.ShowDialog();
 }