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; /// /// Логика взаимодействия для UserInfo.xaml /// 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; } } } }