using PP_Ven_MosS.Classes; using PP_Ven_MosS.ModelBase; using System; using System.Collections.Generic; using System.Data.Entity; using System.Linq; using System.Security.RightsManagement; 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 PP_Ven_MosS.Pages { /// /// Логика взаимодействия для Acount.xaml /// public partial class Acount : Page { public Acount() { InitializeComponent(); UserList.ItemsSource = Classes.Database.entities.User.ToList(); CB_Filter_user.ItemsSource = new List { "Роли", "Сотрудники", "Пользователи" }; CB_Filter_user.SelectedIndex = 0; } private void CB_Filter_user_SelectionChanged(object sender, SelectionChangedEventArgs e) { Filter(); } private void TB_Search_app_TextChanged(object sender, TextChangedEventArgs e) { Filter(); } private void Filter() { List users = Classes.Database.entities.User.ToList(); if (CB_Filter_user.SelectedIndex != 0) { switch (CB_Filter_user.SelectedIndex) { case 1: users = users.Where(x => x.Id_role == 1 || x.Id_role == 2).ToList(); break; case 2: users = users.Where(x => x.Id_role == 3).ToList(); break; } } if (!string.IsNullOrEmpty(TB_Search_app.Text)) { users = users.Where(x => x.Surname.ToUpper().Contains(TB_Search_app.Text.ToUpper())).ToList(); } UserList.ItemsSource = users; } private void Exit_Click(object sender, RoutedEventArgs e) { FrameClass.MainFrame.Navigate(new MenuAdmin()); } } }