No puede seleccionar más de 25 temas
Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
|
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using BPASmartClient.CustomResource.Pages.Model;
- using BPA.Helper;
- using BPA.Helper;
-
-
- namespace BPASmartClient.CustomResource.Pages.ViewModel
- {
-
- public class PasswordChangeViewModel : NotifyBase
- {
- private void CheckPassword(UserInfo userInfo)
- {
- if (userInfo.Password == OldPassword)
- {
- if (NewPassword1 == NewPassword2)
- {
- userInfo.Password = NewPassword2;
- int index = Array.FindIndex(Global.userManager.userInfos.ToArray(), p => p.UserName == userInfo.UserName);
- if (index >= 0 && index < Global.userManager.userInfos.Count)
- Global.userManager.userInfos.ElementAt(index).Password = NewPassword1;
- Config.GetInstance.SaveUser();
- ActionManage.GetInstance.Send("PasswordChangeViewconfirm");
- Global.changeUserInfo = null;
- }
- else
- {
- ErrorInfo = "新密码不匹配";
- }
- }
- else
- {
- ErrorInfo = "原密码错误";
- }
- }
-
- public PasswordChangeViewModel( )
- {
- LoginCommand = new BPARelayCommand(() =>
- {
- if (Global.changeUserInfo == null) CheckPassword(Global.userInfo);
- else { CheckPassword(Global.changeUserInfo); }
-
-
- });
-
- ExitCommand = new BPARelayCommand(() =>
- {
- ActionManage.GetInstance.Send("PasswordChangeViewCancel");
- Global.changeUserInfo = null;
- });
- }
-
- public BPARelayCommand LoginCommand { get; set; }
-
- public BPARelayCommand ExitCommand { get; set; }
-
-
-
- public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
- private string _mErrorInfo;
-
- public string OldPassword { get { return _mOldPassword; } set { _mOldPassword = value; OnPropertyChanged(); } }
- private string _mOldPassword;
-
-
- public string NewPassword1 { get { return _mNewPassword1; } set { _mNewPassword1 = value; OnPropertyChanged(); } }
- private string _mNewPassword1;
-
-
- public string NewPassword2 { get { return _mNewPassword2; } set { _mNewPassword2 = value; OnPropertyChanged(); } }
- private string _mNewPassword2;
-
-
- }
- }
|