the app remembers the user

This commit is contained in:
NikitaOnianov 2025-02-25 17:42:18 +03:00
parent 2e74cf1d5d
commit 110362f3fc
36 changed files with 196 additions and 161 deletions

View File

@ -3,16 +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\\addclient.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{B40AB1D5-A904-4458-95A8-8CAE49BE0884}|demo_blagodat.csproj|solutionrelative: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\\addclient.axaml||{6D5344A2-2FCD-49DE-A09D-6A14FD1B1224}",
"RelativeMoniker": "D:0:0:{B40AB1D5-A904-4458-95A8-8CAE49BE0884}|demo_blagodat.csproj|solutionrelative: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\\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}"
"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\\admin.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{B40AB1D5-A904-4458-95A8-8CAE49BE0884}|demo_blagodat.csproj|solutionrelative:admin.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [
@ -22,7 +14,7 @@
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 4,
"SelectedChildIndex": 2,
"Children": [
{
"$type": "Bookmark",
@ -32,42 +24,17 @@
"$type": "Bookmark",
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
},
{
"$type": "Document",
"DocumentIndex": 1,
"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\\AddClient.axaml",
"RelativeDocumentMoniker": "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\\AddClient.axaml",
"RelativeToolTip": "AddClient.axaml",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
"WhenOpened": "2025-02-25T10:23:27.314Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 2,
"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": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-02-19T17:13:36.115Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 0,
"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\\AddClient.axaml.cs",
"RelativeDocumentMoniker": "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\\AddClient.axaml.cs",
"RelativeToolTip": "AddClient.axaml.cs",
"ViewState": "AgIAAC0AAAAAAAAAAAAAAEEAAAAdAAAAAAAAAA==",
"Title": "Admin.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\\Admin.axaml.cs",
"RelativeDocumentMoniker": "Admin.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\\Admin.axaml.cs",
"RelativeToolTip": "Admin.axaml.cs",
"ViewState": "AgIAAA8AAAAAAAAAAAAAACcAAAAvAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-02-19T17:00:34.941Z",
"WhenOpened": "2025-02-25T14:35:58.682Z",
"EditorCaption": ""
}
]

View File

