docAndRole

This commit is contained in:
-SSS- 2025-04-22 18:56:23 +03:00
parent ea37bf27f3
commit 93b7ac325f
18 changed files with 24 additions and 25 deletions

Binary file not shown.

View File

@ -21,8 +21,10 @@
<Run Text="{Binding Role}"/> <Run Text="{Binding Role}"/>
</TextBlock> </TextBlock>
<Button Content="Назад" Click="Back_Button" Margin="5"/> <Button Content="Назад" Click="Back_Button" Margin="5"/>
<Button Content="Создать заказ" Click="Next_Function_Button" Margin="5"/> <Button Content="Создать заказ" Click="Next_Function_Button" Margin="5"
<Button Content="История входа" Click="History_Button" Margin="5" IsVisible="{Binding IsRole2}"/> IsVisible="{Binding ShowCreateOrderButton}"/>
<Button Content="История входа" Click="History_Button" Margin="5"
IsVisible="{Binding ShowHistoryButton}"/>
<TextBlock x:Name="SessionTimer" FontSize="16" Foreground="Red" HorizontalAlignment="Center" Margin="10"/> <TextBlock x:Name="SessionTimer" FontSize="16" Foreground="Red" HorizontalAlignment="Center" Margin="10"/>
<TextBlock Text="" HorizontalAlignment="Center" Margin="10" x:Name="WarningBlock"/> <TextBlock Text="" HorizontalAlignment="Center" Margin="10" x:Name="WarningBlock"/>
</StackPanel> </StackPanel>

View File

@ -8,17 +8,15 @@ using Avalonia.Markup.Xaml;
using Avalonia.Media.Imaging; using Avalonia.Media.Imaging;
using demo_hard.Model; using demo_hard.Model;
namespace demo_hard; namespace demo_hard;
public partial class FunctionWindow : Window public partial class FunctionWindow : Window
{ {
private readonly TimeSpan sessionDuration = TimeSpan.FromMinutes(10); private readonly TimeSpan sessionDuration = TimeSpan.FromMinutes(10);
private readonly TimeSpan warningTime = TimeSpan.FromMinutes(5); private readonly TimeSpan warningTime = TimeSpan.FromMinutes(5);
//private readonly TimeSpan lockoutDuration = TimeSpan.FromMinutes(1);
private DateTime sessionStartTime; private DateTime sessionStartTime;
private bool warningShow = false; private bool warningShow = false;
public FunctionWindow(Employee user) public FunctionWindow(Employee user)
{ {
InitializeComponent(); InitializeComponent();
@ -30,13 +28,13 @@ public partial class FunctionWindow : Window
Login = user.Login, Login = user.Login,
Password = user.Password, Password = user.Password,
Role = user.Role, Role = user.Role,
Photo = user.Photo Photo = user.Photo,
ShowHistoryButton = user.Role == 3,
ShowCreateOrderButton = user.Role != 3
}; };
sessionStartTime = DateTime.Now; sessionStartTime = DateTime.Now;
StartSessionTimer(); StartSessionTimer();
} }
public FunctionWindow() public FunctionWindow()
@ -69,7 +67,7 @@ public partial class FunctionWindow : Window
} }
} }
private async void EndSession() private void EndSession()
{ {
this.Close(); this.Close();
} }
@ -84,12 +82,16 @@ public partial class FunctionWindow : Window
new SallerWindow().ShowDialog(this); new SallerWindow().ShowDialog(this);
} }
private void History_Button(object? sender, RoutedEventArgs e)
{
new HistoryWindow().ShowDialog(this);
}
public class ImageEmployee : Employee public class ImageEmployee : Employee
{ {
public bool IsRole2 => Role == 2; public bool ShowHistoryButton { get; set; }
public bool ShowCreateOrderButton { get; set; }
Bitmap? Image Bitmap? Image
{ {
get get
@ -107,9 +109,4 @@ public partial class FunctionWindow : Window
} }
} }
} }
private void History_Button(object? sender, RoutedEventArgs e)
{
new HistoryWindow().ShowDialog(this);
}
} }

View File

@ -203,7 +203,7 @@ public partial class SallerWindow : Window, INotifyPropertyChanged, IReactiveObj
await _databaseContext.SaveChangesAsync(); await _databaseContext.SaveChangesAsync();
GenerateOrderPdfDocument(newOrder); GenerateOrderPdfDocument(newOrder);
// Получаем максимальное время аренды из выбранных услуг
int maxRentTime = SelectedServices.Max(s => s.RentTime); int maxRentTime = SelectedServices.Max(s => s.RentTime);
new BarcodeWindow(newOrder.OrderId, maxRentTime).Show(); new BarcodeWindow(newOrder.OrderId, maxRentTime).Show();

View File

@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("demo_hard")] [assembly: System.Reflection.AssemblyCompanyAttribute("demo_hard")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+cbe1e192f4be37b6c3c9b90d69bf9ee24aa29818")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ea37bf27f32e6687cc89505862404c85129bd324")]
[assembly: System.Reflection.AssemblyProductAttribute("demo_hard")] [assembly: System.Reflection.AssemblyProductAttribute("demo_hard")]
[assembly: System.Reflection.AssemblyTitleAttribute("demo_hard")] [assembly: System.Reflection.AssemblyTitleAttribute("demo_hard")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
072a4f3754d79ff9cd5f43f59910c627cb7a50cc81717c7fb6d437c2e7a535f3 b614a5bb202bbb84fbe66408acfbdcf181dc215f2aac414fa67259c823479be3