history_sort_filter
This commit is contained in:
parent
24fcb4b4bd
commit
9425badd58
@ -16,7 +16,7 @@
|
|||||||
<Image x:Name="Image" Width="150" Height="150"/>
|
<Image x:Name="Image" Width="150" Height="150"/>
|
||||||
<TextBlock x:Name="FioName" Foreground="Black"/>
|
<TextBlock x:Name="FioName" Foreground="Black"/>
|
||||||
<TextBlock x:Name="RoleName" Foreground="Black"/>
|
<TextBlock x:Name="RoleName" Foreground="Black"/>
|
||||||
<Button Content="Сформировать заказ" Click="History_OnClick" Background="LightGray" Width="170"/>
|
<Button Content="История" Click="History_OnClick" Background="LightGray" Width="170"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</Border>
|
</Border>
|
||||||
|
@ -11,6 +11,12 @@
|
|||||||
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Background="Gray" Height="30">
|
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Background="Gray" Height="30">
|
||||||
<Button Content="Назад" Click="Back_OnClick" Width="120" Background="LightGray" Foreground="Black" HorizontalAlignment="Left" DockPanel.Dock="Left"/>
|
<Button Content="Назад" Click="Back_OnClick" Width="120" Background="LightGray" Foreground="Black" HorizontalAlignment="Left" DockPanel.Dock="Left"/>
|
||||||
<TextBlock x:Name="TimerText" Foreground="White" Margin="10,5,0,0" HorizontalAlignment="Center"/>
|
<TextBlock x:Name="TimerText" Foreground="White" Margin="10,5,0,0" HorizontalAlignment="Center"/>
|
||||||
|
<ComboBox VerticalAlignment="Center" Width="100" x:Name="SortComboBox" SelectionChanged="SortComboBox_OnSelectionChanged">
|
||||||
|
<ComboBoxItem Content="сброс"/>
|
||||||
|
<ComboBoxItem Content="later"/>
|
||||||
|
<ComboBoxItem Content="nah"/>
|
||||||
|
</ComboBox>
|
||||||
|
<ComboBox VerticalAlignment="Center" Width="100" x:Name="FilterCombobox" SelectionChanged="FilterCombobox_OnSelectionChanged"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<ScrollViewer DockPanel.Dock="Top" VerticalScrollBarVisibility="Auto">
|
<ScrollViewer DockPanel.Dock="Top" VerticalScrollBarVisibility="Auto">
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
@ -12,12 +13,13 @@ namespace dmeo040225;
|
|||||||
|
|
||||||
public partial class HistoryWindow : Window
|
public partial class HistoryWindow : Window
|
||||||
{
|
{
|
||||||
public ObservableCollection<User> Users { get; set; } = new();
|
ObservableCollection<User> Users = new ObservableCollection<User>();
|
||||||
|
List<UserPresenter> dataSourceUsers;
|
||||||
public HistoryWindow()
|
public HistoryWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
using var context = new DatabaseContext();
|
using var context = new DatabaseContext();
|
||||||
var users = context.Users.Select(user => new UserPresenter
|
dataSourceUsers = context.Users.Select(user => new UserPresenter
|
||||||
{
|
{
|
||||||
Id = user.Id,
|
Id = user.Id,
|
||||||
RoleId = user.RoleId,
|
RoleId = user.RoleId,
|
||||||
@ -27,8 +29,9 @@ public partial class HistoryWindow : Window
|
|||||||
Logorno = user.Logorno,
|
Logorno = user.Logorno,
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
Users = new ObservableCollection<User>(users);
|
|
||||||
ListBoxHistory.ItemsSource = Users;
|
ListBoxHistory.ItemsSource = Users;
|
||||||
|
FilterCombobox.ItemsSource = dataSourceUsers.Select(user => user.Login).ToList();
|
||||||
|
DisplayServices();
|
||||||
|
|
||||||
TimerService.Instance.TimeUpdated += UpdateTimerText;
|
TimerService.Instance.TimeUpdated += UpdateTimerText;
|
||||||
TimerService.Instance.TimerExpired += LogoutUser;
|
TimerService.Instance.TimerExpired += LogoutUser;
|
||||||
@ -51,6 +54,38 @@ public partial class HistoryWindow : Window
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DisplayServices()
|
||||||
|
{
|
||||||
|
var temp = dataSourceUsers;
|
||||||
|
Users.Clear();
|
||||||
|
switch (SortComboBox.SelectedIndex)
|
||||||
|
{
|
||||||
|
case 1: temp = temp.OrderBy(it => it.Lastlogin).ToList(); break;
|
||||||
|
case 0: temp = temp.OrderByDescending(it => it.Lastlogin).ToList(); break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FilterCombobox.SelectionBoxItem != null)
|
||||||
|
{
|
||||||
|
temp = temp.Where(u => u.Login == FilterCombobox.SelectionBoxItem.ToString()).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var item in temp)
|
||||||
|
{
|
||||||
|
Users.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SortComboBox_OnSelectionChanged(object? sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
DisplayServices();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FilterCombobox_OnSelectionChanged(object? sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
DisplayServices();
|
||||||
|
}
|
||||||
|
|
||||||
private void Back_OnClick(object? sender, RoutedEventArgs e)
|
private void Back_OnClick(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("dmeo040225")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("dmeo040225")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+7df29eaed73ff8157467edb785b5cec0c2f2baac")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+24fcb4b4bdec7f65156773fbaab0680cea833382")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("dmeo040225")]
|
[assembly: System.Reflection.AssemblyProductAttribute("dmeo040225")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("dmeo040225")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("dmeo040225")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
@ -1 +1 @@
|
|||||||
8148ae1978269f085dafca0635f8af2746f8bdf7cc4fe5ae6804146ebc19fd26
|
619dff8a150155e86bea2906fa1ba070e670274bf639e016b092abdd96b0f3a8
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user