Реализации

This commit is contained in:
mara-1 2025-02-24 23:09:17 +04:00
parent e50b4dab9c
commit cf6d712375
10 changed files with 292 additions and 2 deletions

View File

@ -0,0 +1,8 @@
using System;
public class Class1
{
public Class1()
{
}
}

View File

@ -0,0 +1,38 @@
using Microsoft.Extensions.Logging;
using Squirrel.BusinessLogicsContracts;
using Squirrel.DataModels;
using Squirrel.StoragesContracts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SquirelBusinessLogic.Implementations;
internal class GuestBusinessLogicContract(IGuestStorageContract
guestStorageContract, ILogger logger) : IGuestBusinessLogicContract
{
private readonly ILogger _logger = logger;
private readonly IGuestStorageContract _guestStorageContract =
guestStorageContract;
public List<GuestDataModel> GetAllGuests()
{
return [];
}
public GuestDataModel GetGuestByData(string data)
{
return new("", "", "", 0);
}
public void InsertGuest(GuestDataModel guestDataModel)
{
}
public void UpdateGuest(GuestDataModel guestDataModel)
{
}
public void DeleteGuest(string id)
{
}
}

View File

@ -0,0 +1,44 @@
using Microsoft.Extensions.Logging;
using Squirrel.BusinessLogicsContracts;
using Squirrel.DataModels;
using Squirrel.Enums;
using Squirrel.StoragesContracts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SquirelBusinessLogic.Implementations;
internal class PostBusinessLogicContract(IPostStorageContract
postStorageContract, ILogger logger) : IPostBusinessLogicContract
{
private readonly ILogger _logger = logger;
private readonly IPostStorageContract _postStorageContract = postStorageContract;
public List<PostDataModel> GetAllPosts(bool onlyActive = true)
{
return [];
}
public List<PostDataModel> GetAllDataOfPost(string postId)
{
return [];
}
public PostDataModel GetPostByData(string data)
{
return new("", "", "", PostType.None, 0, true, DateTime.UtcNow);
}
public void InsertPost(PostDataModel postDataModel)
{
}
public void UpdatePost(PostDataModel postDataModel)
{
}
public void DeletePost(string id)
{
}
public void RestorePost(string id)
{
}
}

View File

@ -0,0 +1,44 @@
using Microsoft.Extensions.Logging;
using Squirrel.BusinessLogicsContracts;
using Squirrel.DataModels;
using Squirrel.Enums;
using Squirrel.StoragesContracts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SquirelBusinessLogic.Implementations;
internal class ProductBusinessLogicContract(IProductStorageContract
productStorageContract, ILogger logger) : IProductBusinessLogicContract
{
private readonly ILogger _logger = logger;
private readonly IProductStorageContract _productStorageContract = productStorageContract;
public List<ProductDataModel> GetAllProducts(bool onlyActive)
{
return [];
}
public List<ProductHistoryDataModel> GetProductHistoryByProduct(string
productId)
{
return [];
}
public ProductDataModel GetProductByData(string data)
{
return new("", "", ProductType.None, 0, true);
}
public void InsertProduct(ProductDataModel productDataModel)
{
}
public void UpdateProduct(ProductDataModel productDataModel)
{
}
public void DeleteProduct(string id)
{
}
}

View File

@ -0,0 +1,34 @@
using Microsoft.Extensions.Logging;
using Squirrel.BusinessLogicsContracts;
using Squirrel.DataModels;
using Squirrel.StoragesContracts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SquirelBusinessLogic.Implementations;
internal class SalaryBusinessLogicContract(ISalaryStorageContract salaryStorageContract, ISaleStorageContract saleStorageContract, IPostStorageContract
postStorageContract, IWorkerStorageContract workerStorageContract, ILogger
logger) : ISalaryBusinessLogicContract
{
private readonly ILogger _logger = logger;
private readonly ISalaryStorageContract _salaryStorageContract = salaryStorageContract;
private readonly ISaleStorageContract _saleStorageContract = saleStorageContract;
private readonly IPostStorageContract _postStorageContract = postStorageContract;
private readonly IWorkerStorageContract _workerStorageContract = workerStorageContract;
public List<SalaryDataModel> GetAllSalariesByPeriod(DateTime fromDate, DateTime toDate)
{
return [];
}
public List<SalaryDataModel> GetAllSalariesByPeriodByWorker(DateTime fromDate, DateTime toDate, string workerId)
{
return [];
}
public void CalculateSalaryByMounth(DateTime date)
{
}
}

View File

