1 экран

This commit is contained in:
kto765 2025-02-05 13:47:39 +03:00
commit dd6cd84a0d
190 changed files with 8121 additions and 0 deletions

10
App.axaml Normal file
View File

@ -0,0 +1,10 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Blagodat.App"
RequestedThemeVariant="Default">
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
<Application.Styles>
<FluentTheme />
</Application.Styles>
</Application>

23
App.axaml.cs Normal file
View File

@ -0,0 +1,23 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
namespace Blagodat;
public partial class App : Application
{
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
desktop.MainWindow = new Registration();
}
base.OnFrameworkInitializationCompleted();
}
}

29
Blagodat.csproj Normal file
View File

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

22
Blagodat.sln Normal file
View File

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.12.35514.174 d17.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blagodat", "Blagodat.csproj", "{FECC1AE0-6656-4657-8763-B25A62C978C3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FECC1AE0-6656-4657-8763-B25A62C978C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FECC1AE0-6656-4657-8763-B25A62C978C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FECC1AE0-6656-4657-8763-B25A62C978C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FECC1AE0-6656-4657-8763-B25A62C978C3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

11
MainWindow.axaml Normal file
View File

@ -0,0 +1,11 @@
<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="Blagodat.MainWindow"
Title="Function Window" Height="250" Width="300">
<DockPanel>
</DockPanel>
</Window>

16
MainWindow.axaml.cs Normal file
View File

@ -0,0 +1,16 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using ReactiveUI;
namespace Blagodat;
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
new Registration().Show();
}
}

23
Models/Client.cs Normal file
View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
namespace Blagodat.Models;
public partial class Client
{
public int ClientId { get; set; }
public string? Fio { get; set; }
public int? CodeClient { get; set; }
public string PassportData { get; set; } = null!;
public DateOnly? DateOfBirth { get; set; }
public string? Address { get; set; }
public string? EMail { get; set; }
public string? Password { get; set; }
}

