init commit

This commit is contained in:
-SSS- 2025-02-25 14:42:29 +03:00
parent 1bd44d45c0
commit cdab316bb7
22 changed files with 117 additions and 5 deletions

41
Order.axaml Normal file
View File

@ -0,0 +1,41 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="demo_hard.Order"
x:CompileBindings="True"
Title="Order">
<StackPanel Margin="10" VerticalAlignment="Center" Orientation="Vertical">
<TextBlock Text="Информация о заказе" FontSize="20" HorizontalAlignment="Center" Margin="10"/>
<TextBlock Text="Номер заказа:"/>
<TextBlock x:Name="OrderNumberText" Margin="5"/>
<TextBlock Text="Код клиента:"/>
<TextBlock x:Name="ClientCodeText" Margin="5"/>
<TextBlock Text="Время заказа:"/>
<TextBlock x:Name="DateTimeBox" Margin="5"/>
<TextBlock Text="ФИО клиента:"/>
<TextBlock x:Name="ClientFioText" Margin="5"/>
<TextBlock Text="Адрес клиента:"/>
<TextBlock x:Name="ClientAddressText" Margin="5"/>
<TextBlock Text="Перечень услуг:"/>
<ListBox x:Name="ServicesListBox" Margin="5" Height="150">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<TextBlock Text="Стоимость:"/>
<TextBlock x:Name="TotalCostText" Margin="5"/>
<Button Content="Закрыть" HorizontalAlignment="Center" Margin="10" Click="CloseButton_Click"/>
</StackPanel>
</Window>

48
Order.axaml.cs Normal file
View File

@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Avalonia.Controls;
using Avalonia.Interactivity;
using demo_hard.Model;
using Tmds.DBus.Protocol;
namespace demo_hard;
public partial class Order: Window
{
public Order()
{
InitializeComponent();
}
public Order(string orderNumber, Client client, List<Service> selectedServices)
{
InitializeComponent();
OrderNumberText.Text=orderNumber;
ClientCodeText.Text = client.Id.ToString();
ClientFioText.Text = client.Fio;
ClientAddressText.Text = client.Address;
ServicesListBox.ItemsSource = selectedServices.Select(s => s.ServiceName).ToList();
DateTimeBox.Text = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss");
decimal totalPrice = selectedServices.Sum(s =>
{
decimal serviceCost = decimal.TryParse(s.ServiceCost, out var cost) ? cost : 0;
return serviceCost;
});
TotalCostText.Text = $"${totalPrice:0.00}";
}
private void CloseButton_Click(object? sender, RoutedEventArgs e)
{
Close();
}
}

View File

@ -54,6 +54,7 @@
<Button Content="Назад" Click="Go_Back_Button" HorizontalAlignment="Center" Margin="5"/>
<Button Content="Создать штрих код" HorizontalAlignment="Center" Margin="5"/>
<Button Content="Добавить Пользователя" Click="AddUser_Button" HorizontalAlignment="Center" Margin="5"/>
<Button Content="Создать заказ" Click = "Create_Order" HorizontalAlignment="Center" Margin="5"/>
</StackPanel>
</DockPanel>
</Window>

View File

@ -72,7 +72,7 @@ public partial class SallerWindow : Window
{
SelectedServices.Add(selectedService);
UpdateServiceList();
}
}
}
private void UpdateServiceList()
@ -112,4 +112,17 @@ public partial class SallerWindow : Window
{
new AddClient().ShowDialog(this);
}
private void Create_Order(object? sender, RoutedEventArgs e)
{
string orderNumber = CompleteBox.SelectedItem.ToString();
Client selectedClient = Clients_ComboBox.SelectedItem as Client;
List<Service> selectedServices = new List<Service>(SelectedServices);
if (selectedClient != null && !string.IsNullOrEmpty(orderNumber) && selectedServices.Any())
{
new Order(orderNumber, selectedClient, selectedServices).ShowDialog(this);
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -25,4 +25,10 @@
</PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.10" />
</ItemGroup>
<ItemGroup>
<Compile Update="Order.axaml.cs">
<DependentUpon>Order.axaml.axaml</DependentUpon>
</Compile>
</ItemGroup>
</Project>

View File

@ -1 +1 @@
1bb4aad2af4080c40f10bd47fb00ff5ae4a956da4d13f762d92fb2f830c6f5bb
23bd68dbc8d0fcd3ca1a2051b2c274887182e2f1ad877d6a6343995c941824af

Binary file not shown.

Binary file not shown.

View File

@ -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+a22617f76bc998c4e3da55d9c7e9f6e7477c1a11")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1bd44d45c0662cabe996f24e5419cbd3e5061ebd")]
[assembly: System.Reflection.AssemblyProductAttribute("demo_hard")]
[assembly: System.Reflection.AssemblyTitleAttribute("demo_hard")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
090dd4c763b98e3a2c03283f99207de2f7278187128e5724aa8d8a181941c103
7c3e2bcb812f7727f9a05da53425287fa9d556d2c94e1fbd1ba1d23d6656a6cc

View File

@ -34,5 +34,8 @@ build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
[C:/Users/IVAN/RiderProjects/demo_hard/MainWindow.axaml]
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
[C:/Users/IVAN/RiderProjects/demo_hard/Order.axaml]
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
[C:/Users/IVAN/RiderProjects/demo_hard/SallerWindow.axaml]
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml

View File

@ -1 +1 @@
aee666d28c43098d7df81700364862e84dbc7372e568978b94bb010969a56d0c
64749509748f32a477e90757ddc24a1681e27e00fec69a3f332b42a98aff8a73

Binary file not shown.

Binary file not shown.

Binary file not shown.