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

This commit is contained in:
2025-02-17 19:36:37 +04:00
parent 9b7afd24b1
commit 4a82378f01
11 changed files with 196 additions and 0 deletions

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="..\CatHasPawsContratcs\CatHasPawsContratcs.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,17 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace CatHasPawsDatabase.Models;
internal class Buyer
{
public required string Id { get; set; }
public required string FIO { get; set; }
public required string PhoneNumber { get; set; }
public double DiscountSize { get; set; }
[ForeignKey("BuyerId")]
public List<Sale>? Sales { get; set; }
}

View File

@@ -0,0 +1,17 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace CatHasPawsDatabase.Models;
internal class Manufacturer
{
public required string Id { get; set; }
public required string ManufacturerName { get; set; }
public string? PrevManufacturerName { get; set; }
public string? PrevPrevManufacturerName { get; set; }
[ForeignKey("ManufacturerId")]
public List<Product>? Products { get; set; }
}

View File

@@ -0,0 +1,20 @@
using CatHasPawsContratcs.Enums;
namespace CatHasPawsDatabase.Models;
internal class Post
{
public required string Id { get; set; }
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,27 @@
using CatHasPawsContratcs.Enums;
using System.ComponentModel.DataAnnotations.Schema;
namespace CatHasPawsDatabase.Models;
internal class Product
{
public required string Id { get; set; }
public required string ProductName { get; set; }
public ProductType ProductType { get; set; }
public required string ManufacturerId { get; set; }
public double Price { get; set; }
public bool IsDeleted { get; set; }
public Manufacturer? Manufacturer { get; set; }
[ForeignKey("ProductId")]
public List<ProductHistory>? ProductHistories { get; set; }
[ForeignKey("ProductId")]
public List<SaleProduct>? SaleProducts { get; set; }
}

View File

@@ -0,0 +1,14 @@
namespace CatHasPawsDatabase.Models;
internal class ProductHistory
{
public required string Id { get; set; } = Guid.NewGuid().ToString();
public required string ProductId { get; set; }
public double OldPrice { get; set; }
public DateTime ChangeDate { get; set; }
public Product? Product { get; set; }
}

View File

@@ -0,0 +1,14 @@
namespace CatHasPawsDatabase.Models;
internal class Salary
{
public required string Id { get; set; } = Guid.NewGuid().ToString();
public required string WorkerId { get; set; }
public DateTime SalaryDate { get; set; }
public double WorkerSalary { get; set; }
public Worker? Worker { get; set; }
}

View File

@@ -0,0 +1,30 @@
using CatHasPawsContratcs.Enums;
using System.ComponentModel.DataAnnotations.Schema;
namespace CatHasPawsDatabase.Models;
internal class Sale
{
public required string Id { get; set; }
public required string WorkerId { get; set; }
public string? BuyerId { get; set; }
public DateTime SaleDate { get; set; }
public double Sum { get; set; }
public DiscountType DiscountType { get; set; }
public double Discount { 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,14 @@
namespace CatHasPawsDatabase.Models;
internal class SaleProduct
{
public required string SaleId { get; set; }
public required string ProductId { get; set; }
public int Count { get; set; }
public Sale? Sale { get; set; }
public Product? Product { get; set; }
}

View File

@@ -0,0 +1,24 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace CatHasPawsDatabase.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; }
[ForeignKey("WorkerId")]
public List<Salary>? Salaries { get; set; }
[ForeignKey("WorkerId")]
public List<Sale>? Sales { get; set; }
}

View File

@@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CatHasPawsTests", "CatHasPa
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CatHasPawsBusinessLogic", "CatHasPawsBusinessLogic\CatHasPawsBusinessLogic.csproj", "{42EEABA6-5F1B-4552-8DDF-9974A2B89BCF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CatHasPawsDatabase", "CatHasPawsDatabase\CatHasPawsDatabase.csproj", "{54BFB74B-3DA5-47C7-BF70-E8F6C3FFA334}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -27,6 +29,10 @@ Global
{42EEABA6-5F1B-4552-8DDF-9974A2B89BCF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{42EEABA6-5F1B-4552-8DDF-9974A2B89BCF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{42EEABA6-5F1B-4552-8DDF-9974A2B89BCF}.Release|Any CPU.Build.0 = Release|Any CPU
{54BFB74B-3DA5-47C7-BF70-E8F6C3FFA334}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{54BFB74B-3DA5-47C7-BF70-E8F6C3FFA334}.Debug|Any CPU.Build.0 = Debug|Any CPU
{54BFB74B-3DA5-47C7-BF70-E8F6C3FFA334}.Release|Any CPU.ActiveCfg = Release|Any CPU
{54BFB74B-3DA5-47C7-BF70-E8F6C3FFA334}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE