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.Navigation; using System.Windows.Shapes; namespace HelpHelf.Pages { /// /// Логика взаимодействия для ChangePassword.xaml /// public partial class ChangePassword : Page { LoginedTable loginedTable; public ChangePassword(LoginedTable logined) { InitializeComponent(); loginedTable = logined; } private void btnSave_Click(object sender, RoutedEventArgs e) { if(Classes.CheckFields.CheckUpdatePassword(pswOldPassword.Password, pswNewPassword.Password, pswRepeatePassword.Password)) { if(Classes.CheckFields.CheckOldPassword(pswOldPassword.Password, loginedTable)) { if(Classes.CheckFields.CheckRepeatePassword(pswNewPassword.Password, pswRepeatePassword.Password)) { try { int password = pswNewPassword.Password.GetHashCode(); loginedTable.Password = password; Classes.DateBase.connect.SaveChanges(); MessageBox.Show("Успешная смена пароля\nПовторите вход", "Информация", MessageBoxButton.OK, MessageBoxImage.Information); Classes.DebugClass.diagWrite("Переход на страницу авторизации"); Classes.FrameClass.frmMain.Navigate(new AuthorizationPage()); } catch (Exception ex) { Classes.DebugClass.diagWrite(ex.Message); MessageBox.Show("Ошибка", "Ошибка", MessageBoxButton.OK,MessageBoxImage.Error); } } } } } private void btnCancel_Click(object sender, RoutedEventArgs e) { Classes.FrameClass.frmMain.Navigate(new PersonalAccount(loginedTable));// переход на страницу данных пользователя } } }