@ -1,20 +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\\addclient.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{B40AB1D5-A904-4458-95A8-8CAE49BE0884}|demo_blagodat.csproj|solutionrelative: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\\addclient.axaml||{6D5344A2-2FCD-49DE-A09D-6A14FD1B1224}",
"RelativeMoniker": "D:0:0:{B40AB1D5-A904-4458-95A8-8CAE49BE0884}|demo_blagodat.csproj|solutionrelative: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\\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}"
}
],
"Documents": [],
"DocumentGroupContainers": [
{
"Orientation": 0,
@ -22,7 +9,7 @@
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 4,
"SelectedChildIndex": -1,
"Children": [
{
"$type": "Bookmark",
@ -31,44 +18,6 @@
{
"$type": "Bookmark",
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
},
{
"$type": "Document",
"DocumentIndex": 1,
"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\\AddClient.axaml",
"RelativeDocumentMoniker": "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\\AddClient.axaml",
"RelativeToolTip": "AddClient.axaml",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
"WhenOpened": "2025-02-25T10:23:27.314Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 2,
"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": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-02-19T17:13:36.115Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 0,
"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\\AddClient.axaml.cs",
"RelativeDocumentMoniker": "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\\AddClient.axaml.cs",
"RelativeToolTip": "AddClient.axaml.cs",
"ViewState": "AgIAADMAAAAAAAAAAAAAADoAAABrAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-02-19T17:00:34.941Z",
"EditorCaption": ""
}
]
}

View File

@ -26,7 +26,7 @@
<TextBox Width="300" x:Name="TextPassword" ></TextBox>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<Button Content="Добавить Клиента" Click="addclient"/>
<Button Content="Вернуться назад" Click="ExitAddToSeller"/>
<Button Content="Вернуться назад" Click="ExitClik"/>
</StackPanel>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock x:Name="MesAddError" Text="" Foreground="Red"/>

View File

@ -11,18 +11,14 @@ namespace demo_blagodat;
public partial class AddClient : Window
{
public AddClient()
public Employee User;
public AddClient(Employee user)
{
InitializeComponent();
User = user;
}
public void ExitAddToSeller(object sender, RoutedEventArgs e)
{
new Seller().Show();
Close();
}
public void addclient(object sender, RoutedEventArgs e)
private void addclient(object sender, RoutedEventArgs e)
{
try
{
@ -66,5 +62,33 @@ public partial class AddClient : Window
MesAdd.Text = "";
MesAddError.Text = "Ïðîâåðüòå äàííûå";
}
}
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();
}
}

View File

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

View File

@ -6,19 +6,51 @@ using System.Runtime.ExceptionServices;
using System;
using demo_blagodat.Models;
using Microsoft.EntityFrameworkCore;
using System.Linq;
namespace demo_blagodat;
public partial class Admin : Window
{
public Admin()
public Employee User;
public Admin(Employee user)
{
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();
using (User11Context db = new User11Context())
{
var corrUser = db.Employees.Where(x => x.EmployeesLogin == User.EmployeesLogin).FirstOrDefault();
corrUser.EmployeesEntrance = false;
db.SaveChanges();
}
Close();
}
}
private void Exit(object sender, RoutedEventArgs e)
{
using (User11Context db = new User11Context())
{
var corrUser = db.Employees.Where(x => x.EmployeesLogin == User.EmployeesLogin).FirstOrDefault();
corrUser.EmployeesEntrance = false;
db.SaveChanges();
}
Close();
}
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

@ -4,6 +4,7 @@ using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using demo_blagodat.Models;
using Microsoft.EntityFrameworkCore;
using System;
using System.Linq;
namespace demo_blagodat;
@ -12,9 +13,7 @@ public partial class Authorization : Window
{
string? Login;
string? password;
static User11Context db = new User11Context();
public Authorization()
{
InitializeComponent();
@ -30,35 +29,49 @@ public partial class Authorization : Window
Login = LoginTextBox.Text;
password = PasswordTextBox.Text;
var corrUser = db.Employees.FirstOrDefault(x => x.EmployeesLogin == Login && x.EmployeesPassword == password);
User11Context db = new User11Context();
var corrUser = db.Employees.Where(x => x.EmployeesLogin == Login && x.EmployeesPassword == password).FirstOrDefault();
if (corrUser == null)
{
Mess.Text = "Ïîëüçîâàòåëü íå íàéäåí â ñèñòåìå";
}
else
{
switch (corrUser.EmployeesPosition)
try
{
case "Àäìèíèñòðàòîð": AdminOneClikc(); break;
case "Ïðîäàâåö": SellerOneClikc(); break;
case "Ñòàðøèé ñìåíû": ShiftSupervisorOneClikc(); break;
corrUser.EmployeesEntrance = true;
corrUser.EmployeesDateHour = TimeOnly.FromDateTime(DateTime.Now);
corrUser.EmployeesDateDay = DateOnly.FromDateTime(DateTime.Now);
db.SaveChanges();
switch (corrUser.EmployeesPosition)
{
case "Àäìèíèñòðàòîð": AdminOneClikc(corrUser); break;
case "Ïðîäàâåö": SellerOneClikc(corrUser); break;
case "Ñòàðøèé ñìåíû": ShiftSupervisorOneClikc(corrUser); break;
}
Close();
}
catch (Exception ex)
{
Console.WriteLine("{0} Exception caught", ex.Message);
}
}
}
private void SellerOneClikc()
private void SellerOneClikc(Employee corrUser)
{
new Seller().Show();
new Seller(corrUser).Show();
Close();
}
private void AdminOneClikc()
private void AdminOneClikc(Employee corrUser)
{
new Admin().Show();
new Admin(corrUser).Show();
Close();
}
private void ShiftSupervisorOneClikc()
private void ShiftSupervisorOneClikc(Employee corrUser)
{
new ShiftSupervisor().Show();
new ShiftSupervisor(corrUser).Show();
Close();
}
}

View File

@ -5,5 +5,7 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="demo_blagodat.CreateOrder"
Title="CreateOrder">
Welcome to Avalonia!
<StackPanel>
<Button Content="Назад" Click="ExitClik"/>
</StackPanel>
</Window>

View File

@ -1,13 +1,43 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using demo_blagodat.Models;
namespace demo_blagodat;
public partial class CreateOrder : Window
{
public CreateOrder()
public Employee User;
public CreateOrder(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();
}
}

View File

@ -15,7 +15,7 @@
<TextBlock Text="Введите пароль"/>
<TextBox Width="300" x:Name="PasswordTextBox" ></TextBox>
<TextBox Text="Выберите должность:" x:Name="position"/>
<TextBlock x:Name="position" Text="Добрый день "/>
<StackPanel Orientation="Horizontal">
<Button Content="Продавец" Click="sellerUser"/>
<Button Content="Старший смены" Click="shiftSupervisorUser"/>

View File

@ -57,17 +57,14 @@ public partial class Registration : Window
};
db.Employees.Add(newUser);
db.SaveChanges();
switch (PositionUser)
{
case "Ïðîäàâåö": SellerOneClikc(newUser); break;
case "Ñòàðøèé ñìåíû": ShiftSupervisorOneClikc(newUser); break;
}
UserLogin = LoginTextBox.Text;
}
switch (PositionUser)
{
case "Ïðîäàâåö": SellerOneClikc(); break;
case "Ñòàðøèé ñìåíû": ShiftSupervisorOneClikc(); break;
}
UserLogin = LoginTextBox.Text;
}
catch (Exception ex)
{
@ -75,15 +72,15 @@ public partial class Registration : Window
}
}
private void SellerOneClikc()
private void SellerOneClikc(Employee newUser)
{
new Seller().Show();
new Seller(newUser).Show();
Close();
}
private void ShiftSupervisorOneClikc()
private void ShiftSupervisorOneClikc(Employee newUser)
{
new ShiftSupervisor().Show();
new ShiftSupervisor(newUser).Show();
Close();
}
}

