This commit is contained in:
gitea 2024-09-05 16:22:57 +03:00
commit 88e7296c97
199 changed files with 6784 additions and 0 deletions

Binary file not shown.

BIN
.vs/Demo/v17/.futdcache.v2 Normal file

Binary file not shown.

BIN
.vs/Demo/v17/.suo Normal file

Binary file not shown.

View File

@ -0,0 +1,71 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\prdb\\source\\repos\\Demo\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{3014C8EE-92B3-4D09-94B0-3E3FC712DC0F}|Demo\\Demo.csproj|c:\\users\\prdb\\source\\repos\\demo\\demo\\mainwindow.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{3014C8EE-92B3-4D09-94B0-3E3FC712DC0F}|Demo\\Demo.csproj|solutionrelative:demo\\mainwindow.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{3014C8EE-92B3-4D09-94B0-3E3FC712DC0F}|Demo\\Demo.csproj|c:\\users\\prdb\\source\\repos\\demo\\demo\\utils\\context.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{3014C8EE-92B3-4D09-94B0-3E3FC712DC0F}|Demo\\Demo.csproj|solutionrelative:demo\\utils\\context.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{3014C8EE-92B3-4D09-94B0-3E3FC712DC0F}|Demo\\Demo.csproj|c:\\users\\prdb\\source\\repos\\demo\\demo\\ui\\changemodedialog.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{3014C8EE-92B3-4D09-94B0-3E3FC712DC0F}|Demo\\Demo.csproj|solutionrelative:demo\\ui\\changemodedialog.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 2,
"Children": [
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "Context.cs",
"DocumentMoniker": "C:\\Users\\prdb\\source\\repos\\Demo\\Demo\\Utils\\Context.cs",
"RelativeDocumentMoniker": "Demo\\Utils\\Context.cs",
"ToolTip": "C:\\Users\\prdb\\source\\repos\\Demo\\Demo\\Utils\\Context.cs",
"RelativeToolTip": "Demo\\Utils\\Context.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-09-05T13:03:18.495Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "ChangeModeDialog.axaml.cs",
"DocumentMoniker": "C:\\Users\\prdb\\source\\repos\\Demo\\Demo\\UI\\ChangeModeDialog.axaml.cs",
"RelativeDocumentMoniker": "Demo\\UI\\ChangeModeDialog.axaml.cs",
"ToolTip": "C:\\Users\\prdb\\source\\repos\\Demo\\Demo\\UI\\ChangeModeDialog.axaml.cs",
"RelativeToolTip": "Demo\\UI\\ChangeModeDialog.axaml.cs",
"ViewState": "AgIAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-09-05T11:26:55.57Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "MainWindow.axaml.cs",
"DocumentMoniker": "C:\\Users\\prdb\\source\\repos\\Demo\\Demo\\MainWindow.axaml.cs",
"RelativeDocumentMoniker": "Demo\\MainWindow.axaml.cs",
"ToolTip": "C:\\Users\\prdb\\source\\repos\\Demo\\Demo\\MainWindow.axaml.cs*",
"RelativeToolTip": "Demo\\MainWindow.axaml.cs*",
"ViewState": "AgIAAEwAAAAAAAAAAAAywFsAAAAPAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-09-05T09:16:42.751Z",
"EditorCaption": ""
}
]
}
]
}
]
}

View File

