This commit is contained in:
studen 2025-02-05 12:03:32 +03:00
parent b6d029f0b5
commit f7a8efb8de
26 changed files with 132 additions and 37 deletions

View File

@ -3,9 +3,13 @@
<component name="AvaloniaProject"> <component name="AvaloniaProject">
<option name="projectPerEditor"> <option name="projectPerEditor">
<map> <map>
<entry key="AdminWindow.axaml" value="Demka_Snova_1.csproj" />
<entry key="AdminWindow/.axaml" value="Demka_Snova_1.csproj" />
<entry key="App.axaml" value="Demka_Snova_1.csproj" /> <entry key="App.axaml" value="Demka_Snova_1.csproj" />
<entry key="FunctionalWindow.axaml" value="Demka_Snova_1.csproj" /> <entry key="FunctionalWindow.axaml" value="Demka_Snova_1.csproj" />
<entry key="MainWindow.axaml" value="Demka_Snova_1.csproj" /> <entry key="MainWindow.axaml" value="Demka_Snova_1.csproj" />
<entry key="SellerWindow.axaml" value="Demka_Snova_1.csproj" />
<entry key="StarshiyWindow.axaml" value="Demka_Snova_1.csproj" />
</map> </map>
</option> </option>
</component> </component>

View File

@ -3,7 +3,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Demka_Snova_1.FunctionalWindow" x:Class="Demka_Snova_1.AdminWindow"
Title="FunctionalWindow"> Title="AdminWindow">
Welcome to Avalonia! Welcome to Avalonia!
</Window> </Window>

View File