@ -0,0 +1,48 @@
using Microsoft.Extensions.Logging;
using Squirrel.BusinessLogicsContracts;
using Squirrel.DataModels;
using Squirrel.Enums;
using Squirrel.StoragesContracts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SquirelBusinessLogic.Implementations;
internal class SaleBusinessLogicContract(ISaleStorageContract
saleStorageContract, ILogger logger) : ISaleBusinessLogicContract
{
private readonly ILogger _logger = logger;
private readonly ISaleStorageContract _saleStorageContract = saleStorageContract;
public List<SaleDataModel> GetAllSalesByPeriod(DateTime fromDate, DateTime toDate)
{
return [];
}
public List<SaleDataModel> GetAllSalesByWorkerByPeriod(string workerId, DateTime fromDate, DateTime toDate)
{
return [];
}
public List<SaleDataModel> GetAllSalesByGuestByPeriod(string? guestId, DateTime fromDate, DateTime toDate)
{
return [];
}
public List<SaleDataModel> GetAllSalesByProductByPeriod(string productId, DateTime fromDate, DateTime toDate)
{
return [];
}
public SaleDataModel GetSaleByData(string data)
{
return new("", "", "", 0, DiscountType.None, 0, false, []);
}
public void InsertSale(SaleDataModel saleDataModel)
{
}
public void CancelSale(string id)
{
}
}

View File

@ -0,0 +1,51 @@
using Microsoft.Extensions.Logging;
using Squirrel.BusinessLogicsContracts;
using Squirrel.DataModels;
using Squirrel.StoragesContracts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SquirelBusinessLogic.Implementations;
internal class WorkerBusinessLogicContract(IWorkerStorageContract
workerStorageContract, ILogger logger) : IWorkerBusinessLogicContract
{
private readonly ILogger _logger = logger;
private readonly IWorkerStorageContract _workerStorageContract =
workerStorageContract;
public List<WorkerDataModel> GetAllWorkers(bool onlyActive = true)
{
return [];
}
public List<WorkerDataModel> GetAllWorkersByPost(string postId, bool
onlyActive = true)
{
return [];
}
public List<WorkerDataModel> GetAllWorkersByBirthDate(DateTime fromDate,
DateTime toDate, bool onlyActive = true)
{
return [];
}
public List<WorkerDataModel> GetAllWorkersByEmploymentDate(DateTime
fromDate, DateTime toDate, bool onlyActive = true)
{
return [];
}
public WorkerDataModel GetWorkerByData(string data)
{
return new("", "", "", DateTime.Now, DateTime.Now, true);
}
public void InsertWorker(WorkerDataModel workerDataModel)
{
}
public void UpdateWorker(WorkerDataModel workerDataModel)
{
}
public void DeleteWorker(string id)
{
}
}

View File

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Squirrel\Squirrel.csproj" />
</ItemGroup>
</Project>

View File

@ -5,7 +5,9 @@ VisualStudioVersion = 17.11.35303.130
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Squirrel", "Squirrel\Squirrel.csproj", "{16CED5CC-61F1-494B-8B3E-7F6A3BD6F0C3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SquirrelTests", "SquirrelTests\SquirrelTests.csproj", "{C61A5FF4-E87A-4722-AA58-2E7FC2057217}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SquirrelTests", "SquirrelTests\SquirrelTests.csproj", "{C61A5FF4-E87A-4722-AA58-2E7FC2057217}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SquirelBusinessLogic", "SquirelBusinessLogic\SquirelBusinessLogic.csproj", "{9846600E-25A1-423B-B84E-A87CE0563ED7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -21,6 +23,10 @@ Global
{C61A5FF4-E87A-4722-AA58-2E7FC2057217}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C61A5FF4-E87A-4722-AA58-2E7FC2057217}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C61A5FF4-E87A-4722-AA58-2E7FC2057217}.Release|Any CPU.Build.0 = Release|Any CPU
{9846600E-25A1-423B-B84E-A87CE0563ED7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9846600E-25A1-423B-B84E-A87CE0563ED7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9846600E-25A1-423B-B84E-A87CE0563ED7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9846600E-25A1-423B-B84E-A87CE0563ED7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -12,6 +12,6 @@ public interface IGuestBusinessLogicContract
List<GuestDataModel> GetAllGuests();
GuestDataModel GetGuestByData(string data);
void InsertGuest(GuestDataModel guestDataModel);
void UpdateBuyer(GuestDataModel guestDataModel);
void UpdateGuest(GuestDataModel guestDataModel);
void DeleteGuest(string id);
}