Beispiel #1
0
        private void 返回首頁ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            index_Form IF = new index_Form(this.readwrite_R, this.engineer_R, this.boss_R, this.Acc_name_R);//用上面傳進form的權限在傳出去

            this.Hide();
            IF.Show(this);
            IF.BringToFront();
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            ArrayList name      = new ArrayList();
            ArrayList account   = new ArrayList();
            ArrayList psw       = new ArrayList();
            ArrayList readwrite = new ArrayList();
            ArrayList engineer  = new ArrayList();
            ArrayList boss      = new ArrayList();

            //this.Close();
            // F1.Show();
            if (textBox_account.Text.Length == 0 || textBox_psw.Text.Length == 0)
            {
                MessageBox.Show(" 請輸入帳號或密碼", "登入錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                String check_psd = "SELECT * FROM staff_account WHERE account LIKE '" + textBox_account.Text + "'";
                conn.Open();
                cmd.Connection  = conn;
                cmd.CommandText = check_psd;
                dr = cmd.ExecuteReader();

                while (dr.Read())
                {
                    name.Add(dr[1]);
                    account.Add(dr[2]);
                    psw.Add(dr[3]);
                    readwrite.Add(dr[4]);
                    engineer.Add(dr[5]);
                    boss.Add(dr[6]);
                }

                conn.Close();

                if (account.Count > 0 || psw.Count > 0)
                {
                    if (account[0].ToString() == textBox_account.Text.ToString() && psw[0].ToString() == textBox_psw.Text.ToString())
                    {
                        index_Form IF = new index_Form(readwrite[0].ToString(), engineer[0].ToString(), boss[0].ToString(), name[0].ToString());
                        this.Hide();
                        IF.Show(this);



                        //Customer_Form CF = new Customer_Form(readwrite[0].ToString(), engineer[0].ToString(), boss[0].ToString(),name[0].ToString());
                        //this.Hide();
                        //CF.Show(this);
                        //CF.BringToFront();
                    }
                    else
                    {
                        MessageBox.Show(" 帳號或密碼錯誤", "登入錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show(" 帳號或密碼錯誤", "登入錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }