Browse Source

init commit

Никита Кашлач 2 years ago
commit
f44b028b96

+ 13 - 0
.idea/.idea.QualTask/.idea/.gitignore

@@ -0,0 +1,13 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Rider ignored files
+/modules.xml
+/contentModel.xml
+/projectSettingsUpdater.xml
+/.idea.QualTask.iml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml

+ 13 - 0
.idea/.idea.QualTask/.idea/avalonia.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="AvaloniaProject">
+    <option name="projectPerEditor">
+      <map>
+        <entry key="QualTask/App.axaml" value="QualTask/QualTask.csproj" />
+        <entry key="QualTask/MainWindow.axaml" value="QualTask/QualTask.csproj" />
+        <entry key="QualTask/RegistrationWindow.axaml" value="QualTask/QualTask.csproj" />
+        <entry key="QualTask/UserWindow.axaml" value="QualTask/QualTask.csproj" />
+      </map>
+    </option>
+  </component>
+</project>

+ 19 - 0
.idea/.idea.QualTask/.idea/dataSources.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="DataSourceManagerImpl" format="xml" multifile-model="true">
+    <data-source source="LOCAL" name="gr692_kns@10.30.0.137" uuid="6b6b7fb1-7ff9-4dc6-b578-13f96fcfc3e0">
+      <driver-ref>postgresql</driver-ref>
+      <synchronize>true</synchronize>
+      <jdbc-driver>org.postgresql.Driver</jdbc-driver>
+      <jdbc-url>jdbc:postgresql://10.30.0.137:5432/gr692_kns</jdbc-url>
+      <working-dir>$ProjectFileDir$</working-dir>
+    </data-source>
+    <data-source source="LOCAL" name="user19@192.168.12.164" uuid="dac62796-c9dc-4c8f-81b8-65aece3379a8">
+      <driver-ref>postgresql</driver-ref>
+      <synchronize>true</synchronize>
+      <jdbc-driver>org.postgresql.Driver</jdbc-driver>
+      <jdbc-url>jdbc:postgresql://192.168.12.164:5432/user19</jdbc-url>
+      <working-dir>$ProjectFileDir$</working-dir>
+    </data-source>
+  </component>
+</project>

+ 8 - 0
.idea/.idea.QualTask/.idea/indexLayout.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="UserContentModel">
+    <attachedFolders />
+    <explicitIncludes />
+    <explicitExcludes />
+  </component>
+</project>

+ 16 - 0
QualTask.sln

@@ -0,0 +1,16 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QualTask", "QualTask\QualTask.csproj", "{2936AB60-CA58-49A1-BA79-0CD934207892}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{2936AB60-CA58-49A1-BA79-0CD934207892}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{2936AB60-CA58-49A1-BA79-0CD934207892}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{2936AB60-CA58-49A1-BA79-0CD934207892}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{2936AB60-CA58-49A1-BA79-0CD934207892}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+EndGlobal

+ 454 - 0
QualTask/.gitignore

