PageUserList.xaml.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using MyWpfApp.models;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Navigation;
  15. using System.Windows.Shapes;
  16. namespace MyWpfApp.Pages
  17. {
  18. /// <summary>
  19. /// Логика взаимодействия для PageUserList.xaml
  20. /// </summary>
  21. public partial class PageUserList : Page
  22. {
  23. UserListModel users = new UserListModel();
  24. public PageUserList()
  25. {
  26. InitializeComponent();
  27. DataContext = users;
  28. }
  29. private void Button_Click(object sender, RoutedEventArgs e)
  30. {
  31. Button btn = (Button)sender;
  32. int ID = Convert.ToInt32(btn.Uid);
  33. LoginedTable user = Globals.MyGlobalConnection.LoginedTable.FirstOrDefault(x=>x.ID == ID);
  34. if (user != null)
  35. {
  36. Globals.MyGlobalFrame.Navigate(new PageUserInfo(user));
  37. }
  38. }
  39. private void BtnAddUser_Click(object sender, RoutedEventArgs e)
  40. {
  41. Globals.MyGlobalFrame.Navigate(new PageUserInfo());
  42. }
  43. private void btnResetFilters_Click(object sender, RoutedEventArgs e)
  44. {
  45. users.Surname = null;
  46. users.IdRole = 0;
  47. }
  48. }
  49. }