23
Models/Order.cs Normal file
View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
namespace Blagodat.Models;
public partial class Order
{
public int IdOrder { get; set; }
public int ClientCode { get; set; }
public DateOnly DateOfCreation { get; set; }
public TimeOnly OrderTime { get; set; }
public string Status { get; set; } = null!;
public DateOnly? ClosingDate { get; set; }
public int RentalTimeMin { get; set; }
public virtual ICollection<OrdersAndService> OrdersAndServices { get; set; } = new List<OrdersAndService>();
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
namespace Blagodat.Models;
public partial class OrdersAndService
{
public int IdOrdersAndServices { get; set; }
public int? Order { get; set; }
public int? Service { get; set; }
public virtual Order? OrderNavigation { get; set; }
public virtual Service? ServiceNavigation { get; set; }
}

17
Models/Service.cs Normal file
View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
namespace Blagodat.Models;
public partial class Service
{
public int IdServices { get; set; }
public string? NameServices { get; set; }
public string? CodeServices { get; set; }
public decimal? CostPerHour { get; set; }
public virtual ICollection<OrdersAndService> OrdersAndServices { get; set; } = new List<OrdersAndService>();
}

23
Models/Staff.cs Normal file
View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
namespace Blagodat.Models;
public partial class Staff
{
public string IdStaff { get; set; } = null!;
public string? Post { get; set; }
public string? Fio { get; set; }
public string? Login { get; set; }
public string? Password { get; set; }
public DateOnly? LastLoginDate { get; set; }
public TimeOnly? LastLoginTime { get; set; }
public bool? TypeOfEntrance { get; set; }
}

148
Models/User7Context.cs Normal file
View File

@ -0,0 +1,148 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
namespace Blagodat.Models;
public partial class User7Context : DbContext
{
public User7Context()
{
}
public User7Context(DbContextOptions<User7Context> options)
: base(options)
{
}
public virtual DbSet<Client> Clients { get; set; }
public virtual DbSet<Order> Orders { get; set; }
public virtual DbSet<OrdersAndService> OrdersAndServices { get; set; }
public virtual DbSet<Service> Services { get; set; }
public virtual DbSet<Staff> Staff { 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;Port=5421;Database=user7;Username=user7;Password=a8yLONBC");
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Client>(entity =>
{
entity.HasKey(e => e.ClientId).HasName("clients_pk");
entity.ToTable("clients", "blagodat");
entity.Property(e => e.ClientId)
.UseIdentityAlwaysColumn()
.HasColumnName("client_id");
entity.Property(e => e.Address)
.HasColumnType("character varying")
.HasColumnName("address");
entity.Property(e => e.CodeClient).HasColumnName("code_client");
entity.Property(e => e.DateOfBirth).HasColumnName("date_of_birth");
entity.Property(e => e.EMail)
.HasColumnType("character varying")
.HasColumnName("e-mail");
entity.Property(e => e.Fio)
.HasColumnType("character varying")
.HasColumnName("fio");
entity.Property(e => e.PassportData)
.HasColumnType("character varying")
.HasColumnName("passport_data");
entity.Property(e => e.Password)
.HasColumnType("character varying")
.HasColumnName("password");
});
modelBuilder.Entity<Order>(entity =>
{
entity.HasKey(e => e.IdOrder).HasName("orders_pkey");
entity.ToTable("orders", "blagodat");
entity.Property(e => e.IdOrder)
.UseIdentityAlwaysColumn()
.HasColumnName("id_order");
entity.Property(e => e.ClientCode).HasColumnName("client_code");
entity.Property(e => e.ClosingDate).HasColumnName("closing_date");
entity.Property(e => e.DateOfCreation).HasColumnName("date_of_creation");
entity.Property(e => e.OrderTime).HasColumnName("order_time");
entity.Property(e => e.RentalTimeMin).HasColumnName("rental_time_min");
entity.Property(e => e.Status)
.HasColumnType("character varying")
.HasColumnName("status");
});
modelBuilder.Entity<OrdersAndService>(entity =>
{
entity.HasKey(e => e.IdOrdersAndServices).HasName("orders_and_services_pk");
entity.ToTable("orders_and_services", "blagodat");
entity.Property(e => e.IdOrdersAndServices)
.UseIdentityAlwaysColumn()
.HasColumnName("id_orders_and_services");
entity.Property(e => e.Order).HasColumnName("order");
entity.Property(e => e.Service).HasColumnName("service");
entity.HasOne(d => d.OrderNavigation).WithMany(p => p.OrdersAndServices)
.HasForeignKey(d => d.Order)
.HasConstraintName("orders_and_services_orders_fk");
entity.HasOne(d => d.ServiceNavigation).WithMany(p => p.OrdersAndServices)
.HasForeignKey(d => d.Service)
.HasConstraintName("orders_and_services_services_fk");
});
modelBuilder.Entity<Service>(entity =>
{
entity.HasKey(e => e.IdServices).HasName("services_pk");
entity.ToTable("services", "blagodat");
entity.Property(e => e.IdServices)
.ValueGeneratedNever()
.HasColumnName("id_services");
entity.Property(e => e.CodeServices)
.HasColumnType("character varying")
.HasColumnName("code_services");
entity.Property(e => e.CostPerHour).HasColumnName("cost_per_hour");
entity.Property(e => e.NameServices)
.HasColumnType("character varying")
.HasColumnName("name_services");
});
modelBuilder.Entity<Staff>(entity =>
{
entity.HasKey(e => e.IdStaff).HasName("staff_pk");
entity.ToTable("staff", "blagodat");
entity.Property(e => e.IdStaff)
.HasColumnType("character varying")
.HasColumnName("id_staff");
entity.Property(e => e.Fio)
.HasColumnType("character varying")
.HasColumnName("fio");
entity.Property(e => e.LastLoginDate).HasColumnName("last_login_date");
entity.Property(e => e.LastLoginTime).HasColumnName("last_login_time");
entity.Property(e => e.Login)
.HasColumnType("character varying")
.HasColumnName("login");
entity.Property(e => e.Password).HasColumnType("character varying");
entity.Property(e => e.Post)
.HasColumnType("character varying")
.HasColumnName("post");
entity.Property(e => e.TypeOfEntrance).HasColumnName("type_of_entrance");
});
OnModelCreatingPartial(modelBuilder);
}
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}

21
Program.cs Normal file
View File

@ -0,0 +1,21 @@
using Avalonia;
using System;
namespace Blagodat;
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();
}

18
Registration.axaml Normal file
View File

@ -0,0 +1,18 @@
<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="Blagodat.Registration"
Title="Registration">
<StackPanel Spacing="15" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="Введите логин"/>
<TextBox Width="300" x:Name="LoginTextBox" ></TextBox>
<TextBlock Text="Введите пароль"/>
<TextBox Width="300" x:Name="PasswordTextBox" ></TextBox>
<StackPanel Spacing="5" Orientation="Horizontal">
<Button x:Name="RegisterClick" Click="RegisterClick_OnClick" Content="Зарегистрироваться"/>
<Button x:Name="LoginClick" Click="LoginClick_OnClick" Content="Войти"/>
</StackPanel>
</StackPanel>
</Window>

38
Registration.axaml.cs Normal file
View File

@ -0,0 +1,38 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Blagodat.Models;
namespace Blagodat;
public partial class Registration : Window
{
public Registration()
{
InitializeComponent();
}
private void RegisterClick_OnClick(object? sender, RoutedEventArgs e)
{
if (string.IsNullOrEmpty(LoginTextBox.Text)) return;
if (string.IsNullOrEmpty(PasswordTextBox.Text)) return;
using var dbContext = new User7Context();
var user = new Client
{
Fio = LoginTextBox.Text,
Password = PasswordTextBox.Text
};
dbContext.Clients.Add(user);
if (dbContext.SaveChanges() > 0)
{
new MainWindow().Show();
Close();
}
}
private void LoginClick_OnClick(object? sender, RoutedEventArgs e)
{
new MainWindow().Show();
Close();
}
}

18
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="Blagodat.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.

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": "net9.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "9.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.

BIN
bin/Debug/net9.0/Npgsql.dll Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
bin/Debug/net9.0/Splat.dll Normal file

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