@ -0,0 +1,71 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\prdb\\source\\repos\\Demo\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{3014C8EE-92B3-4D09-94B0-3E3FC712DC0F}|Demo\\Demo.csproj|c:\\users\\prdb\\source\\repos\\demo\\demo\\mainwindow.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{3014C8EE-92B3-4D09-94B0-3E3FC712DC0F}|Demo\\Demo.csproj|solutionrelative:demo\\mainwindow.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{3014C8EE-92B3-4D09-94B0-3E3FC712DC0F}|Demo\\Demo.csproj|c:\\users\\prdb\\source\\repos\\demo\\demo\\utils\\context.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{3014C8EE-92B3-4D09-94B0-3E3FC712DC0F}|Demo\\Demo.csproj|solutionrelative:demo\\utils\\context.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{3014C8EE-92B3-4D09-94B0-3E3FC712DC0F}|Demo\\Demo.csproj|c:\\users\\prdb\\source\\repos\\demo\\demo\\ui\\changemodedialog.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{3014C8EE-92B3-4D09-94B0-3E3FC712DC0F}|Demo\\Demo.csproj|solutionrelative:demo\\ui\\changemodedialog.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 2,
"Children": [
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "Context.cs",
"DocumentMoniker": "C:\\Users\\prdb\\source\\repos\\Demo\\Demo\\Utils\\Context.cs",
"RelativeDocumentMoniker": "Demo\\Utils\\Context.cs",
"ToolTip": "C:\\Users\\prdb\\source\\repos\\Demo\\Demo\\Utils\\Context.cs",
"RelativeToolTip": "Demo\\Utils\\Context.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-09-05T13:03:18.495Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "ChangeModeDialog.axaml.cs",
"DocumentMoniker": "C:\\Users\\prdb\\source\\repos\\Demo\\Demo\\UI\\ChangeModeDialog.axaml.cs",
"RelativeDocumentMoniker": "Demo\\UI\\ChangeModeDialog.axaml.cs",
"ToolTip": "C:\\Users\\prdb\\source\\repos\\Demo\\Demo\\UI\\ChangeModeDialog.axaml.cs",
"RelativeToolTip": "Demo\\UI\\ChangeModeDialog.axaml.cs",
"ViewState": "AgIAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-09-05T11:26:55.57Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "MainWindow.axaml.cs",
"DocumentMoniker": "C:\\Users\\prdb\\source\\repos\\Demo\\Demo\\MainWindow.axaml.cs",
"RelativeDocumentMoniker": "Demo\\MainWindow.axaml.cs",
"ToolTip": "C:\\Users\\prdb\\source\\repos\\Demo\\Demo\\MainWindow.axaml.cs",
"RelativeToolTip": "Demo\\MainWindow.axaml.cs",
"ViewState": "AgIAACAAAAAAAAAAAAAqwC8AAABTAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-09-05T09:16:42.751Z",
"EditorCaption": ""
}
]
}
]
}
]
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

25
Demo.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.35222.181
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo", "Demo\Demo.csproj", "{3014C8EE-92B3-4D09-94B0-3E3FC712DC0F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3014C8EE-92B3-4D09-94B0-3E3FC712DC0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3014C8EE-92B3-4D09-94B0-3E3FC712DC0F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3014C8EE-92B3-4D09-94B0-3E3FC712DC0F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3014C8EE-92B3-4D09-94B0-3E3FC712DC0F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6F897B91-E585-4BA6-B131-92AAFA5C6B68}
EndGlobalSection
EndGlobal

17
Demo/App.axaml Normal file
View File

@ -0,0 +1,17 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Demo.App"
RequestedThemeVariant="Default">
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
<Application.Styles>
<FluentTheme />
</Application.Styles>
<Application.Resources>
<SolidColorBrush x:Key="PrimaryColor">#ffffff</SolidColorBrush>
<SolidColorBrush x:Key="SecondryColor">#ffffe1</SolidColorBrush>
<SolidColorBrush x:Key="AccentColor">#ff9c1a</SolidColorBrush>
</Application.Resources>
</Application>

24
Demo/App.axaml.cs Normal file
View File

