Exemplo n.º 1
0
        private void Button1_Click(object sender, EventArgs e)
        {
            ClsMember user = new ClsMember();

            user.Username = this.Usertext.Text;
            user.Password = this.Pwordtext.Text;
            if (user.ValidateUser())
            {
                if (PasswordChangeFun.CheckAuthCode(user.Username, this.AuthCodetext.Text) && this.AuthCodetext.Text != "")
                {
                    if (PasswordChangeFun.UpdateUser(this.Usertext.Text, this.NPWtext.Text))
                    {
                        MessageBox.Show("更改成功");
                        if (this.Tc != null)
                        {
                            this.Tc(this.button1, e);
                        }
                    }
                    else
                    {
                        MessageBox.Show("更改失敗");
                    }
                }
                else
                {
                    this.label5.Text = "驗證碼錯誤";
                }
            }
            else
            {
                this.label5.Text = "會員資料錯誤";
            }
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            ClsMember user = new ClsMember();

            user.Username = this.Usertext.Text;
            user.Password = this.Pwordtext.Text;
            if (user.ValidateUser() && this.Usertext.Text != "" && this.Pwordtext.Text != "")
            {
                FrmMain go = new FrmMain(user.Username);
                go.Show();
            }
            else
            {
                MessageBox.Show("帳號密碼錯誤");
            }
        }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            ClsMember user = new ClsMember();

            user.Username = this.Usertext.Text;
            user.Password = this.Pwordtext.Text;
            if (IDo.IsValidEmail(this.Emailtext.Text))
            {
                user.Email = this.Emailtext.Text;
            }
            else
            {
                MessageBox.Show("Email 格式錯誤");
                return;
            }
            try
            {
                user.CreateUser();

                MessageBox.Show($"註冊成功");
            }
            catch (SqlException ex)
            {
                int n = ex.Number;
                if (n == 2627)
                {
                    MessageBox.Show("帳號重複", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                this.Usertext.Focus();
                this.Usertext.SelectAll();
            }
        }