using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; namespace SiaSun.LMS.WPFClient.Dialog { /// /// Password.xaml 的交互逻辑 /// public partial class Password : Window { private string _USER_CODE; /// /// 构造函数 /// public Password(string USER_CODE) { InitializeComponent(); this._USER_CODE = USER_CODE; } /// /// 加载窗体 /// private void Window_Loaded(object sender, RoutedEventArgs e) { this.txtUserCode.Text = this._USER_CODE; this.txtUserCode.IsEnabled = false; this.txtOldPwd.Focus(); } /// /// 按钮事件 /// private void WrapPanel_Click(object sender, RoutedEventArgs e) { Button btn = e.OriginalSource as Button; if (btn != null) { switch (btn.Name) { case "btnOK": this.SavePwd(); break; case "btnCancel": this.Close(); break; } } } /// /// 修改密码 /// private void SavePwd() { if (string.IsNullOrEmpty(this.txtOldPwd.Password)) { this.txtOldPwd.Focus(); MainApp._MessageDialog.ShowDialog(Enum.MessageConverter.Null, "请填写旧密码!"); return; } if (string.IsNullOrEmpty(this.txtNewPwd.Password.ToString())) { this.txtNewPwd.Focus(); MainApp._MessageDialog.ShowDialog(Enum.MessageConverter.Null, "请填写新密码!"); return; } if (string.IsNullOrEmpty(this.txtConfirmPwd.Password.ToString())) { this.txtConfirmPwd.Focus(); MainApp._MessageDialog.ShowDialog(Enum.MessageConverter.Null, "请填写确认密码!"); return; } if (!this.txtNewPwd.Password.Equals(this.txtConfirmPwd.Password)) { this.txtConfirmPwd.Focus(); MainApp._MessageDialog.ShowDialog(Enum.MessageConverter.Null, "新密码和确认密码不一致!"); return; } string sResult = string.Empty; bool boolResult = true; try { boolResult = MainApp._I_SystemService.USER_PASSWORD(this.txtUserCode.Text, this.txtOldPwd.Password, this.txtNewPwd.Password, out sResult); this.txtOldPwd.Focus(); this.DialogResult = boolResult; } catch (Exception ex) { boolResult = false; sResult = ex.Message; } //判断结果 if (boolResult) { this.Close(); } MainApp._MessageDialog.ShowResult(boolResult, sResult); } } }