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

@ -7,7 +7,7 @@
x:CompileBindings="False"
Title="FunctionWindow">
<DockPanel>
<StackPanel DockPanel.Dock="Top" HorizontalAlignment="Center" Orientation="Horizontal" >
<StackPanel DockPanel.Dock="Top" HorizontalAlignment="Center" Orientation="Horizontal">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Image Source="{Binding Image}" Width="100" Height="100" Margin="5" HorizontalAlignment="Center"/>
</StackPanel>
@ -21,8 +21,10 @@
<Run Text="{Binding Role}"/>
</TextBlock>
<Button Content="Назад" Click="Back_Button" Margin="5"/>
<Button Content="Создать заказ" Click="Next_Function_Button" Margin="5"/>
<Button Content="История входа" Click="History_Button" Margin="5" IsVisible="{Binding IsRole2}"/>
<Button Content="Создать заказ" Click="Next_Function_Button" Margin="5"
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 Text="" HorizontalAlignment="Center" Margin="10" x:Name="WarningBlock"/>
</StackPanel>

View File

@ -8,17 +8,15 @@ using Avalonia.Markup.Xaml;
using Avalonia.Media.Imaging;
using demo_hard.Model;
namespace demo_hard;
public partial class FunctionWindow : Window
{
private readonly TimeSpan sessionDuration = TimeSpan.FromMinutes(10);
private readonly TimeSpan warningTime = TimeSpan.FromMinutes(5);
//private readonly TimeSpan lockoutDuration = TimeSpan.FromMinutes(1);
private DateTime sessionStartTime;
private bool warningShow = false;
public FunctionWindow(Employee user)
{
InitializeComponent();
@ -30,13 +28,13 @@ public partial class FunctionWindow : Window
Login = user.Login,
Password = user.Password,
Role = user.Role,
Photo = user.Photo
Photo = user.Photo,
ShowHistoryButton = user.Role == 3,
ShowCreateOrderButton = user.Role != 3
};
sessionStartTime = DateTime.Now;
StartSessionTimer();
}
public FunctionWindow()
@ -69,7 +67,7 @@ public partial class FunctionWindow : Window
}
}
private async void EndSession()
private void EndSession()
{
this.Close();
}
@ -83,13 +81,17 @@ public partial class FunctionWindow : Window
{
new SallerWindow().ShowDialog(this);
}
public class ImageEmployee: Employee
private void History_Button(object? sender, RoutedEventArgs e)
{
public bool IsRole2 => Role == 2;
new HistoryWindow().ShowDialog(this);
}
public class ImageEmployee : Employee
{
public bool ShowHistoryButton { get; set; }
public bool ShowCreateOrderButton { get; set; }
Bitmap? Image
{
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();
GenerateOrderPdfDocument(newOrder);
// Получаем максимальное время аренды из выбранных услуг
int maxRentTime = SelectedServices.Max(s => s.RentTime);
new BarcodeWindow(newOrder.OrderId, maxRentTime).Show();

View File

@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("demo_hard")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[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.AssemblyTitleAttribute("demo_hard")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
072a4f3754d79ff9cd5f43f59910c627cb7a50cc81717c7fb6d437c2e7a535f3
b614a5bb202bbb84fbe66408acfbdcf181dc215f2aac414fa67259c823479be3