Example #1
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     if (this.txtInitPwd.Text.Length < 6)
     {
         this.errorProvider1.SetError(this.txtInitPwd, "密码不能小于6位!");
         return;
     }
     if (this.txtAmendPwd.Text.Length < 6)
     {
         this.errorProvider1.SetError(this.txtAmendPwd, "密码不能小于6位!");
         return;
     }
     if (this.txtOkPwd.Text.Length < 6)
     {
         this.errorProvider1.SetError(this.txtOkPwd, "密码不能小于6位!");
         return;
     }
     if (this.txtInitPwd.Text.Trim() == G_WinFormClass.DESDecrypt(PropertyClass.SavePassword))
     {
         if (this.txtAmendPwd.Text == this.txtOkPwd.Text)
         {
             string P_Str_cmdtxt = "UPDATE tb_User SET Pwd='" + G_WinFormClass.DESEncrypt(this.txtAmendPwd.Text.Trim()) + "' where UserID = '" + PropertyClass.SendUserIDValue + "'";
             if (G_SqlClass.GetExecute(P_Str_cmdtxt))
             {
                 MessageBox.Show("密码修改成功,下次登录时修改的密码将生效!", "提示框", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
             }
             else
             {
                 MessageBox.Show("密码修改失败!", "提示框", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
             }
         }
         else
         {
             MessageBox.Show("两次密码输入不一致!", "提示框", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     else
     {
         MessageBox.Show("输入密码与原始密码不一致!", "提示框", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }