generated from admin/template
Demo
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvaloniaPostrgresApp", "AvaloniaPostrgresApp\AvaloniaPostrgresApp.csproj", "{2D67BF53-BE3F-4118-8095-57A478E04588}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2D67BF53-BE3F-4118-8095-57A478E04588}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2D67BF53-BE3F-4118-8095-57A478E04588}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2D67BF53-BE3F-4118-8095-57A478E04588}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2D67BF53-BE3F-4118-8095-57A478E04588}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,10 @@
|
||||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="AvaloniaPostrgresApp.App"
|
||||
RequestedThemeVariant="Default">
|
||||
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
||||
|
||||
<Application.Styles>
|
||||
<FluentTheme />
|
||||
</Application.Styles>
|
||||
</Application>
|
||||
@@ -0,0 +1,23 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace AvaloniaPostrgresApp;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using AvaloniaPostrgresApp.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
namespace AvaloniaPostrgresApp;
|
||||
|
||||
public class AppDbContext : DbContext
|
||||
{
|
||||
public DbSet<UserInfo> Users { get; set; } = null!;
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
|
||||
string connectionString = "Host=127.0.0.1;Port=5432;Database=postgres;Username=postgres;Password=mysecretpassword;Timeout=15;Command Timeout=15;Trust Server Certificate=true;SSL Mode=Prefer";
|
||||
optionsBuilder.UseNpgsql(connectionString);
|
||||
}
|
||||
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
modelBuilder.Entity<UserInfo>().ToTable("UserInfo");
|
||||
|
||||
modelBuilder.Entity<UserInfo>().Property(u => u.Id).HasColumnName("id");
|
||||
modelBuilder.Entity<UserInfo>().Property(u => u.Fio).HasColumnName("fio");
|
||||
modelBuilder.Entity<UserInfo>().Property(u => u.Login).HasColumnName("login");
|
||||
modelBuilder.Entity<UserInfo>().Property(u => u.Password).HasColumnName("password");
|
||||
modelBuilder.Entity<UserInfo>().Property(u => u.RoleId).HasColumnName("role_id");
|
||||
|
||||
modelBuilder.Entity<UserInfo>().Ignore(u => u.Orders);
|
||||
modelBuilder.Entity<UserInfo>().Ignore(u => u.Role);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="12.1.4" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="12.1.4" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="12.1.4" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="12.1.4" />
|
||||
<PackageReference Include="AvaloniaUI.DiagnosticsSupport" Version="2.2.3">
|
||||
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
|
||||
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.*">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.*" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -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="AvaloniaPostrgresApp.MainWindow"
|
||||
Title="Вход" Width="300" Height="250">
|
||||
|
||||
<StackPanel Margin="20" Spacing="10">
|
||||
|
||||
<TextBlock Text="Логин:" />
|
||||
<TextBox Name="LoginInput" />
|
||||
|
||||
<TextBlock Text="Пароль:" />
|
||||
<TextBox Name="PasswordInput" PasswordChar="*" />
|
||||
|
||||
<Button Content="Войти"
|
||||
Click="SignInClick"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Center"/>
|
||||
|
||||
<Button Content="Войти как гость"
|
||||
Click="GuestSignInClick"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Center"/>
|
||||
|
||||
<TextBlock Name="StatusText" Foreground="Blue" HorizontalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
|
||||
</Window>
|
||||
@@ -0,0 +1,70 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Media;
|
||||
using AvaloniaPostrgresApp.Models;
|
||||
using System.Linq;
|
||||
namespace AvaloniaPostrgresApp;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Npgsql;
|
||||
using System;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
private async void SignInClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string login = LoginInput.Text ?? string.Empty;
|
||||
string password = PasswordInput.Text ?? string.Empty;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(login) || string.IsNullOrWhiteSpace(password))
|
||||
{
|
||||
StatusText.Text = "Заполните все поля!";
|
||||
StatusText.Foreground = Brushes.Red;
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
using (var db = new PostgresContext())
|
||||
{
|
||||
UserInfo? user = await db.UserInfos
|
||||
.FirstOrDefaultAsync(u => u.Login == login && u.Password == password);
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
StatusText.Text = $"Успешно! Добро пожаловать, {user.Fio}.";
|
||||
StatusText.Foreground = Brushes.Green;
|
||||
}
|
||||
else
|
||||
{
|
||||
StatusText.Text = "Неверный логин или пароль.";
|
||||
StatusText.Foreground = Brushes.Red;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (NpgsqlException)
|
||||
{
|
||||
StatusText.Text = "Ошибка подключения. Проверьте строку в PostgresContext.cs или Docker.";
|
||||
StatusText.Foreground = Brushes.Red;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
StatusText.Text = ex.InnerException?.Message ?? ex.Message;
|
||||
StatusText.Foreground = Brushes.Red;
|
||||
}
|
||||
}
|
||||
|
||||
private void GuestSignInClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
StatusText.Text = "Вы вошли в систему как Гость.";
|
||||
LoginInput.Text = string.Empty;
|
||||
PasswordInput.Text = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AvaloniaPostrgresApp.Models;
|
||||
|
||||
public partial class Category
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string CategoryName { get; set; } = null!;
|
||||
|
||||
public string Unit { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<Tovar> Tovars { get; set; } = new List<Tovar>();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AvaloniaPostrgresApp.Models;
|
||||
|
||||
public partial class Manufacturer
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string ManufacturerName { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<Tovar> Tovars { get; set; } = new List<Tovar>();
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AvaloniaPostrgresApp.Models;
|
||||
|
||||
public partial class Order
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public DateTime OrderDate { get; set; }
|
||||
|
||||
public DateTime? DeliveryDate { get; set; }
|
||||
|
||||
public int AddressPvzId { get; set; }
|
||||
|
||||
public int IdUser { get; set; }
|
||||
|
||||
public string? Code { get; set; }
|
||||
|
||||
public virtual Pvz AddressPvz { get; set; } = null!;
|
||||
|
||||
public virtual UserInfo IdUserNavigation { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<OrderDetail> OrderDetails { get; set; } = new List<OrderDetail>();
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AvaloniaPostrgresApp.Models;
|
||||
|
||||
public partial class OrderDetail
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int IdOrder { get; set; }
|
||||
|
||||
public int ArtId { get; set; }
|
||||
|
||||
public int Amount { get; set; }
|
||||
|
||||
public virtual Tovar Art { get; set; } = null!;
|
||||
|
||||
public virtual Order IdOrderNavigation { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,265 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace AvaloniaPostrgresApp.Models;
|
||||
|
||||
public partial class PostgresContext : DbContext
|
||||
{
|
||||
public PostgresContext()
|
||||
{
|
||||
}
|
||||
|
||||
public PostgresContext(DbContextOptions<PostgresContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual DbSet<Category> Categories { get; set; }
|
||||
|
||||
public virtual DbSet<Manufacturer> Manufacturers { get; set; }
|
||||
|
||||
public virtual DbSet<Order> Orders { get; set; }
|
||||
|
||||
public virtual DbSet<OrderDetail> OrderDetails { get; set; }
|
||||
|
||||
public virtual DbSet<Pvz> Pvzs { get; set; }
|
||||
|
||||
public virtual DbSet<Role> Roles { get; set; }
|
||||
|
||||
public virtual DbSet<Section> Sections { get; set; }
|
||||
|
||||
public virtual DbSet<Supplier> Suppliers { get; set; }
|
||||
|
||||
public virtual DbSet<Tovar> Tovars { get; set; }
|
||||
|
||||
public virtual DbSet<UserInfo> UserInfos { 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;Port=5432;Database=postgres;Username=postgres;Password=mysecretpassword");
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.HasPostgresEnum("order_status", new[] { "Завершен", "Новый", "В пути" });
|
||||
|
||||
modelBuilder.Entity<Category>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("category_pkey");
|
||||
|
||||
entity.ToTable("category");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.UseIdentityAlwaysColumn()
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.CategoryName)
|
||||
.HasMaxLength(250)
|
||||
.HasColumnName("category_name");
|
||||
entity.Property(e => e.Unit)
|
||||
.HasMaxLength(10)
|
||||
.HasColumnName("unit");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Manufacturer>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("manufacturer_pkey");
|
||||
|
||||
entity.ToTable("manufacturer");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.UseIdentityAlwaysColumn()
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.ManufacturerName)
|
||||
.HasMaxLength(250)
|
||||
.HasColumnName("manufacturer_name");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Order>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("orders_pkey");
|
||||
|
||||
entity.ToTable("orders");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.UseIdentityAlwaysColumn()
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.AddressPvzId).HasColumnName("address_pvz_id");
|
||||
entity.Property(e => e.Code)
|
||||
.HasMaxLength(10)
|
||||
.HasColumnName("code");
|
||||
entity.Property(e => e.DeliveryDate).HasColumnName("delivery_date");
|
||||
entity.Property(e => e.IdUser).HasColumnName("id_user");
|
||||
entity.Property(e => e.OrderDate)
|
||||
.HasDefaultValueSql("now()")
|
||||
.HasColumnName("order_date");
|
||||
|
||||
entity.HasOne(d => d.AddressPvz).WithMany(p => p.Orders)
|
||||
.HasForeignKey(d => d.AddressPvzId)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("orders_address_pvz_id_fkey");
|
||||
|
||||
entity.HasOne(d => d.IdUserNavigation).WithMany(p => p.Orders)
|
||||
.HasForeignKey(d => d.IdUser)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("orders_id_user_fkey");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<OrderDetail>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("order_details_pkey");
|
||||
|
||||
entity.ToTable("order_details");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.UseIdentityAlwaysColumn()
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.Amount).HasColumnName("amount");
|
||||
entity.Property(e => e.ArtId).HasColumnName("art_id");
|
||||
entity.Property(e => e.IdOrder).HasColumnName("id_order");
|
||||
|
||||
entity.HasOne(d => d.Art).WithMany(p => p.OrderDetails)
|
||||
.HasForeignKey(d => d.ArtId)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("order_details_art_id_fkey");
|
||||
|
||||
entity.HasOne(d => d.IdOrderNavigation).WithMany(p => p.OrderDetails)
|
||||
.HasForeignKey(d => d.IdOrder)
|
||||
.HasConstraintName("order_details_id_order_fkey");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Pvz>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("pvz_pkey");
|
||||
|
||||
entity.ToTable("pvz");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.UseIdentityAlwaysColumn()
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.Address)
|
||||
.HasMaxLength(255)
|
||||
.HasColumnName("address");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Role>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("roles_pkey");
|
||||
|
||||
entity.ToTable("roles");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.UseIdentityAlwaysColumn()
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.RoleName)
|
||||
.HasMaxLength(100)
|
||||
.HasColumnName("role_name");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Section>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("sections_pkey");
|
||||
|
||||
entity.ToTable("sections");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.UseIdentityAlwaysColumn()
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.Name)
|
||||
.HasMaxLength(100)
|
||||
.HasColumnName("name");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Supplier>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("supplier_pkey");
|
||||
|
||||
entity.ToTable("supplier");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.UseIdentityAlwaysColumn()
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.SupName)
|
||||
.HasMaxLength(200)
|
||||
.HasColumnName("sup_name");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Tovar>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("tovar_pkey");
|
||||
|
||||
entity.ToTable("tovar");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.UseIdentityAlwaysColumn()
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.Amount).HasColumnName("amount");
|
||||
entity.Property(e => e.Art)
|
||||
.HasMaxLength(250)
|
||||
.HasColumnName("art");
|
||||
entity.Property(e => e.Cost)
|
||||
.HasPrecision(10, 2)
|
||||
.HasColumnName("cost");
|
||||
entity.Property(e => e.Description).HasColumnName("description");
|
||||
entity.Property(e => e.Discount)
|
||||
.HasDefaultValue(0)
|
||||
.HasColumnName("discount");
|
||||
entity.Property(e => e.IdCategory).HasColumnName("id_category");
|
||||
entity.Property(e => e.IdManufacturer).HasColumnName("id_manufacturer");
|
||||
entity.Property(e => e.IdSection).HasColumnName("id_section");
|
||||
entity.Property(e => e.IdSupplier).HasColumnName("id_supplier");
|
||||
entity.Property(e => e.Photo).HasColumnName("photo");
|
||||
|
||||
entity.HasOne(d => d.IdCategoryNavigation).WithMany(p => p.Tovars)
|
||||
.HasForeignKey(d => d.IdCategory)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("tovar_id_category_fkey");
|
||||
|
||||
entity.HasOne(d => d.IdManufacturerNavigation).WithMany(p => p.Tovars)
|
||||
.HasForeignKey(d => d.IdManufacturer)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("tovar_id_manufacturer_fkey");
|
||||
|
||||
entity.HasOne(d => d.IdSectionNavigation).WithMany(p => p.Tovars)
|
||||
.HasForeignKey(d => d.IdSection)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("tovar_id_section_fkey");
|
||||
|
||||
entity.HasOne(d => d.IdSupplierNavigation).WithMany(p => p.Tovars)
|
||||
.HasForeignKey(d => d.IdSupplier)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("tovar_id_supplier_fkey");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<UserInfo>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("user_info_pkey");
|
||||
|
||||
entity.ToTable("user_info");
|
||||
|
||||
entity.HasIndex(e => e.Login, "user_info_login_key").IsUnique();
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.UseIdentityAlwaysColumn()
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.Fio)
|
||||
.HasMaxLength(255)
|
||||
.HasColumnName("fio");
|
||||
entity.Property(e => e.Login)
|
||||
.HasMaxLength(255)
|
||||
.HasColumnName("login");
|
||||
entity.Property(e => e.Password)
|
||||
.HasMaxLength(255)
|
||||
.HasColumnName("password");
|
||||
entity.Property(e => e.RoleId).HasColumnName("role_id");
|
||||
|
||||
entity.HasOne(d => d.Role).WithMany(p => p.UserInfos)
|
||||
.HasForeignKey(d => d.RoleId)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("user_info_role_id_fkey");
|
||||
});
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AvaloniaPostrgresApp.Models;
|
||||
|
||||
public partial class Pvz
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Address { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<Order> Orders { get; set; } = new List<Order>();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AvaloniaPostrgresApp.Models;
|
||||
|
||||
public partial class Role
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string RoleName { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<UserInfo> UserInfos { get; set; } = new List<UserInfo>();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AvaloniaPostrgresApp.Models;
|
||||
|
||||
public partial class Section
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<Tovar> Tovars { get; set; } = new List<Tovar>();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AvaloniaPostrgresApp.Models;
|
||||
|
||||
public partial class Supplier
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string SupName { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<Tovar> Tovars { get; set; } = new List<Tovar>();
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AvaloniaPostrgresApp.Models;
|
||||
|
||||
public partial class Tovar
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string? Art { get; set; }
|
||||
|
||||
public int IdCategory { get; set; }
|
||||
|
||||
public int IdSection { get; set; }
|
||||
|
||||
public int IdManufacturer { get; set; }
|
||||
|
||||
public int IdSupplier { get; set; }
|
||||
|
||||
public decimal Cost { get; set; }
|
||||
|
||||
public int? Discount { get; set; }
|
||||
|
||||
public int Amount { get; set; }
|
||||
|
||||
public string? Description { get; set; }
|
||||
|
||||
public string? Photo { get; set; }
|
||||
|
||||
public virtual Category IdCategoryNavigation { get; set; } = null!;
|
||||
|
||||
public virtual Manufacturer IdManufacturerNavigation { get; set; } = null!;
|
||||
|
||||
public virtual Section IdSectionNavigation { get; set; } = null!;
|
||||
|
||||
public virtual Supplier IdSupplierNavigation { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<OrderDetail> OrderDetails { get; set; } = new List<OrderDetail>();
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using AvaloniaPostrgresApp.Models;
|
||||
|
||||
namespace AvaloniaPostrgresApp
|
||||
{
|
||||
[Table("user_info")]
|
||||
public class UserInfo
|
||||
{
|
||||
[Key]
|
||||
[Column("id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column("fio")]
|
||||
public string Fio { get; set; } = string.Empty;
|
||||
|
||||
[Column("login")]
|
||||
public string Login { get; set; } = string.Empty;
|
||||
|
||||
[Column("password")]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
[Column("role_id")]
|
||||
public int RoleId { get; set; }
|
||||
public virtual ICollection<Order> Orders { get; set; } = new List<Order>();
|
||||
public virtual Role Role { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using Avalonia;
|
||||
using System;
|
||||
|
||||
namespace AvaloniaPostrgresApp;
|
||||
|
||||
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()
|
||||
#if DEBUG
|
||||
.WithDeveloperTools()
|
||||
#endif
|
||||
.WithInterFont()
|
||||
.LogToTrace();
|
||||
}
|
||||
@@ -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="AvaloniaPostrgresApp.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>
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tables", "Tables\Tables.csproj", "{20243430-FD8F-43D7-A498-665205F85D9F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{20243430-FD8F-43D7-A498-665205F85D9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{20243430-FD8F-43D7-A498-665205F85D9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{20243430-FD8F-43D7-A498-665205F85D9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{20243430-FD8F-43D7-A498-665205F85D9F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,10 @@
|
||||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="Tables.App"
|
||||
RequestedThemeVariant="Default">
|
||||
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
||||
|
||||
<Application.Styles>
|
||||
<FluentTheme />
|
||||
</Application.Styles>
|
||||
</Application>
|
||||
@@ -0,0 +1,23 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Tables;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<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="Tables.MainWindow"
|
||||
Title="Tables">
|
||||
|
||||
<Grid RowDefinitions="Auto, *" Margin="20">
|
||||
<Grid Grid.Row="0" ColumnDefinitions="*, Auto, Auto" ColumnSpacing="10" Margin="0,0,0,20">
|
||||
<TextBox Grid.Column="0" Watermark="Поиск" HorizontalAlignment="Stretch"/>
|
||||
<ComboBox Grid.Column="1" PlaceholderText="Сортировка" MinWidth="120" HorizontalAlignment="Stretch"/>
|
||||
<ComboBox Grid.Column="2" PlaceholderText="Фильтрация" MinWidth="120" HorizontalAlignment="Stretch"/>
|
||||
</Grid>
|
||||
<Border Grid.Row = "1" BorderBrush="Gray" BorderThickness="2" CornerRadius="8" Background="#F9F9F9">
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Spacing="10">
|
||||
<TextBlock FontSize="24">Каталог продуктов</TextBlock>
|
||||
<TextBlock FontSize="18" Foreground="Gray">Здесь будет список продуктов</TextBlock>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,11 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Tables;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using Avalonia;
|
||||
using System;
|
||||
|
||||
namespace Tables;
|
||||
|
||||
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()
|
||||
#if DEBUG
|
||||
.WithDeveloperTools()
|
||||
#endif
|
||||
.WithInterFont()
|
||||
.LogToTrace();
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="12.1.4"/>
|
||||
<PackageReference Include="Avalonia.Desktop" Version="12.1.4"/>
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="12.1.4"/>
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="12.1.4"/>
|
||||
<PackageReference Include="AvaloniaUI.DiagnosticsSupport" Version="2.2.3">
|
||||
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
|
||||
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -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="Tables.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>
|
||||
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,21 @@
|
||||
id_order;art_id;amount
|
||||
1;1;2
|
||||
1;2;2
|
||||
2;3;1
|
||||
2;4;1
|
||||
3;5;10
|
||||
3;6;10
|
||||
4;7;5
|
||||
4;8;4
|
||||
5;1;2
|
||||
5;2;2
|
||||
6;3;1
|
||||
6;4;1
|
||||
7;5;10
|
||||
7;6;10
|
||||
8;7;5
|
||||
8;8;4
|
||||
9;9;5
|
||||
9;10;1
|
||||
10;11;5
|
||||
10;12;5
|
||||
|
@@ -0,0 +1,11 @@
|
||||
order_date;delivery_date;address_pvz_id;id_user;code;status
|
||||
2025-02-27;2025-04-20;1;1;901;�אגונרום
|
||||
2022-09-28;2025-04-21;11;2;902;�אגונרום
|
||||
2025-03-21;2025-04-22;2;3;903;�אגונרום
|
||||
2025-02-20;2025-04-23;11;4;904;�אגונרום
|
||||
2025-03-17;2025-04-24;2;1;905;�אגונרום
|
||||
2025-03-01;2025-04-25;15;2;906;�אגונרום
|
||||
2025-03-01;2025-04-26;3;3;907;�אגונרום
|
||||
2025-03-31;2025-04-27;19;4;908;�מג�י
|
||||
2025-04-02;2025-04-28;5;1;909;�מג�י
|
||||
2025-04-03;2025-04-29;19;1;910;�מג�י
|
||||
|
@@ -0,0 +1,37 @@
|
||||
address
|
||||
420151, г. Лесной, ул. Вишневая, 32
|
||||
125061, г. Лесной, ул. Подгорная, 8
|
||||
630370, г. Лесной, ул. Шоссейная, 24
|
||||
400562, г. Лесной, ул. Зеленая, 32
|
||||
614510, г. Лесной, ул. Маяковского, 47
|
||||
410542, г. Лесной, ул. Светлая, 46
|
||||
620839, г. Лесной, ул. Цветочная, 8
|
||||
443890, г. Лесной, ул. Коммунистическая, 1
|
||||
603379, г. Лесной, ул. Спортивная, 46
|
||||
603721, г. Лесной, ул. Гоголя, 41
|
||||
410172, г. Лесной, ул. Северная, 13
|
||||
614611, г. Лесной, ул. Молодежная, 50
|
||||
454311, г.Лесной, ул. Новая, 19
|
||||
660007, г.Лесной, ул. Октябрьская, 19
|
||||
603036, г. Лесной, ул. Садовая, 4
|
||||
394060, г.Лесной, ул. Фрунзе, 43
|
||||
410661, г. Лесной, ул. Школьная, 50
|
||||
625590, г. Лесной, ул. Коммунистическая, 20
|
||||
625683, г. Лесной, ул. 8 Марта
|
||||
450983, г.Лесной, ул. Комсомольская, 26
|
||||
394782, г. Лесной, ул. Чехова, 3
|
||||
603002, г. Лесной, ул. Дзержинского, 28
|
||||
450558, г. Лесной, ул. Набережная, 30
|
||||
344288, г. Лесной, ул. Чехова, 1
|
||||
614164, г.Лесной, ул. Степная, 30
|
||||
394242, г. Лесной, ул. Коммунистическая, 43
|
||||
660540, г. Лесной, ул. Солнечная, 25
|
||||
125837, г. Лесной, ул. Шоссейная, 40
|
||||
125703, г. Лесной, ул. Партизанская, 49
|
||||
625283, г. Лесной, ул. Победы, 46
|
||||
614753, г. Лесной, ул. Полевая, 35
|
||||
426030, г. Лесной, ул. Маяковского, 44
|
||||
450375, г. Лесной ул. Клубная, 44
|
||||
625560, г. Лесной, ул. Некрасова, 12
|
||||
630201, г. Лесной, ул. Комсомольская, 17
|
||||
190949, г. Лесной, ул. Мичурина, 26
|
||||
|
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
category_name;unit
|
||||
Áîňčíęč;řň
|
||||
Ňóôëč;řň
|
||||
Ęđîńńîâęč;řň
|
||||
Ďîëóáîňčíęč;řň
|
||||
Ęĺäű;řň
|
||||
Ňŕďî÷ęč;řň
|
||||
Ńŕďîăč;řň
|
||||
|
@@ -0,0 +1,7 @@
|
||||
manufacturer_name
|
||||
Kari
|
||||
Marco Tozzi
|
||||
Poc
|
||||
Reiker
|
||||
Alessio Nesca
|
||||
CROSBY
|
||||
|
@@ -0,0 +1,3 @@
|
||||
name
|
||||
Женская обувь
|
||||
Мужская обувь
|
||||
|
@@ -0,0 +1,3 @@
|
||||
sup_name
|
||||
Kari
|
||||
Îáóâü äëÿ âàñ
|
||||
|
@@ -0,0 +1,31 @@
|
||||
art;id_category;id_section;id_manufacturer;id_supplier;cost;discount;amount;description;photo
|
||||
А112Т4;1;1;1;1;4990;3;6;Женские Ботинки демисезонные kari;1.jpg
|
||||
F635R4;1;1;2;2;3244;2;13;Ботинки Marco Tozzi женские демисезонные, размер 39, цвет бежевый;2.jpg
|
||||
H782T5;2;2;1;1;4499;4;5;Туфли kari мужские классика MYZ21AW-450A, размер 43, цвет: черный;3.jpg
|
||||
G783F5;1;2;3;1;5900;2;8;Мужские ботинки Рос-Обувь кожаные с натуральным мехом;4.jpg
|
||||
J384T6;1;2;4;2;3800;2;16;B3430/14 Полуботинки мужские Rieker;5.jpg
|
||||
D572U8;3;2;3;2;4100;3;6;129615-4 Кроссовки мужские;6.jpg
|
||||
F572H7;2;1;2;1;2700;2;14;Туфли Marco Tozzi женские летние, размер 39, цвет черный;7.jpg
|
||||
D329H3;4;1;5;2;1890;4;4;Полуботинки Alessio Nesca женские 3-30797-47, размер 37, цвет: бордовый;8.jpg
|
||||
B320R5;2;1;4;1;4300;2;6;Туфли Rieker женские демисезонные, размер 41, цвет коричневый;9.jpg
|
||||
G432E4;2;1;1;1;2800;3;15;Туфли kari женские TR-YR-413017, размер 37, цвет: черный;10.jpg
|
||||
S213E3;4;2;6;2;2156;3;6;407700/01-01 Полуботинки мужские CROSBY;
|
||||
E482R4;4;1;1;1;1800;2;14;Полуботинки kari женские MYZ20S-149, размер 41, цвет: черный;
|
||||
S634B5;5;2;6;2;5500;3;0;Кеды Caprice мужские демисезонные, размер 42, цвет черный;
|
||||
K345R4;4;2;6;2;2100;2;3;407700/01-02 Полуботинки мужские CROSBY;
|
||||
O754F4;2;1;4;2;5400;4;18;Туфли женские демисезонные Rieker артикул 55073-68/37;
|
||||
G531F4;1;1;1;1;6600;12;9;Ботинки женские зимние ROMER арт. 893167-01 Черный;
|
||||
J542F5;6;2;1;1;500;13;0;Тапочки мужские Арт.70701-55-67син р.41;
|
||||
B431R5;1;2;4;2;2700;2;5;Мужские кожаные ботинки/мужские ботинки;
|
||||
P764G4;2;1;6;1;6800;15;15;Туфли женские, ARGO, размер 38;
|
||||
C436G5;1;1;5;1;10200;15;9;Ботинки женские, ARGO, размер 40;
|
||||
F427R5;1;1;4;2;11800;15;11;Ботинки на молнии с декоративной пряжкой FRAU;
|
||||
N457T5;4;1;6;1;4600;3;13;Полуботинки Ботинки черные зимние, мех;
|
||||
D364R4;2;1;1;1;12400;16;5;Туфли Luiza Belly женские Kate-lazo черные из натуральной замши;
|
||||
S326R5;6;2;6;2;9900;17;15;"Мужские кожаные тапочки ""Профиль С.Дали"" ";
|
||||
L754R4;4;1;1;1;1700;2;7;Полуботинки kari женские WB2020SS-26, размер 38, цвет: черный;
|
||||
M542T5;3;2;4;2;2800;18;3;Кроссовки мужские TOFA;
|
||||
D268G5;2;1;4;2;4399;3;12;Туфли Rieker женские демисезонные, размер 36, цвет коричневый;
|
||||
T324F5;7;1;6;1;4699;2;5;Сапоги замша Цвет: синий;
|
||||
K358H6;6;2;4;1;599;20;2;Тапочки мужские син р.41;
|
||||
H535R5;1;1;4;2;2300;2;7;Женские Ботинки демисезонные;
|
||||
|
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
role_name
|
||||
Ŕäěčíčńňđŕňîđ
|
||||
Ěĺíĺäćĺđ
|
||||
Ŕâňîđčçîâŕííűé ęëčĺíň
|
||||
|
@@ -0,0 +1,11 @@
|
||||
fio;login;password;role_id
|
||||
Íèêèôîðîâà Âåñåíèÿ Íèêîëàåâíà;94d5ous@gmail.com;uzWC67;1
|
||||
Ñàçîíîâ Ðóñëàí Ãåðìàíîâè÷;uth4iz@mail.com;2L6KZG;1
|
||||
Îäèíöîâ Ñåðàôèì Àðò¸ìîâè÷;yzls62@outlook.com;JlFRCZ;1
|
||||
Ñòåïàíîâ Ìèõàèë Àðò¸ìîâè÷;1diph5e@tutanota.com;8ntwUp;2
|
||||
Âîðñèí Ïåòð Åâãåíüåâè÷;tjde7c@yahoo.com;YOyhfR;2
|
||||
Ñòàðèêîâà Åëåíà Ïàâëîâíà;wpmrc3do@tutanota.com;RSbvHv;2
|
||||
Ìèõàéëþê Àííà Âÿ÷åñëàâîâíà;5d4zbu@tutanota.com;rwVDh9;3
|
||||
Ñèòäèêîâà Åëåíà Àíàòîëüåâíà;ptec8ym@yahoo.com;LdNyos;3
|
||||
Âîðñèí Ïåòð Åâãåíüåâè÷;1qz4kw@mail.com;gynQMT;3
|
||||
Ñòàðèêîâà Åëåíà Ïàâëîâíà;4np6se@mail.com;AtnDjr;3
|
||||
|
@@ -0,0 +1,71 @@
|
||||
CREATE TABLE category (
|
||||
id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||||
category_name VARCHAR(250) NOT NULL,
|
||||
unit VARCHAR(10) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE manufacturer (
|
||||
id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||||
manufacturer_name VARCHAR(250) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE sections (
|
||||
id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||||
name VARCHAR(100) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE supplier (
|
||||
id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||||
sup_name VARCHAR(200) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE roles (
|
||||
id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||||
role_name VARCHAR(100) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE pvz (
|
||||
id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||||
address VARCHAR(255) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE user_info (
|
||||
id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||||
fio VARCHAR(255) NOT NULL,
|
||||
login VARCHAR(255) NOT NULL UNIQUE,
|
||||
password VARCHAR(255) NOT NULL,
|
||||
role_id INT NOT NULL REFERENCES roles(id)
|
||||
);
|
||||
|
||||
CREATE TABLE tovar (
|
||||
id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||||
art VARCHAR(250),
|
||||
id_category INT NOT NULL REFERENCES category(id),
|
||||
id_section INT NOT NULL REFERENCES sections(id),
|
||||
id_manufacturer INT NOT NULL REFERENCES manufacturer(id),
|
||||
id_supplier INT NOT NULL REFERENCES supplier(id),
|
||||
cost DECIMAL(10, 2) NOT NULL,
|
||||
discount INT DEFAULT 0,
|
||||
amount INT NOT NULL DEFAULT 0,
|
||||
description TEXT,
|
||||
photo TEXT
|
||||
);
|
||||
|
||||
CREATE TYPE order_status AS ENUM ('Завершен', 'Новый', 'В пути');
|
||||
|
||||
CREATE TABLE orders (
|
||||
id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||||
order_date TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
delivery_date TIMESTAMPTZ,
|
||||
address_pvz_id INT NOT NULL REFERENCES pvz(id),
|
||||
id_user INT NOT NULL REFERENCES user_info(id),
|
||||
code VARCHAR(10),
|
||||
status order_status NOT NULL DEFAULT 'Новый'
|
||||
);
|
||||
|
||||
CREATE TABLE order_details (
|
||||
id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||||
id_order INT NOT NULL REFERENCES orders(id) ON DELETE CASCADE,
|
||||
art_id INT NOT NULL REFERENCES tovar(id),
|
||||
amount INT NOT NULL CHECK (amount > 0)
|
||||
);
|
||||
Reference in New Issue
Block a user