@ -4,9 +4,9 @@ using Avalonia.Markup.Xaml;
namespace Demka_Snova_1; namespace Demka_Snova_1;
public partial class FunctionalWindow : Window public partial class AdminWindow : Window
{ {
public FunctionalWindow() public AdminWindow()
{ {
InitializeComponent(); InitializeComponent();
} }

View File

@ -24,7 +24,10 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Hardik\Date\" />
<Folder Include="Hardik\UI\" /> <Folder Include="Hardik\UI\" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<UpToDateCheckInput Remove="AdminWindow\.axaml" />
</ItemGroup>
</Project> </Project>

View File

@ -5,7 +5,7 @@ namespace Demka_Snova_1.Hardik.Conect.Dao;
public class SotrudnikDao public class SotrudnikDao
{ {
public int ID {get;set;} public int ID {get;set;}
public string Pozition {get;set;} public static string Pozition {get;set;}
public string Fio {get;set;} public string Fio {get;set;}
public static string Login {get;set;} public static string Login {get;set;}
public static string Pass {get;set;} public static string Pass {get;set;}

20
Hardik/Date/Dostup.cs Normal file
View File

@ -0,0 +1,20 @@
namespace Demka_Snova_1.Hardik.Date;
public interface ISeller
{
void CreateOrder();
}
public interface IStarshiy
{
void CreateOrder();
void AcceptGoods();
}
public interface IAdmin
{
void GenerateReports();
void MonitorLoginHistory();
void ManageMaterials();
}

View File

@ -7,52 +7,71 @@ namespace Demka_Snova_1;
public partial class MainWindow : Window public partial class MainWindow : Window
{ {
private bool _isPasswordVisible = false; private bool _isPasswordVisible = false;
private void InitializeComponent() private void InitializeComponent()
{ {
AvaloniaXamlLoader.Load(this); AvaloniaXamlLoader.Load(this);
} }
public MainWindow() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
} }
private void TogglePasswordButton_Click(object sender, RoutedEventArgs e) private void TogglePasswordButton_Click(object sender, RoutedEventArgs e)
{ {
_isPasswordVisible = !_isPasswordVisible; _isPasswordVisible = !_isPasswordVisible;
PasswordTextBox.PasswordChar = _isPasswordVisible ? '\0' : '*'; PasswordTextBox.PasswordChar = _isPasswordVisible ? '\0' : '*';
} }
private void LoginButton_Click(object sender, RoutedEventArgs e) private void LoginButton_Click(object sender, RoutedEventArgs e)
{ {
string username = UsernameTextBox.Text; string username = UsernameTextBox.Text;
string password = PasswordTextBox.Text; string password = PasswordTextBox.Text;
if (IsValidUser(username, password)) if (IsValidUser(username, password))
{ {
var funcWindow = new FunctionalWindow(); Window nextWindow = null;
funcWindow.Show(); switch (SotrudnikDao.Pozition)
{
case "Продавец":
nextWindow = new SellerWindow();
break;
case "Старший смены":
nextWindow = new StarshiyWindow();
break;
case "Администратор":
nextWindow = new AdminWindow();
break;
default:
ShowErrorDialog("Неизвестная роль пользователя");
return;
}
nextWindow.Show();
this.Close(); this.Close();
} }
else else
{ {
ShowErrorDialog(); ShowErrorDialog("Неверный логин или пароль");
}
} }
private async void ShowErrorDialog() async void ShowErrorDialog(string mes)
{ {
var dialog = new Window var dialog = new Window
{ {
Title = "Ошибка", Title = "Ошибка",
Content = "Неверный логин или пароль", Content = mes,
Width = 300, Width = 300,
Height = 200 Height = 200
}; };
await dialog.ShowDialog(this); await dialog.ShowDialog(this);
} }
private bool IsValidUser(string username, string password) bool IsValidUser(string username, string password)
{ {
return username == SotrudnikDao.Login && password == SotrudnikDao.Pass; return username == SotrudnikDao.Login && password == SotrudnikDao.Pass;
} }
}
} }

9
SellerWindow.axaml Normal file
View File

@ -0,0 +1,9 @@
<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="Demka_Snova_1.SellerWindow"
Title="SellerWindow">
Welcome to Avalonia!
</Window>

13
SellerWindow.axaml.cs Normal file
View File

@ -0,0 +1,13 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Demka_Snova_1;
public partial class SellerWindow : Window
{
public SellerWindow()
{
InitializeComponent();
}
}

8
StarshiyWindow.axaml Normal file
View File

@ -0,0 +1,8 @@
<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="Demka_Snova_1.StarshiyWindow"
Title="StarshiyWindow">
</Window>

13
StarshiyWindow.axaml.cs Normal file
View File

@ -0,0 +1,13 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Demka_Snova_1;
public partial class StarshiyWindow : Window
{
public StarshiyWindow()
{
InitializeComponent();
}
}

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
ee6d23eda34c1cfc781068f6657ce3dec5e9426b09f041f9aef45af723067c58 29745a75820841542fa2c2c5a9d6b6beaa6ec9a89ad0c6c1c9d046e48bfc80e4

Binary file not shown.

View File

@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Demka_Snova_1")] [assembly: System.Reflection.AssemblyCompanyAttribute("Demka_Snova_1")]
[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+eb9909704e777a27e1fecb9dd0bd78be53a34c31")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+b6d029f0b54073e0ebf25932bb61b695c248c8a2")]
[assembly: System.Reflection.AssemblyProductAttribute("Demka_Snova_1")] [assembly: System.Reflection.AssemblyProductAttribute("Demka_Snova_1")]
[assembly: System.Reflection.AssemblyTitleAttribute("Demka_Snova_1")] [assembly: System.Reflection.AssemblyTitleAttribute("Demka_Snova_1")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
3813d61eab3435d17a2006f3552a671fa68f357f222a9c200aca02797526040e 085bcc2aa465297637c4e04dda495e07ced23a12a13e81e25b3c1d74901d7cc6

View File

@ -19,11 +19,17 @@ build_property.ProjectDir = /home/class_student/RiderProjects/Demka_Snova_1/
build_property.EnableComHosting = build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop = build_property.EnableGeneratedComInterfaceComImportInterop =
[/home/class_student/RiderProjects/Demka_Snova_1/App.axaml] [/home/class_student/RiderProjects/Demka_Snova_1/AdminWindow.axaml]
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
[/home/class_student/RiderProjects/Demka_Snova_1/FunctionalWindow.axaml] [/home/class_student/RiderProjects/Demka_Snova_1/App.axaml]
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
[/home/class_student/RiderProjects/Demka_Snova_1/MainWindow.axaml] [/home/class_student/RiderProjects/Demka_Snova_1/MainWindow.axaml]
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
[/home/class_student/RiderProjects/Demka_Snova_1/SellerWindow.axaml]
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
[/home/class_student/RiderProjects/Demka_Snova_1/StarshiyWindow.axaml]
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
17386686056158970 17386687920300443