@@ -0,0 +1,454 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
+
+# User-specific files
+*.rsuser
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Mono auto generated files
+mono_crash.*
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+[Ww][Ii][Nn]32/
+[Aa][Rr][Mm]/
+[Aa][Rr][Mm]64/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+[Ll]ogs/
+
+# Visual Studio 2015/2017 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# Visual Studio 2017 auto generated files
+Generated\ Files/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUnit
+*.VisualState.xml
+TestResult.xml
+nunit-*.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# Benchmark Results
+BenchmarkDotNet.Artifacts/
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+# Tye
+.tye/
+
+# ASP.NET Scaffolding
+ScaffoldingReadMe.txt
+
+# StyleCop
+StyleCopReport.xml
+
+# Files built by Visual Studio
+*_i.c
+*_p.c
+*_h.h
+*.ilk
+*.meta
+*.obj
+*.iobj
+*.pch
+*.pdb
+*.ipdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*_wpftmp.csproj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# Visual Studio Trace Files
+*.e2e
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# AxoCover is a Code Coverage Tool
+.axoCover/*
+!.axoCover/settings.json
+
+# Coverlet is a free, cross platform Code Coverage Tool
+coverage*.json
+coverage*.xml
+coverage*.info
+
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# Note: Comment the next line if you want to checkin your web deploy settings,
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# NuGet Symbol Packages
+*.snupkg
+# The packages folder can be ignored because of Package Restore
+**/[Pp]ackages/*
+# except build/, which is used as an MSBuild target.
+!**/[Pp]ackages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+*.appx
+*.appxbundle
+*.appxupload
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!?*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+orleans.codegen.cs
+
+# Including strong name files can present a security risk
+# (https://github.com/github/gitignore/pull/2483#issue-259490424)
+#*.snk
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+ServiceFabricBackup/
+*.rptproj.bak
+
+# SQL Server files
+*.mdf
+*.ldf
+*.ndf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+*.rptproj.rsuser
+*- [Bb]ackup.rdl
+*- [Bb]ackup ([0-9]).rdl
+*- [Bb]ackup ([0-9][0-9]).rdl
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+node_modules/
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# CodeRush personal settings
+.cr/personal
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+# Cake - Uncomment if you are using it
+# tools/**
+# !tools/packages.config
+
+# Tabs Studio
+*.tss
+
+# Telerik's JustMock configuration file
+*.jmconfig
+
+# BizTalk build output
+*.btp.cs
+*.btm.cs
+*.odx.cs
+*.xsd.cs
+
+# OpenCover UI analysis results
+OpenCover/
+
+# Azure Stream Analytics local run output
+ASALocalRun/
+
+# MSBuild Binary and Structured Log
+*.binlog
+
+# NVidia Nsight GPU debugger configuration file
+*.nvuser
+
+# MFractors (Xamarin productivity tool) working folder
+.mfractor/
+
+# Local History for Visual Studio
+.localhistory/
+
+# BeatPulse healthcheck temp database
+healthchecksdb
+
+# Backup folder for Package Reference Convert tool in Visual Studio 2017
+MigrationBackup/
+
+# Ionide (cross platform F# VS Code tools) working folder
+.ionide/
+
+# Fody - auto-generated XML schema
+FodyWeavers.xsd
+
+##
+## Visual studio for Mac
+##
+
+
+# globs
+Makefile.in
+*.userprefs
+*.usertasks
+config.make
+config.status
+aclocal.m4
+install-sh
+autom4te.cache/
+*.tar.gz
+tarballs/
+test-results/
+
+# Mac bundle stuff
+*.dmg
+*.app
+
+# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
+# General
+.DS_Store
+.AppleDouble
+.LSOverride
+
+# Icon must end with two \r
+Icon
+
+
+# Thumbnails
+._*
+
+# Files that might appear in the root of a volume
+.DocumentRevisions-V100
+.fseventsd
+.Spotlight-V100
+.TemporaryItems
+.Trashes
+.VolumeIcon.icns
+.com.apple.timemachine.donotpresent
+
+# Directories potentially created on remote AFP share
+.AppleDB
+.AppleDesktop
+Network Trash Folder
+Temporary Items
+.apdisk
+
+# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
+# Windows thumbnail cache files
+Thumbs.db
+ehthumbs.db
+ehthumbs_vista.db
+
+# Dump file
+*.stackdump
+
+# Folder config file
+[Dd]esktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Windows Installer files
+*.cab
+*.msi
+*.msix
+*.msm
+*.msp
+
+# Windows shortcuts
+*.lnk
+
+# JetBrains Rider
+.idea/
+*.sln.iml
+
+##
+## Visual Studio Code
+##
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json

+ 10 - 0
QualTask/App.axaml

@@ -0,0 +1,10 @@
+<Application xmlns="https://github.com/avaloniaui"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             x:Class="QualTask.App">
+    <Application.Styles>
+        <FluentTheme Mode="Light"/>
+        <StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml"/>
+        <StyleInclude Source="avares://Avalonia.Themes.Default/Accents/BaseLight.xaml"/>
+        <StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Default.xaml"/>
+    </Application.Styles>
+</Application>

+ 23 - 0
QualTask/App.axaml.cs

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

+ 26 - 0
QualTask/AuthWindow.axaml

@@ -0,0 +1,26 @@
+<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="QualTask.AuthWindow"
+        Title="Авторизация">
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition/>
+            <RowDefinition/>
+            <RowDefinition/>
+            <RowDefinition/>
+            <RowDefinition/>
+            <RowDefinition/>
+            <RowDefinition/>
+        </Grid.RowDefinitions>
+        
+        <TextBox Grid.Row="1" x:Name="LoginTextBox" Watermark="Логин"/>
+        <TextBox Grid.Row="3" x:Name="PasswordTextBox" PasswordChar="#" Watermark="Пароль"/>
+        <Button Grid.Row="4" x:Name="AuthButton" Content="Войти" Click="AuthButton_OnClick"/>
+        <TextBlock Grid.Row="5" x:Name="ErrorTextBlock" IsVisible="False" Foreground="Red" FontSize="16" 
+                   FontWeight="SemiBold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+        <Button Grid.Row="6" x:Name="RegistrationButton" Content="Регистрация" Click="RegistrationButton_OnClick"/>
+    </Grid>
+</Window>

