123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- using System;
- using System.Windows.Forms;
- using DevExpress.XtraEditors;
- using GCAS.Code;
- using GCAS.Model;
- namespace GCAS
- {
- public partial class ChangePwd : XtraForm
- {
- private OperatorRepository operatorRepository;
- public OperatorModel currentOperator;
- public ChangePwd()
- {
- InitializeComponent();
- }
- private void ChangePwd_Load(object sender, EventArgs e)
- {
- operatorRepository = new OperatorRepository();
- }
- private async void simpleButton1_Click(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(text_old.Text))
- {
- XtraMessageBox.Show("旧密码不能为空", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- if (string.IsNullOrEmpty(text_new.Text))
- {
- XtraMessageBox.Show("新密码不能为空", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
- }
- if (text_confim.Text != text_new.Text)
- {
- XtraMessageBox.Show("新密码与确认密码不一致", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
- }
- if (currentOperator.Pwd != SHAHelper.SHAmd5Encrypt(text_old.Text))
- {
- XtraMessageBox.Show("您输入的旧密码不正确,请重试!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return;
- }
- currentOperator.Pwd = SHAHelper.SHAmd5Encrypt(text_new.Text);
- if (await operatorRepository.Update(currentOperator) > 0)
- {
- XtraMessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- DialogResult = DialogResult.OK;
- Close();
- }
- }
- private void text_old_Click(object sender, EventArgs e)
- {
- SoftKeyboard.ActiveSoftKeyboard(sender);
- }
- private void text_new_Click(object sender, EventArgs e)
- {
- SoftKeyboard.ActiveSoftKeyboard(sender);
- }
- private void text_confim_Click(object sender, EventArgs e)
- {
- SoftKeyboard.ActiveSoftKeyboard(sender);
- }
- }
- }
|