コード例 #1
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            mitoden_dbgr13Entities db = new mitoden_dbgr13Entities();
            List<Person1> mylist = new List<Person1>();

            try
            {
                mylist = db.Person1.ToList();
                for (int i = 0; i < mylist.Count; i++)
                {
                    if (UserNameTextBox.Text == mylist[i].PK_Username && PasswordBox.Password == mylist[i].Password)
                    {
                        if (mylist[i].trueorfalse == true)
                        {
                            AdminWindow adw = new AdminWindow();
                            adw.Show();

                        }

                        if (mylist[i].trueorfalse == false)
                        {
                            StatisticsWindow stw = new StatisticsWindow(UserNameTextBox.Text);
                            stw.Show();
                        }

                        this.Hide();
                        UserNameTextBox.Text = "";
                        PasswordBox.Password = "";
                        return;
                    }
                    else
                    {
                    }
                }
                MessageBox.Show("Invalid Username or Password. Please try again.");
            }
            catch (Exception)
            {
                MessageBox.Show("Error");
            }
        }
コード例 #2
0
 private void button2_Click_1(object sender, RoutedEventArgs e)
 {
     StatisticsWindow stw = new StatisticsWindow();
     stw.Show();
 }