+ 51 - 0
QualTask/AuthWindow.axaml.cs

@@ -0,0 +1,51 @@
+using System;
+using System.Linq;
+using Avalonia.Controls;
+using Avalonia.Interactivity;
+using QualTask.Models;
+
+namespace QualTask;
+
+public partial class AuthWindow : Window
+{
+    public AuthWindow()
+    {
+        InitializeComponent();
+    }
+
+    private void AuthButton_OnClick(object? sender, RoutedEventArgs e)
+    {
+        // Получаем данные из TextBox'ов
+        string login = LoginTextBox.Text;
+        string password = PasswordTextBox.Text;
+
+        // Проверяем, что поля заполнены
+        if (String.IsNullOrWhiteSpace(login) || String.IsNullOrWhiteSpace(password))
+        {
+            ErrorTextBlock.IsVisible = true;
+            ErrorTextBlock.Text = "Все поля должны быть заполнены!";
+            return;
+        }
+
+        // Проверяем, что пользователь существует
+        User? user = DbService.GetContext().Users.FirstOrDefault(u => u.Login == login && u.Password == password);
+        if (user == null)
+        {
+            ErrorTextBlock.IsVisible = true;
+            ErrorTextBlock.Text = "Такого пользователь не существует!";
+            return;
+        }
+
+        ErrorTextBlock.IsVisible = false;
+        UserWindow wnd = new UserWindow();
+        wnd.Show();
+        Close();
+    }
+
+    private void RegistrationButton_OnClick(object? sender, RoutedEventArgs e)
+    {
+        RegistrationWindow wnd = new RegistrationWindow();
+        wnd.Show();
+        Close();
+    }
+}

+ 17 - 0
QualTask/DbService.cs

@@ -0,0 +1,17 @@
+namespace QualTask;
+using Models;
+
+public class DbService
+{
+    private static Gr692KnsContext db_;
+    
+    public static Gr692KnsContext GetContext()
+    {
+        if (db_ == null)
+        {
+            db_ = new Gr692KnsContext();
+        }
+
+        return db_;
+    }
+}

+ 71 - 0
QualTask/Models/Gr692KnsContext.cs

@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.EntityFrameworkCore;
+
+namespace QualTask.Models;
+
+public partial class Gr692KnsContext : DbContext
+{
+    public Gr692KnsContext()
+    {
+    }
+
+    public Gr692KnsContext(DbContextOptions<Gr692KnsContext> options)
+        : base(options)
+    {
+    }
+
+    public virtual DbSet<Role> Roles { get; set; }
+
+    public virtual DbSet<User> Users { 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 http://go.microsoft.com/fwlink/?LinkId=723263.
+        => optionsBuilder.UseNpgsql("Host=10.30.0.137;Port=5432;Database=gr692_kns;Username=gr692_kns;Password=pap04kA?");
+
+    protected override void OnModelCreating(ModelBuilder modelBuilder)
+    {
+        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.RoleName)
+                .HasMaxLength(50)
+                .HasColumnName("role_name");
+        });
+
+        modelBuilder.Entity<User>(entity =>
+        {
+            entity.HasKey(e => e.Id).HasName("users_pkey");
+
+            entity.ToTable("users");
+
+            entity.Property(e => e.Id).HasColumnName("id");
+            entity.Property(e => e.Fname)
+                .HasMaxLength(100)
+                .HasColumnName("fname");
+            entity.Property(e => e.Lname)
+                .HasMaxLength(100)
+                .HasColumnName("lname");
+            entity.Property(e => e.Login)
+                .HasMaxLength(100)
+                .HasColumnName("login");
+            entity.Property(e => e.Password)
+                .HasMaxLength(100)
+                .HasColumnName("password");
+            entity.Property(e => e.Role).HasColumnName("role");
+
+            entity.HasOne(d => d.RoleNavigation).WithMany(p => p.Users)
+                .HasForeignKey(d => d.Role)
+                .OnDelete(DeleteBehavior.ClientSetNull)
+                .HasConstraintName("users_role_fkey");
+        });
+
+        OnModelCreatingPartial(modelBuilder);
+    }
+
+    partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
+}

