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
{
///
/// Логика взаимодействия для AdminData.xaml
///
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 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 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 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 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 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 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;
}
}
}
}