예제 #1
0
        private void btn修改訂單_Click(object sender, EventArgs e)
        {
            Form主頁 myForm主頁 = new Form主頁();

            this.Hide();
            myForm主頁.Show();
        }
        private void btn登入_Click(object sender, EventArgs e)
        {
            string str帳號 = "";
            string str密碼 = "";
            string str訊息 = "";

            str帳號 = tb帳號.Text;
            str密碼 = tb密碼.Text;

            string strUser1     = "student";
            string strPassword  = "******";
            string strUser2     = "counter";
            string strPassword2 = "1234";



            if ((str帳號 == "") || (str密碼 == ""))
            {
                str訊息 = "帳號密碼請勿空白";
            }
            else
            {
                if ((str帳號 == strUser1) && (str密碼 == strPassword))
                {
                    //比對成功
                    str訊息 = str訊息 + "歡迎使用本系統\n";

                    Form主頁 myForm主頁 = new Form主頁();
                    this.Hide();
                    myForm主頁.Show();
                }


                else
                {
                    //比對失敗
                    if (str帳號 != strUser1)
                    {
                        str訊息 += "您登入的帳號有誤";
                    }
                    else
                    {
                        str訊息 += "您輸入的密碼有誤";
                    }
                }
                if ((str帳號 == strUser2) && (str密碼 == strPassword2))
                {
                    //比對成功
                    str訊息 = str訊息 + "歡迎使用本系統\n";

                    櫃台訂單 myForm主頁1 = new 櫃台訂單();
                    this.Hide();
                    myForm主頁1.Show();
                }
                else
                {
                    if (str帳號 != strUser2)
                    {
                        str訊息 += "您登入的帳號有誤";
                    }
                    else
                    {
                        str訊息 += "您輸入的密碼有誤";
                    }
                }
            }
            lbl訊息.Text = str訊息;
        }