+ 13 - 0
QualTask/Models/Role.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+
+namespace QualTask.Models;
+
+public partial class Role
+{
+    public int Id { get; set; }
+
+    public string RoleName { get; set; } = null!;
+
+    public virtual ICollection<User> Users { get; set; } = new List<User>();
+}

+ 21 - 0
QualTask/Models/User.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+
+namespace QualTask.Models;
+
+public partial class User
+{
+    public int Id { get; set; }
+
+    public string Fname { get; set; } = null!;
+
+    public string Lname { get; set; } = null!;
+
+    public string Login { get; set; } = null!;
+
+    public string Password { get; set; } = null!;
+
+    public int Role { get; set; }
+
+    public virtual Role RoleNavigation { get; set; } = null!;
+}

+ 20 - 0
QualTask/Program.cs

@@ -0,0 +1,20 @@
+using Avalonia;
+using System;
+
+namespace QualTask;
+
+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()
+            .LogToTrace();
+}

+ 34 - 0
QualTask/QualTask.csproj

@@ -0,0 +1,34 @@
+<Project Sdk="Microsoft.NET.Sdk">
+    <PropertyGroup>
+        <OutputType>WinExe</OutputType>
+        <TargetFramework>net6.0</TargetFramework>
+        <Nullable>enable</Nullable>
+        <BuiltInComInteropSupport>true</BuiltInComInteropSupport>
+        <ApplicationManifest>app.manifest</ApplicationManifest>
+    </PropertyGroup>
+    <ItemGroup>
+        <None Remove=".gitignore" />
+    </ItemGroup>
+
+    <ItemGroup>
+        <TrimmerRootDescriptor Include="Roots.xml" />
+    </ItemGroup>
+
+    <ItemGroup>
+        <PackageReference Include="Avalonia" Version="0.10.18" />
+        <PackageReference Include="Avalonia.Desktop" Version="0.10.18" />
+        <!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
+        <PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.18" />
+        <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.5">
+          <PrivateAssets>all</PrivateAssets>
+          <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+        </PackageReference>
+        <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.5" />
+        <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.5">
+          <PrivateAssets>all</PrivateAssets>
+          <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+        </PackageReference>
+        <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.3" />
+        <PackageReference Include="XamlNameReferenceGenerator" Version="1.5.1" />
+    </ItemGroup>
+</Project>

+ 33 - 0
QualTask/RegistrationWindow.axaml

@@ -0,0 +1,33 @@
+<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="QualTask.RegistrationWindow"
+        Title="Регистрация">
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition/>
+            <RowDefinition/>
+            <RowDefinition/>
+            <RowDefinition/>
+            <RowDefinition/>
+            <RowDefinition/>
+            <RowDefinition/>
+            <RowDefinition/>
+        </Grid.RowDefinitions>
+        
+        <TextBox x:Name="FNameTextBox" Grid.Row="0" Watermark="Имя"/>
+        <TextBox x:Name="LNameTextBox" Grid.Row="1" Watermark="Фамилия"/>
+        <TextBox x:Name="LoginTextBox" Grid.Row="2" Watermark="Логин"/>
+        <TextBox x:Name="PasswordTextBox" Grid.Row="3" Watermark="Пароль" PasswordChar="#"/>
+        <ComboBox x:Name="RoleComboBox" Grid.Row="4">
+            <ComboBoxItem>Пользователь</ComboBoxItem>
+            <ComboBoxItem>Администратор</ComboBoxItem>
+        </ComboBox>
+        <Button x:Name="RegistrationButton" Grid.Row="5" Content="Зарегистрироваться" Click="RegistrationButton_OnClick"/>
+        <Button x:Name="BackButton" Grid.Row="6" Content="Назад" Click="BackButton_OnClick"/>
+        <TextBlock Grid.Row="7" x:Name="ErrorTextBlock" IsVisible="False" Foreground="Red" FontSize="16" 
+                   FontWeight="SemiBold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+    </Grid>
+</Window>

+ 75 - 0
QualTask/RegistrationWindow.axaml.cs

