64 lines
1.6 KiB
C#
64 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
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;
|
|
using ViewModel;
|
|
|
|
|
|
namespace FeiYu
|
|
{
|
|
/// <summary>
|
|
/// PwdAlter.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class PwdAlter : Window
|
|
{
|
|
public PwdAlter()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void btnClose_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void btnOK_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
MainWindowVM MW = this.DataContext as MainWindowVM;
|
|
string pwd = SoftwareValidation.MD5(pbOutPwd.Password.Trim());
|
|
if (pwd != MW.User.UserPwd)
|
|
{
|
|
MessageBox.Show("原始密码错误");
|
|
return;
|
|
}
|
|
|
|
if (pbNewPwd1.Password.Trim() != pbNewPwd2.Password.Trim())
|
|
{
|
|
MessageBox.Show("两次密码输入不一致");
|
|
return;
|
|
}
|
|
string newPwd = SoftwareValidation.MD5(pbNewPwd1.Password.Trim());
|
|
MW.User.UserPwd = newPwd;
|
|
if (MW.dal.UpdateUser(MW.User)>0)
|
|
{
|
|
MessageBox.Show("密码更改成功,请牢记新密码");
|
|
}else
|
|
{
|
|
MessageBox.Show("密码修改失败");
|
|
}
|
|
|
|
|
|
this.Close();
|
|
}
|
|
}
|
|
}
|