コード例 #1
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            var userinput     = tbxUser.Text;
            var passwordinput = pbxPassword.Password;

            if (userinput.Trim() == "" || passwordinput.Trim() == "")
            {
                MessageBox.Show("Fyll i alla fälten");
            }
            else
            {
                int value;
                if (int.TryParse(userinput, out value))
                {
                    var user = HandleItems.GetUser(value);
                    if (user.userID.Equals(value) && user.password.Equals(passwordinput))
                    {
                        Application.Current.Properties["currentUser"] = user;
                        Application.Current.Properties["currentUser"] = UserHandling.GetUser(value);
                        var rapport = new RapportHantering();
                        rapport.Show();
                        Close();
                    }
                    else
                    {
                        MessageBox.Show("Inlogg eller lösenord fel");
                    }
                }
                else
                {
                    MessageBox.Show("Fyll i alla fälten");
                }
            }
        }
コード例 #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            RapportHantering cr = new RapportHantering();

            cr.Show();
            this.Close();
        }