123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- 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 Prakticheskaya5_Venediktov
- {
- /// <summary>
- /// Логика взаимодействия для AdminFun.xaml
- /// </summary>
- public partial class AdminFun : Page
- {
- User users = new User();
- public AdminFun()
- {
- InitializeComponent();
- All.ItemsSource = users.usr.ToList();
- gender.ItemsSource = Base.database.Pol.ToList();
- gender.SelectedValue = "ID_Gender";
- gender.DisplayMemberPath = "Gender1";
- gender.SelectedIndex = -1;
- }
- private void sortbig_Click(object sender, RoutedEventArgs e)
- {
- All.ItemsSource = users.usr.ToList().OrderBy(x => x.Surname).ToList();
- }
- private void sortsmall_Click(object sender, RoutedEventArgs e)
- {
- All.ItemsSource = users.usr.ToList().OrderBy(x => x.Surname).Reverse().ToList();
- }
- private void gender_Selected(object sender, RoutedEventArgs e)
- {
- if (gender.SelectedIndex == -1)
- {
- All.ItemsSource = users.usr.ToList();
- }
- else
- {
- All.ItemsSource = users.usr.ToList().Where(x => x.ID_Gender == (gender.SelectedIndex + 1)).ToList();
- }
- }
- private void poisk_TextChanged(object sender, TextChangedEventArgs e)
- {
- if (!string.IsNullOrWhiteSpace(poisk.Text))
- {
- All.ItemsSource = users.usr.ToList().Where(x => (x.Surname.ToLower().Contains(poisk.Text.ToLower())) || (x.Name.ToLower().Contains(poisk.Text.ToLower()))).ToList();
- }
- }
- private void clear_Click(object sender, RoutedEventArgs e)
- {
- All.ItemsSource = users.usr.ToList();
- }
- private void glav_Click(object sender, RoutedEventArgs e)
- {
- NavigationService.Navigate(new AdminPage());
- }
- }
- }
|