123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- 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 SneakersSkakunov
- {
- /// <summary>
- /// Логика взаимодействия для AdminData.xaml
- /// </summary>
- public partial class AdminData : Page
- {
- private void Revert(object sender, RoutedEventArgs e)
- {
- MainFrame.mframe.Navigate(new AdminPage());
- }
- public AdminData()
- {
- InitializeComponent();
- using (Sniker DB = new Sniker())
- {
- List<Users> u = DB.Users.ToList();
- foreach (Users us in u)
- {
- if (us.id_Gender == 1)
- {
- us.Gender.Gender1 = "Мужской";
- }
- else
- {
- us.Gender.Gender1 = "Женский";
- }
- }
- Data.ItemsSource = u;
- }
- }
- private void SortAZ(object sender, RoutedEventArgs e)
- {
- using (Sniker DB = new Sniker())
- {
- List<Users> u = DB.Users.OrderBy(x => x.Surname).ToList();
- foreach (Users us in u)
- {
- if (us.id_Gender == 1)
- {
- us.Gender.Gender1 = "Мужской";
- }
- else
- {
- us.Gender.Gender1 = "Женский";
- }
- }
- Data.ItemsSource = u;
- }
- }
- private void SortZA(object sender, RoutedEventArgs e)
- {
- using (Sniker DB = new Sniker())
- {
- List<Users> u = DB.Users.OrderByDescending(x => x.Surname).ToList();
- foreach (Users us in u)
- {
- if (us.id_Gender == 1)
- {
- us.Gender.Gender1 = "Мужской";
- }
- else
- {
- us.Gender.Gender1 = "Женский";
- }
- }
- Data.ItemsSource = u;
- }
- }
- private void FindM(object sender, RoutedEventArgs e)
- {
- using (Sniker DB = new Sniker())
- {
- List<Users> u = DB.Users.Where(x => x.id_Gender == 1).ToList();
- foreach (Users us in u)
- {
- if (us.id_Gender == 1)
- {
- us.Gender.Gender1 = "Мужской";
- }
- else
- {
- us.Gender.Gender1 = "Женский";
- }
- }
- Data.ItemsSource = u;
- }
- }
- private void FindW(object sender, RoutedEventArgs e)
- {
- using (Sniker DB = new Sniker())
- {
- List<Users> u = DB.Users.Where(x => x.id_Gender == 2).ToList();
- foreach (Users us in u)
- {
- if (us.id_Gender == 1)
- {
- us.Gender.Gender1 = "Мужской";
- }
- else
- {
- us.Gender.Gender1 = "Женский";
- }
- }
- Data.ItemsSource = u;
- }
- }
- private void Search(object sender, RoutedEventArgs e)
- {
- using (Sniker DB = new Sniker())
- {
- string SeText = SearchString.Text;
- List<Users> u = DB.Users.Where(x => x.Surname.StartsWith(SeText) || x.Name.StartsWith(SeText)).ToList();
- foreach (Users us in u)
- {
- if (us.id_Gender == 1)
- {
- us.Gender.Gender1 = "Мужской";
- }
- else
- {
- us.Gender.Gender1 = "Женский";
- }
- }
- Data.ItemsSource = u;
- }
- }
- }
- }
|