diff --git a/SallerWindow.axaml b/SallerWindow.axaml
index 0aade92..b66cf9a 100644
--- a/SallerWindow.axaml
+++ b/SallerWindow.axaml
@@ -11,8 +11,8 @@
-
-
+
+
@@ -21,9 +21,10 @@
-
+
-
+
+
@@ -31,16 +32,27 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
diff --git a/SallerWindow.axaml.cs b/SallerWindow.axaml.cs
index 1562c8a..068f039 100644
--- a/SallerWindow.axaml.cs
+++ b/SallerWindow.axaml.cs
@@ -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 SelectedServices = new();
+
public SallerWindow()
{
InitializeComponent();
@@ -19,21 +20,20 @@ public partial class SallerWindow : Window
LoadClients();
LoadService();
SearchItems();
-
}
-
private void OrderNubmber()
{
- using var context = new User2Context();
+ 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();
+ using var context = new User2Context();
var client = context.Clients.ToList();
Clients_ComboBox.ItemsSource = client;
}
@@ -53,46 +53,63 @@ public partial class SallerWindow : Window
private void LoadService()
{
- using var context = new User2Context();
+ using var context = new User2Context();
var service = context.Services.ToList();
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))
+ using var context = new User2Context();
+ string searchText = SearchBox.Text?.ToLower() ?? "";
+ if (string.IsNullOrWhiteSpace(searchText))
{
SearchResultsListBox.ItemsSource = new List();
+ 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 results = clientRes.Concat(SeviceRes).ToList();
+ var clientRes = context.Clients
+ .Where(c => c.Fio.ToLower().Contains(searchText))
+ .Select(c => c.Fio);
+
+ 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();
}
private void AddUser_Button(object? sender, RoutedEventArgs e)
{
- new AddClient().ShowDialog(this);
+ new AddClient().ShowDialog(this);
}
-}
\ No newline at end of file
+}
diff --git a/bin/Debug/net8.0/demo_hard.dll b/bin/Debug/net8.0/demo_hard.dll
index ec67b23..81c2fd8 100644
Binary files a/bin/Debug/net8.0/demo_hard.dll and b/bin/Debug/net8.0/demo_hard.dll differ
diff --git a/bin/Debug/net8.0/demo_hard.exe b/bin/Debug/net8.0/demo_hard.exe
index daf1290..4ef622b 100644
Binary files a/bin/Debug/net8.0/demo_hard.exe and b/bin/Debug/net8.0/demo_hard.exe differ
diff --git a/bin/Debug/net8.0/demo_hard.pdb b/bin/Debug/net8.0/demo_hard.pdb
index 6501e72..d6d81f2 100644
Binary files a/bin/Debug/net8.0/demo_hard.pdb and b/bin/Debug/net8.0/demo_hard.pdb differ
diff --git a/obj/Debug/net8.0/Avalonia/demo_hard.dll b/obj/Debug/net8.0/Avalonia/demo_hard.dll
index ec67b23..81c2fd8 100644
Binary files a/obj/Debug/net8.0/Avalonia/demo_hard.dll and b/obj/Debug/net8.0/Avalonia/demo_hard.dll differ
diff --git a/obj/Debug/net8.0/Avalonia/demo_hard.pdb b/obj/Debug/net8.0/Avalonia/demo_hard.pdb
index 6501e72..d6d81f2 100644
Binary files a/obj/Debug/net8.0/Avalonia/demo_hard.pdb and b/obj/Debug/net8.0/Avalonia/demo_hard.pdb differ
diff --git a/obj/Debug/net8.0/Avalonia/resources b/obj/Debug/net8.0/Avalonia/resources
index d990735..10cd416 100644
Binary files a/obj/Debug/net8.0/Avalonia/resources and b/obj/Debug/net8.0/Avalonia/resources differ
diff --git a/obj/Debug/net8.0/apphost.exe b/obj/Debug/net8.0/apphost.exe
index daf1290..4ef622b 100644
Binary files a/obj/Debug/net8.0/apphost.exe and b/obj/Debug/net8.0/apphost.exe differ
diff --git a/obj/Debug/net8.0/demo_hard.AssemblyInfo.cs b/obj/Debug/net8.0/demo_hard.AssemblyInfo.cs
index 2a2fc59..3fc1f8a 100644
--- a/obj/Debug/net8.0/demo_hard.AssemblyInfo.cs
+++ b/obj/Debug/net8.0/demo_hard.AssemblyInfo.cs
@@ -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")]
diff --git a/obj/Debug/net8.0/demo_hard.AssemblyInfoInputs.cache b/obj/Debug/net8.0/demo_hard.AssemblyInfoInputs.cache
index 43c8fc6..b836e1d 100644
--- a/obj/Debug/net8.0/demo_hard.AssemblyInfoInputs.cache
+++ b/obj/Debug/net8.0/demo_hard.AssemblyInfoInputs.cache
@@ -1 +1 @@
-212d01cd01222b730329db90ffcbef63559222ef1cebdf9636893fb4f6874dfa
+090dd4c763b98e3a2c03283f99207de2f7278187128e5724aa8d8a181941c103
diff --git a/obj/Debug/net8.0/demo_hard.dll b/obj/Debug/net8.0/demo_hard.dll
index 1f3a6e5..e4c28aa 100644
Binary files a/obj/Debug/net8.0/demo_hard.dll and b/obj/Debug/net8.0/demo_hard.dll differ
diff --git a/obj/Debug/net8.0/demo_hard.pdb b/obj/Debug/net8.0/demo_hard.pdb
index 4d75313..57f60da 100644
Binary files a/obj/Debug/net8.0/demo_hard.pdb and b/obj/Debug/net8.0/demo_hard.pdb differ
diff --git a/obj/Debug/net8.0/ref/demo_hard.dll b/obj/Debug/net8.0/ref/demo_hard.dll
index dcccb37..9ab2278 100644
Binary files a/obj/Debug/net8.0/ref/demo_hard.dll and b/obj/Debug/net8.0/ref/demo_hard.dll differ
diff --git a/obj/Debug/net8.0/refint/Avalonia/demo_hard.dll b/obj/Debug/net8.0/refint/Avalonia/demo_hard.dll
index dcccb37..9ab2278 100644
Binary files a/obj/Debug/net8.0/refint/Avalonia/demo_hard.dll and b/obj/Debug/net8.0/refint/Avalonia/demo_hard.dll differ
diff --git a/obj/Debug/net8.0/refint/demo_hard.dll b/obj/Debug/net8.0/refint/demo_hard.dll
index ff504a7..81ad7b1 100644
Binary files a/obj/Debug/net8.0/refint/demo_hard.dll and b/obj/Debug/net8.0/refint/demo_hard.dll differ