You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
3.1 KiB
111 lines
3.1 KiB
1 year ago
|
using SSWMS.Common;
|
||
|
using System;
|
||
|
using System.Windows;
|
||
|
using System.Windows.Controls;
|
||
|
|
||
|
namespace SSWMS.Client
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// Password.xaml 的交互逻辑
|
||
|
/// </summary>
|
||
|
public partial class Password : Window
|
||
|
{
|
||
|
private string _USER_CODE;
|
||
|
|
||
|
/// <summary>
|
||
|
/// 构造函数
|
||
|
/// </summary>
|
||
|
public Password(string USER_CODE)
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
this._USER_CODE = USER_CODE;
|
||
|
Window_Loaded(null, null);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 加载窗体
|
||
|
/// </summary>
|
||
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||
|
{
|
||
|
this.txtUserCode.Text = this._USER_CODE;
|
||
|
this.txtUserCode.IsEnabled = false;
|
||
|
this.txtOldPwd.Focus();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 按钮事件
|
||
|
/// </summary>
|
||
|
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;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 修改密码
|
||
|
/// </summary>
|
||
|
private void SavePwd()
|
||
|
{
|
||
|
if (string.IsNullOrEmpty(this.txtOldPwd.Password))
|
||
|
{
|
||
|
this.txtOldPwd.Focus();
|
||
|
MessageDialog.ShowException("请填写旧密码!");
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (string.IsNullOrEmpty(this.txtNewPwd.Password.ToString()))
|
||
|
{
|
||
|
this.txtNewPwd.Focus();
|
||
|
MessageDialog.ShowException("请填写新密码!");
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (string.IsNullOrEmpty(this.txtConfirmPwd.Password.ToString()))
|
||
|
{
|
||
|
this.txtConfirmPwd.Focus();
|
||
|
MessageDialog.ShowException("请填写确认密码!");
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (this.txtNewPwd.Password != this.txtConfirmPwd.Password)
|
||
|
{
|
||
|
this.txtConfirmPwd.Focus();
|
||
|
MessageDialog.ShowException("新密码和确认密码不一致!");
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
string sResult = string.Empty;
|
||
|
bool bResult = true;
|
||
|
try
|
||
|
{
|
||
|
bResult = WCFChannel._I_SystemService.ChangePassword(this.txtUserCode.Text, this.txtOldPwd.Password, this.txtNewPwd.Password, out sResult);
|
||
|
this.txtOldPwd.Focus();
|
||
|
this.DialogResult = bResult;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
bResult = false;
|
||
|
sResult = ex.Message;
|
||
|
}
|
||
|
|
||
|
//判断结果
|
||
|
if (bResult)
|
||
|
{
|
||
|
this.Close();
|
||
|
}
|
||
|
MessageDialog.ShowResult(bResult, sResult);
|
||
|
}
|
||
|
}
|
||
|
}
|