@ -0,0 +1,24 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
namespace Demo
{
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();
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

29
Demo/Demo.csproj Normal file
View File

@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationManifest>app.manifest</ApplicationManifest>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
</PropertyGroup>
<ItemGroup>
<AvaloniaResource Include="Assets\**"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.1.0" />
<PackageReference Include="Avalonia.Desktop" Version="11.1.0" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.1.0" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.1.0" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
namespace Demo.EntityModels;
public partial class Client
{
public int Id { get; set; }
public string Firstname { get; set; } = null!;
public string Lastname { get; set; } = null!;
public string? Patronymic { get; set; }
public DateOnly? Birthday { get; set; }
public DateTime Registrationdate { get; set; }
public string? Email { get; set; }
public string Phone { get; set; } = null!;
public int Gendercode { get; set; }
public string? Photopath { get; set; }
public virtual ICollection<Clientservice> Clientservices { get; set; } = new List<Clientservice>();
public virtual Gender GendercodeNavigation { get; set; } = null!;
public virtual ICollection<Tag> Tags { get; set; } = new List<Tag>();
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
namespace Demo.EntityModels;
public partial class Clientservice
{
public int Id { get; set; }
public int Clientid { get; set; }
public int Serviceid { get; set; }
public DateTime Starttime { get; set; }
public string? Comment { get; set; }
public virtual Client Client { get; set; } = null!;
public virtual ICollection<Documentbyservice> Documentbyservices { get; set; } = new List<Documentbyservice>();
public virtual ICollection<Productsale> Productsales { get; set; } = new List<Productsale>();
public virtual Service Service { get; set; } = null!;
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
namespace Demo.EntityModels;
public partial class Documentbyservice
{
public int Id { get; set; }
public int Clientserviceid { get; set; }
public string Documentpath { get; set; } = null!;
public virtual Clientservice Clientservice { get; set; } = null!;
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
namespace Demo.EntityModels;
public partial class Gender
{
public int Code { get; set; }
public string? Name { get; set; }
public virtual ICollection<Client> Clients { get; set; } = new List<Client>();
}

View File

@ -0,0 +1,334 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
namespace Demo.EntityModels;
public partial class IsajkinContext : DbContext
{
public IsajkinContext()
{
}
public IsajkinContext(DbContextOptions<IsajkinContext> options)
: base(options)
{
}
public virtual DbSet<Client> Clients { get; set; }
public virtual DbSet<Clientservice> Clientservices { get; set; }
public virtual DbSet<Documentbyservice> Documentbyservices { get; set; }
public virtual DbSet<Gender> Genders { get; set; }
public virtual DbSet<Manufacturer> Manufacturers { get; set; }
public virtual DbSet<Product> Products { get; set; }
public virtual DbSet<Productphoto> Productphotos { get; set; }
public virtual DbSet<Productsale> Productsales { get; set; }
public virtual DbSet<Service> Services { get; set; }
public virtual DbSet<Servicephoto> Servicephotos { get; set; }
public virtual DbSet<Tag> Tags { 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=45.67.56.214;Username=isajkin;Password=hqD9f9EZ;Port=5454");
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Client>(entity =>
{
entity.HasKey(e => e.Id).HasName("client_pkey");
entity.ToTable("client");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.Birthday).HasColumnName("birthday");
entity.Property(e => e.Email)
.HasMaxLength(255)
.HasColumnName("email");
entity.Property(e => e.Firstname)
.HasMaxLength(50)
.HasColumnName("firstname");
entity.Property(e => e.Gendercode).HasColumnName("gendercode");
entity.Property(e => e.Lastname)
.HasMaxLength(50)
.HasColumnName("lastname");
entity.Property(e => e.Patronymic)
.HasMaxLength(50)
.HasColumnName("patronymic");
entity.Property(e => e.Phone)
.HasMaxLength(20)
.HasColumnName("phone");
entity.Property(e => e.Photopath)
.HasMaxLength(1000)
.HasColumnName("photopath");
entity.Property(e => e.Registrationdate)
.HasColumnType("timestamp(6) without time zone")
.HasColumnName("registrationdate");
entity.HasOne(d => d.GendercodeNavigation).WithMany(p => p.Clients)
.HasForeignKey(d => d.Gendercode)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_client_gender");
entity.HasMany(d => d.Tags).WithMany(p => p.Clients)
.UsingEntity<Dictionary<string, object>>(
"Tagofclient",
r => r.HasOne<Tag>().WithMany()
.HasForeignKey("Tagid")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_tagofclient_tag"),
l => l.HasOne<Client>().WithMany()
.HasForeignKey("Clientid")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_tagofclient_client"),
j =>
{
j.HasKey("Clientid", "Tagid").HasName("tagofclient_pkey");
j.ToTable("tagofclient");
j.IndexerProperty<int>("Clientid").HasColumnName("clientid");
j.IndexerProperty<int>("Tagid").HasColumnName("tagid");
});
});
modelBuilder.Entity<Clientservice>(entity =>
{
entity.HasKey(e => e.Id).HasName("clientservice_pkey");
entity.ToTable("clientservice");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.Clientid).HasColumnName("clientid");
entity.Property(e => e.Comment).HasColumnName("comment");
entity.Property(e => e.Serviceid).HasColumnName("serviceid");
entity.Property(e => e.Starttime)
.HasColumnType("timestamp(6) without time zone")
.HasColumnName("starttime");
entity.HasOne(d => d.Client).WithMany(p => p.Clientservices)
.HasForeignKey(d => d.Clientid)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_clientservice_client");
entity.HasOne(d => d.Service).WithMany(p => p.Clientservices)
.HasForeignKey(d => d.Serviceid)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_clientservice_service");
});
modelBuilder.Entity<Documentbyservice>(entity =>
{
entity.HasKey(e => e.Id).HasName("documentbyservice_pkey");
entity.ToTable("documentbyservice");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.Clientserviceid).HasColumnName("clientserviceid");
entity.Property(e => e.Documentpath)
.HasMaxLength(1000)
.HasColumnName("documentpath");
entity.HasOne(d => d.Clientservice).WithMany(p => p.Documentbyservices)
.HasForeignKey(d => d.Clientserviceid)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_documentbyservice_clientservice");
});
modelBuilder.Entity<Gender>(entity =>
{
entity.HasKey(e => e.Code).HasName("gender_pkey");
entity.ToTable("gender");
entity.Property(e => e.Code).HasColumnName("code");
entity.Property(e => e.Name)
.HasMaxLength(10)
.HasColumnName("name");
});
modelBuilder.Entity<Manufacturer>(entity =>
{
entity.HasKey(e => e.Id).HasName("manufacturer_pkey");
entity.ToTable("manufacturer");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.Name)
.HasMaxLength(100)
.HasColumnName("name");
entity.Property(e => e.Startdate).HasColumnName("startdate");
});
modelBuilder.Entity<Product>(entity =>
{
entity.HasKey(e => e.Id).HasName("product_pkey");
entity.ToTable("product");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.Cost)
.HasPrecision(19, 4)
.HasColumnName("cost");
entity.Property(e => e.Description).HasColumnName("description");
entity.Property(e => e.Isactive).HasColumnName("isactive");
entity.Property(e => e.Mainimagepath)
.HasMaxLength(1000)
.HasColumnName("mainimagepath");
entity.Property(e => e.Manufacturerid).HasColumnName("manufacturerid");
entity.Property(e => e.Title)
.HasMaxLength(100)
.HasColumnName("title");
entity.HasOne(d => d.Manufacturer).WithMany(p => p.Products)
.HasForeignKey(d => d.Manufacturerid)
.HasConstraintName("fk_product_manufacturer");
entity.HasMany(d => d.Attachedproducts).WithMany(p => p.Mainproducts)
.UsingEntity<Dictionary<string, object>>(
"Attachedproduct",
r => r.HasOne<Product>().WithMany()
.HasForeignKey("Attachedproductid")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_attachedproduct_product1"),
l => l.HasOne<Product>().WithMany()
.HasForeignKey("Mainproductid")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_attachedproduct_product"),
j =>
{
j.HasKey("Mainproductid", "Attachedproductid").HasName("attachedproduct_pkey");
j.ToTable("attachedproduct");
j.IndexerProperty<int>("Mainproductid").HasColumnName("mainproductid");
j.IndexerProperty<int>("Attachedproductid").HasColumnName("attachedproductid");
});
entity.HasMany(d => d.Mainproducts).WithMany(p => p.Attachedproducts)
.UsingEntity<Dictionary<string, object>>(
"Attachedproduct",
r => r.HasOne<Product>().WithMany()
.HasForeignKey("Mainproductid")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_attachedproduct_product"),
l => l.HasOne<Product>().WithMany()
.HasForeignKey("Attachedproductid")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_attachedproduct_product1"),
j =>
{
j.HasKey("Mainproductid", "Attachedproductid").HasName("attachedproduct_pkey");
j.ToTable("attachedproduct");
j.IndexerProperty<int>("Mainproductid").HasColumnName("mainproductid");
j.IndexerProperty<int>("Attachedproductid").HasColumnName("attachedproductid");
});
});
modelBuilder.Entity<Productphoto>(entity =>
{
entity.HasKey(e => e.Id).HasName("productphoto_pkey");
entity.ToTable("productphoto");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.Photopath)
.HasMaxLength(1000)
.HasColumnName("photopath");
entity.Property(e => e.Productid).HasColumnName("productid");
entity.HasOne(d => d.Product).WithMany(p => p.Productphotos)
.HasForeignKey(d => d.Productid)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_productphoto_product");
});
modelBuilder.Entity<Productsale>(entity =>
{
entity.HasKey(e => e.Id).HasName("productsale_pkey");
entity.ToTable("productsale");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.Clientserviceid).HasColumnName("clientserviceid");
entity.Property(e => e.Productid).HasColumnName("productid");
entity.Property(e => e.Quantity).HasColumnName("quantity");
entity.Property(e => e.Saledate)
.HasColumnType("timestamp(6) without time zone")
.HasColumnName("saledate");
entity.HasOne(d => d.Clientservice).WithMany(p => p.Productsales)
.HasForeignKey(d => d.Clientserviceid)
.HasConstraintName("fk_productsale_clientservice");
entity.HasOne(d => d.Product).WithMany(p => p.Productsales)
.HasForeignKey(d => d.Productid)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_productsale_product");
});
modelBuilder.Entity<Service>(entity =>
{
entity.HasKey(e => e.Id).HasName("service_pkey");
entity.ToTable("service");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.Cost)
.HasPrecision(19, 4)
.HasColumnName("cost");
entity.Property(e => e.Description).HasColumnName("description");
entity.Property(e => e.Discount).HasColumnName("discount");
entity.Property(e => e.Durationinminutes).HasColumnName("durationinminutes");
entity.Property(e => e.Mainimagepath)
.HasMaxLength(1000)
.HasColumnName("mainimagepath");
entity.Property(e => e.Title)
.HasMaxLength(100)
.HasColumnName("title");
});
modelBuilder.Entity<Servicephoto>(entity =>
{
entity.HasKey(e => e.Id).HasName("servicephoto_pkey");
entity.ToTable("servicephoto");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.Photopath)
.HasMaxLength(1000)
.HasColumnName("photopath");
entity.Property(e => e.Serviceid).HasColumnName("serviceid");
entity.HasOne(d => d.Service).WithMany(p => p.Servicephotos)
.HasForeignKey(d => d.Serviceid)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_servicephoto_service");
});
modelBuilder.Entity<Tag>(entity =>
{
entity.HasKey(e => e.Id).HasName("tag_pkey");
entity.ToTable("tag");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.Color)
.HasMaxLength(6)
.IsFixedLength()
.HasColumnName("color");
entity.Property(e => e.Title)
.HasMaxLength(30)
.HasColumnName("title");
});
OnModelCreatingPartial(modelBuilder);
}
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
namespace Demo.EntityModels;
public partial class Manufacturer
{
public int Id { get; set; }
public string Name { get; set; } = null!;
public DateOnly? Startdate { get; set; }
public virtual ICollection<Product> Products { get; set; } = new List<Product>();
}

