1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- using MyWpfApp.models;
- 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 MyWpfApp.Pages
- {
- /// <summary>
- /// Логика взаимодействия для PageUserList.xaml
- /// </summary>
- public partial class PageUserList : Page
- {
- List<UserTable> users = Globals.MyGlobalConnection.UserTable.ToList();
- public PageUserList()
- {
- InitializeComponent();
- LB1.ItemsSource = users;
- cbRoleFind.ItemsSource = Globals.MyGlobalConnection.Roles.ToList();
- cbRoleFind.SelectedValuePath = "ID";
- cbRoleFind.DisplayMemberPath = "Role";
- }
-
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- Button btn = (Button)sender;
- int ID = Convert.ToInt32(btn.Uid);
- LoginedTable user = Globals.MyGlobalConnection.LoginedTable.FirstOrDefault(x=>x.ID == ID);
- if (user != null)
- {
- Globals.MyGlobalFrame.Navigate(new PageUserInfo(user));
- }
- }
- private void BtnAddUser_Click(object sender, RoutedEventArgs e)
- {
- Globals.MyGlobalFrame.Navigate(new PageUserInfo());
- }
- private void txtSurnameFind_TextChanged(object sender, TextChangedEventArgs e)
- {
- LB1.ItemsSource = users.Where(x=>x.Surname.StartsWith(txtSurnameFind.Text)).ToList();
- }
- private void cbRoleFind_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- LB1.ItemsSource = users.Where(x=>x.LoginedTable.IDRole == (int)cbRoleFind.SelectedValue).ToList();
- }
- private void btnResetFilters_Click(object sender, RoutedEventArgs e)
- {
- LB1.ItemsSource = users;
- }
- }
- }
|