用户修改密码代码

来源:互联网 发布:欧洲四猪 知乎 编辑:程序博客网 时间:2024/06/04 19:32
using System;
using System.Windows.Forms;
using CRM.BaseClass;


namespace CRM.UserManage
{
    public partial class frmEditPwd : Form
    {
        private readonly BaseOperate boperate = new BaseOperate();


        public frmEditPwd()
        {
            InitializeComponent();
        }


        private void frmEditPwd_Load(object sender, EventArgs e)
        {
            txtUName.Text = frmLogin.M_str_name;
        }


        private void btnSure_Click(object sender, EventArgs e)
        {
            if (txtFUNPwd.Text.Trim() != txtUNPwd.Text.Trim())
            {
                errorPrPwd.SetError(txtFUNPwd, "输入密码不一致!");
            }
            else
            {
                if (txtUOPwd.Text.Trim() != frmLogin.M_str_pwd)
                {
                    MessageBox.Show("用户旧密码输入错误,请重新输入!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    boperate.getcom("update tb_User set UserPwd='" + txtUNPwd.Text.Trim() + "'where UserName='" +
                                    txtUName.Text.Trim() + "'");
                    MessageBox.Show("密码修改成功!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }


        private void btnExit_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}
原创粉丝点击