This commit is contained in:
bekodeg 2024-11-06 21:04:19 +04:00
parent cea8e833e8
commit 22041e42bc
30 changed files with 802 additions and 0 deletions

View File

@ -9,6 +9,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestCustomComponents", "Tes
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PIHelperSh.PdfCreator", "PIHelperSh.PdfCreater\PIHelperSh.PdfCreator.csproj", "{572BD835-A500-43C9-A66F-648540F4A1C8}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PIHelperSh.PdfCreator", "PIHelperSh.PdfCreater\PIHelperSh.PdfCreator.csproj", "{572BD835-A500-43C9-A66F-648540F4A1C8}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lab3", "Lab3\Lab3.csproj", "{1E630CC7-090F-471C-ADA1-74107CF3DC2A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lab3.Database", "Lab3.Database\Lab3.Database.csproj", "{698DE9E8-7885-4F98-AFE3-9A9C6CD2FCF5}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -27,6 +31,14 @@ Global
{572BD835-A500-43C9-A66F-648540F4A1C8}.Debug|Any CPU.Build.0 = Debug|Any CPU {572BD835-A500-43C9-A66F-648540F4A1C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{572BD835-A500-43C9-A66F-648540F4A1C8}.Release|Any CPU.ActiveCfg = Release|Any CPU {572BD835-A500-43C9-A66F-648540F4A1C8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{572BD835-A500-43C9-A66F-648540F4A1C8}.Release|Any CPU.Build.0 = Release|Any CPU {572BD835-A500-43C9-A66F-648540F4A1C8}.Release|Any CPU.Build.0 = Release|Any CPU
{1E630CC7-090F-471C-ADA1-74107CF3DC2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1E630CC7-090F-471C-ADA1-74107CF3DC2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1E630CC7-090F-471C-ADA1-74107CF3DC2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1E630CC7-090F-471C-ADA1-74107CF3DC2A}.Release|Any CPU.Build.0 = Release|Any CPU
{698DE9E8-7885-4F98-AFE3-9A9C6CD2FCF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{698DE9E8-7885-4F98-AFE3-9A9C6CD2FCF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{698DE9E8-7885-4F98-AFE3-9A9C6CD2FCF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{698DE9E8-7885-4F98-AFE3-9A9C6CD2FCF5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -5,6 +5,9 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<PackageId>$(AssemblyName)</PackageId>
<Version>$(VersionPrefix)8.0.1</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -0,0 +1,34 @@
// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
using Lab3.Database.Context.Configurations;
using Lab3.Database.Models;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
#nullable disable
namespace Lab3.Database.Context;
public partial class COPContext : DbContext
{
public COPContext(DbContextOptions<COPContext> options)
: base(options)
{
}
public virtual DbSet<EducationForm> EducationForms { get; set; }
public virtual DbSet<Student> Students { get; set; }
public virtual DbSet<StudentSession> StudentSessions { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.ApplyConfiguration(new Configurations.EducationFormConfiguration());
modelBuilder.ApplyConfiguration(new Configurations.StudentConfiguration());
modelBuilder.ApplyConfiguration(new Configurations.StudentSessionConfiguration());
OnModelCreatingPartial(modelBuilder);
}
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}

View File

@ -0,0 +1,46 @@
// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
#nullable disable
using Lab3.Database.Models;
using Microsoft.EntityFrameworkCore;
using Npgsql;
using System;
using System.Collections.Generic;
using System.Data;
using System.Threading;
using System.Threading.Tasks;
namespace Lab3.Database.Context
{
public partial class COPContext
{
private ICOPContextFunctions _procedures;
public virtual ICOPContextFunctions Functions
{
get
{
if (_procedures is null) _procedures = new COPContextFunctions(this);
return _procedures;
}
set
{
_procedures = value;
}
}
public ICOPContextFunctions GetFunctions()
{
return Functions;
}
}
public partial class COPContextFunctions : ICOPContextFunctions
{
private readonly COPContext _context;
public COPContextFunctions(COPContext context)
{
_context = context;
}
}
}

View File

@ -0,0 +1,31 @@
// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
using Lab3.Database.Context;
using Lab3.Database.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
namespace Lab3.Database.Context.Configurations
{
public partial class EducationFormConfiguration : IEntityTypeConfiguration<EducationForm>
{
public void Configure(EntityTypeBuilder<EducationForm> entity)
{
entity.HasKey(e => e.Id).HasName("EducationForm_pkey");
entity.ToTable("EducationForm");
entity.HasIndex(e => e.Name, "EducationForm_Name_Name1_key").IsUnique();
entity.Property(e => e.Id).ValueGeneratedNever();
entity.Property(e => e.Name)
.IsRequired()
.HasColumnType("character varying");
OnConfigurePartial(entity);
}
partial void OnConfigurePartial(EntityTypeBuilder<EducationForm> entity);
}
}

View File

@ -0,0 +1,31 @@
// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
using Lab3.Database.Context;
using Lab3.Database.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
namespace Lab3.Database.Context.Configurations
{
public partial class StartEducationConfiguration : IEntityTypeConfiguration<StartEducation>
{
public void Configure(EntityTypeBuilder<StartEducation> entity)
{
entity.HasKey(e => e.Id).HasName("StartEducation_pkey");
entity.ToTable("StartEducation");
entity.Property(e => e.Id).ValueGeneratedNever();
entity.Property(e => e.DateTime).HasColumnType("timestamp without time zone");
entity.HasOne(d => d.Student).WithMany(p => p.StartEducations)
.HasForeignKey(d => d.StudentId)
.HasConstraintName("StartEducation_StudentId_fkey");
OnConfigurePartial(entity);
}
partial void OnConfigurePartial(EntityTypeBuilder<StartEducation> entity);
}
}

View File

@ -0,0 +1,33 @@
// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
using Lab3.Database.Context;
using Lab3.Database.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
namespace Lab3.Database.Context.Configurations
{
public partial class StudentConfiguration : IEntityTypeConfiguration<Student>
{
public void Configure(EntityTypeBuilder<Student> entity)
{
entity.HasKey(e => e.Id).HasName("Student_pkey");
entity.ToTable("Student");
entity.Property(e => e.Id).ValueGeneratedNever();
entity.Property(e => e.EducationForm)
.IsRequired()
.HasColumnType("character varying");
entity.Property(e => e.Name)
.IsRequired()
.HasColumnType("character varying");
entity.Property(e => e.StartEducation).HasColumnType("timestamp without time zone");
OnConfigurePartial(entity);
}
partial void OnConfigurePartial(EntityTypeBuilder<Student> entity);
}
}

View File

@ -0,0 +1,30 @@
// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
using Lab3.Database.Context;
using Lab3.Database.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
namespace Lab3.Database.Context.Configurations
{
public partial class StudentSessionConfiguration : IEntityTypeConfiguration<StudentSession>
{
public void Configure(EntityTypeBuilder<StudentSession> entity)
{
entity.HasKey(e => e.Id).HasName("StudentSession_pkey");
entity.ToTable("StudentSession");
entity.Property(e => e.Id).ValueGeneratedNever();
entity.HasOne(d => d.Student).WithMany(p => p.StudentSessions)
.HasForeignKey(d => d.StudentId)
.HasConstraintName("StudentSession");
OnConfigurePartial(entity);
}
partial void OnConfigurePartial(EntityTypeBuilder<StudentSession> entity);
}
}

View File

@ -0,0 +1,62 @@
// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace Lab3.Database.Context
{
public static class DbContextExtensions
{
public static async Task<List<T>> SqlQueryAsync<T>(this DbContext db, string sql, object[] parameters = null, CancellationToken cancellationToken = default)
where T : class
{
if (parameters is null)
{
parameters = new object[] { };
}
if (typeof(T).GetProperties().Any())
{
return await db.Database
.SqlQueryRaw<T>(sql, parameters)
.ToListAsync(cancellationToken);
}
else
{
await db.Database.ExecuteSqlRawAsync(sql, parameters, cancellationToken);
return default;
}
}
}
public class OutputParameter<TValue>
{
private bool _valueSet = false;
public TValue _value;
public TValue Value
{
get
{
if (!_valueSet)
throw new InvalidOperationException("Value not set.");
return _value;
}
}
internal void SetValue(object value)
{
_valueSet = true;
_value = null == value || Convert.IsDBNull(value) ? default(TValue) : (TValue)value;
}
}
}

View File

@ -0,0 +1,17 @@
// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
#nullable disable
using Lab3.Database.Models;
using Microsoft.EntityFrameworkCore;
using Npgsql;
using System;
using System.Collections.Generic;
using System.Data;
using System.Threading;
using System.Threading.Tasks;
namespace Lab3.Database.Context
{
public partial interface ICOPContextFunctions
{
}
}

View File

@ -0,0 +1,15 @@
namespace Lab3.Database.DTO
{
public record StudentDTO
{
public Guid Id { get; init; }
public string Name { get; init; } = null!;
public DateTime StartEducation { get; init; }
public string EducationForm { get; init; } = null!;
public List<StudentSessionDTO> StudentSessions { get; init; } = [];
}
}

View File

@ -0,0 +1,11 @@
namespace Lab3.Database.DTO
{
public record StudentSessionDTO
{
public Guid Id { get; init; }
public decimal Score { get; init; }
public int Number { get; init; }
}
}

View File

@ -0,0 +1,38 @@
using Lab3.Database.Context;
using Lab3.Database.MappingProfiles;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace Lab3.Database.Extensions
{
public static class DiExtension
{
public static IServiceCollection AddDatabase(
this IServiceCollection services,
IConfiguration configuration)
{
services.AddDbContextPool<COPContext>(
dbContextOptions =>
{
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
_ = dbContextOptions.UseNpgsql(configuration.GetConnectionString("COPDataBase"));
_ = dbContextOptions.ConfigureWarnings(warnings => { });
}
);
return services;
}
public static IServiceCollection AddDbMapping(
this IServiceCollection services)
{
services.AddAutoMapper(typeof(StudentMappingProfile));
services.AddAutoMapper(typeof(SessionMappingProfile));
return services;
}
}
}

View File

@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.4" />
</ItemGroup>
<ItemGroup>
<Folder Include="Repository\Implementations\" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,15 @@
using AutoMapper;
using Lab3.Database.DTO;
using Lab3.Database.Models;
namespace Lab3.Database.MappingProfiles
{
public class SessionMappingProfile : Profile
{
SessionMappingProfile()
{
_ = CreateMap<StudentSession, StudentSessionDTO>();
_ = CreateMap<StudentSessionDTO, StudentSession>();
}
}
}

View File

@ -0,0 +1,15 @@
using AutoMapper;
using Lab3.Database.DTO;
using Lab3.Database.Models;
namespace Lab3.Database.MappingProfiles
{
public class StudentMappingProfile : Profile
{
public StudentMappingProfile()
{
_ = CreateMap<Student, StudentDTO>();
_ = CreateMap<StudentDTO, Student>();
}
}
}

View File

@ -0,0 +1,13 @@
// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
#nullable disable
using System;
using System.Collections.Generic;
namespace Lab3.Database.Models;
public partial class EducationForm
{
public Guid Id { get; set; }
public string Name { get; set; }
}

View File

@ -0,0 +1,19 @@
// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
#nullable disable
using System;
using System.Collections.Generic;
namespace Lab3.Database.Models;
public partial class Student
{
public Guid Id { get; set; }
public string Name { get; set; }
public DateTime StartEducation { get; set; }
public string EducationForm { get; set; }
public virtual ICollection<StudentSession> StudentSessions { get; set; } = new List<StudentSession>();
}

View File

@ -0,0 +1,19 @@
// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
#nullable disable
using System;
using System.Collections.Generic;
namespace Lab3.Database.Models;
public partial class StudentSession
{
public Guid Id { get; set; }
public Guid StudentId { get; set; }
public decimal Score { get; set; }
public int Number { get; set; }
public virtual Student Student { get; set; }
}

View File

@ -0,0 +1,17 @@
using Lab3.Database.DTO;
namespace Lab3.Database.Repository.Interfaces
{
public interface IStudentRepository
{
public Task<List<StudentDTO>> Get(int limit = 10000, int offset = 0);
public Task<StudentDTO> Get(Guid id);
public Task<StudentDTO> Update(StudentDTO studentDTO);
public Task<StudentDTO> Delete(Guid id);
public Task<List<StudentDTO>> Create(StudentDTO studentDTO);
}
}

View File

@ -0,0 +1,54 @@
{
"CodeGenerationMode": 4,
"ContextClassName": "COPContext",
"ContextNamespace": "Context",
"FilterSchemas": false,
"IncludeConnectionString": false,
"ModelNamespace": "Models",
"OutputContextPath": "Context",
"OutputPath": "Models",
"PreserveCasingWithRegex": true,
"ProjectRootNamespace": "Lab3.Database",
"Schemas": null,
"SelectedHandlebarsLanguage": 2,
"SelectedToBeGenerated": 0,
"T4TemplatePath": null,
"Tables": [
{
"Name": "public.EducationForm",
"ObjectType": 0
},
{
"Name": "public.Student",
"ObjectType": 0
},
{
"Name": "public.StudentSession",
"ObjectType": 0
}
],
"UiHint": null,
"UncountableWords": null,
"UseAsyncStoredProcedureCalls": true,
"UseBoolPropertiesWithoutDefaultSql": false,
"UseDatabaseNames": false,
"UseDateOnlyTimeOnly": true,
"UseDbContextSplitting": true,
"UseDecimalDataAnnotationForSprocResult": true,
"UseFluentApiOnly": true,
"UseHandleBars": false,
"UseHierarchyId": false,
"UseInflector": true,
"UseLegacyPluralizer": false,
"UseManyToManyEntity": false,
"UseNoDefaultConstructor": true,
"UseNoNavigations": false,
"UseNoObjectFilter": true,
"UseNodaTime": false,
"UseNullableReferences": false,
"UsePrefixNavigationNaming": false,
"UseSchemaFolders": false,
"UseSchemaNamespaces": false,
"UseSpatial": false,
"UseT4": false
}

View File

@ -0,0 +1,19 @@
using Lab3.Database.Extensions;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace Lab3.Extensions
{
public static class DIExtension
{
public static IServiceCollection ConfigureDAL(
this IServiceCollection services,
IConfiguration configuration)
{
services.AddDatabase(configuration);
services.AddDbMapping();
return services;
}
}
}

View File

@ -0,0 +1,39 @@
namespace Lab3.Forms
{
partial class MainForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "MainForm";
}
#endregion
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Lab3.Forms
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<Folder Include="Logic\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Lab3.Database\Lab3.Database.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,15 @@
using AutoMapper;
using Lab3.Database.DTO;
using Lab3.Models;
namespace Lab3.MappingProfiles
{
public class StudentViewMappingProfile : Profile
{
public StudentViewMappingProfile()
{
_ = CreateMap<StudentDTO, StudentViewModel>()\
;
}
}
}

View File

@ -0,0 +1,15 @@
using Lab3.Database.DTO;
using System.Globalization;
namespace Lab3.Models
{
public record StudentViewModel : StudentDTO
{
public string SessionMarks => string.Join("; ", StudentSessions
.Select(s => string.Format(
CultureInfo.InvariantCulture,
"сессия{}: {0:f2}",
s.Number,
s.Score)));
}
}

View File

@ -0,0 +1,17 @@
namespace Lab3
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
}
}
}

View File

@ -0,0 +1,5 @@
{
"ConnectionStrings": {
"COPDataBase": "Host=localhost;Username=postgres;Password=postgres;Database=COP"
}
}