@@ -0,0 +1,75 @@
+using System;
+using System.Linq;
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Interactivity;
+using Avalonia.Markup.Xaml;
+using QualTask.Models;
+
+namespace QualTask;
+
+public partial class RegistrationWindow : Window
+{
+    public RegistrationWindow()
+    {
+        InitializeComponent();
+        RoleComboBox.SelectedIndex = 1;
+    }
+
+    private void RegistrationButton_OnClick(object? sender, RoutedEventArgs e)
+    {
+        // Получаем данные из TextBox'ов
+        string fname = FNameTextBox.Text;
+        string lname = LNameTextBox.Text;
+        string login = LoginTextBox.Text;
+        string password = PasswordTextBox.Text;
+        string role = RoleComboBox.SelectedItem.ToString();
+
+        // Проверяем что поля не пустые
+        if (String.IsNullOrWhiteSpace(fname) || String.IsNullOrWhiteSpace(lname) || String.IsNullOrWhiteSpace(login) 
+            || String.IsNullOrWhiteSpace(password) || String.IsNullOrWhiteSpace(role))
+        {
+            ErrorTextBlock.IsVisible = true;
+            ErrorTextBlock.Text = "Все поля должны быть заполнены!";
+            return;
+        }
+
+        // Получаем id роли
+        int role_id;
+        if (role == "Администратор")
+        {
+            role_id = 1;
+        }
+        else
+        {
+            role_id = 2;
+        }
+
+        // Проверяем что пользователя не существует
+        if (DbService.GetContext().Users.Where(u => u.Login == login).Count() != 0)
+        {
+            ErrorTextBlock.IsVisible = true;
+            ErrorTextBlock.Text = "Такой пользователь уже существует!";
+            return;
+        }
+
+        // Добавляем пользователя
+        User user = new User();
+        user.Fname = fname;
+        user.Lname = lname;
+        user.Login = login;
+        user.Password = password;
+        user.Role = role_id;
+        DbService.GetContext().Users.Add(user);
+        DbService.GetContext().SaveChanges();
+
+        ErrorTextBlock.IsVisible = false;
+    }
+
+    private void BackButton_OnClick(object? sender, RoutedEventArgs e)
+    {
+        AuthWindow wnd = new AuthWindow();
+        wnd.Show();
+        Close();
+    }
+}

+ 5 - 0
QualTask/Roots.xml

@@ -0,0 +1,5 @@
+<linker>
+  <!-- Can be removed if CompiledBinding and no reflection are used -->
+  <assembly fullname="QualTask" preserve="All" />
+  <assembly fullname="Avalonia.Themes.Fluent" preserve="All" />
+</linker>

+ 18 - 0
QualTask/UserWindow.axaml

@@ -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="QualTask.UserWindow"
+        Title="UserWindow">
+    <Grid>
+        <DataGrid x:Name="UsersDataGrid" IsReadOnly="True">
+            <DataGrid.Columns>
+                <DataGridTextColumn Header="Имя"  Binding="{Binding Fname}"/>
+                <DataGridTextColumn Header="Фамилия"  Binding="{Binding Lname}"/>
+                <DataGridTextColumn Header="Логин"  Binding="{Binding Login}"/>
+                <DataGridTextColumn Header="Роль"  Binding="{Binding Role}"/>
+            </DataGrid.Columns>
+        </DataGrid>
+    </Grid>
+</Window>

+ 15 - 0
QualTask/UserWindow.axaml.cs

@@ -0,0 +1,15 @@
+using System.Linq;
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+
+namespace QualTask;
+
+public partial class UserWindow : Window
+{
+    public UserWindow()
+    {
+        InitializeComponent();
+        UsersDataGrid.Items = DbService.GetContext().Users.ToList();
+    }
+}

+ 18 - 0
QualTask/app.manifest

@@ -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 embeded controls.
+       For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
+  <assemblyIdentity version="1.0.0.0" name="AvaloniaTest.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>

+ 15 - 0
SCRIPT.txt

@@ -0,0 +1,15 @@
+create table roles
+(
+    id serial primary key not null,
+    role_name varchar(50) not null
+);
+
+create table users
+(
+    id serial primary key not null,
+    fname varchar(100) not null,
+    lname varchar(100) not null,
+    login varchar(100) not null,
+    password varchar(100) not null,
+    role int not null references roles (id)
+);

+ 101 - 0
Users.csv

