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(); } } }