1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- using PP_Ven_MosS.ModelBase;
- 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;
- using PP_Ven_MosS.Classes;
- using System.Data.Entity;
- using static PP_Ven_MosS.Classes.Events;
- namespace PP_Ven_MosS.Pages
- {
- /// <summary>
- /// Логика взаимодействия для Profile.xaml
- /// </summary>
- public partial class Profile : Page
- {
- public User buffer;
- public User changeuser;
- User user = new User();
- Users users = new Users();
- public Profile(User ID_User)
- {
- InitializeComponent();
- DataContext = ID_User;
- buffer = ID_User;
- changeuser = ID_User;
- User user = Classes.Database.entities.User.FirstOrDefault(x => x.Id_user == UserID.userid);
- txtSurn.Text = user.Surname;
- txtName.Text = user.Name;
- txtPatron.Text = user.Patronymic;
- txtPost.Text = user.Post;
- txtPhone.Text = user.Phone_number;
- txtLog.Text = user.Login;
- txtApp.Text = user.Count_complete_app.ToString();
- txtEvent.Text = user.Count_complete_event.ToString();
- if (UserRole.userrole == 2)
- {
- GBApp.Visibility = Visibility.Visible;
- GBEvent.Visibility = Visibility.Visible;
- }
- }
-
- // Кнопка сохранения изменений профиля
- private void Save_Click(object sender, RoutedEventArgs e)
- {
- PP_MininEntities DB = new PP_MininEntities();
-
- User user = DB.User.FirstOrDefault(x => x.Id_user == UserID.userid);
- user.Surname = txtSurn.Text;
- user.Name = txtName.Text;
- user.Patronymic = txtPatron.Text;
- user.Post = txtPost.Text;
- user.Phone_number = txtPhone.Text;
- user.Login = txtLog.Text;
- if(txtPass.Text != null)
- {
- user.Password = txtPass.Text.GetHashCode().ToString();
- }
- DB.SaveChanges();
- MessageBox.Show("Изменения сохранены");
- }
- private void Exit_Click(object sender, RoutedEventArgs e)
- {
- if (UserRole.userrole == 1)
- {
- FrameClass.MainFrame.Navigate(new MenuAdmin());
- }
- else if (UserRole.userrole == 2)
- {
- FrameClass.MainFrame.Navigate(new ApplicationsListAdmin());
- }
- else
- {
- FrameClass.MainFrame.Navigate(new ApplicationsListUser());
- }
- }
- }
-
- }
|