View File

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
namespace Demo.EntityModels;
public partial class Product
{
public int Id { get; set; }
public string Title { get; set; } = null!;
public decimal Cost { get; set; }
public string? Description { get; set; }
public string? Mainimagepath { get; set; }
public int Isactive { get; set; }
public int? Manufacturerid { get; set; }
public virtual Manufacturer? Manufacturer { get; set; }
public virtual ICollection<Productphoto> Productphotos { get; set; } = new List<Productphoto>();
public virtual ICollection<Productsale> Productsales { get; set; } = new List<Productsale>();
public virtual ICollection<Product> Attachedproducts { get; set; } = new List<Product>();
public virtual ICollection<Product> Mainproducts { get; set; } = new List<Product>();
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
namespace Demo.EntityModels;
public partial class Productphoto
{
public int Id { get; set; }
public int Productid { get; set; }
public string Photopath { get; set; } = null!;
public virtual Product Product { get; set; } = null!;
}

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
namespace Demo.EntityModels;
public partial class Productsale
{
public int Id { get; set; }
public DateTime Saledate { get; set; }
public int Productid { get; set; }
public int Quantity { get; set; }
public int? Clientserviceid { get; set; }
public virtual Clientservice? Clientservice { get; set; }
public virtual Product Product { get; set; } = null!;
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
namespace Demo.EntityModels;
public partial class Service
{
public int Id { get; set; }
public string Title { get; set; } = null!;
public decimal Cost { get; set; }
public int Durationinminutes { get; set; }
public string? Description { get; set; }
public double? Discount { get; set; }
public string? Mainimagepath { get; set; }
public virtual ICollection<Clientservice> Clientservices { get; set; } = new List<Clientservice>();
public virtual ICollection<Servicephoto> Servicephotos { get; set; } = new List<Servicephoto>();
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
namespace Demo.EntityModels;
public partial class Servicephoto
{
public int Id { get; set; }
public int Serviceid { get; set; }
public string Photopath { get; set; } = null!;
public virtual Service Service { get; set; } = null!;
}

15
Demo/EntityModels/Tag.cs Normal file
View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
namespace Demo.EntityModels;
public partial class Tag
{
public int Id { get; set; }
public string Title { get; set; } = null!;
public string Color { get; set; } = null!;
public virtual ICollection<Client> Clients { get; set; } = new List<Client>();
}

45
Demo/MainWindow.axaml Normal file
View File

@ -0,0 +1,45 @@
<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="Demo.MainWindow"
x:CompileBindings="False"
Title="Demo">
<DockPanel Background="{StaticResource AccentColor}">
<Border DockPanel.Dock="Top" Background="White">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="25">
<TextBox Width="250" Name="SearchTextBox" TextChanging="SearchTextBox_TextChanging"/>
<ComboBox Name="DiscountComboBox"/>
<ComboBox Name="SortComboBox" SelectionChanged="SortComboBox_SelectionChanged"/>
<Button Name="ChangeModeButton" Click="ChangeModeButton_ClickAsync">Смена режима</Button>
</StackPanel>
</Border>
<Border DockPanel.Dock="Bottom" Background="Green">
<TextBlock Name="CountValues"/>
</Border>
<Border Width="250" Name="AdminPanel" DockPanel.Dock="Right" Background="Aqua" IsVisible="False">
<Image Name="MyImage" Width="100" Height="100"/>
</Border>
<Border>
<ListBox Name="ServiceList">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image />
<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding ServiceName}" />
<TextBlock Text="{Binding ServicePriceMinutes}"/>
<TextBlock Text="{Binding ServiceDiscount}"/>
<StackPanel Name="AdminServicePanel" Orientation="Horizontal" IsVisible="{Binding AdminMode}">
<Button Name="EditButton" />
<Button Name="RemoveButton" />
</StackPanel>
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
</DockPanel>
</Window>

156
Demo/MainWindow.axaml.cs Normal file
View File

@ -0,0 +1,156 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Media;
using Avalonia.Media.Imaging;
using Avalonia.Platform;
using Avalonia.Platform.Storage;
using Demo.EntityModels;
using Demo.Utils;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Tmds.DBus.Protocol;
namespace Demo
{
public partial class MainWindow : Window
{
//flags
private bool AdminMode = false;
private bool IsFiltred = false;
//null - nothing, 0 - asc, 1 - desc
private bool? SortedMode = null;
//changedList
private string SearchWord = "";
//constants for comboboxes
private string[] sortValues = new string[3] { "îòñóò", "ïî âîçðàñò.", "ïî óáûâ." };
private List<Service> services = new List<Service>()
{
new Service(){ ServiceName = "Abc", ServiceDiscount="Abc", ServicePriceMinutes = "Abc" },
new Service(){ ServiceName = "cba", ServiceDiscount="cba", ServicePriceMinutes = "cba" },
new Service(){ ServiceName = "bca", ServiceDiscount="bca", ServicePriceMinutes = "bca" },
new Service(){ ServiceName = "ccb", ServiceDiscount="ccb", ServicePriceMinutes = "ccb" }
};
public MainWindow()
{
InitializeComponent();
MyImage.Source = new Bitmap(AssetLoader.Open(new System.Uri("avares://Assets/service_layout.png")));
services = Context
.DbContext
.Services.Select(service => new Service
{
ServiceDiscount = service.Discount.ToString(),
ServiceName = service.Title,
ServicePriceMinutes = $"{service.Cost}/{service.Durationinminutes}"
}).ToList();
SortComboBox.ItemsSource = sortValues;
SortComboBox.SelectedIndex = 0;
DisplayService();
}
private void Button_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
{
AdminPanel.IsVisible = !AdminPanel.IsVisible;
}
private void SearchTextBox_TextChanging(object? sender, Avalonia.Controls.TextChangingEventArgs e)
{
string inputValue = (sender as TextBox).Text;
SearchWord = inputValue.ToLower();
DisplayService();
}
public async void ChangeModeButton_ClickAsync(object sender, RoutedEventArgs e)
{
var changeModeDialog = new ChangeModeDialog();
AdminMode = await changeModeDialog.ShowDialog<bool>(this);
AdminPanel.IsVisible = AdminMode;
DisplayService();
}
private void DisplayService()
{
List<Service> displayList = services;
if (!string.IsNullOrEmpty(SearchWord)) {
displayList =
displayList
.Where(x =>
x.ServiceName
.ToLower()
.Contains(SearchWord)
).ToList();
}
switch (SortedMode)
{
case true: displayList =
displayList
.OrderBy(
service =>
service.ServiceName)
.ToList(); break;
case false: displayList =
displayList
.OrderByDescending(
service =>
service.ServiceName)
.ToList(); break;
case null:
break;
}
ServiceList.ItemsSource = displayList
.Select(service => service.SetAdminMode(AdminMode))
.ToList();
CountValues.Text = $"Îòîáðæàåòñÿ:{displayList.Count}/Âñåãî:{services.Count}";
}
class Service()
{
public string ServiceName { get; set; }
public string ServicePriceMinutes { get; set; }
public string ServiceDiscount { get; set; }
public bool AdminMode { get; set; } = false;
public Service SetAdminMode(bool mode)
{
this.AdminMode = mode;
return this;
}
}
private void SortComboBox_SelectionChanged(object? sender, Avalonia.Controls.SelectionChangedEventArgs e)
{
int selectedIndex = (sender as ComboBox).SelectedIndex;
switch (selectedIndex) {
case 1: SortedMode = false; break;
case 2: SortedMode = true; break;
default:
SortedMode = null; break;
}
DisplayService();
}
}
}

22
Demo/Program.cs Normal file
View File

@ -0,0 +1,22 @@
using Avalonia;
using System;
namespace Demo
{
internal 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();
}
}

View 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="150" d:DesignHeight="60"
x:Class="Demo.ChangeModeDialog"
Title="ChangeModeDialog">
<StackPanel Orientation="Vertical">
<TextBlock>Введите код для смены режима</TextBlock>
<TextBox Name="TextBoxCode"/>
<StackPanel Orientation="Horizontal">
<Button Name="SendButton" Click="SendButton_Click">Отрпавить</Button>
<Button Name="DeclineButton" Click="DeclineButton_Click">Отменить</Button>
</StackPanel>
</StackPanel>
</Window>

View File

@ -0,0 +1,22 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Demo;
public partial class ChangeModeDialog : Window
{
public ChangeModeDialog()
{
InitializeComponent();
}
private void SendButton_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
{
if(TextBoxCode.Text == "0000") Close(true);
}
private void DeclineButton_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
{
Close(false);
}
}

15
Demo/Utils/Context.cs Normal file
View File

@ -0,0 +1,15 @@
using Demo.EntityModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Demo.Utils
{
public static class Context
{
public static IsajkinContext DbContext { get; set; } = new IsajkinContext();
}
}

18
Demo/app.manifest Normal file
View 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="Demo.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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,14 @@
{
"runtimeOptions": {
"tfm": "net8.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "8.0.0"
},
"configProperties": {
"System.Reflection.NullabilityInfoContext.IsSupported": true,
"System.Runtime.InteropServices.BuiltInComInterop.IsSupported": true,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More