12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.Software.MainBusiness.SystemSettings
- {
- public partial class FrmChangePassword : LYFZ.Software.UI.SystemSettings.FrmChangePassword
- {
- public FrmChangePassword()
- {
- }
- #region 加载
- protected override void FrmChangePassword_Load(object sender, EventArgs e)
- {
- txtUser_Account.Text = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Account;
- }
- #endregion
- #region 确定
- protected override void btnSave_Click(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(txtUser_Account.Text))
- {
- MessageBoxCustom.Show("用户账号不能为空!");
- return;
- }
- if (string.IsNullOrEmpty(txtOldUser_Password.Text))
- {
- MessageBoxCustom.Show("旧密码不能为空!");
- return;
- }
- if (string.IsNullOrEmpty(txtNewUser_Password.Text))
- {
- MessageBoxCustom.Show("新密码不能为空!");
- return;
- }
- if (string.IsNullOrEmpty(txtOkUser_Password.Text))
- {
- MessageBoxCustom.Show("确定密码不能为空!");
- return;
- }
- if (txtNewUser_Password.Text != txtOkUser_Password.Text)
- {
- MessageBoxCustom.Show("新密码与确定密码不一致!");
- return;
- }
- LYFZ.BLL.BLL_ErpUser userbll = new BLL.BLL_ErpUser();
- DataTable dt = new DataTable();
- #region 检查输入旧密码是否正确
- dt = userbll.GetList("User_Account='" + txtUser_Account.Text + "' and User_Password='"+LYFZ.Command.Command_MD5.md5(txtOldUser_Password.Text)+"'").Tables[0];
- if (dt.Rows.Count <= 0)
- {
- MessageBoxCustom.Show("旧密码输入错误!");
- return;
- }
- #endregion
- #region 更新密码
- int i= userbll.UpdateUser_Password(LYFZ.Command.Command_MD5.md5(txtNewUser_Password.Text), txtUser_Account.Text);
- if (i > 0)
- {
- MessageBoxCustom.Show("保存成功,请重新启动!");
- // 模拟键盘;
- System.Threading.Tasks.Task task = new System.Threading.Tasks.Task(()=> {
- SendKeys.SendWait("{F12}");
- });
- task.Start();
- this.Close();
- }
- else
- {
- MessageBoxCustom.Show("保存失败!");
- txtOldUser_Password.Text = "";
- txtNewUser_Password.Text = "";
- txtOkUser_Password.Text = "";
- }
- #endregion
- }
- #endregion
- #region 关闭
- protected override void BtnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- #endregion
- }
- }
|