init commit
This commit is contained in:
parent
a22617f76b
commit
1bd44d45c0
@ -11,8 +11,8 @@
|
|||||||
<TextBlock Text="Добро пожаловать в окно создания заказа"/>
|
<TextBlock Text="Добро пожаловать в окно создания заказа"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel DockPanel.Dock="Left" Orientation="Vertical" VerticalAlignment="Center" Margin="5">
|
<StackPanel DockPanel.Dock="Left" Orientation="Vertical" VerticalAlignment="Center" Margin="5">
|
||||||
<TextBox x:Name= "SearchBox" Width="200" TextChanged="SeacrchBox_Changed"/>
|
<TextBox x:Name="SearchBox" Width="200" TextChanged="SearchBox_Changed"/>
|
||||||
<ListBox x:Name ="SearchResultsListBox">
|
<ListBox x:Name="SearchResultsListBox">
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBlock Text="{Binding}"/>
|
<TextBlock Text="{Binding}"/>
|
||||||
@ -21,9 +21,10 @@
|
|||||||
</ListBox>
|
</ListBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel VerticalAlignment="Center" Orientation="Vertical" Margin="5">
|
<StackPanel VerticalAlignment="Center" Orientation="Vertical" Margin="5">
|
||||||
<TextBlock Text="Номер заказа" Margin="5" HorizontalAlignment="Center" />
|
<TextBlock Text="Номер заказа" Margin="5" HorizontalAlignment="Center"/>
|
||||||
<AutoCompleteBox x:Name="CompleteBox" FilterMode="StartsWith" Width="200" HorizontalAlignment="Center" Margin="5"/>
|
<AutoCompleteBox x:Name="CompleteBox" FilterMode="StartsWith" Width="200" HorizontalAlignment="Center" Margin="5"/>
|
||||||
<TextBlock Text="Сделать штрих кода нада" Margin="5" HorizontalAlignment="Center"/>
|
<TextBlock Text="Сделать штрих кода надо" Margin="5" HorizontalAlignment="Center"/>
|
||||||
|
|
||||||
<ComboBox x:Name="Clients_ComboBox" Width="200" SelectionChanged="Clients_ComboBox_SelectionChanged" HorizontalAlignment="Center" Margin="5">
|
<ComboBox x:Name="Clients_ComboBox" Width="200" SelectionChanged="Clients_ComboBox_SelectionChanged" HorizontalAlignment="Center" Margin="5">
|
||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
@ -31,16 +32,27 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ComboBox.ItemTemplate>
|
</ComboBox.ItemTemplate>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
<ComboBox x:Name="Service_Combobox" Width="200" SelectionChanged="Serice_Combobox_SelectionChanged" HorizontalAlignment="Center" Margin="5">
|
|
||||||
|
<ComboBox x:Name="Service_Combobox" Width="200" SelectionChanged="Service_Combobox_SelectionChanged" HorizontalAlignment="Center" Margin="5">
|
||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBlock Text="{Binding ServiceName}"/>
|
<TextBlock Text="{Binding ServiceName}"/>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ComboBox.ItemTemplate>
|
</ComboBox.ItemTemplate>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
|
|
||||||
|
<Button Content="Добавить услугу" Click="AddService_Button" HorizontalAlignment="Center" Margin="5"/>
|
||||||
|
|
||||||
|
<ListBox x:Name="SelectedServicesListBox" Width="200" Height="100" HorizontalAlignment="Center" Margin="5">
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
|
||||||
<Button Content="Назад" Click="Go_Back_Button" HorizontalAlignment="Center" Margin="5"/>
|
<Button Content="Назад" Click="Go_Back_Button" HorizontalAlignment="Center" Margin="5"/>
|
||||||
<Button Content="Создать штрих код" HorizontalAlignment="Center" Margin="5"/>
|
<Button Content="Создать штрих код" HorizontalAlignment="Center" Margin="5"/>
|
||||||
<Button Content="Добавить услугу" HorizontalAlignment="Center" Margin="5"/>
|
|
||||||
<Button Content="Добавить Пользователя" Click="AddUser_Button" HorizontalAlignment="Center" Margin="5"/>
|
<Button Content="Добавить Пользователя" Click="AddUser_Button" HorizontalAlignment="Center" Margin="5"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
@ -7,11 +7,12 @@ using Avalonia.Interactivity;
|
|||||||
using Avalonia.Markup.Xaml;
|
using Avalonia.Markup.Xaml;
|
||||||
using demo_hard.Model;
|
using demo_hard.Model;
|
||||||
|
|
||||||
|
|
||||||
namespace demo_hard;
|
namespace demo_hard;
|
||||||
|
|
||||||
public partial class SallerWindow : Window
|
public partial class SallerWindow : Window
|
||||||
{
|
{
|
||||||
|
private List<Service> SelectedServices = new();
|
||||||
|
|
||||||
public SallerWindow()
|
public SallerWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -19,21 +20,20 @@ public partial class SallerWindow : Window
|
|||||||
LoadClients();
|
LoadClients();
|
||||||
LoadService();
|
LoadService();
|
||||||
SearchItems();
|
SearchItems();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void OrderNubmber()
|
private void OrderNubmber()
|
||||||
{
|
{
|
||||||
using var context = new User2Context();
|
using var context = new User2Context();
|
||||||
var OrderId = context.Orders.Max(o => o.Id) + 1;
|
var OrderId = context.Orders.Max(o => o.Id) + 1;
|
||||||
if (context.Orders.Any(o => o.Id == OrderId)) throw new ArgumentException("Номера Id не должны совпадать");
|
if (context.Orders.Any(o => o.Id == OrderId)) throw new ArgumentException("Номера Id не должны совпадать");
|
||||||
if (OrderId < 1) throw new ArgumentException("OrderId must be greater than 1");
|
if (OrderId < 1) throw new ArgumentException("OrderId must be greater than 1");
|
||||||
CompleteBox.ItemsSource = new string[] {OrderId.ToString()};
|
CompleteBox.ItemsSource = new string[] { OrderId.ToString() };
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadClients()
|
private void LoadClients()
|
||||||
{
|
{
|
||||||
using var context = new User2Context();
|
using var context = new User2Context();
|
||||||
var client = context.Clients.ToList();
|
var client = context.Clients.ToList();
|
||||||
Clients_ComboBox.ItemsSource = client;
|
Clients_ComboBox.ItemsSource = client;
|
||||||
}
|
}
|
||||||
@ -53,46 +53,63 @@ public partial class SallerWindow : Window
|
|||||||
|
|
||||||
private void LoadService()
|
private void LoadService()
|
||||||
{
|
{
|
||||||
using var context = new User2Context();
|
using var context = new User2Context();
|
||||||
var service = context.Services.ToList();
|
var service = context.Services.ToList();
|
||||||
Service_Combobox.ItemsSource = service;
|
Service_Combobox.ItemsSource = service;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Serice_Combobox_SelectionChanged(object? sender, SelectionChangedEventArgs e)
|
private void Service_Combobox_SelectionChanged(object? sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (Clients_ComboBox.SelectedItem is Service selectedServiceName)
|
if (Service_Combobox.SelectedItem is Service selectedService)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Вы выбрали улугу: {selectedServiceName.ServiceName}");
|
Console.WriteLine($"Вы выбрали услугу: {selectedService.ServiceName}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AddService_Button(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (Service_Combobox.SelectedItem is Service selectedService && !SelectedServices.Contains(selectedService))
|
||||||
|
{
|
||||||
|
SelectedServices.Add(selectedService);
|
||||||
|
UpdateServiceList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateServiceList()
|
||||||
|
{
|
||||||
|
SelectedServicesListBox.ItemsSource = null;
|
||||||
|
SelectedServicesListBox.ItemsSource = SelectedServices.Select(s => s.ServiceName).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
private void SearchItems()
|
private void SearchItems()
|
||||||
{
|
{
|
||||||
using var context = new User2Context();
|
using var context = new User2Context();
|
||||||
string seacrhText = SearchBox.Text?.ToLower() ?? "";
|
string searchText = SearchBox.Text?.ToLower() ?? "";
|
||||||
if (string.IsNullOrWhiteSpace(seacrhText))
|
if (string.IsNullOrWhiteSpace(searchText))
|
||||||
{
|
{
|
||||||
SearchResultsListBox.ItemsSource = new List<string>();
|
SearchResultsListBox.ItemsSource = new List<string>();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var clientRes = context.Clients.ToList().Where(c => c.Fio.ToLower().Contains(seacrhText))
|
var clientRes = context.Clients
|
||||||
.Select(c=> $"{c.Fio}");
|
.Where(c => c.Fio.ToLower().Contains(searchText))
|
||||||
var SeviceRes = context.Services.ToList().Where(s => s.ServiceName.ToLower().Contains(seacrhText))
|
.Select(c => c.Fio);
|
||||||
.Select(s => $"{s.ServiceName}");
|
|
||||||
|
var serviceRes = context.Services
|
||||||
var results = clientRes.Concat(SeviceRes).ToList();
|
.Where(s => s.ServiceName.ToLower().Contains(searchText))
|
||||||
|
.Select(s => s.ServiceName);
|
||||||
|
|
||||||
|
var results = clientRes.Concat(serviceRes).ToList();
|
||||||
SearchResultsListBox.ItemsSource = results;
|
SearchResultsListBox.ItemsSource = results;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SearchBox_Changed(object? sender, TextChangedEventArgs e)
|
||||||
private void SeacrchBox_Changed(object? sender, TextChangedEventArgs e)
|
|
||||||
{
|
{
|
||||||
SearchItems();
|
SearchItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddUser_Button(object? sender, RoutedEventArgs e)
|
private void AddUser_Button(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
new AddClient().ShowDialog(this);
|
new AddClient().ShowDialog(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Binary file not shown.
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("demo_hard")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("demo_hard")]
|
||||||
[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+0421119ccc3a8fb4511ce1afcf4ded03661d4361")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a22617f76bc998c4e3da55d9c7e9f6e7477c1a11")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("demo_hard")]
|
[assembly: System.Reflection.AssemblyProductAttribute("demo_hard")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("demo_hard")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("demo_hard")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
@ -1 +1 @@
|
|||||||
212d01cd01222b730329db90ffcbef63559222ef1cebdf9636893fb4f6874dfa
|
090dd4c763b98e3a2c03283f99207de2f7278187128e5724aa8d8a181941c103
|
||||||
|
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