12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- 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;
- 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_MininEntities2 DB = new PP_MininEntities2();
-
- 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());
- }
- }
- }
-
- }
|