duheng
2025-03-28 b266e82b9a377fa35a766f7a3a2f5aa95f3c9125
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using DevExpress.XtraEditors;
using Yw.WinFrmUI;
 
namespace HStation.WinFrmUI
 
{
    public partial class UpdatePwdDlg : DevExpress.XtraEditors.XtraForm
    {
        public UpdatePwdDlg()
        {
            InitializeComponent();
            //this.IconOptions.Icon = Properties.Resources.App;
            this.layoutControl1.SetupLayoutControl();
        }
 
        private long _userLoginId;
 
        public void SetBindingData(long userId)
        {
            _userLoginId = userId;
        }
 
        private bool Valid()
        {
            this.dxErrorProvider1.ClearErrors();
            if (string.IsNullOrEmpty(this.txtPwd.Text.Trim()))
            {
                this.dxErrorProvider1.SetError(this.txtPwd, "必填项");
                return false;
            }
            if (string.IsNullOrEmpty(this.txtConfirm.Text.Trim()))
            {
                this.dxErrorProvider1.SetError(this.txtConfirm, "必填项");
                return false;
            }
            if (this.txtPwd.Text.Trim() != this.txtConfirm.Text.Trim())
            {
                this.dxErrorProvider1.SetError(txtConfirm, "密码不一致");
                return false;
            }
            return true;
        }
 
        private async void btnOk_Click(object sender, EventArgs e)
        {
            if (!Valid())
                return;
 
            var pwd = this.txtConfirm.Text.Trim();
            var bol = await new Yw.BLL.UserLoginAccount().UpdateSystemLoginPwd(_userLoginId, pwd);
            if (!bol)
            {
                XtraMessageBox.Show("修改失败!");
                return;
            }
 
            XtraMessageBox.Show("修改成功");
 
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
    }
}