12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using LogoForceTestApp.Modules.MainModule.Models;
- using Prism.Commands;
- using Prism.Mvvm;
- using Repository;
- using Repository.Entiies;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Security.Cryptography;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace LogoForceTestApp.Modules.MainModule.ViewModels
- {
- public class AccountPageViewModel: BindableBase
- {
- IRepository _repository;
- public string IdAcc { get; set; }
- public string ChangeP { get; set; }
- public DelegateCommand PasswordCommand { get; set; }
- public AccountPageViewModel(IRepository repository)
- {
- _repository = repository;
- PasswordCommand = new DelegateCommand(ChangePassword);
- }
- private void ChangePassword()
- {
- System.Windows.Forms.DialogResult digres = MessageBox.Show("确认是否修改密码?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);
- if (digres == System.Windows.Forms.DialogResult.OK)
- {
- var change= _repository.GetFirstDefault<Account>(c => c.AccountID == IdAcc);
- change.ChangePassword = ChangeP;
- _repository.Update(change);
- }
- else
- {
- ChangeP = string.Empty;
- }
- }
- }
- }
|