first commit
13
.idea/.idea.demo5/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Rider ignored files
|
||||||
|
/modules.xml
|
||||||
|
/contentModel.xml
|
||||||
|
/projectSettingsUpdater.xml
|
||||||
|
/.idea.demo5.iml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
10
.idea/.idea.demo5/.idea/avalonia.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AvaloniaProject">
|
||||||
|
<option name="projectPerEditor">
|
||||||
|
<map>
|
||||||
|
<entry key="demo5/MainWindow.axaml" value="demo5/demo5.csproj" />
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
8
.idea/.idea.demo5/.idea/indexLayout.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="UserContentModel">
|
||||||
|
<attachedFolders />
|
||||||
|
<explicitIncludes />
|
||||||
|
<explicitExcludes />
|
||||||
|
</component>
|
||||||
|
</project>
|
4
.idea/.idea.demo5/.idea/vcs.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings" defaultProject="true" />
|
||||||
|
</project>
|
16
demo5.sln
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "demo5", "demo5\demo5.csproj", "{E5F29055-83E1-4B73-A9E0-EFBD2695C785}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{E5F29055-83E1-4B73-A9E0-EFBD2695C785}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{E5F29055-83E1-4B73-A9E0-EFBD2695C785}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{E5F29055-83E1-4B73-A9E0-EFBD2695C785}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{E5F29055-83E1-4B73-A9E0-EFBD2695C785}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
BIN
demo5/.DS_Store
vendored
Normal file
9
demo5/AdminWindow.axaml
Normal 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="demo5.AdminWindow"
|
||||||
|
Title="AdminWindow">
|
||||||
|
Welcome to Avalonia!
|
||||||
|
</Window>
|
13
demo5/AdminWindow.axaml.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
|
namespace demo5;
|
||||||
|
|
||||||
|
public partial class AdminWindow : Window
|
||||||
|
{
|
||||||
|
public AdminWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
10
demo5/App.axaml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<Application xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
x:Class="demo5.App"
|
||||||
|
RequestedThemeVariant="Default">
|
||||||
|
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
||||||
|
|
||||||
|
<Application.Styles>
|
||||||
|
<FluentTheme />
|
||||||
|
</Application.Styles>
|
||||||
|
</Application>
|
23
demo5/App.axaml.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
|
namespace demo5;
|
||||||
|
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
AvaloniaXamlLoader.Load(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnFrameworkInitializationCompleted()
|
||||||
|
{
|
||||||
|
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||||
|
{
|
||||||
|
desktop.MainWindow = new MainWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
base.OnFrameworkInitializationCompleted();
|
||||||
|
}
|
||||||
|
}
|
9
demo5/BlankWindow.axaml
Normal 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="demo5.BlankWindow"
|
||||||
|
Title="BlankWindow">
|
||||||
|
Welcome to Avalonia!
|
||||||
|
</Window>
|
13
demo5/BlankWindow.axaml.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
|
namespace demo5;
|
||||||
|
|
||||||
|
public partial class BlankWindow : Window
|
||||||
|
{
|
||||||
|
public BlankWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
9
demo5/FormOrderWindow.axaml
Normal 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="demo5.FormOrderWindow"
|
||||||
|
Title="FormOrderWindow">
|
||||||
|
Welcome to Avalonia!
|
||||||
|
</Window>
|
13
demo5/FormOrderWindow.axaml.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
|
namespace demo5;
|
||||||
|
|
||||||
|
public partial class FormOrderWindow : Window
|
||||||
|
{
|
||||||
|
public FormOrderWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
9
demo5/HistoryWindow.axaml
Normal 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="demo5.HistoryWindow"
|
||||||
|
Title="HistoryWindow">
|
||||||
|
Welcome to Avalonia!
|
||||||
|
</Window>
|
13
demo5/HistoryWindow.axaml.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
|
namespace demo5;
|
||||||
|
|
||||||
|
public partial class HistoryWindow : Window
|
||||||
|
{
|
||||||
|
public HistoryWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
16
demo5/MainWindow.axaml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<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="demo5.MainWindow"
|
||||||
|
Title="demo5">
|
||||||
|
<StackPanel Spacing="5" VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||||
|
<TextBox x:Name="LoginTextBox" Width="200" Watermark="Логин"/>
|
||||||
|
<TextBox x:Name="PasswordTextBox" Width="200" Watermark="Пароль"/>
|
||||||
|
<StackPanel Orientation="Horizontal" Spacing="5">
|
||||||
|
<Button Click="AuthButton_OnClick" Content="Вход"/>
|
||||||
|
<CheckBox Content="Показать пароль" HorizontalAlignment="Right" Name="ShowPasswordCheckBox" Checked="ShowPasswordCheckBox_OnCheck" Unchecked="ShowPasswordCheckBox_OnUncheck"/>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</Window>
|
93
demo5/MainWindow.axaml.cs
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Input;
|
||||||
|
using Avalonia.Interactivity;
|
||||||
|
using Avalonia.Media.Imaging;
|
||||||
|
using demo5.MyModels;
|
||||||
|
using demo5.Models;
|
||||||
|
|
||||||
|
namespace demo5;
|
||||||
|
|
||||||
|
public partial class MainWindow : Window
|
||||||
|
{
|
||||||
|
|
||||||
|
ObservableCollection<ClientMy> myClients = new ObservableCollection<ClientMy>();
|
||||||
|
List<ClientMy> dataSourceClient;
|
||||||
|
|
||||||
|
public static ObservableCollection<ClientMy> ClientMyList { get; set; }
|
||||||
|
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
PasswordTextBox.PasswordChar = '•';
|
||||||
|
|
||||||
|
using var context = new Demo5Context();
|
||||||
|
dataSourceClient = context.Clients.Select(it => new ClientMy
|
||||||
|
{
|
||||||
|
Photopath = it.Photopath,
|
||||||
|
Email = it.Email,
|
||||||
|
Password = it.Password,
|
||||||
|
Fio = it.Fio,
|
||||||
|
Role = it.Role
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
ClientMyList = new ObservableCollection<ClientMy>(dataSourceClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AuthButton_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
using var context = new Demo5Context();
|
||||||
|
|
||||||
|
var LoginText = LoginTextBox?.Text;
|
||||||
|
var Password = PasswordTextBox?.Text;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(LoginText) || string.IsNullOrEmpty(Password))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var client = ClientMyList.FirstOrDefault(it => it.Email == LoginText);
|
||||||
|
|
||||||
|
if (client != null && client.Password == Password)
|
||||||
|
{
|
||||||
|
switch (client.Role)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
BlankWindow blankWindow = new BlankWindow();
|
||||||
|
blankWindow.ShowDialog(this);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
SellerWindow sallerWindow = new SellerWindow(client);
|
||||||
|
sallerWindow.ShowDialog(this);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
MegaSellerWindow megaSellerWindow = new MegaSellerWindow();
|
||||||
|
megaSellerWindow.ShowDialog(this);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
AdminWindow adminWindow = new AdminWindow();
|
||||||
|
adminWindow.ShowDialog(this);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
BlankWindow blankWindow2 = new BlankWindow();
|
||||||
|
blankWindow2.ShowDialog(this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowPasswordCheckBox_OnCheck(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
PasswordTextBox.PasswordChar = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowPasswordCheckBox_OnUncheck(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
PasswordTextBox.PasswordChar = '•';
|
||||||
|
}
|
||||||
|
}
|
9
demo5/MegaSellerWindow.axaml
Normal 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="demo5.MegaSellerWindow"
|
||||||
|
Title="MegaSellerWindow">
|
||||||
|
Welcome to Avalonia!
|
||||||
|
</Window>
|
13
demo5/MegaSellerWindow.axaml.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
|
namespace demo5;
|
||||||
|
|
||||||
|
public partial class MegaSellerWindow : Window
|
||||||
|
{
|
||||||
|
public MegaSellerWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
35
demo5/Models/Client.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace demo5.Models;
|
||||||
|
|
||||||
|
public partial class Client
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public int? Code { get; set; }
|
||||||
|
|
||||||
|
public string Fio { get; set; } = null!;
|
||||||
|
|
||||||
|
public string? Passport { get; set; }
|
||||||
|
|
||||||
|
public DateTime? Date { get; set; }
|
||||||
|
|
||||||
|
public string? Address { get; set; }
|
||||||
|
|
||||||
|
public string Email { get; set; } = null!;
|
||||||
|
|
||||||
|
public string Password { get; set; } = null!;
|
||||||
|
|
||||||
|
public int Role { get; set; }
|
||||||
|
|
||||||
|
public string? Photopath { get; set; }
|
||||||
|
|
||||||
|
public DateTime? LastLogin { get; set; }
|
||||||
|
|
||||||
|
public bool? SuccessLogin { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<Order> Orders { get; set; } = new List<Order>();
|
||||||
|
|
||||||
|
public virtual Role RoleNavigation { get; set; } = null!;
|
||||||
|
}
|
152
demo5/Models/Demo5Context.cs
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace demo5.Models;
|
||||||
|
|
||||||
|
public partial class Demo5Context : DbContext
|
||||||
|
{
|
||||||
|
public Demo5Context()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public Demo5Context(DbContextOptions<Demo5Context> options)
|
||||||
|
: base(options)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual DbSet<Client> Clients { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<Order> Orders { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<OrdersService> OrdersServices { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<Role> Roles { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<Service> Services { get; set; }
|
||||||
|
|
||||||
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
|
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
|
||||||
|
=> optionsBuilder.UseNpgsql("Host=localhost;Database=demo5;Username=demo5;Password=demo5;Port=5440");
|
||||||
|
|
||||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
modelBuilder.Entity<Client>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasKey(e => e.Id).HasName("clients_pkey");
|
||||||
|
|
||||||
|
entity.ToTable("clients");
|
||||||
|
|
||||||
|
entity.Property(e => e.Id).HasColumnName("id");
|
||||||
|
entity.Property(e => e.Address)
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnName("address");
|
||||||
|
entity.Property(e => e.Code).HasColumnName("code");
|
||||||
|
entity.Property(e => e.Date)
|
||||||
|
.HasColumnType("timestamp without time zone")
|
||||||
|
.HasColumnName("date");
|
||||||
|
entity.Property(e => e.Email)
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnName("email");
|
||||||
|
entity.Property(e => e.Fio)
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnName("fio");
|
||||||
|
entity.Property(e => e.LastLogin)
|
||||||
|
.HasColumnType("timestamp without time zone")
|
||||||
|
.HasColumnName("last_login");
|
||||||
|
entity.Property(e => e.Passport)
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.HasColumnName("passport");
|
||||||
|
entity.Property(e => e.Password)
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnName("password");
|
||||||
|
entity.Property(e => e.Photopath)
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.HasColumnName("photopath");
|
||||||
|
entity.Property(e => e.Role).HasColumnName("role");
|
||||||
|
entity.Property(e => e.SuccessLogin).HasColumnName("success_login");
|
||||||
|
|
||||||
|
entity.HasOne(d => d.RoleNavigation).WithMany(p => p.Clients)
|
||||||
|
.HasForeignKey(d => d.Role)
|
||||||
|
.HasConstraintName("clients_role_fkey");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<Order>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasKey(e => e.Id).HasName("orders_pkey");
|
||||||
|
|
||||||
|
entity.ToTable("orders");
|
||||||
|
|
||||||
|
entity.Property(e => e.Id).HasColumnName("id");
|
||||||
|
entity.Property(e => e.CodeClient).HasColumnName("code_client");
|
||||||
|
entity.Property(e => e.CodeOrder)
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnName("code_order");
|
||||||
|
entity.Property(e => e.Date)
|
||||||
|
.HasColumnType("timestamp without time zone")
|
||||||
|
.HasColumnName("date");
|
||||||
|
entity.Property(e => e.DateClose)
|
||||||
|
.HasColumnType("timestamp without time zone")
|
||||||
|
.HasColumnName("date_close");
|
||||||
|
entity.Property(e => e.Period).HasColumnName("period");
|
||||||
|
entity.Property(e => e.Status)
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnName("status");
|
||||||
|
entity.Property(e => e.Time).HasColumnName("time");
|
||||||
|
|
||||||
|
entity.HasOne(d => d.CodeClientNavigation).WithMany(p => p.Orders)
|
||||||
|
.HasForeignKey(d => d.CodeClient)
|
||||||
|
.HasConstraintName("orders_code_client_fkey");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<OrdersService>(entity =>
|
||||||
|
{
|
||||||
|
entity
|
||||||
|
.HasNoKey()
|
||||||
|
.ToTable("orders_services");
|
||||||
|
|
||||||
|
entity.Property(e => e.OrderId).HasColumnName("order_id");
|
||||||
|
entity.Property(e => e.ServiceId).HasColumnName("service_id");
|
||||||
|
|
||||||
|
entity.HasOne(d => d.Order).WithMany()
|
||||||
|
.HasForeignKey(d => d.OrderId)
|
||||||
|
.HasConstraintName("orders_services_order_id_fkey");
|
||||||
|
|
||||||
|
entity.HasOne(d => d.Service).WithMany()
|
||||||
|
.HasForeignKey(d => d.ServiceId)
|
||||||
|
.HasConstraintName("orders_services_service_id_fkey");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<Role>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasKey(e => e.Id).HasName("roles_pkey");
|
||||||
|
|
||||||
|
entity.ToTable("roles");
|
||||||
|
|
||||||
|
entity.Property(e => e.Id).HasColumnName("id");
|
||||||
|
entity.Property(e => e.Name)
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnName("name");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<Service>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasKey(e => e.Id).HasName("services_pkey");
|
||||||
|
|
||||||
|
entity.ToTable("services");
|
||||||
|
|
||||||
|
entity.Property(e => e.Id).HasColumnName("id");
|
||||||
|
entity.Property(e => e.CodeService)
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnName("code_service");
|
||||||
|
entity.Property(e => e.Name)
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnName("name");
|
||||||
|
entity.Property(e => e.Price).HasColumnName("price");
|
||||||
|
});
|
||||||
|
|
||||||
|
OnModelCreatingPartial(modelBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
||||||
|
}
|
25
demo5/Models/Order.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace demo5.Models;
|
||||||
|
|
||||||
|
public partial class Order
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string CodeOrder { get; set; } = null!;
|
||||||
|
|
||||||
|
public DateTime Date { get; set; }
|
||||||
|
|
||||||
|
public TimeOnly Time { get; set; }
|
||||||
|
|
||||||
|
public int CodeClient { get; set; }
|
||||||
|
|
||||||
|
public string Status { get; set; } = null!;
|
||||||
|
|
||||||
|
public DateTime? DateClose { get; set; }
|
||||||
|
|
||||||
|
public int Period { get; set; }
|
||||||
|
|
||||||
|
public virtual Client CodeClientNavigation { get; set; } = null!;
|
||||||
|
}
|
15
demo5/Models/OrdersService.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace demo5.Models;
|
||||||
|
|
||||||
|
public partial class OrdersService
|
||||||
|
{
|
||||||
|
public int OrderId { get; set; }
|
||||||
|
|
||||||
|
public int ServiceId { get; set; }
|
||||||
|
|
||||||
|
public virtual Order Order { get; set; } = null!;
|
||||||
|
|
||||||
|
public virtual Service Service { get; set; } = null!;
|
||||||
|
}
|
13
demo5/Models/Role.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace demo5.Models;
|
||||||
|
|
||||||
|
public partial class Role
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string Name { get; set; } = null!;
|
||||||
|
|
||||||
|
public virtual ICollection<Client> Clients { get; set; } = new List<Client>();
|
||||||
|
}
|
15
demo5/Models/Service.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace demo5.Models;
|
||||||
|
|
||||||
|
public partial class Service
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string Name { get; set; } = null!;
|
||||||
|
|
||||||
|
public string CodeService { get; set; } = null!;
|
||||||
|
|
||||||
|
public int Price { get; set; }
|
||||||
|
}
|
25
demo5/MyModels/ClientMy.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using Avalonia.Media.Imaging;
|
||||||
|
using demo5.Models;
|
||||||
|
|
||||||
|
namespace demo5.MyModels;
|
||||||
|
|
||||||
|
public class ClientMy : Client
|
||||||
|
{
|
||||||
|
public Bitmap? Image
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string absolutePath = Path.Combine(AppContext.BaseDirectory, Photopath);
|
||||||
|
return new Bitmap(absolutePath);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
21
demo5/Program.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace demo5;
|
||||||
|
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
||||||
|
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
||||||
|
// yet and stuff might break.
|
||||||
|
[STAThread]
|
||||||
|
public static void Main(string[] args) => BuildAvaloniaApp()
|
||||||
|
.StartWithClassicDesktopLifetime(args);
|
||||||
|
|
||||||
|
// Avalonia configuration, don't remove; also used by visual designer.
|
||||||
|
public static AppBuilder BuildAvaloniaApp()
|
||||||
|
=> AppBuilder.Configure<App>()
|
||||||
|
.UsePlatformDetect()
|
||||||
|
.WithInterFont()
|
||||||
|
.LogToTrace();
|
||||||
|
}
|
30
demo5/SellerWindow.axaml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<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="demo5.SellerWindow"
|
||||||
|
Title="SellerWindow">
|
||||||
|
<DockPanel>
|
||||||
|
<Border>
|
||||||
|
<Grid>
|
||||||
|
<Grid ColumnDefinitions="Auto, 1*" VerticalAlignment="Center" Margin="10,0,0,0">
|
||||||
|
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="1" MaxWidth="250">
|
||||||
|
<Image Width="150" Height="250" x:Name="ClientImage"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid ColumnDefinitions="Auto, 1*" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||||
|
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="1" MaxWidth="250" Spacing="15">
|
||||||
|
<TextBlock x:Name="FioTextBlock" FontSize="16"/>
|
||||||
|
<TextBlock x:Name="RoleTextBlock" FontSize="14"/>
|
||||||
|
|
||||||
|
<Button x:Name="FormOrderButton" Height="80" Width="300" BorderThickness="2" Click="FormOrderButton_OnClick">
|
||||||
|
<TextBlock Text="Сформировать заказ" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Button>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</DockPanel>
|
||||||
|
</Window>
|
31
demo5/SellerWindow.axaml.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Input;
|
||||||
|
using Avalonia.Interactivity;
|
||||||
|
using Avalonia.Media.Imaging;
|
||||||
|
using demo5.Models;
|
||||||
|
using demo5.MyModels;
|
||||||
|
|
||||||
|
namespace demo5;
|
||||||
|
|
||||||
|
public partial class SellerWindow : Window
|
||||||
|
{
|
||||||
|
public SellerWindow(ClientMy client)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
FioTextBlock.Text = client.Fio;
|
||||||
|
RoleTextBlock.Text = client.Role.ToString();
|
||||||
|
ClientImage.Source = client.Image;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormOrderButton_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
FormOrderWindow formOrderWindow = new FormOrderWindow();
|
||||||
|
formOrderWindow.ShowDialog(this);
|
||||||
|
}
|
||||||
|
}
|
18
demo5/app.manifest
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<!-- This manifest is used on Windows only.
|
||||||
|
Don't remove it as it might cause problems with window transparency and embedded controls.
|
||||||
|
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
|
||||||
|
<assemblyIdentity version="1.0.0.0" name="demo5.Desktop"/>
|
||||||
|
|
||||||
|
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||||
|
<application>
|
||||||
|
<!-- A list of the Windows versions that this application has been tested on
|
||||||
|
and is designed to work with. Uncomment the appropriate elements
|
||||||
|
and Windows will automatically select the most compatible environment. -->
|
||||||
|
|
||||||
|
<!-- Windows 10 -->
|
||||||
|
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||||
|
</application>
|
||||||
|
</compatibility>
|
||||||
|
</assembly>
|
BIN
demo5/bin/.DS_Store
vendored
Normal file
BIN
demo5/bin/Debug/.DS_Store
vendored
Normal file
BIN
demo5/bin/Debug/net8.0/.DS_Store
vendored
Normal file
BIN
demo5/bin/Debug/net8.0/Avalonia.Base.dll
Executable file
BIN
demo5/bin/Debug/net8.0/Avalonia.Controls.ColorPicker.dll
Executable file
BIN
demo5/bin/Debug/net8.0/Avalonia.Controls.DataGrid.dll
Executable file
BIN
demo5/bin/Debug/net8.0/Avalonia.Controls.dll
Executable file
BIN
demo5/bin/Debug/net8.0/Avalonia.DesignerSupport.dll
Executable file
BIN
demo5/bin/Debug/net8.0/Avalonia.Desktop.dll
Executable file
BIN
demo5/bin/Debug/net8.0/Avalonia.Diagnostics.dll
Executable file
BIN
demo5/bin/Debug/net8.0/Avalonia.Dialogs.dll
Executable file
BIN
demo5/bin/Debug/net8.0/Avalonia.Fonts.Inter.dll
Executable file
BIN
demo5/bin/Debug/net8.0/Avalonia.FreeDesktop.dll
Executable file
BIN
demo5/bin/Debug/net8.0/Avalonia.Markup.Xaml.dll
Executable file
BIN
demo5/bin/Debug/net8.0/Avalonia.Markup.dll
Executable file
BIN
demo5/bin/Debug/net8.0/Avalonia.Metal.dll
Executable file
BIN
demo5/bin/Debug/net8.0/Avalonia.MicroCom.dll
Executable file
BIN
demo5/bin/Debug/net8.0/Avalonia.Native.dll
Executable file
BIN
demo5/bin/Debug/net8.0/Avalonia.OpenGL.dll
Executable file
BIN
demo5/bin/Debug/net8.0/Avalonia.Remote.Protocol.dll
Executable file
BIN
demo5/bin/Debug/net8.0/Avalonia.Skia.dll
Executable file
BIN
demo5/bin/Debug/net8.0/Avalonia.Themes.Fluent.dll
Executable file
BIN
demo5/bin/Debug/net8.0/Avalonia.Themes.Simple.dll
Executable file
BIN
demo5/bin/Debug/net8.0/Avalonia.Vulkan.dll
Executable file
BIN
demo5/bin/Debug/net8.0/Avalonia.Win32.dll
Executable file
BIN
demo5/bin/Debug/net8.0/Avalonia.X11.dll
Executable file
BIN
demo5/bin/Debug/net8.0/Avalonia.dll
Executable file
BIN
demo5/bin/Debug/net8.0/Employees/.DS_Store
vendored
Normal file
BIN
demo5/bin/Debug/net8.0/Employees/Беляева.jpeg
Normal file
After Width: | Height: | Size: 5.7 KiB |
BIN
demo5/bin/Debug/net8.0/Employees/Иванов.jpeg
Normal file
After Width: | Height: | Size: 7.1 KiB |
BIN
demo5/bin/Debug/net8.0/Employees/Игнатов.jpg
Normal file
After Width: | Height: | Size: 8.9 KiB |
BIN
demo5/bin/Debug/net8.0/Employees/Миронов.jpeg
Normal file
After Width: | Height: | Size: 5.2 KiB |
BIN
demo5/bin/Debug/net8.0/Employees/Петров.jpeg
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
demo5/bin/Debug/net8.0/Employees/Смирнова.jpeg
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
demo5/bin/Debug/net8.0/Employees/Стрелков.jpeg
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
demo5/bin/Debug/net8.0/Employees/Федоров.jpeg
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
demo5/bin/Debug/net8.0/Employees/Хохлов.jpeg
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
demo5/bin/Debug/net8.0/Employees/Ширяев.jpeg
Normal file
After Width: | Height: | Size: 4.1 KiB |