12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- 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 WPF01.pages
- {
- using db;
- /// <summary>
- /// Логика взаимодействия для UserInfo.xaml
- /// </summary>
- public partial class UserInfo : Page
- {
- public UserInfo()
- {
- InitializeComponent();
- }
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- Database.User.Phone = phoneTextBox.Text;
- Database.User.FirstName = fistnameTextBox.Text;
- Database.User.SecondName = lastnameTextBox.Text;
- Database.User.Patronymic = patronymicTextBox.Text;
- if (
- passwordBox.Password.Length != 0 &&
- passwordBox.Password.Length > 3 &&
- passwordBox.Password.Length < 11
- )
- {
- Database.User.Password = passwordBox.Password;
- }
- int result = Database.Context.SaveChanges();
- if (result > 0)
- {
- MessageBox.Show("Данные успешно изменены", "Информация", MessageBoxButton.OK, MessageBoxImage.Information);
- }
- }
- private void Page_Loaded(object sender, RoutedEventArgs e)
- {
- if (Database.User != null)
- {
- loginLabel.Content = Database.User.Login;
- phoneTextBox.Text = Database.User.Phone;
- fistnameTextBox.Text = Database.User.FirstName;
- lastnameTextBox.Text = Database.User.SecondName;
- patronymicTextBox.Text = Database.User.Patronymic;
- }
- }
- }
- }
|