update app 0.5
This commit is contained in:
parent
62a5c37073
commit
e1a0c1864a
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.
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\\addclient.axaml||{6D5344A2-2FCD-49DE-A09D-6A14FD1B1224}",
|
||||
"RelativeMoniker": "D:0:0:{B40AB1D5-A904-4458-95A8-8CAE49BE0884}|demo_blagodat.csproj|solutionrelative:functions\\addclient.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\\users\\admin.axaml||{6D5344A2-2FCD-49DE-A09D-6A14FD1B1224}",
|
||||
"RelativeMoniker": "D:0:0:{B40AB1D5-A904-4458-95A8-8CAE49BE0884}|demo_blagodat.csproj|solutionrelative:users\\admin.axaml||{6D5344A2-2FCD-49DE-A09D-6A14FD1B1224}"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
@ -27,13 +27,13 @@
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "AddClient.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\\AddClient.axaml",
|
||||
"RelativeDocumentMoniker": "Functions\\AddClient.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\\AddClient.axaml",
|
||||
"RelativeToolTip": "Functions\\AddClient.axaml",
|
||||
"Title": "Admin.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\\Users\\Admin.axaml",
|
||||
"RelativeDocumentMoniker": "Users\\Admin.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\\Users\\Admin.axaml",
|
||||
"RelativeToolTip": "Users\\Admin.axaml",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
|
||||
"WhenOpened": "2025-02-26T20:55:34.609Z",
|
||||
"WhenOpened": "2025-03-01T13:52:46.864Z",
|
||||
"EditorCaption": ""
|
||||
}
|
||||
]
|
||||
|
@ -1,12 +1,7 @@
|
||||
{
|
||||
"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": [
|
||||
{
|
||||
"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||{6D5344A2-2FCD-49DE-A09D-6A14FD1B1224}",
|
||||
"RelativeMoniker": "D:0:0:{B40AB1D5-A904-4458-95A8-8CAE49BE0884}|demo_blagodat.csproj|solutionrelative:functions\\addclient.axaml||{6D5344A2-2FCD-49DE-A09D-6A14FD1B1224}"
|
||||
}
|
||||
],
|
||||
"Documents": [],
|
||||
"DocumentGroupContainers": [
|
||||
{
|
||||
"Orientation": 0,
|
||||
@ -14,7 +9,7 @@
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 2,
|
||||
"SelectedChildIndex": -1,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
@ -23,18 +18,6 @@
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "AddClient.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\\AddClient.axaml",
|
||||
"RelativeDocumentMoniker": "Functions\\AddClient.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\\AddClient.axaml",
|
||||
"RelativeToolTip": "Functions\\AddClient.axaml",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
|
||||
"WhenOpened": "2025-02-26T20:55:34.609Z",
|
||||
"EditorCaption": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -20,13 +20,13 @@ public partial class Registration : Window
|
||||
public void sellerUser(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
PositionUser = "Ïðîäàâåö";
|
||||
position.Text = position.Text + PositionUser;
|
||||
position.Text = "Âûáåðèòå äîëæíîñòü: " + PositionUser;
|
||||
}
|
||||
|
||||
public void shiftSupervisorUser(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
PositionUser = "Ñòàðøèé ñìåíû";
|
||||
position.Text = position.Text + PositionUser;
|
||||
position.Text = "Âûáåðèòå äîëæíîñòü: " + PositionUser;
|
||||
}
|
||||
|
||||
private void RegisterClick_OnClick(object? sender, RoutedEventArgs e)
|
@ -49,7 +49,7 @@ public partial class AddClient : Window
|
||||
|
||||
// Добавляем пользователя в БД
|
||||
db.Clients.Add(client);
|
||||
db.SaveChanges();
|
||||
db.SaveChanges(); // Сохраняем изменения
|
||||
|
||||
// Стераем все данные
|
||||
TextName.Text = "";
|
||||
|
98
demo_blagodat/Functions/ChangeClient.axaml
Normal file
98
demo_blagodat/Functions/ChangeClient.axaml
Normal file
@ -0,0 +1,98 @@
|
||||
<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.ChangeClient"
|
||||
Title="Изменить клиента">
|
||||
<StackPanel Spacing="15" Orientation="Vertical">
|
||||
<TextBlock Text="Введите имя клиента, которого хотите изменить:"/>
|
||||
<TextBox x:Name="Name"/>
|
||||
|
||||
<StackPanel Spacing="15" HorizontalAlignment="Center" Orientation="Horizontal">
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Введите ФИО"/>
|
||||
<TextBox Width="300" x:Name="TextNewName" Text=""/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Введите Паспорт"/>
|
||||
<TextBox Width="300" x:Name="TextNewPassport" Text=""/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Введите дату рождения (цифрами)"/>
|
||||
<TextBox Width="300" x:Name="TextNewBirthday" Text=""/>
|
||||
</StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Spacing="15" HorizontalAlignment="Center" Orientation="Horizontal">
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Введите адрес"/>
|
||||
<TextBox Width="300" Height="90" x:Name="TextNewAddress" TextWrapping="Wrap" Text=""/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Введите Email"/>
|
||||
<TextBox Width="300" x:Name="TextNewEmail" Text=""/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Введите пароль"/>
|
||||
<TextBox Width="300" x:Name="TextNewPassword" Text=""/>
|
||||
</StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel HorizontalAlignment="Center" Orientation="Vertical" VerticalAlignment="Center">
|
||||
<Button Content="Изменить данные Клиента" Click="changeClient"/>
|
||||
<Button Content="Отчислить данные" Click="clear"/>
|
||||
<Button Content="Вернуться назад" Click="ExitClik"/>
|
||||
</StackPanel>
|
||||
<StackPanel HorizontalAlignment="Center" Orientation="Vertical">
|
||||
<TextBlock x:Name="MesAddError" Text="" Foreground="Red"/>
|
||||
<TextBlock x:Name="MesAdd" Text="" Foreground="Green"/>
|
||||
</StackPanel>
|
||||
<StackPanel Spacing="15" HorizontalAlignment="Center" Orientation="Horizontal">
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="ФИО"/>
|
||||
<TextBlock Width="300" x:Name="SelectName"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Паспорт"/>
|
||||
<TextBlock Width="300" x:Name="SelectPassport"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Дата рождения"/>
|
||||
<TextBlock Width="300" x:Name="SelectBirthday"/>
|
||||
</StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Spacing="15" HorizontalAlignment="Center" Orientation="Horizontal">
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Адрес"/>
|
||||
<TextBlock Width="300" Height="90" x:Name="SelectAddress" TextWrapping="Wrap"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Email"/>
|
||||
<TextBlock Width="300" x:Name="SelectEmail"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Пароль"/>
|
||||
<TextBlock Width="300" x:Name="SelectPassword"/>
|
||||
</StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
</Window>
|
186
demo_blagodat/Functions/ChangeClient.axaml.cs
Normal file
186
demo_blagodat/Functions/ChangeClient.axaml.cs
Normal file
@ -0,0 +1,186 @@
|
||||
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 ChangeClient : Window
|
||||
{
|
||||
public Employee User;
|
||||
public ChangeClient(Employee user)
|
||||
{
|
||||
InitializeComponent();
|
||||
User = user;
|
||||
}
|
||||
|
||||
private void changeClient(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try // Êîíñòðóêöèÿ äëÿ îáðàáîòêè èñêëþ÷åíèé
|
||||
{
|
||||
// Îáîçíà÷àåì êîíêðåòíîãî ïîëüçîâàòåëÿ
|
||||
string? name = Name.Text;
|
||||
|
||||
// Ñîáèðàåì âñå äàííûå ñ ýêðàíà
|
||||
string? newname = TextNewName.Text;
|
||||
string? newpas = TextNewPassport.Text;
|
||||
string? newaddress = TextNewAddress.Text;
|
||||
DateOnly? newdate = DateOnly.TryParse(TextNewBirthday.Text, out var BirthDate) ? BirthDate : null;
|
||||
string? newemail = TextNewEmail.Text;
|
||||
string? newpassword = TextNewPassword.Text;
|
||||
|
||||
if (name != "")
|
||||
{
|
||||
using (User11Context db = new User11Context()) // Ïîäêëþ÷åíèå ê ÁÄ
|
||||
{
|
||||
Client? client = db.Clients.Where(it => it.ClientName == name).FirstOrDefault();
|
||||
if (client != null)
|
||||
{
|
||||
if (newname != "")
|
||||
{
|
||||
client.ClientName = newname; // Ìåíÿåì ïàðàìåíò "Èìÿ"
|
||||
|
||||
db.SaveChanges(); // Ñîõðàíÿåì èçìåíåíèÿ
|
||||
|
||||
// Ñîîáùåíèå
|
||||
MesAdd.Text = "Äàííûå èçìåíåíû";
|
||||
MesAddError.Text = "";
|
||||
}
|
||||
if (newpas != "")
|
||||
{
|
||||
client.ClientPassport = newpas; // Ìåíÿåì ïàðàìåíò "Ïàñïîðò"
|
||||
|
||||
db.SaveChanges(); // Ñîõðàíÿåì èçìåíåíèÿ
|
||||
|
||||
// Ñîîáùåíèå
|
||||
MesAdd.Text = "Äàííûå èçìåíåíû";
|
||||
MesAddError.Text = "";
|
||||
}
|
||||
if (newdate != null)
|
||||
{
|
||||
client.ClientBirthday = (DateOnly) newdate;// Ìåíÿåì ïàðàìåíò "Äåíü ðîæäåíèÿ"
|
||||
|
||||
db.SaveChanges(); // Ñîõðàíÿåì èçìåíåíèÿ
|
||||
|
||||
// Ñîîáùåíèå
|
||||
MesAdd.Text = "Äàííûå èçìåíåíû";
|
||||
MesAddError.Text = "";
|
||||
}
|
||||
if (newemail != "")
|
||||
{
|
||||
client.ClientEmail = newemail; // Ìåíÿåì ïàðàìåíò "Ïî÷òà"
|
||||
|
||||
db.SaveChanges(); // Ñîõðàíÿåì èçìåíåíèÿ
|
||||
|
||||
// Ñîîáùåíèå
|
||||
MesAdd.Text = "Äàííûå èçìåíåíû";
|
||||
MesAddError.Text = "";
|
||||
}
|
||||
if (newpassword != "")
|
||||
{
|
||||
client.ClientPassword = newpassword; // Ìåíÿåì ïàðàìåíò "Ïàðîëü"
|
||||
|
||||
db.SaveChanges(); // Ñîõðàíÿåì èçìåíåíèÿ
|
||||
|
||||
// Ñîîáùåíèå
|
||||
MesAdd.Text = "Äàííûå èçìåíåíû";
|
||||
MesAddError.Text = "";
|
||||
}
|
||||
if (newaddress != "")
|
||||
{
|
||||
client.ClientAddress = newaddress; // Ìåíÿåì ïàðàìåíò "Ïàðîëü"
|
||||
|
||||
db.SaveChanges(); // Ñîõðàíÿåì èçìåíåíèÿ
|
||||
|
||||
// Ñîîáùåíèå
|
||||
MesAdd.Text = "Äàííûå èçìåíåíû";
|
||||
MesAddError.Text = "";
|
||||
}
|
||||
|
||||
if(TextNewName.Text == "" && TextNewPassport.Text == "" && TextNewBirthday.Text == "" && TextNewEmail.Text == "" && TextNewPassword.Text == "" && TextNewAddress.Text == "")
|
||||
{
|
||||
// Ñîîáùåíèå
|
||||
MesAdd.Text = "";
|
||||
MesAddError.Text = "Ââåäèòå íîâûå äàííûå";
|
||||
}
|
||||
check(client);
|
||||
}
|
||||
else
|
||||
{
|
||||
MesAdd.Text = "";
|
||||
MesAddError.Text = "Òàêîãî êëèåíòà íåò";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MesAddError.Text = "Ñíà÷àëà îáîçíà÷üòå èçìåíÿåìîãî êëèåíòà";
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message); // Âûâîäèì ñîîáùåíèå îá îøèáêå â êîíñîëü
|
||||
|
||||
// Ìåíÿåì ñîîáùåíèå
|
||||
MesAdd.Text = "";
|
||||
MesAddError.Text = "Ïðîèçîøëà îøèáêà";
|
||||
}
|
||||
}
|
||||
|
||||
private void clear(object sender, RoutedEventArgs e)
|
||||
{
|
||||
TextNewName.Text = "";
|
||||
TextNewPassport.Text = "";
|
||||
TextNewBirthday.Text = "";
|
||||
TextNewAddress.Text = "";
|
||||
TextNewEmail.Text = "";
|
||||
TextNewPassword.Text = "";
|
||||
}
|
||||
|
||||
private void check(Client client)
|
||||
{
|
||||
using (User11Context db = new User11Context()) // Ïîäêëþ÷åíèå ê ÁÄ
|
||||
{
|
||||
|
||||
Client checkclient = db.Clients.Where(it => it.ClientName == client.ClientName).FirstOrDefault();
|
||||
|
||||
SelectName.Text = checkclient.ClientName;
|
||||
SelectPassport.Text = checkclient.ClientPassport;
|
||||
SelectPassword.Text = checkclient.ClientPassword;
|
||||
SelectAddress.Text = checkclient.ClientAddress;
|
||||
SelectEmail.Text = checkclient.ClientEmail;
|
||||
SelectBirthday.Text = checkclient.ClientBirthday.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private void ExitClik(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();
|
||||
}
|
||||
}
|
11
demo_blagodat/Functions/ChangeOrder.axaml
Normal file
11
demo_blagodat/Functions/ChangeOrder.axaml
Normal file
@ -0,0 +1,11 @@
|
||||
<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.ChangeOrder"
|
||||
Title="Изменить заказ">
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<Button Content="Назад" Click="ExitClik"/>
|
||||
</StackPanel>
|
||||
</Window>
|
43
demo_blagodat/Functions/ChangeOrder.axaml.cs
Normal file
43
demo_blagodat/Functions/ChangeOrder.axaml.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using demo_blagodat.Models;
|
||||
|
||||
namespace demo_blagodat;
|
||||
|
||||
public partial class ChangeOrder : Window
|
||||
{
|
||||
public Employee User;
|
||||
public ChangeOrder(Employee user)
|
||||
{
|
||||
InitializeComponent();
|
||||
User = user;
|
||||
}
|
||||
private void ExitClik(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();
|
||||
}
|
||||
}
|
62
demo_blagodat/Functions/ChangeServices.axaml
Normal file
62
demo_blagodat/Functions/ChangeServices.axaml
Normal file
@ -0,0 +1,62 @@
|
||||
<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.ChangeServices"
|
||||
Title="Изменить услугу">
|
||||
<StackPanel Spacing="15" Orientation="Vertical">
|
||||
<TextBlock Text="Введите код сервиса:"/>
|
||||
<TextBox x:Name="Name"/>
|
||||
|
||||
<StackPanel Spacing="15" HorizontalAlignment="Center" Orientation="Horizontal">
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Введите название услуги"/>
|
||||
<TextBox Width="300" x:Name="TextNewName" Text=""/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Введите код услуги"/>
|
||||
<TextBox Width="300" x:Name="TextNewCode" Text=""/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Введите цену в час"/>
|
||||
<TextBox Width="300" x:Name="TextNewPrice" Text=""/>
|
||||
</StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel HorizontalAlignment="Center" Orientation="Vertical" VerticalAlignment="Center">
|
||||
<Button Content="Изменить данные Клиента" Click="changeClient"/>
|
||||
<Button Content="Отчислить данные" Click="clear"/>
|
||||
<Button Content="Вернуться назад" Click="ExitClik"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel HorizontalAlignment="Center" Orientation="Vertical">
|
||||
<TextBlock x:Name="MesAddError" Text="" Foreground="Red"/>
|
||||
<TextBlock x:Name="MesAdd" Text="" Foreground="Green"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Spacing="15" HorizontalAlignment="Center" Orientation="Horizontal">
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Название услуги"/>
|
||||
<TextBlock Width="300" x:Name="SelectName"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Код услуги"/>
|
||||
<TextBlock Width="300" x:Name="SelectCode"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Цена услуги в час"/>
|
||||
<TextBlock Width="300" x:Name="SelectPrice"/>
|
||||
</StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
</Window>
|
154
demo_blagodat/Functions/ChangeServices.axaml.cs
Normal file
154
demo_blagodat/Functions/ChangeServices.axaml.cs
Normal file
@ -0,0 +1,154 @@
|
||||
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 ChangeServices : Window
|
||||
{
|
||||
public Employee User;
|
||||
public ChangeServices(Employee user)
|
||||
{
|
||||
InitializeComponent();
|
||||
User = user;
|
||||
}
|
||||
|
||||
private void changeClient(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try // Êîíñòðóêöèÿ äëÿ îáðàáîòêè èñêëþ÷åíèé
|
||||
{
|
||||
// Îáîçíà÷àåì êîíêðåòíîãî ïîëüçîâàòåëÿ
|
||||
string? name = Name.Text;
|
||||
|
||||
// Ñîáèðàåì âñå äàííûå ñ ýêðàíà
|
||||
string? newname = TextNewName.Text;
|
||||
string? newcode = TextNewCode.Text;
|
||||
decimal? newprice = Math.Round(decimal.TryParse(TextNewPrice.Text.Replace(".", ","), out decimal resalt) ? resalt : -1 , 2);
|
||||
|
||||
|
||||
if (name != "")
|
||||
{
|
||||
using (User11Context db = new User11Context()) // Ïîäêëþ÷åíèå ê ÁÄ
|
||||
{
|
||||
Service? service = db.Services.Where(it => it.ServiceName == name).FirstOrDefault();
|
||||
if (service != null)
|
||||
{
|
||||
if (TextNewName.Text != "")
|
||||
{
|
||||
service.ServiceName = newname; // Ìåíÿåì ïàðàìåíò "Íàçâàíèå"
|
||||
|
||||
db.SaveChanges(); // Ñîõðàíÿåì èçìåíåíèÿ
|
||||
|
||||
// Ñîîáùåíèå
|
||||
MesAdd.Text = "Äàííûå èçìåíåíû";
|
||||
MesAddError.Text = "";
|
||||
}
|
||||
if (TextNewCode.Text != "")
|
||||
{
|
||||
service.ServiceCode = newcode; // Ìåíÿåì ïàðàìåíò "Êîä"
|
||||
|
||||
db.SaveChanges(); // Ñîõðàíÿåì èçìåíåíèÿ
|
||||
|
||||
// Ñîîáùåíèå
|
||||
MesAdd.Text = "Äàííûå èçìåíåíû";
|
||||
MesAddError.Text = "";
|
||||
}
|
||||
|
||||
if (newprice == -1)
|
||||
{
|
||||
// Ñîîáùåíèå
|
||||
MesAdd.Text = "";
|
||||
MesAddError.Text = "Íåïðàâèëüíàÿ öåíà";
|
||||
}
|
||||
else if (TextNewPrice.Text != "")
|
||||
{
|
||||
service.ServiceCostPerHour = (decimal) newprice;// Ìåíÿåì ïàðàìåíò "öåíà â ÷àñû"
|
||||
|
||||
db.SaveChanges(); // Ñîõðàíÿåì èçìåíåíèÿ
|
||||
|
||||
// Ñîîáùåíèå
|
||||
MesAdd.Text = "Äàííûå èçìåíåíû";
|
||||
MesAddError.Text = "";
|
||||
}
|
||||
|
||||
if(TextNewName.Text == "" && TextNewCode.Text == "" && TextNewPrice.Text == "")
|
||||
{
|
||||
// Ñîîáùåíèå
|
||||
MesAdd.Text = "";
|
||||
MesAddError.Text = "Ââåäèòå íîâûå äàííûå";
|
||||
}
|
||||
check(service);
|
||||
}
|
||||
else
|
||||
{
|
||||
MesAdd.Text = "";
|
||||
MesAddError.Text = "Òàêîãî ñåðâèñà íåò";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MesAddError.Text = "Ñíà÷àëà îáîçíà÷üòå èçìåíÿåìûé ñåðâèñ";
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message); // Âûâîäèì ñîîáùåíèå îá îøèáêå â êîíñîëü
|
||||
|
||||
// Ìåíÿåì ñîîáùåíèå
|
||||
MesAdd.Text = "";
|
||||
MesAddError.Text = "Ïðîèçîøëà îøèáêà";
|
||||
}
|
||||
}
|
||||
|
||||
private void clear(object sender, RoutedEventArgs e)
|
||||
{
|
||||
TextNewName.Text = "";
|
||||
TextNewCode.Text = "";
|
||||
TextNewPrice.Text = "";
|
||||
}
|
||||
|
||||
private void check(Service service)
|
||||
{
|
||||
using (User11Context db = new User11Context()) // Ïîäêëþ÷åíèå ê ÁÄ
|
||||
{
|
||||
Service checkService = db.Services.Where(it => it.ServiceName == service.ServiceName).FirstOrDefault();
|
||||
|
||||
SelectName.Text = checkService.ServiceName;
|
||||
SelectCode.Text = checkService.ServiceCode;
|
||||
SelectPrice.Text = checkService.ServiceCostPerHour.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private void ExitClik(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();
|
||||
}
|
||||
}
|
62
demo_blagodat/Functions/ChangeYourSelf.axaml
Normal file
62
demo_blagodat/Functions/ChangeYourSelf.axaml
Normal file
@ -0,0 +1,62 @@
|
||||
<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.ChangeYourSelf"
|
||||
Title="Изменить свои данные">
|
||||
<StackPanel Spacing="15" Orientation="Vertical">
|
||||
|
||||
|
||||
<StackPanel Spacing="15" HorizontalAlignment="Center" Orientation="Horizontal">
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Введите новое ФИО"/>
|
||||
<TextBox Width="300" x:Name="TextNewName" Text=""/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Введите новый логин"/>
|
||||
<TextBox Width="300" x:Name="TextNewLogin" Text=""/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Введите новый пароль"/>
|
||||
<TextBox Width="300" x:Name="TextNewPassword" Text=""/>
|
||||
</StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel HorizontalAlignment="Center" Orientation="Vertical" VerticalAlignment="Center">
|
||||
<Button Content="Изменить свои данные" Click="changeYourSelf"/>
|
||||
<Button Content="Отчислить данные" Click="clear"/>
|
||||
<Button Content="Вернуться назад" Click="ExitClik"/>
|
||||
</StackPanel>
|
||||
<StackPanel HorizontalAlignment="Center" Orientation="Vertical">
|
||||
<TextBlock x:Name="MesAddError" Text="" Foreground="Red"/>
|
||||
<TextBlock x:Name="MesAdd" Text="" Foreground="Green"/>
|
||||
</StackPanel>
|
||||
<StackPanel Spacing="15" HorizontalAlignment="Center" Orientation="Horizontal">
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="ФИО"/>
|
||||
<TextBlock Width="300" x:Name="SelectName"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Логин"/>
|
||||
<TextBlock Width="300" x:Name="SelectLogin"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Пароль"/>
|
||||
<TextBlock Width="300" x:Name="SelectPassword"/>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</StackPanel>
|
||||
|
||||
|
||||
|
||||
</StackPanel>
|
||||
</Window>
|
133
demo_blagodat/Functions/ChangeYourSelf.axaml.cs
Normal file
133
demo_blagodat/Functions/ChangeYourSelf.axaml.cs
Normal file
@ -0,0 +1,133 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using demo_blagodat.Models;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace demo_blagodat;
|
||||
|
||||
public partial class ChangeYourSelf : Window
|
||||
{
|
||||
public Employee User;
|
||||
public ChangeYourSelf(Employee user)
|
||||
{
|
||||
InitializeComponent();
|
||||
User = user;
|
||||
check(user);
|
||||
}
|
||||
|
||||
private void changeYourSelf(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try // Êîíñòðóêöèÿ äëÿ îáðàáîòêè èñêëþ÷åíèé
|
||||
{
|
||||
// Ñîáèðàåì âñå äàííûå ñ ýêðàíà
|
||||
string? newname = TextNewName.Text;
|
||||
string? newlogin = TextNewLogin.Text;
|
||||
string? newpassword = TextNewPassword.Text;
|
||||
|
||||
using (User11Context db = new User11Context()) // Ïîäêëþ÷åíèå ê ÁÄ
|
||||
{
|
||||
Employee I = db.Employees.Where(it => it.EmployeesLogin == User.EmployeesLogin).FirstOrDefault();
|
||||
if (TextNewName.Text != "")
|
||||
{
|
||||
I.EmployeesName = newname; // Ìåíÿåì ïàðàìåíò "Èìÿ"
|
||||
|
||||
db.SaveChanges(); // Ñîõðàíÿåì èçìåíåíèÿ
|
||||
|
||||
// Ñîîáùåíèå
|
||||
MesAdd.Text = "Äàííûå èçìåíåíû";
|
||||
MesAddError.Text = "";
|
||||
}
|
||||
if (TextNewPassword.Text != "")
|
||||
{
|
||||
I.EmployeesPassword = newpassword; // Ìåíÿåì ïàðàìåíò "Ïàðîëü"
|
||||
|
||||
db.SaveChanges(); // Ñîõðàíÿåì èçìåíåíèÿ
|
||||
|
||||
// Ñîîáùåíèå
|
||||
MesAdd.Text = "Äàííûå èçìåíåíû";
|
||||
MesAddError.Text = "";
|
||||
}
|
||||
if (TextNewLogin.Text != "")
|
||||
{
|
||||
I.EmployeesLogin = newlogin; // Ìåíÿåì ïàðàìåíò "Ëîãèí"
|
||||
|
||||
db.SaveChanges(); // Ñîõðàíÿåì èçìåíåíèÿ
|
||||
|
||||
// Ñîîáùåíèå
|
||||
MesAdd.Text = "Äàííûå èçìåíåíû";
|
||||
MesAddError.Text = "";
|
||||
}
|
||||
if (TextNewName.Text != "" && TextNewLogin.Text != "" && TextNewPassword.Text != "")
|
||||
{
|
||||
// Ñîîáùåíèå
|
||||
MesAdd.Text = "";
|
||||
MesAddError.Text = "Ââåäèòå íîâûå äàííûå";
|
||||
}
|
||||
check(I);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message); // Âûâîäèì ñîîáùåíèå îá îøèáêå â êîíñîëü
|
||||
|
||||
// Ìåíÿåì ñîîáùåíèå
|
||||
MesAdd.Text = "";
|
||||
MesAddError.Text = "Ïðîèçîøëà îøèáêà";
|
||||
}
|
||||
}
|
||||
|
||||
private void clear(object sender, RoutedEventArgs e)
|
||||
{
|
||||
TextNewName.Text = "";
|
||||
TextNewLogin.Text = "";
|
||||
TextNewPassword.Text = "";
|
||||
}
|
||||
|
||||
private void check(Employee I)
|
||||
{
|
||||
using(User11Context db = new User11Context()) // Ïîäêëþ÷åíèå ê ÁÄ
|
||||
{
|
||||
|
||||
Employee checkMe = db.Employees.Where(it => it.EmployeesLogin == I.EmployeesLogin).FirstOrDefault();
|
||||
|
||||
SelectName.Text = checkMe.EmployeesName;
|
||||
|
||||
SelectPassword.Text = checkMe.EmployeesPassword;
|
||||
|
||||
SelectLogin.Text = checkMe.EmployeesLogin;
|
||||
|
||||
User = I;
|
||||
}
|
||||
}
|
||||
|
||||
private void ExitClik(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();
|
||||
}
|
||||
}
|
32
demo_blagodat/Functions/DeleteClient.axaml
Normal file
32
demo_blagodat/Functions/DeleteClient.axaml
Normal file
@ -0,0 +1,32 @@
|
||||
<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.DeleteClient"
|
||||
Title="Удалить клиента">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Spacing="15" HorizontalAlignment="Center" Orientation="Vertical">
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Введите ФИО"/>
|
||||
<TextBox Width="300" x:Name="TextName"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Введите Паспорт"/>
|
||||
<TextBox Width="300" x:Name="TextPassport"/>
|
||||
</StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel HorizontalAlignment="Center" Orientation="Vertical" VerticalAlignment="Center">
|
||||
<Button Content="Удвлить Клиента" Click="deleteclient"/>
|
||||
<Button Content="Вернуться назад" Click="ExitClik"/>
|
||||
</StackPanel>
|
||||
<StackPanel HorizontalAlignment="Center" Orientation="Vertical">
|
||||
<TextBlock x:Name="MesDelError" Text="" Foreground="Red"/>
|
||||
<TextBlock x:Name="MesDel" Text="" Foreground="Green"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Window>
|
101
demo_blagodat/Functions/DeleteClient.axaml.cs
Normal file
101
demo_blagodat/Functions/DeleteClient.axaml.cs
Normal file
@ -0,0 +1,101 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using demo_blagodat.Models;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace demo_blagodat;
|
||||
|
||||
public partial class DeleteClient : Window
|
||||
{
|
||||
public Employee User;
|
||||
public DeleteClient(Employee user)
|
||||
{
|
||||
InitializeComponent();
|
||||
User = user;
|
||||
}
|
||||
private void deleteclient(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try // Êîíñòðóêöèÿ äëÿ îáðàáîòêè èñêëþ÷åíèé
|
||||
{
|
||||
using (User11Context db = new User11Context()) // Ïîäêëþ÷åíèå ê ÁÄ
|
||||
{
|
||||
// Ñîáèðàåì âñå äàííûå ñ ýêðàíà
|
||||
string? name = TextName.Text;
|
||||
//string pas = TextPassport.Text;
|
||||
|
||||
|
||||
if (name != null) // Ïðîâåðÿåì íàëè÷èå âàæíûõ äàííûõ
|
||||
{
|
||||
Client? client = db.Clients.Where(it => it.ClientName == name).FirstOrDefault(); // ñîçäà¸ì ýêçåìïëÿð êëàññà Client
|
||||
|
||||
if (client != null)
|
||||
{
|
||||
// Óäàëÿåì ïîëüçîâàòåëÿ èç ÁÄ
|
||||
db.Clients.Remove(client);
|
||||
|
||||
// Ñîõðàíÿåì èçìåíåíèÿ ÁÄ
|
||||
db.SaveChanges();
|
||||
|
||||
// Ìåíÿåì ñîîáùåíèå
|
||||
MesDelError.Text = "";
|
||||
MesDel.Text = "Êëèåíò óäàë¸í";
|
||||
}
|
||||
else
|
||||
{
|
||||
MesDel.Text = "Òàêîãî êëèåíòà íåò";
|
||||
}
|
||||
|
||||
// Ñòåðàåì âñå äàííûå
|
||||
TextName.Text = "";
|
||||
TextPassport.Text = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ìåíÿåì ñîîáùåíèå
|
||||
MesDel.Text = "";
|
||||
MesDelError.Text = "Íóæíî äîáàâèòü âñå äàííûå êëèåíòà!\nÌîæíî èãíîðèðîâàòü òîëüêî ïî÷òó.";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Âûâîäèì ñîîáùåíèå îá îøèáêå â êîíñîëü
|
||||
Console.WriteLine(ex.Message);
|
||||
|
||||
// Ìåíÿåì ñîîáùåíèå
|
||||
MesDel.Text = "";
|
||||
MesDelError.Text = "Ïðîâåðüòå äàííûå";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ExitClik(object sender, RoutedEventArgs e)
|
||||
{
|
||||
switch (User.EmployeesPosition) // äîæíîñòü ïîëüçîâàòåëÿ
|
||||
{
|
||||
case "Àäìèíèñòðàòîð": AdminOneClikc(User); break;
|
||||
case "Ïðîäàâåö": SellerOneClikc(User); break;
|
||||
case "Ñòàðøèé ñìåíû": ShiftSupervisorOneClikc(User); break;
|
||||
}
|
||||
}
|
||||
|
||||
// Ïðèâàòíûå ìåòîäû äëÿ ïåðåìåùåíèÿ â íóæíûå îêíà ïîëüçîâàòåëÿ
|
||||
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();
|
||||
}
|
||||
}
|
26
demo_blagodat/Functions/DeleteEmployee.axaml
Normal file
26
demo_blagodat/Functions/DeleteEmployee.axaml
Normal file
@ -0,0 +1,26 @@
|
||||
<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.DeleteEmployee"
|
||||
Title="DeleteEmployee">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Spacing="15" HorizontalAlignment="Center" Orientation="Vertical">
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Введите Логин "/>
|
||||
<TextBox Width="300" x:Name="TextLogin"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel HorizontalAlignment="Center" Orientation="Vertical" VerticalAlignment="Center">
|
||||
<Button Content="Удвлить Сотрудника" Click="deleteEmployee"/>
|
||||
<Button Content="Вернуться назад" Click="ExitClik"/>
|
||||
</StackPanel>
|
||||
<StackPanel HorizontalAlignment="Center" Orientation="Vertical">
|
||||
<TextBlock x:Name="MesDelError" Text="" Foreground="Red"/>
|
||||
<TextBlock x:Name="MesDel" Text="" Foreground="Green"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Window>
|
79
demo_blagodat/Functions/DeleteEmployee.axaml.cs
Normal file
79
demo_blagodat/Functions/DeleteEmployee.axaml.cs
Normal file
@ -0,0 +1,79 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using demo_blagodat.Models;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace demo_blagodat;
|
||||
|
||||
public partial class DeleteEmployee : Window
|
||||
{
|
||||
public Employee User;
|
||||
public DeleteEmployee(Employee user)
|
||||
{
|
||||
InitializeComponent();
|
||||
User = user;
|
||||
}
|
||||
|
||||
private void deleteEmployee(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try // Êîíñòðóêöèÿ äëÿ îáðàáîòêè èñêëþ÷åíèé
|
||||
{
|
||||
using (User11Context db = new User11Context()) // Ïîäêëþ÷åíèå ê ÁÄ
|
||||
{
|
||||
// Ñîáèðàåì âñå äàííûå ñ ýêðàíà
|
||||
string? login = TextLogin.Text;
|
||||
|
||||
if (login != null) // Ïðîâåðÿåì íàëè÷èå âàæíûõ äàííûõ
|
||||
{
|
||||
Employee? employee = db.Employees.Where(it => it.EmployeesLogin == login).FirstOrDefault();// ñîçäà¸ì ýêçåìïëÿð êëàññà Client
|
||||
|
||||
if (employee != null)
|
||||
{
|
||||
// Óäàëÿåì ïîëüçîâàòåëÿ èç ÁÄ
|
||||
db.Employees.Remove(employee);
|
||||
|
||||
// Ñîõðàíÿåì èçìåíåíèÿ ÁÄ
|
||||
db.SaveChanges();
|
||||
|
||||
// Ìåíÿåì ñîîáùåíèå
|
||||
MesDelError.Text = "";
|
||||
MesDel.Text = "Ñîòðóäíèê óäàë¸í";
|
||||
TextLogin.Text = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
MesDel.Text = "";
|
||||
MesDelError.Text = "Òàêîãî ñîòðóäíèêà íåò";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ìåíÿåì ñîîáùåíèå
|
||||
MesDel.Text = "";
|
||||
MesDelError.Text = "Íóæíî ââåñòè ëîãèí ñîòðóäíèêà";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Âûâîäèì ñîîáùåíèå îá îøèáêå â êîíñîëü
|
||||
Console.WriteLine(ex.Message);
|
||||
|
||||
// Ìåíÿåì ñîîáùåíèå
|
||||
MesDel.Text = "";
|
||||
MesDelError.Text = "Ïðîâåðüòå äàííûå";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ExitClik(object sender, RoutedEventArgs e)
|
||||
{
|
||||
new Admin(User).Show();
|
||||
Close();
|
||||
}
|
||||
}
|
27
demo_blagodat/Functions/DeleteOrder.axaml
Normal file
27
demo_blagodat/Functions/DeleteOrder.axaml
Normal file
@ -0,0 +1,27 @@
|
||||
<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.DeleteOrder"
|
||||
Title="DeleteOrder">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Spacing="15" HorizontalAlignment="Center" Orientation="Vertical">
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Введите ID заказа"/>
|
||||
<TextBox Width="300" x:Name="TextID"/>
|
||||
</StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel HorizontalAlignment="Center" Orientation="Vertical" VerticalAlignment="Center">
|
||||
<Button Content="Удвлить Клиента" Click="deleteclient"/>
|
||||
<Button Content="Вернуться назад" Click="ExitClik"/>
|
||||
</StackPanel>
|
||||
<StackPanel HorizontalAlignment="Center" Orientation="Vertical">
|
||||
<TextBlock x:Name="MesDelError" Text="" Foreground="Red"/>
|
||||
<TextBlock x:Name="MesDel" Text="" Foreground="Green"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Window>
|
100
demo_blagodat/Functions/DeleteOrder.axaml.cs
Normal file
100
demo_blagodat/Functions/DeleteOrder.axaml.cs
Normal file
@ -0,0 +1,100 @@
|
||||
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 DeleteOrder : Window
|
||||
{
|
||||
public Employee User;
|
||||
public DeleteOrder(Employee user)
|
||||
{
|
||||
InitializeComponent();
|
||||
User = user;
|
||||
}
|
||||
private void deleteclient(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try // Êîíñòðóêöèÿ äëÿ îáðàáîòêè èñêëþ÷åíèé
|
||||
{
|
||||
using (User11Context db = new User11Context()) // Ïîäêëþ÷åíèå ê ÁÄ
|
||||
{
|
||||
// Ñîáèðàåì âñå äàííûå ñ ýêðàíà
|
||||
int? id = int.Parse(TextID.Text);
|
||||
|
||||
|
||||
if (id != null) // Ïðîâåðÿåì íàëè÷èå âàæíûõ äàííûõ
|
||||
{
|
||||
Order? order = db.Orders.Where(it => it.OrderId == id).FirstOrDefault(); // ñîçäà¸ì ýêçåìïëÿð êëàññà Order
|
||||
|
||||
if (order != null)
|
||||
{
|
||||
// Óäàëÿåì Çàêàç èç ÁÄ
|
||||
db.Orders.Remove(order);
|
||||
|
||||
// Ñîõðàíÿåì èçìåíåíèÿ ÁÄ
|
||||
db.SaveChanges();
|
||||
|
||||
// Ìåíÿåì ñîîáùåíèå
|
||||
MesDelError.Text = "";
|
||||
MesDel.Text = "Çàêàç óäàë¸í";
|
||||
}
|
||||
else
|
||||
{
|
||||
MesDel.Text = "Òàêîãî çàêàçà íåò";
|
||||
}
|
||||
|
||||
// Ñòåðàåì âñå äàííûå
|
||||
TextID.Text = "";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ìåíÿåì ñîîáùåíèå
|
||||
MesDel.Text = "";
|
||||
MesDelError.Text = "Íóæíî äîáàâèòü ID.";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Âûâîäèì ñîîáùåíèå îá îøèáêå â êîíñîëü
|
||||
Console.WriteLine(ex.Message);
|
||||
|
||||
// Ìåíÿåì ñîîáùåíèå
|
||||
MesDel.Text = "";
|
||||
MesDelError.Text = "Ïðîâåðüòå äàííûå";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ExitClik(object sender, RoutedEventArgs e)
|
||||
{
|
||||
switch (User.EmployeesPosition) // äîæíîñòü ïîëüçîâàòåëÿ
|
||||
{
|
||||
case "Àäìèíèñòðàòîð": AdminOneClikc(User); break;
|
||||
case "Ïðîäàâåö": SellerOneClikc(User); break;
|
||||
case "Ñòàðøèé ñìåíû": ShiftSupervisorOneClikc(User); break;
|
||||
}
|
||||
}
|
||||
|
||||
// Ïðèâàòíûå ìåòîäû äëÿ ïåðåìåùåíèÿ â íóæíûå îêíà ïîëüçîâàòåëÿ
|
||||
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();
|
||||
}
|
||||
}
|
33
demo_blagodat/Functions/DeleteServices.axaml
Normal file
33
demo_blagodat/Functions/DeleteServices.axaml
Normal file
@ -0,0 +1,33 @@
|
||||
<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.DeleteServices"
|
||||
Title="Удалить Сервис">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Spacing="15" HorizontalAlignment="Center" Orientation="Vertical">
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Введите название"/>
|
||||
<TextBox Width="300" x:Name="TextName"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="Введите код услуги"/>
|
||||
<TextBox Width="300" x:Name="TextCode"/>
|
||||
</StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel HorizontalAlignment="Center" Orientation="Vertical" VerticalAlignment="Center">
|
||||
<Button Content="Удвлить Сервис" Click="deleteclient"/>
|
||||
<Button Content="Вернуться назад" Click="ExitClik"/>
|
||||
</StackPanel>
|
||||
<StackPanel HorizontalAlignment="Center" Orientation="Vertical">
|
||||
<TextBlock x:Name="MesDelError" Text="" Foreground="Red"/>
|
||||
<TextBlock x:Name="MesDel" Text="" Foreground="Green"/>
|
||||
</StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
</Window>
|
102
demo_blagodat/Functions/DeleteServices.axaml.cs
Normal file
102
demo_blagodat/Functions/DeleteServices.axaml.cs
Normal file
@ -0,0 +1,102 @@
|
||||
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 DeleteServices : Window
|
||||
{
|
||||
public Employee User;
|
||||
public DeleteServices(Employee user)
|
||||
{
|
||||
InitializeComponent();
|
||||
User = user;
|
||||
}
|
||||
|
||||
private void deleteclient(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try // Êîíñòðóêöèÿ äëÿ îáðàáîòêè èñêëþ÷åíèé
|
||||
{
|
||||
using (User11Context db = new User11Context()) // Ïîäêëþ÷åíèå ê ÁÄ
|
||||
{
|
||||
// Ñîáèðàåì äàííûå ñ ýêðàíà
|
||||
string? name = TextName.Text;
|
||||
string? code = TextCode.Text;
|
||||
|
||||
if (name != null) // Ïðîâåðÿåì íàëè÷èå âàæíûõ äàííûõ
|
||||
{
|
||||
Service? service = db.Services.Where(it => it.ServiceName == name).FirstOrDefault(); // ñîçäà¸ì ýêçåìïëÿð êëàññà Service
|
||||
|
||||
if (service != null)
|
||||
{
|
||||
// Óäàëÿåì ïîëüçîâàòåëÿ èç ÁÄ
|
||||
db.Services.Remove(service);
|
||||
|
||||
// Ñîõðàíÿåì èçìåíåíèÿ ÁÄ
|
||||
db.SaveChanges();
|
||||
|
||||
// Ìåíÿåì ñîîáùåíèå
|
||||
MesDelError.Text = "";
|
||||
MesDel.Text = "Ñåðâèñ óäàë¸í";
|
||||
}
|
||||
else
|
||||
{
|
||||
MesDel.Text = "Òàêîãî ñåðâèñà íåò";
|
||||
}
|
||||
|
||||
// Ñòåðàåì âñå äàííûå
|
||||
TextName.Text = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ìåíÿåì ñîîáùåíèå
|
||||
MesDel.Text = "";
|
||||
MesDelError.Text = "Íóæíî äîáàâèòü íàçâàíèå èëè êîä!";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Âûâîäèì ñîîáùåíèå îá îøèáêå â êîíñîëü
|
||||
Console.WriteLine(ex.Message);
|
||||
|
||||
// Ìåíÿåì ñîîáùåíèå
|
||||
MesDel.Text = "";
|
||||
MesDelError.Text = "Ïðîâåðüòå äàííûå";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Âûõîä
|
||||
private void ExitClik(object sender, RoutedEventArgs e)
|
||||
{
|
||||
switch (User.EmployeesPosition) // äîæíîñòü ïîëüçîâàòåëÿ
|
||||
{
|
||||
case "Àäìèíèñòðàòîð": AdminOneClikc(User); break;
|
||||
case "Ïðîäàâåö": SellerOneClikc(User); break;
|
||||
case "Ñòàðøèé ñìåíû": ShiftSupervisorOneClikc(User); break;
|
||||
}
|
||||
}
|
||||
|
||||
// Ïðèâàòíûå ìåòîäû äëÿ ïåðåìåùåíèÿ â íóæíûå îêíà ïîëüçîâàòåëÿ
|
||||
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();
|
||||
}
|
||||
}
|
22
demo_blagodat/Functions/Heir.axaml
Normal file
22
demo_blagodat/Functions/Heir.axaml
Normal file
@ -0,0 +1,22 @@
|
||||
<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.Heir"
|
||||
Title="Наследник">
|
||||
<StackPanel Spacing="15" Orientation="Vertical">
|
||||
<TextBlock Text="Введите Логин сотрудника, которому хотите передать полномочия"/>
|
||||
<TextBox x:Name="Login"/>
|
||||
<TextBlock x:Name="Position" Text="Выберите себе новую должность: "/>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Content="Продавец" Click="NewPositionSeller"/>
|
||||
<Button Content="Старший смены" Click="NewPositionSS"/>
|
||||
</StackPanel>
|
||||
|
||||
<Button Content="Передать" Click="heir"/>
|
||||
<Button Content="Назад" Click="ExitClick"/>
|
||||
<TextBlock x:Name="MessError" Text="" Foreground="Red"/>
|
||||
</StackPanel>
|
||||
</Window>
|
87
demo_blagodat/Functions/Heir.axaml.cs
Normal file
87
demo_blagodat/Functions/Heir.axaml.cs
Normal file
@ -0,0 +1,87 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using demo_blagodat.Models;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Tmds.DBus.Protocol;
|
||||
|
||||
namespace demo_blagodat;
|
||||
|
||||
public partial class Heir : Window
|
||||
{
|
||||
public Employee User;
|
||||
public string position = "";
|
||||
public Heir(Employee user)
|
||||
{
|
||||
InitializeComponent();
|
||||
User = user;
|
||||
}
|
||||
|
||||
private void NewPositionSeller(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Position.Text = "Âûáåðèòå ñåáå íîâóþ äîëæíîñòü: Ïðîäàâåö";
|
||||
position = "Ïðîäàâåö";
|
||||
}
|
||||
|
||||
private void NewPositionSS(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Position.Text = "Âûáåðèòå ñåáå íîâóþ äîëæíîñòü: Ñòàðøèé ñìåíû";
|
||||
position = "Ñòàðøèé ñìåíû";
|
||||
}
|
||||
|
||||
private void heir(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Login.Text != "")
|
||||
{
|
||||
using (User11Context db = new User11Context())
|
||||
{
|
||||
Employee employee = db.Employees.Where(it => it.EmployeesLogin == Login.Text).FirstOrDefault();
|
||||
if (employee != null)
|
||||
{
|
||||
if(position != "")
|
||||
{
|
||||
employee.EmployeesPosition = "Àäìèíèñòðàòîð";
|
||||
db.SaveChanges();
|
||||
|
||||
Employee I = db.Employees.Where(it => it.EmployeesLogin == User.EmployeesLogin).FirstOrDefault();
|
||||
I.EmployeesPosition = position;
|
||||
I.EmployeesEntrance = false;
|
||||
db.SaveChanges();
|
||||
|
||||
new Authorization().Show();
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessError.Text = "Âûáåðèòå ñåáå íîâóþ äîëæíîñòü";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessError.Text = "Òàêîãî ñîòðóäíèêà íå ñóùåñòâóåò.";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessError.Text = "Ââåäèòå èìÿ íîâîãî àäìèíà";
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
MessError.Text = "Ïðîèçîøëà îøèáêà";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ExitClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
new Admin(User).Show();
|
||||
Close();
|
||||
}
|
||||
}
|
@ -16,13 +16,32 @@
|
||||
<TextBlock x:Name="Userposition" Text="Ваша должность: "/>
|
||||
</StackPanel>
|
||||
<TextBlock Text="Доступные функции" HorizontalAlignment="Center"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Content="Выход" Click="ExitAuthorization"/>
|
||||
<Button Content="Выход из приложения" Click="Exit"/>
|
||||
<Button Content="Добавить клиента" Click="addClient"/>
|
||||
<Button Content="Сформировать заказ" Click="createOrder"/>
|
||||
<Button Content="Добавить услугу" Click="addServices"/>
|
||||
<Button Content="Удалить заказ" />
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Stretch">
|
||||
<Button Content="Добавить клиента" Click="addClient"/>
|
||||
<Button Content="Удалить клиента" Click="deleteClient"/>
|
||||
<Button Content="Изменить клиента" Click="changeClient"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Stretch">
|
||||
<Button Content="Добавить услугу" Click="addServices"/>
|
||||
<Button Content="Удалить услугу" Click="deleteServices"/>
|
||||
<Button Content="Изменить услугу" Click="changeServices"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Stretch">
|
||||
<Button Content="Добавить заказ" Click="createOrder"/>
|
||||
<Button Content="Удалить заказ" Click="deleteOrder"/>
|
||||
<Button Content="Изменить заказ" Click="changeOrder"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Stretch">
|
||||
<Button Content="Передать должность" Click="heir"/>
|
||||
<Button Content="Выход из приложения" Click="Exit"/>
|
||||
<Button Content="Выход в авторизацию" Click="ExitAuthorization"/>
|
||||
<Button Content="Удалить сотрудника" Click="deleteEmployee"/>
|
||||
<Button Content="Изменить свои данные" Click="changeYourSelf"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
@ -29,6 +29,12 @@ public partial class Admin : Window
|
||||
Userposition.Text = Userposition.Text + User.EmployeesPosition;
|
||||
}
|
||||
|
||||
private void heir(object sender, RoutedEventArgs e)
|
||||
{
|
||||
new Heir(User).Show();
|
||||
Close(); // Çàêðûâàåì òåêóùåå îêíî
|
||||
}
|
||||
|
||||
// Âûõîä â îêíî Àâòîðèçàöèè
|
||||
private void ExitAuthorization(object sender, RoutedEventArgs e)
|
||||
{
|
||||
@ -43,6 +49,17 @@ public partial class Admin : Window
|
||||
Close();
|
||||
}
|
||||
|
||||
// Ìåòîä äëÿ îáíîâëåíèå àêòèâíîñòè íà false
|
||||
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)
|
||||
{
|
||||
@ -63,14 +80,51 @@ public partial class Admin : Window
|
||||
Close();
|
||||
}
|
||||
|
||||
// Ìåòîä äëÿ îáíîâëåíèå àêòèâíîñòè íà false
|
||||
private void activityUpdate()
|
||||
private void deleteClient(object sender, RoutedEventArgs e)
|
||||
{
|
||||
using (User11Context db = new User11Context()) // Ïîäêëþ÷åíèå ê ÁÄ
|
||||
{
|
||||
var corrUser = db.Employees.Where(x => x.EmployeesLogin == User.EmployeesLogin).FirstOrDefault();
|
||||
corrUser.EmployeesEntrance = false; // Ìåíÿåì â ïàðàìåòðå "Àêòîâíîñòü" True íà False
|
||||
db.SaveChanges(); // Ñîõðàíÿåì èçìåíåíèÿ â ÁÄ
|
||||
}
|
||||
new DeleteClient(User).Show();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void deleteServices(object sender, RoutedEventArgs e)
|
||||
{
|
||||
new DeleteServices(User).Show();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void deleteOrder(object sender, RoutedEventArgs e)
|
||||
{
|
||||
new DeleteServices(User).Show();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void changeOrder(object sender, RoutedEventArgs e)
|
||||
{
|
||||
new ChangeOrder(User).Show();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void changeServices(object sender, RoutedEventArgs e)
|
||||
{
|
||||
new ChangeServices(User).Show();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void changeClient(object sender, RoutedEventArgs e)
|
||||
{
|
||||
new ChangeClient(User).Show();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void deleteEmployee(object sender, RoutedEventArgs e)
|
||||
{
|
||||
new DeleteEmployee(User).Show();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void changeYourSelf(object sender, RoutedEventArgs e)
|
||||
{
|
||||
new ChangeYourSelf(User).Show();
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
@ -16,12 +16,28 @@
|
||||
<TextBlock x:Name="Userposition" Text="Ваша должность: "/>
|
||||
</StackPanel>
|
||||
<TextBlock Text="Доступные функции" HorizontalAlignment="Center"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Content="Сформировать заказ" Click="createOrder"/>
|
||||
<Button Content="Выход" Click="ExitAuthorization"/>
|
||||
<Button Content="Выход из приложения" Click="Exit"/>
|
||||
<Button Content="Добавить клиента" Click="addClient"/>
|
||||
<Button Content="Добавить услугу" Click="addServices"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Button Content="Добавить клиента" Click="addClient"/>
|
||||
<Button Content="Удалить клиента" Click="deleteClient"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Button Content="Добавить услугу" Click="addServices"/>
|
||||
<Button Content="Удалить услугу" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Button Content="Добавить заказ" Click="createOrder"/>
|
||||
<Button Content="Удалить заказ" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Button Content="Выход из приложения" Click="Exit"/>
|
||||
<Button Content="Выход" Click="ExitAuthorization"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
@ -58,6 +58,12 @@ public partial class Seller : Window
|
||||
Close(); // Çàêðûâàåì òåêóùåå îêíî
|
||||
}
|
||||
|
||||
private void deleteClient(object sender, RoutedEventArgs e)
|
||||
{
|
||||
new DeleteClient(User).Show();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void activityUpdate()
|
||||
{
|
||||
using (User11Context db = new User11Context()) // Ïîäêëþ÷åíèå ê ÁÄ
|
||||
|
@ -17,11 +17,20 @@
|
||||
</StackPanel>
|
||||
<TextBlock Text="Доступные функции" HorizontalAlignment="Center"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<Button Content="сформировать заказ" Click="createOrder"/>
|
||||
<Button Content="Добавить пользователя" Click="addClient"/>
|
||||
<Button Content="принять товар"/>
|
||||
<Button Content="Выход из приложения" Click="Exit"/>
|
||||
<Button Content="Выход" Click="ExitAuthorization"/>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Button Content="Добавить клиента" Click="addClient"/>
|
||||
<Button Content="Удалить клиента" Click="deleteClient"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Button Content="Добавить заказ" Click="createOrder"/>
|
||||
<Button Content="Удалить заказ" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Button Content="Выход из приложения" Click="Exit"/>
|
||||
<Button Content="Выход" Click="ExitAuthorization"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
@ -58,4 +58,9 @@ public partial class ShiftSupervisor : Window
|
||||
new AddClient(User).Show();
|
||||
Close(); // Çàêðûâàåì òåêóùåå îêíî
|
||||
}
|
||||
private void deleteClient(object sender, RoutedEventArgs e)
|
||||
{
|
||||
new DeleteClient(User).Show();
|
||||
Close();
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -25,4 +25,10 @@
|
||||
</PackageReference>
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.10" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Functions\AddOrder.axaml.cs">
|
||||
<DependentUpon>AddOrder.axaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -1 +1 @@
|
||||
2be621f199d7e2a203d693ae6f5fff0625d5a2932fb1fc10452e2ec3e6444158
|
||||
ab5ec113c47cd0ed26726b590fad36b7976ff45256224af52e4ecd17831cc634
|
||||
|
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+bf2aa0e8fea7c15adaa02c2776b3d962a64d8238")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+62a5c37073e8de050b3ef6eac3fb262f6ca7c0f9")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("demo_blagodat")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("demo_blagodat")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
@ -1 +1 @@
|
||||
c5d4e7921b679a2380e31fa33a79d982d08a3ac86ee1a7bb5fda26b1f08fd78e
|
||||
15c2bfa45e197aa1289a0c26d723f2a088b9752d4152eedee31e9c27fdbc6bfd
|
||||
|
@ -24,19 +24,46 @@ build_property.EnableCodeStyleSeverity =
|
||||
[C:/Users/VivoBook 15X/Desktop/программные модули/Demo_Blagodat/demo_blagodat/demo_blagodat/App.axaml]
|
||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||
|
||||
[C:/Users/VivoBook 15X/Desktop/программные модули/Demo_Blagodat/demo_blagodat/demo_blagodat/Authorization.axaml]
|
||||
[C:/Users/VivoBook 15X/Desktop/программные модули/Demo_Blagodat/demo_blagodat/demo_blagodat/Entry/Authorization.axaml]
|
||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||
|
||||
[C:/Users/VivoBook 15X/Desktop/программные модули/Demo_Blagodat/demo_blagodat/demo_blagodat/Entry/Registration.axaml]
|
||||
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/AddOrder.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]
|
||||
[C:/Users/VivoBook 15X/Desktop/программные модули/Demo_Blagodat/demo_blagodat/demo_blagodat/Functions/ChangeClient.axaml]
|
||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||
|
||||
[C:/Users/VivoBook 15X/Desktop/программные модули/Demo_Blagodat/demo_blagodat/demo_blagodat/Registration.axaml]
|
||||
[C:/Users/VivoBook 15X/Desktop/программные модули/Demo_Blagodat/demo_blagodat/demo_blagodat/Functions/ChangeOrder.axaml]
|
||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||
|
||||
[C:/Users/VivoBook 15X/Desktop/программные модули/Demo_Blagodat/demo_blagodat/demo_blagodat/Functions/ChangeServices.axaml]
|
||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||
|
||||
[C:/Users/VivoBook 15X/Desktop/программные модули/Demo_Blagodat/demo_blagodat/demo_blagodat/Functions/ChangeYourSelf.axaml]
|
||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||
|
||||
[C:/Users/VivoBook 15X/Desktop/программные модули/Demo_Blagodat/demo_blagodat/demo_blagodat/Functions/DeleteClient.axaml]
|
||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||
|
||||
[C:/Users/VivoBook 15X/Desktop/программные модули/Demo_Blagodat/demo_blagodat/demo_blagodat/Functions/DeleteEmployee.axaml]
|
||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||
|
||||
[C:/Users/VivoBook 15X/Desktop/программные модули/Demo_Blagodat/demo_blagodat/demo_blagodat/Functions/DeleteOrder.axaml]
|
||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||
|
||||
[C:/Users/VivoBook 15X/Desktop/программные модули/Demo_Blagodat/demo_blagodat/demo_blagodat/Functions/DeleteServices.axaml]
|
||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||
|
||||
[C:/Users/VivoBook 15X/Desktop/программные модули/Demo_Blagodat/demo_blagodat/demo_blagodat/Functions/Heir.axaml]
|
||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||
|
||||
[C:/Users/VivoBook 15X/Desktop/программные модули/Demo_Blagodat/demo_blagodat/demo_blagodat/Users/Admin.axaml]
|
||||
|
@ -1 +1 @@
|
||||
9e71e112725c9a716a2103cd3fd384cd298c46c7c9feef916663171f7912498b
|
||||
6ba8676dd6ba41f96d33829d1624eddf4ac85ba70d5c98b0486290d37753fec9
|
||||
|
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