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

This commit is contained in:
2025-02-25 13:40:10 +04:00
parent 5fd3fff9b1
commit 651c170ce2
10 changed files with 193 additions and 0 deletions

View File

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

View File

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

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagicCarpetDatabase.Models;
internal class Employee
{
public required string Id { get; set; }
public required string FIO { get; set; }
public string Email { get; set; }
public required string PostId { get; set; }
public DateTime BirthDate { get; set; }
public DateTime EmploymentDate { get; set; }
public bool IsDeleted { get; set; }
[ForeignKey("EmployeeId")]
public List<Salary>? Salaries { get; set; }
[ForeignKey("EmployeeId")]
public List<Sale>? Sales { get; set; }
}

View File

@@ -0,0 +1,20 @@
using MagicCarpetContracts.Enums;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagicCarpetDatabase.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,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagicCarpetDatabase.Models;
internal class Salary
{
public required string Id { get; set; } = Guid.NewGuid().ToString();
public required string EmployeeId { get; set; }
public DateTime SalaryDate { get; set; }
public double EmployeeSalary { get; set; }
}

View File

@@ -0,0 +1,32 @@
using MagicCarpetContracts.DataModels;
using MagicCarpetContracts.Enums;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagicCarpetDatabase.Models;
internal class Sale
{
public required string Id { get; set; }
public required string EmployeeId { get; set; }
public string? ClientId { get; set; }
public DateTime SaleDate { get; set; }
public double Sum { get; private set; }
public DiscountType DiscountType { get; set; }
public double Discount { get; set; }
public bool IsCancel { get; set; }
public Employee? Employee { get; set; }
public Client? Client { get; set; }
[ForeignKey("SaleId")]
public List<SaleTour>? SaleTours { 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 MagicCarpetDatabase.Models;
internal class SaleTour
{
public required string SaleId { get; set; }
public required string TourId { get; set; }
public int Count { get; set; }
public Sale? Sale { get; set; }
public Tour? Tour { get; set; }
}

View File

@@ -0,0 +1,23 @@
using MagicCarpetContracts.Enums;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagicCarpetDatabase.Models;
internal class Tour
{
public required string Id { get; set; } = Guid.NewGuid().ToString();
public required string TourName { get; set; }
public string TourCountry { get; set; }
public double Price { get; set; }
public TourType Type { get; set; }
[ForeignKey("TourId")]
public List<SaleTour>? SaleTours { get; set; }
[ForeignKey("TourId")]
public List<TourHistory>? TourHistories { get; set; }
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagicCarpetDatabase.Models;
internal class TourHistory
{
public required string Id { get; set; } = Guid.NewGuid().ToString();
public required string TourId { get; set; }
public double OldPrice { get; set; }
public DateTime ChangeDate { get; set; }
public Tour? Tour { get; set; }
}

View File

@@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagicCarpetTests", "MagicCa
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagicCarpetBusinessLogic", "MagicCarpetBusinessLogic\MagicCarpetBusinessLogic.csproj", "{688F9182-851F-4CF8-97CD-9B6F1E43D758}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagicCarpetBusinessLogic", "MagicCarpetBusinessLogic\MagicCarpetBusinessLogic.csproj", "{688F9182-851F-4CF8-97CD-9B6F1E43D758}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagicCarpetDatabase", "MagicCarpetDatabase\MagicCarpetDatabase.csproj", "{C69B43B2-8680-42D7-A111-306E2E8225FE}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -27,6 +29,10 @@ Global
{688F9182-851F-4CF8-97CD-9B6F1E43D758}.Debug|Any CPU.Build.0 = Debug|Any CPU {688F9182-851F-4CF8-97CD-9B6F1E43D758}.Debug|Any CPU.Build.0 = Debug|Any CPU
{688F9182-851F-4CF8-97CD-9B6F1E43D758}.Release|Any CPU.ActiveCfg = Release|Any CPU {688F9182-851F-4CF8-97CD-9B6F1E43D758}.Release|Any CPU.ActiveCfg = Release|Any CPU
{688F9182-851F-4CF8-97CD-9B6F1E43D758}.Release|Any CPU.Build.0 = Release|Any CPU {688F9182-851F-4CF8-97CD-9B6F1E43D758}.Release|Any CPU.Build.0 = Release|Any CPU
{C69B43B2-8680-42D7-A111-306E2E8225FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C69B43B2-8680-42D7-A111-306E2E8225FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C69B43B2-8680-42D7-A111-306E2E8225FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C69B43B2-8680-42D7-A111-306E2E8225FE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE