add AddServices

This commit is contained in:
NikitaOnianov 2025-02-26 16:02:53 +03:00
parent d1d788fca6
commit c664ef8be2
40 changed files with 333 additions and 16 deletions

View File

@ -1,7 +1,24 @@
{
"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\\functions\\addservices.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{B40AB1D5-A904-4458-95A8-8CAE49BE0884}|demo_blagodat.csproj|solutionrelative:functions\\addservices.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\\functions\\addservices.axaml||{6D5344A2-2FCD-49DE-A09D-6A14FD1B1224}",
"RelativeMoniker": "D:0:0:{B40AB1D5-A904-4458-95A8-8CAE49BE0884}|demo_blagodat.csproj|solutionrelative:functions\\addservices.axaml||{6D5344A2-2FCD-49DE-A09D-6A14FD1B1224}"
},
{
"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\\addclient.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{B40AB1D5-A904-4458-95A8-8CAE49BE0884}|demo_blagodat.csproj|solutionrelative:functions\\addclient.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\\service.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{B40AB1D5-A904-4458-95A8-8CAE49BE0884}|demo_blagodat.csproj|solutionrelative:models\\service.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
@ -9,7 +26,7 @@
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": -1,
"SelectedChildIndex": 4,
"Children": [
{
"$type": "Bookmark",
@ -18,6 +35,57 @@
{
"$type": "Bookmark",
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "AddClient.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\\AddClient.axaml.cs",
"RelativeDocumentMoniker": "Functions\\AddClient.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\\AddClient.axaml.cs",
"RelativeToolTip": "Functions\\AddClient.axaml.cs",
"ViewState": "AgIAAA8AAAAAAAAAAAAAAB4AAABpAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-02-26T12:26:35.443Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 3,
"Title": "Service.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\\Service.cs",
"RelativeDocumentMoniker": "Models\\Service.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\\Service.cs",
"RelativeToolTip": "Models\\Service.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAA0AAAASAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-02-26T12:14:09.14Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "AddServices.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\\AddServices.axaml.cs",
"RelativeDocumentMoniker": "Functions\\AddServices.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\\AddServices.axaml.cs",
"RelativeToolTip": "Functions\\AddServices.axaml.cs",
"ViewState": "AgIAACoAAAAAAAAAAAAAADgAAABfAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-02-26T12:11:59.898Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "AddServices.axaml",
"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\\AddServices.axaml",
"RelativeDocumentMoniker": "Functions\\AddServices.axaml",
"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\\AddServices.axaml",
"RelativeToolTip": "Functions\\AddServices.axaml",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
"WhenOpened": "2025-02-26T12:11:58.617Z",
"EditorCaption": ""
}
]
}

View File

@ -1,7 +1,24 @@
{
"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\\functions\\addservices.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{B40AB1D5-A904-4458-95A8-8CAE49BE0884}|demo_blagodat.csproj|solutionrelative:functions\\addservices.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\\functions\\addservices.axaml||{6D5344A2-2FCD-49DE-A09D-6A14FD1B1224}",
"RelativeMoniker": "D:0:0:{B40AB1D5-A904-4458-95A8-8CAE49BE0884}|demo_blagodat.csproj|solutionrelative:functions\\addservices.axaml||{6D5344A2-2FCD-49DE-A09D-6A14FD1B1224}"
},
{
"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\\addclient.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{B40AB1D5-A904-4458-95A8-8CAE49BE0884}|demo_blagodat.csproj|solutionrelative:functions\\addclient.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\\service.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{B40AB1D5-A904-4458-95A8-8CAE49BE0884}|demo_blagodat.csproj|solutionrelative:models\\service.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
@ -9,7 +26,7 @@
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": -1,
"SelectedChildIndex": 4,
"Children": [
{
"$type": "Bookmark",
@ -18,6 +35,57 @@
{
"$type": "Bookmark",
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "AddClient.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\\AddClient.axaml.cs",
"RelativeDocumentMoniker": "Functions\\AddClient.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\\AddClient.axaml.cs",
"RelativeToolTip": "Functions\\AddClient.axaml.cs",
"ViewState": "AgIAAA8AAAAAAAAAAAAAAB4AAABpAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-02-26T12:26:35.443Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 3,
"Title": "Service.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\\Service.cs",
"RelativeDocumentMoniker": "Models\\Service.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\\Service.cs",
"RelativeToolTip": "Models\\Service.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAA0AAAASAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-02-26T12:14:09.14Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "AddServices.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\\AddServices.axaml.cs",
"RelativeDocumentMoniker": "Functions\\AddServices.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\\AddServices.axaml.cs",
"RelativeToolTip": "Functions\\AddServices.axaml.cs",
"ViewState": "AgIAACoAAAAAAAAAAAAAADgAAABfAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-02-26T12:11:59.898Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "AddServices.axaml",
"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\\AddServices.axaml",
"RelativeDocumentMoniker": "Functions\\AddServices.axaml",
"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\\AddServices.axaml",
"RelativeToolTip": "Functions\\AddServices.axaml",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
"WhenOpened": "2025-02-26T12:11:58.617Z",
"EditorCaption": ""
}
]
}

View File

@ -0,0 +1,29 @@
<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_blagodat.AddServices"
Title="Добавить новую услугу">
<StackPanel Spacing="15" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="Введите Название новой услуги"/>
<TextBox Width="300" x:Name="TextName"/>
<TextBlock Text="Введите Код услуги"/>
<TextBox Width="300" x:Name="TextCode"/>
<TextBlock Text="Введите стоимость услуги в рублях."/>
<TextBox Width="300" x:Name="TextPrice"/>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<Button Content="Добавить Услугу" Click="addService"/>
<Button Content="Вернуться назад" Click="ExitCliсk"/>
</StackPanel>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock x:Name="MesAddError" Text="" Foreground="Red"/>
<TextBlock x:Name="MesAdd" Text="" Foreground="Green"/>
</StackPanel>
</StackPanel>
</Window>

View File

@ -0,0 +1,103 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using demo_blagodat.Models;
using System.Linq;
using System;
namespace demo_blagodat;
public partial class AddServices : Window
{
public Employee User;
public AddServices(Employee user)
{
InitializeComponent();
User = user;
}
private void ExitCliñk(object sender, RoutedEventArgs e)
{
switch (User.EmployeesPosition)
{
case "Àäìèíèñòðàòîð": AdminOneClikc(User); break;
case "Ïðîäàâåö": SellerOneClikc(User); break;
case "Ñòàðøèé ñìåíû": ShiftSupervisorOneClikc(User); break;
}
Close();
}
private void SellerOneClikc(Employee User)
{
new Seller(User).Show();
Close();
}
private void AdminOneClikc(Employee User)
{
new Admin(User).Show();
Close();
}
private void ShiftSupervisorOneClikc(Employee User)
{
new ShiftSupervisor(User).Show();
Close();
}
private void addService(object sender, RoutedEventArgs e)
{
try // Êîíñòðóêöèÿ äëÿ îáðàáîòêè èñêëþ÷åíèé
{
using (User11Context db = new User11Context()) // Ïîäêëþ÷åíèå ê ÁÄ
{
// Ñîáèðàåì âñå äàííûå ñ ýêðàíà
int id = db.Services.Max(it => it.ServiceId) + 1; // áåð¸ì ìàêñèìàëüíûé ID ïîëüçîâàòåëÿ è ïðèáàâëÿåì "1"
string name = TextName.Text;
string code = TextCode.Text;
decimal price = Math.Round(decimal.Parse(TextPrice.Text.Replace(".", ",")), 2);
if (name != null && code != null) // Ïðîâåðÿåì íàëè÷èå âàæíûõ äàííûõ
{
Service newService = new Service() // ñîçäà¸ì ýêçåìïëÿð êëàññà Service
{
// Ñîîòíîñèì ïåðåìåííûå
ServiceId = id,
ServiceName = name,
ServiceCode = code,
ServiceCostPerHour = price
};
// Äîáàâëÿåì ïîëüçîâàòåëÿ â ÁÄ
db.Services.Add(newService);
db.SaveChanges();
// Ñòåðàåì âñå äàííûå
TextName.Text = "";
TextCode.Text = "";
TextPrice.Text = "";
// Ìåíÿåì ñîîáùåíèå
MesAddError.Text = "";
MesAdd.Text = "Óñëóãà äîáàëåíà";
}
else
{
// Ìåíÿåì ñîîáùåíèå
MesAdd.Text = "";
MesAddError.Text = "Íóæíî îáÿçàòåëüíî äîáàâèòü íàçâàíèå è êîä!";
}
}
}
catch (Exception ex)
{
// Âûâîäèì ñîîáùåíèå îá îøèáêå â êîíñîëü
Console.WriteLine(ex.Message);
// Ìåíÿåì ñîîáùåíèå
MesAdd.Text = "";
MesAddError.Text = "Ïðîâåðüòå äàííûå";
}
}
}

View File

@ -5,7 +5,7 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="demo_blagodat.CreateOrder"
Title="Создание заказа">
<StackPanel>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Content="Назад" Click="ExitClik"/>
</StackPanel>
</Window>

View File

@ -5,11 +5,13 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="demo_blagodat.Admin"
Title="Администратор">
<StackPanel>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock x:Name="HelloUser" Text="Добрый день, "/>
<Button Content="Сформировать заказ" Click="createOrder"/>
<Button Content="Выход" Click="ExitAuthorization"/>
<Button Content="Выход из приложения" Click="Exit"/>
<Button Content="Добавить клиента" Click="addClient"/>
<Button Content="Сформировать заказ" Click="createOrder"/>
<Button Content="Добавить услугу" Click="addServices"/>
<Button Content="Удалить заказ" />
</StackPanel>
</Window>

View File

@ -49,6 +49,12 @@ public partial class Admin : Window
Close();
}
private void addServices(object sender, RoutedEventArgs e)
{
new AddServices(User).Show();
Close();
}
// Метод для обновление активности на false
private void activityUpdate()
{

View File

@ -5,11 +5,12 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="demo_blagodat.Seller"
Title="Продавец">
<StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock x:Name="HelloUser" Text="Добрый день "/>
<Button Content="Сформировать заказ" Click="createOrder"/>
<Button Content="Выход" Click="ExitAuthorization"/>
<Button Content="Выход из приложения" Click="Exit"/>
<Button Content="Добавить клиента" Click="addClient"/>
<Button Content="Добавить услугу" Click="addServices"/>
</StackPanel>
</Window>

View File

@ -37,6 +37,11 @@ public partial class Seller : Window
new CreateOrder(User).Show();
Close(); // Çàêðûâàåì òåêóùåå îêíî
}
private void addServices(object sender, RoutedEventArgs e)
{
new AddServices(User).Show();
Close();
}
private void addClient(object sender, RoutedEventArgs e)
{
new AddClient(User).Show();

View File

@ -6,8 +6,11 @@
x:Class="demo_blagodat.ShiftSupervisor"
Title="Начальник смены">
<StackPanel Orientation="Horizontal">
<Button Content="сформировать заказ"/>
<TextBlock x:Name="HelloUser" Text="Добрый день "/>
<Button Content="сформировать заказ" Click="createOrder"/>
<Button Content="Добавить пользователя" Click="addClient"/>
<Button Content="принять товар"/>
<Button Content="Выход" Click="Exit"/>
<Button Content="Выход из приложения" Click="Exit"/>
<Button Content="Выход" Click="ExitAuthorization"/>
</StackPanel>
</Window>

View File

@ -3,6 +3,7 @@ using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using demo_blagodat.Models;
using System.Linq;
namespace demo_blagodat;
@ -13,10 +14,38 @@ public partial class ShiftSupervisor : Window
{
InitializeComponent();
User = user; // Ïåðåäà¸ì äàííûå ïîëüçîâàòåëÿ â ïóáëè÷íóþ ïåðåìåííóþ
HelloUser.Text = HelloUser.Text + User.EmployeesName; // Ïðèâåòñòâóåì ïîëüçîâàòåëÿ
}
public void Exit(object sender, RoutedEventArgs e)
private void ExitAuthorization(object sender, RoutedEventArgs e)
{
new Authorization().Show();
Close();
activityUpdate();// Ìåòîä äëÿ îáíîâëåíèå àêòèâíîñòè íà false
Close(); // Çàêðûâàåì òåêóùåå îêíî
}
private void Exit(object sender, RoutedEventArgs e)
{
activityUpdate(); // Ìåòîä äëÿ îáíîâëåíèå àêòèâíîñòè íà false
Close(); // Çàêðûâàåì òåêóùåå îêíî
}
private void activityUpdate()
{
using (User11Context db = new User11Context()) // Ïîäêëþ÷åíèå ê ÁÄ
{
var corrUser = db.Employees.Where(x => x.EmployeesLogin == User.EmployeesLogin).FirstOrDefault();
corrUser.EmployeesEntrance = false; // Ìåíÿåì â ïàðàìåòðå "Àêòîâíîñòü" True íà False
db.SaveChanges(); // Ñîõðàíÿåì èçìåíåíèÿ â ÁÄ
}
}
private void createOrder(object sender, RoutedEventArgs e)
{
new CreateOrder(User).Show();
Close(); // Çàêðûâàåì òåêóùåå îêíî
}
private void addClient(object sender, RoutedEventArgs e)
{
new AddClient(User).Show();
Close(); // Çàêðûâàåì òåêóùåå îêíî
}
}

View File

@ -1 +1 @@
587c6bac365720a8d2bbdeb7a2ee455b6747d01e0902eac9a6bf9026eb160acf
2be621f199d7e2a203d693ae6f5fff0625d5a2932fb1fc10452e2ec3e6444158

View File

@ -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+110362f3fc4c907df6f7adeafb5f733533326568")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d1d788fca6acff374ece2a3f894c126aabaf8e6c")]
[assembly: System.Reflection.AssemblyProductAttribute("demo_blagodat")]
[assembly: System.Reflection.AssemblyTitleAttribute("demo_blagodat")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
cbcb50529ef34f85de31420edc7cd8f286a0c01d84c740e2f2a4f10765d919d2
9617ed43f2c6ccc36d2b3aaebf7dea43f410ae6f72ffcca46d342c98745650e9

View File

@ -30,6 +30,9 @@ build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
[C:/Users/VivoBook 15X/Desktop/программные модули/Demo_Blagodat/demo_blagodat/demo_blagodat/Functions/AddClient.axaml]
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
[C:/Users/VivoBook 15X/Desktop/программные модули/Demo_Blagodat/demo_blagodat/demo_blagodat/Functions/AddServices.axaml]
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
[C:/Users/VivoBook 15X/Desktop/программные модули/Demo_Blagodat/demo_blagodat/demo_blagodat/Functions/CreateOrder.axaml]
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml

View File

@ -1 +1 @@
40e3485ea6ee456ff08f179efa3e7e7f539492c04c12875cdde14ecd742da0e2
9e71e112725c9a716a2103cd3fd384cd298c46c7c9feef916663171f7912498b