@@ -0,0 +1,101 @@
+Фамилия;Имя;Логин;Пароль;Роль
+Глаголев;Семен;user1;password100;2
+Косарёва;Вера;user2;password99;2
+Карпов;Даниил;user3;password98;2
+Кудров;Федор;user4;password97;2
+Яцкевич;Тарас;user5;password96;2
+Вагин;Константин;user6;password95;2
+Эвентов;Федот;user7;password94;2
+Федотов;Максим;user8;password93;2
+Лазарев;Павел;user9;password92;1
+Пустов;Герман;user10;password91;1
+Сиянина;Вероника;user11;password90;2
+Тредиаковский;Аркадий;user12;password89;2
+Куприянова;Алиса;user13;password88;1
+Яснова;Инна;user14;password87;2
+Клюев;Георгий;user15;password86;2
+Бурцова;Александра;user16;password85;2
+Пищиков;Юлиан;user17;password84;2
+Коржев;Игнат;user18;password83;2
+Кузьмич;Варвара;user19;password82;2
+Маланов;Аркадий;user20;password81;2
+Шипеев;Федор;user21;password80;2
+Сиянкин;Трофим;user22;password79;1
+Енина;Пелагея;user23;password78;2
+Кашников;Юрий;user24;password77;2
+Давыдкин;Макар;user25;password76;2
+Таганцев;Виталий;user26;password75;2
+Коротаева;Александра;user27;password74;2
+Шамякина;Полина;user28;password73;2
+Воскобойникова;Пелагея;user29;password72;2
+Александрина;Елена;user30;password71;2
+Дудинов;Виталий;user31;password70;2
+Ящук;Георгий;user32;password69;2
+Чегодаев;Евгений;user33;password68;2
+Дмитровский;Михаил;user34;password67;2
+Янина;Вероника;user35;password66;1
+Сыропоршнев;Тимофей;user36;password65;2
+Никологорская;Алла;user37;password64;2
+Гольдин;Арсений;user38;password63;2
+Яхлаков;Венедикт;user39;password62;2
+Колобков;Феликс;user40;password61;2
+Юрьева;Нина;user41;password60;2
+Сафиюлина;Раиса;user42;password59;2
+Адоратская;Жанна;user43;password58;2
+Рясная;Лана;user44;password57;1
+Справцев;Иван;user45;password56;1
+Пастухов;Леонид;user46;password55;2
+Арнаутов;Артем;user47;password54;2
+Феднова;Антонина;user48;password53;2
+Анреп;Василий;user49;password52;1
+Султанов;Максим;user50;password51;2
+Усов;Игнат;user51;password50;2
+Харламова;Любовь;user52;password49;2
+Ураков;Даниил;user53;password48;2
+Яловегин;Емельян;user54;password47;2
+Пярина;Валерия;user55;password46;2
+Филатов;Илья;user56;password45;2
+Акулова;Зоя;user57;password44;2
+Киселева;Жанна;user58;password43;2
+Енина;Катерина;user59;password42;2
+Грефа;Марьяна;user60;password41;2
+Яницкий;Иван;user61;password40;2
+Букирь;Максим;user62;password39;2
+Валеева;Зоя;user63;password38;2
+Пестова;Ирина;user64;password37;2
+Волобуев;Петр;user65;password36;2
+Миронов;Василий;user66;password35;2
+Коновалова;Анастасия;user67;password34;2
+Савкин;Иван;user68;password33;2
+Юдашкин;Никифор;user69;password32;2
+Сарайкин;Венедикт;user70;password31;2
+Греф;Марина;user71;password30;2
+Колокольцева;София;user72;password29;2
+Жариков;Виталий;user73;password28;2
+Аслаханов;Алексей;user74;password27;2
+Висенина;Альбина;user75;password26;2
+Окулова;София;user76;password25;2
+Новицкая;Таисия;user77;password24;2
+Гриневец;Геннадий;user78;password23;2
+Викаш;Геннадий;user79;password22;2
+Подмазко;Максим;user80;password21;2
+Энгельгардта;Екатерина;user81;password20;2
+Новомейская;Лана;user82;password19;2
+Карасевич;Герасим;user83;password18;1
+Купревич;Кира;user84;password17;2
+Ильясова;Марианна;user85;password16;2
+Добрынина;Елена;user86;password15;2
+Сопова;Карина;user87;password14;2
+Щеткина;Марьяна;user88;password13;2
+Остроумов;Георгий;user89;password12;2
+Федина;Карина;user90;password11;2
+Будылина;Ярослава;user91;password10;2
+Мягкова;Клара;user92;password9;2
+Дугина;Юлиана;user93;password8;2
+Шамов;Леонтий;user94;password7;2
+Михно;Ника;user95;password6;1
+Компанец;Афанасия;user96;password5;2
+Веселов;Максим;user97;password4;2
+Ёжина;Валерия;user98;password3;2
+Татаринцев;Ефим;user99;password2;2
+Комракова;Нина;user100;password1;2

BIN
Инструкция пользователя.odt


BIN
Скрины таблиц.odt