Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            //舊密碼判斷
            string userInputOldPwdHash = Util.GetHash(this.txtOldPwd.Text + Common.ContainerForm.SupplierLoginAccount.PasswordSalt);
            string userOldPwdHash      = Common.ContainerForm.SupplierLoginAccount.PasswordHash;

            if (userInputOldPwdHash == userOldPwdHash)
            {
                if (this.txtNewPwd.Text == this.txtNewPwdAgain.Text && this.txtNewPwd.Text.Trim() != "")
                {
                    //密碼 hash
                    string salt                            = Convert.ToString(Guid.NewGuid());
                    string hashPassword                    = Util.GetHash(this.txtNewPwd.Text.Trim() + salt.ToString());
                    string strCmdUpdate                    = @"update [dbo].[SupplierAccount]
                                    set [PasswordHash] = @PasswordHash, [PasswordSalt] = @PasswordSalt, [ModifiedDate] = GETDATE()
                                    where [SupplierAccountID] = @SupplierAccountID";
                    List <SqlParameter> paraList           = new List <SqlParameter>();
                    SqlParameter        sSupplierAccountID = SqlHelper.CreateParameter("@SupplierAccountID", SqlDbType.VarChar, 10, Common.ContainerForm.SupplierLoginAccount.SupplierAccountID);
                    SqlParameter        sPasswordHash      = SqlHelper.CreateParameter("@PasswordHash", SqlDbType.VarChar, 128, hashPassword);
                    SqlParameter        PasswordSalt       = SqlHelper.CreateParameter("@PasswordSalt", SqlDbType.VarChar, 68, salt);
                    paraList.Add(sSupplierAccountID);
                    paraList.Add(sPasswordHash);
                    paraList.Add(PasswordSalt);
                    int result = SqlHelper.ExecuteNonQuery(strCmdUpdate, paraList, CommandType.Text);
                    if (result == 1)
                    {
                        MessageBox.Show("密碼修改成功!");
                        SupplierPersonAccountForm f = new SupplierPersonAccountForm();
                        Common.ContainerForm.NextForm(f);
                    }
                    else
                    {
                        MessageBox.Show("密碼修改失敗!");
                    }
                }
                else
                {
                    MessageBox.Show("密碼輸入錯誤");
                    this.txtNewPwdAgain.Select();
                    this.txtNewPwdAgain.Text = "";
                }
            }
            else
            {
                MessageBox.Show("舊密碼錯誤", "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #2
0
        private void pbAccount_Click(object sender, EventArgs e)
        {
            Form frm = null;

            switch (this.LoginRole)
            {
            case Role.Admin:
            case Role.Buyer:
                frm = new PersonAccount.BuyerPersonAccountForm();
                break;

            case Role.Supplier:
                frm = new PersonAccount.SupplierPersonAccountForm();
                break;

            default:
                break;
            }
            this.NextForm((BaseForm)frm);
        }
        private void button3_Click(object sender, EventArgs e)
        {
            if (this.textBox1.Text != "" && this.textBox2.Text != "" && this.textBox3.Text != "" &&
                this.textBox4.Text != "" && this.textBox5.Text != "")
            {
                int result = spad.UpdateSupplierCompany(this.textBox1.Text, this.textBox2.Text, this.textBox3.Text, this.textBox4.Text, this.textBox5.Text);

                if (result == 0)
                {
                    MessageBox.Show("修改失敗!!!", "Title");
                }
                else
                {
                    MessageBox.Show("修改成功", "Title");
                    SupplierPersonAccountForm frm = new SupplierPersonAccountForm();
                    Common.ContainerForm.NextForm(frm);
                }
            }
            else
            {
                MessageBox.Show("欄位不可為空值!");
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            SupplierPersonAccountForm f = new SupplierPersonAccountForm();

            Common.ContainerForm.NextForm(f);
        }