init commit
This commit is contained in:
parent
a22617f76b
commit
1bd44d45c0
@ -11,8 +11,8 @@
|
||||
<TextBlock Text="Добро пожаловать в окно создания заказа"/>
|
||||
</StackPanel>
|
||||
<StackPanel DockPanel.Dock="Left" Orientation="Vertical" VerticalAlignment="Center" Margin="5">
|
||||
<TextBox x:Name= "SearchBox" Width="200" TextChanged="SeacrchBox_Changed"/>
|
||||
<ListBox x:Name ="SearchResultsListBox">
|
||||
<TextBox x:Name="SearchBox" Width="200" TextChanged="SearchBox_Changed"/>
|
||||
<ListBox x:Name="SearchResultsListBox">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding}"/>
|
||||
@ -21,9 +21,10 @@
|
||||
</ListBox>
|
||||
</StackPanel>
|
||||
<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"/>
|
||||
<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.ItemTemplate>
|
||||
<DataTemplate>
|
||||
@ -31,16 +32,27 @@
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</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>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding ServiceName}"/>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</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="Создать штрих код" HorizontalAlignment="Center" Margin="5"/>
|
||||
<Button Content="Добавить услугу" HorizontalAlignment="Center" Margin="5"/>
|
||||
<Button Content="Добавить Пользователя" Click="AddUser_Button" HorizontalAlignment="Center" Margin="5"/>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
|
@ -7,11 +7,12 @@ using Avalonia.Interactivity;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using demo_hard.Model;
|
||||
|
||||
|
||||
namespace demo_hard;
|
||||
|
||||
public partial class SallerWindow : Window
|
||||
{
|
||||
private List<Service> SelectedServices = new();
|
||||
|
||||
public SallerWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -19,18 +20,17 @@ public partial class SallerWindow : Window
|
||||
LoadClients();
|
||||
LoadService();
|
||||
SearchItems();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void OrderNubmber()
|
||||
{
|
||||
using var context = new User2Context();
|
||||
var OrderId = context.Orders.Max(o => o.Id) + 1;
|
||||
if (context.Orders.Any(o => o.Id == OrderId)) throw new ArgumentException("Номера Id не должны совпадать");
|
||||
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()
|
||||
{
|
||||
using var context = new User2Context();
|
||||
@ -58,35 +58,52 @@ public partial class SallerWindow : Window
|
||||
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()
|
||||
{
|
||||
using var context = new User2Context();
|
||||
string seacrhText = SearchBox.Text?.ToLower() ?? "";
|
||||
if (string.IsNullOrWhiteSpace(seacrhText))
|
||||
string searchText = SearchBox.Text?.ToLower() ?? "";
|
||||
if (string.IsNullOrWhiteSpace(searchText))
|
||||
{
|
||||
SearchResultsListBox.ItemsSource = new List<string>();
|
||||
return;
|
||||
}
|
||||
|
||||
var clientRes = context.Clients.ToList().Where(c => c.Fio.ToLower().Contains(seacrhText))
|
||||
.Select(c=> $"{c.Fio}");
|
||||
var SeviceRes = context.Services.ToList().Where(s => s.ServiceName.ToLower().Contains(seacrhText))
|
||||
.Select(s => $"{s.ServiceName}");
|
||||
var clientRes = context.Clients
|
||||
.Where(c => c.Fio.ToLower().Contains(searchText))
|
||||
.Select(c => c.Fio);
|
||||
|
||||
var results = clientRes.Concat(SeviceRes).ToList();
|
||||
var serviceRes = context.Services
|
||||
.Where(s => s.ServiceName.ToLower().Contains(searchText))
|
||||
.Select(s => s.ServiceName);
|
||||
|
||||
var results = clientRes.Concat(serviceRes).ToList();
|
||||
SearchResultsListBox.ItemsSource = results;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void SeacrchBox_Changed(object? sender, TextChangedEventArgs e)
|
||||
private void SearchBox_Changed(object? sender, TextChangedEventArgs e)
|
||||
{
|
||||
SearchItems();
|
||||
}
|
||||
|
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.AssemblyConfigurationAttribute("Debug")]
|
||||
[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.AssemblyTitleAttribute("demo_hard")]
|
||||
[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