View File

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

View File

@ -4,38 +4,52 @@ using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using demo_blagodat.Models;
using System.Linq;
using System;
using System.Runtime.ExceptionServices;
using Microsoft.EntityFrameworkCore.Diagnostics;
namespace demo_blagodat;
public partial class Seller : Window
{
public Seller()
public Employee User;
public Seller(Employee user)
{
InitializeComponent();
User = user;
HelloUser.Text = HelloUser.Text + User.EmployeesName;
}
public void ExitAuthorization(object sender, RoutedEventArgs e)
private void ExitAuthorization(object sender, RoutedEventArgs e)
{
new Authorization().Show();
Close();
}
public void Exit(object sender, RoutedEventArgs e)
{
//using(User11Context db = new User11Context())
//{
// var name = db.Employees.Where(it => it.EmployeesLogin == ).FirstOrDefault();
// name.EmployeesEntrance = false;
//}
using(User11Context db = new User11Context())
{
var corrUser = db.Employees.Where(x => x.EmployeesLogin == User.EmployeesLogin).FirstOrDefault();
corrUser.EmployeesEntrance = false;
db.SaveChanges();
}
Close();
}
public void createOrder(object sender, RoutedEventArgs e)
private void Exit(object sender, RoutedEventArgs e)
{
new CreateOrder().Show();
using (User11Context db = new User11Context())
{
var corrUser = db.Employees.Where(x => x.EmployeesLogin == User.EmployeesLogin).FirstOrDefault();
corrUser.EmployeesEntrance = false;
db.SaveChanges();
}
Close();
}
public void addClient(object sender, RoutedEventArgs e)
private void createOrder(object sender, RoutedEventArgs e)
{
new AddClient().Show();
new CreateOrder(User).Show();
Close();
}
private void addClient(object sender, RoutedEventArgs e)
{
new AddClient(User).Show();
Close();
}
}

View File

@ -2,14 +2,17 @@ using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using demo_blagodat.Models;
namespace demo_blagodat;
public partial class ShiftSupervisor : Window
{
public ShiftSupervisor()
public Employee User;
public ShiftSupervisor(Employee user)
{
InitializeComponent();
User = user;
}
public void Exit(object sender, RoutedEventArgs e)
{

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+0992c9fef8521c73a8735a7b8a16ba3d717b541f")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2e74cf1d5d3ba7d67ec5e1e7f82eb3dbc9049a33")]
[assembly: System.Reflection.AssemblyProductAttribute("demo_blagodat")]
[assembly: System.Reflection.AssemblyTitleAttribute("demo_blagodat")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
f9304feeaf31782ee00227108fa34886bbd476af9833cb4c4a0379a527764c0b
71985eb52f2155cee0fce6b8282760c334b0f233c9de818568a3939bfb7ab19c