update AddOrder
This commit is contained in:
parent
00ae76a0ab
commit
b008bbb7c3
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.
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.
Binary file not shown.
Binary file not shown.
@ -3,8 +3,8 @@
|
||||
"WorkspaceRootPath": "C:\\Users\\VivoBook 15X\\Desktop\\\u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u043D\u044B\u0435 \u043C\u043E\u0434\u0443\u043B\u0438\\Demo_Blagodat\\demo_blagodat\\demo_blagodat\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{B40AB1D5-A904-4458-95A8-8CAE49BE0884}|demo_blagodat.csproj|c:\\users\\vivobook 15x\\desktop\\\u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u043D\u044B\u0435 \u043C\u043E\u0434\u0443\u043B\u0438\\demo_blagodat\\demo_blagodat\\demo_blagodat\\functions\\deleteorder.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{B40AB1D5-A904-4458-95A8-8CAE49BE0884}|demo_blagodat.csproj|solutionrelative:functions\\deleteorder.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
"AbsoluteMoniker": "D:0:0:{B40AB1D5-A904-4458-95A8-8CAE49BE0884}|demo_blagodat.csproj|c:\\users\\vivobook 15x\\desktop\\\u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u043D\u044B\u0435 \u043C\u043E\u0434\u0443\u043B\u0438\\demo_blagodat\\demo_blagodat\\demo_blagodat\\models\\client.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{B40AB1D5-A904-4458-95A8-8CAE49BE0884}|demo_blagodat.csproj|solutionrelative:models\\client.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
@ -27,14 +27,14 @@
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "DeleteOrder.axaml.cs",
|
||||
"DocumentMoniker": "C:\\Users\\VivoBook 15X\\Desktop\\\u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u043D\u044B\u0435 \u043C\u043E\u0434\u0443\u043B\u0438\\Demo_Blagodat\\demo_blagodat\\demo_blagodat\\Functions\\DeleteOrder.axaml.cs",
|
||||
"RelativeDocumentMoniker": "Functions\\DeleteOrder.axaml.cs",
|
||||
"ToolTip": "C:\\Users\\VivoBook 15X\\Desktop\\\u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u043D\u044B\u0435 \u043C\u043E\u0434\u0443\u043B\u0438\\Demo_Blagodat\\demo_blagodat\\demo_blagodat\\Functions\\DeleteOrder.axaml.cs",
|
||||
"RelativeToolTip": "Functions\\DeleteOrder.axaml.cs",
|
||||
"ViewState": "AgIAABwAAAAAAAAAAAAAACkAAAAtAAAAAAAAAA==",
|
||||
"Title": "Client.cs",
|
||||
"DocumentMoniker": "C:\\Users\\VivoBook 15X\\Desktop\\\u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u043D\u044B\u0435 \u043C\u043E\u0434\u0443\u043B\u0438\\Demo_Blagodat\\demo_blagodat\\demo_blagodat\\Models\\Client.cs",
|
||||
"RelativeDocumentMoniker": "Models\\Client.cs",
|
||||
"ToolTip": "C:\\Users\\VivoBook 15X\\Desktop\\\u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u043D\u044B\u0435 \u043C\u043E\u0434\u0443\u043B\u0438\\Demo_Blagodat\\demo_blagodat\\demo_blagodat\\Models\\Client.cs",
|
||||
"RelativeToolTip": "Models\\Client.cs",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAkAAAAcAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-03-01T21:26:02.846Z",
|
||||
"WhenOpened": "2025-03-09T19:24:32.315Z",
|
||||
"EditorCaption": ""
|
||||
}
|
||||
]
|
||||
|
@ -1,7 +1,12 @@
|
||||
{
|
||||
"Version": 1,
|
||||
"WorkspaceRootPath": "C:\\Users\\VivoBook 15X\\Desktop\\\u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u043D\u044B\u0435 \u043C\u043E\u0434\u0443\u043B\u0438\\Demo_Blagodat\\demo_blagodat\\demo_blagodat\\",
|
||||
"Documents": [],
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{B40AB1D5-A904-4458-95A8-8CAE49BE0884}|demo_blagodat.csproj|c:\\users\\vivobook 15x\\desktop\\\u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u043D\u044B\u0435 \u043C\u043E\u0434\u0443\u043B\u0438\\demo_blagodat\\demo_blagodat\\demo_blagodat\\models\\client.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{B40AB1D5-A904-4458-95A8-8CAE49BE0884}|demo_blagodat.csproj|solutionrelative:models\\client.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
{
|
||||
"Orientation": 0,
|
||||
@ -9,7 +14,7 @@
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": -1,
|
||||
"SelectedChildIndex": 2,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
@ -18,6 +23,19 @@
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "Client.cs",
|
||||
"DocumentMoniker": "C:\\Users\\VivoBook 15X\\Desktop\\\u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u043D\u044B\u0435 \u043C\u043E\u0434\u0443\u043B\u0438\\Demo_Blagodat\\demo_blagodat\\demo_blagodat\\Models\\Client.cs",
|
||||
"RelativeDocumentMoniker": "Models\\Client.cs",
|
||||
"ToolTip": "C:\\Users\\VivoBook 15X\\Desktop\\\u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u043D\u044B\u0435 \u043C\u043E\u0434\u0443\u043B\u0438\\Demo_Blagodat\\demo_blagodat\\demo_blagodat\\Models\\Client.cs",
|
||||
"RelativeToolTip": "Models\\Client.cs",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAkAAAAcAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-03-09T19:24:32.315Z",
|
||||
"EditorCaption": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -4,15 +4,30 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="demo_blagodat.CreateOrder"
|
||||
xmlns:vm="using:demo_blagodat.Models"
|
||||
Title="Создание заказа">
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Vertical">
|
||||
|
||||
<StackPanel Spacing="15" HorizontalAlignment="Center" Orientation="Horizontal">
|
||||
<StackPanel Spacing="15" HorizontalAlignment="Center">
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Введите ФИО клиента"/>
|
||||
<TextBox Width="300" x:Name="TextNameClient" Text=""/>
|
||||
</StackPanel>
|
||||
<Border Background="Red"
|
||||
CornerRadius="10"
|
||||
Padding="20"
|
||||
Margin="20"
|
||||
Width="300"
|
||||
Height="300">
|
||||
<ScrollViewer>
|
||||
<ListBox Name="ListCliets" SelectionChanged="ListBox_SelectionChanged">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="vm:Client">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding ClientName}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Введите продолжительность заказа в минутах"/>
|
||||
|
@ -4,6 +4,7 @@ using Avalonia.Interactivity;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using demo_blagodat.Models;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
|
||||
namespace demo_blagodat;
|
||||
@ -12,62 +13,56 @@ public partial class CreateOrder : Window
|
||||
{
|
||||
public Order NewOrder = null;
|
||||
public Employee User;
|
||||
static User11Context db = new User11Context();
|
||||
ObservableCollection<Client> ClientitemSource = new ObservableCollection<Client>(db.Clients);
|
||||
|
||||
public CreateOrder(Employee user)
|
||||
{
|
||||
InitializeComponent();
|
||||
User = user;
|
||||
ListCliets.ItemsSource = ClientitemSource;
|
||||
|
||||
}
|
||||
|
||||
private void ListBox_SelectionChanged(object? sender, Avalonia.Controls.SelectionChangedEventArgs e)
|
||||
{
|
||||
if (sender != null)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void createOrder(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
string NameClient = TextNameClient.Text;
|
||||
Client client = db.Clients.Where(it => it == sender).FirstOrDefault();
|
||||
|
||||
int order_rental_time = int.Parse(TextOrderRentalTime.Text);
|
||||
DateOnly? order_closing_date = DateOnly.TryParse(TextOrderClosingDate.Text, out var Date) ? Date : null;
|
||||
|
||||
if (TextNameClient.Text != "")
|
||||
if (TextOrderRentalTime.Text != "")
|
||||
{
|
||||
if(TextOrderRentalTime.Text != "")
|
||||
Order newOrder = new Order()
|
||||
{
|
||||
using (User11Context db = new User11Context())
|
||||
{
|
||||
Client? client = db.Clients.Where(it => it.ClientName == NameClient).FirstOrDefault();
|
||||
if (client != null)
|
||||
{
|
||||
Order newOrder = new Order()
|
||||
{
|
||||
OrderId = db.Orders.Max(o => o.OrderId) + 1,
|
||||
OrderDate = DateOnly.FromDateTime(DateTime.Now),
|
||||
OrderTime = TimeOnly.FromDateTime(DateTime.Now),
|
||||
OrderClient = client.ClientCode,
|
||||
OrderRentalTime = order_rental_time,
|
||||
OrderClosingDate = order_closing_date,
|
||||
OrderStatus = "Íîâàÿ",
|
||||
};
|
||||
db.Orders.Add(newOrder);
|
||||
db.SaveChanges();
|
||||
OrderId = db.Orders.Max(o => o.OrderId) + 1,
|
||||
OrderDate = DateOnly.FromDateTime(DateTime.Now),
|
||||
OrderTime = TimeOnly.FromDateTime(DateTime.Now),
|
||||
OrderClient = client.ClientCode,
|
||||
OrderRentalTime = order_rental_time,
|
||||
OrderClosingDate = order_closing_date,
|
||||
OrderStatus = "Íîâàÿ",
|
||||
};
|
||||
db.Orders.Add(newOrder);
|
||||
db.SaveChanges();
|
||||
|
||||
NewOrder = newOrder;
|
||||
MesAdd.Text = "Çàêàç ñîçäàí";
|
||||
MesAddError.Text = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
MesAddError.Text = "Òàêîãî êëèåíòà íåò";
|
||||
MesAdd.Text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MesAddError.Text = "Ââåäèòå ïðîäîëæèòåëüíîñòü çàêàçà";
|
||||
MesAdd.Text = "";
|
||||
}
|
||||
NewOrder = newOrder;
|
||||
MesAdd.Text = "Çàêàç ñîçäàí";
|
||||
MesAddError.Text = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
MesAddError.Text = "Ââåäèòå èìÿ êëèåíòà";
|
||||
MesAddError.Text = "Ââåäèòå ïðîäîëæèòåëüíîñòü çàêàçà";
|
||||
MesAdd.Text = "";
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
||||
ab5ec113c47cd0ed26726b590fad36b7976ff45256224af52e4ecd17831cc634
|
||||
7c092f63670d2db338546de4e905b570a22d6e6f19ed1870f85fe324f50fa70f
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -14,7 +14,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("demo_blagodat")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e1a0c1864ae93b140382bb5253f30e14f658b6bb")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+00ae76a0ab3d956dbf5f59daa534e063baa7213b")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("demo_blagodat")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("demo_blagodat")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
@ -1 +1 @@
|
||||
60e5bbf7d18ab8cc5ef27cc140454e6bbb540cd3aab7e9ed7c9eb5da0fe665a0
|
||||
df5338b29169336180b002de0b7cc972e3611af3b3c1f8aff16ee2a8a3a2faa9
|
||||
|
Binary file not shown.
@ -1 +1 @@
|
||||
6ba8676dd6ba41f96d33829d1624eddf4ac85ba70d5c98b0486290d37753fec9
|
||||
d99fcffecf2b311dfd8f27035da74520f0f3b412bad16ca51a0dfe6598a4e02d
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -44,7 +44,7 @@
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
},
|
||||
"SdkAnalysisLevel": "9.0.100"
|
||||
"SdkAnalysisLevel": "9.0.200"
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
@ -101,7 +101,7 @@
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.103/PortableRuntimeIdentifierGraph.json"
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.200/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\VivoBook 15X\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.3</NuGetToolVersion>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.13.2</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="C:\Users\VivoBook 15X\.nuget\packages\" />
|
||||
|
@ -3527,7 +3527,7 @@
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
},
|
||||
"SdkAnalysisLevel": "9.0.100"
|
||||
"SdkAnalysisLevel": "9.0.200"
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
@ -3584,7 +3584,7 @@
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.103/PortableRuntimeIdentifierGraph.json"
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.200/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "/zQed7nVKhU=",
|
||||
"dgSpecHash": "bjbTStQJmbs=",
|
||||
"success": true,
|
||||
"projectFilePath": "C:\\Users\\VivoBook 15X\\Desktop\\программные модули\\Demo_Blagodat\\demo_blagodat\\demo_blagodat\\demo_blagodat.csproj",
|
||||
"expectedPackageFiles": [
|
||||
|
Loading…
Reference in New Issue
Block a user