コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            UpdateDBLin ul = new UpdateDBLin();


            string pass;

            if (textBox1.Text.StartsWith("Admin") == true)
            {
                ai   = ul.getAdmin(textBox1.Text);
                pass = ul.getAdminPass(textBox1.Text);

                if (textBox2.Text == pass)
                {
                    AdminHome h = new AdminHome(ai);
                    h.Show();
                    this.Visible = false;
                }
                else
                {
                    MessageBox.Show("Wrong Password or Username", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                ui   = ul.getUser(textBox1.Text);
                pass = ul.getPassword(textBox1.Text);

                if (textBox2.Text == pass)
                {
                    HomeUser h = new HomeUser(ui);
                    h.Show();
                    this.Visible = false;
                }
                else
                {
                    MessageBox.Show("Wrong Password or Username", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }