1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- 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
- {
- /// <summary>
- /// Логика взаимодействия для ChangePassword.xaml
- /// </summary>
- 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));// переход на страницу данных пользователя
- }
- }
- }
|