Проект и модели

This commit is contained in:
Glliza 2025-03-10 19:50:14 +04:00
parent 2041f50390
commit 60e193a47a
10 changed files with 177 additions and 0 deletions

View File

@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PuferFishTests", "PuferFish
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PuferFishBusinessLogic", "PuferFishBusinessLogic\PuferFishBusinessLogic.csproj", "{6997CEC9-5AB7-40C0-9873-E51D2674187B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PuferFishDataBase", "PuferFishDataBase\PuferFishDataBase.csproj", "{B50100BC-3D08-48A8-921D-1EB5D1FE8674}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -27,6 +29,10 @@ Global
{6997CEC9-5AB7-40C0-9873-E51D2674187B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6997CEC9-5AB7-40C0-9873-E51D2674187B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6997CEC9-5AB7-40C0-9873-E51D2674187B}.Release|Any CPU.Build.0 = Release|Any CPU
{B50100BC-3D08-48A8-921D-1EB5D1FE8674}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B50100BC-3D08-48A8-921D-1EB5D1FE8674}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B50100BC-3D08-48A8-921D-1EB5D1FE8674}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B50100BC-3D08-48A8-921D-1EB5D1FE8674}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PuferFishDataBase.Models;
internal class Buyer
{
public required string Id { get; set; }
public required string FIO { get; set; }
public required string PhoneNumber { get; set; }
public double Points { get; set; }
[ForeignKey("BuyerId")]
public List<Sale>? Sales { get; set; }
[ForeignKey("BuyerId")]
public List<Points>? Pointss { get; set; }
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PuferFishDataBase.Models;
internal class Points
{
public string Id { get; set; } = Guid.NewGuid().ToString();
public string BuyerId { get; set; }
public DateTime PointsDate { get; set; }
public double BuyerPoints { get; set; }
public Buyer? Buyer { get; set; }
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PuferFishContracts.Enums;
namespace PuferFishDataBase.Models;
internal class Post
{
public string Id { get; set; } = Guid.NewGuid().ToString();
public required string PostId { get; set; }
public required string PostName { get; set; }
public PostType PostType { get; set; }
public double Salary { get; set; }
public bool IsActual { get; set; }
public DateTime ChangeDate { get; set; }
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PuferFishContracts.Enums;
namespace PuferFishDataBase.Models;
internal class Product
{
public required string Id { get; set; }
public required string ProductName { get; set; }
public ProductType ProductType { get; set; }
public double Price { get; set; }
public bool IsDeleted { get; set; }
public string? PrevProductName { get; set; }
public string? PrevPrevProductName { get; set; }
[ForeignKey("ProductId")]
public List<ProductHistory>? ProductHistories { get; set; }
[ForeignKey("ProductId")]
public List<SaleProduct>? SaleProducts { get; set; }
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PuferFishDataBase.Models;
internal class ProductHistory
{
public string Id { get; set; } = Guid.NewGuid().ToString();
public required string ProductId { get; set; }
public double OldPrice { get; set; }
public DateTime ChangeDate { get; set; } = DateTime.UtcNow;
public Product? Product { get; set; }
}

View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PuferFishDataBase.Models;
internal class Sale
{
public string Id { get; set; } = Guid.NewGuid().ToString();
public required string WorkerId { get; set; }
public string? BuyerId { get; set; }
public DateTime SaleDate { get; set; }
public double Sum { get; set; }
public double Points { get; set; }
public bool IsCancel { get; set; }
public Worker? Worker { get; set; }
public Buyer? Buyer { get; set; }
[ForeignKey("SaleId")]
public List<SaleProduct>? SaleProducts { get; set; }
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PuferFishDataBase.Models;
internal class SaleProduct
{
public required string SaleId { get; set; }
public required string ProductId { get; set; }
public int Count { get; set; }
public double Price { get; set; }
public Sale? Sale { get; set; }
public Product? Product { get; set; }
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PuferFishDataBase.Models;
internal class Worker
{
public required string Id { get; set; }
public required string FIO { get; set; }
public required string PostId { get; set; }
public DateTime BirthDate { get; set; }
public DateTime EmploymentDate { get; set; }
public bool IsDeleted { get; set; }
}

View File

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\PuferFishContracts\PuferFishContracts.csproj" />
</ItemGroup>
</Project>