PiBD-23_Ivanov_D.A._LabWork2 #2
@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "North_Bridge_Contract", "No
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "North_Bridge_Tests", "North_Bridge_Tests\North_Bridge_Tests.csproj", "{D77A42DA-D116-49A5-A735-95B5AC7B6D5D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "North_Bridge_BusinessLogics", "North_Bridge_BusinessLogics\North_Bridge_BusinessLogics.csproj", "{51817427-2BC6-40CF-8269-3C55DBDBF867}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -21,6 +23,10 @@ Global
|
||||
{D77A42DA-D116-49A5-A735-95B5AC7B6D5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D77A42DA-D116-49A5-A735-95B5AC7B6D5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D77A42DA-D116-49A5-A735-95B5AC7B6D5D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{51817427-2BC6-40CF-8269-3C55DBDBF867}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{51817427-2BC6-40CF-8269-3C55DBDBF867}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{51817427-2BC6-40CF-8269-3C55DBDBF867}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{51817427-2BC6-40CF-8269-3C55DBDBF867}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -0,0 +1,45 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using North_Bridge_Contract.BusinessLogicsContracts;
|
||||
using North_Bridge_Contract.DataModels;
|
||||
using North_Bridge_Contract.Enums;
|
||||
using North_Bridge_Contract.StoragesContracts;
|
||||
|
||||
namespace North_Bridge_BusinessLogics.Implementations;
|
||||
|
||||
public 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)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using North_Bridge_Contract.BusinessLogicsContracts;
|
||||
using North_Bridge_Contract.DataModels;
|
||||
using North_Bridge_Contract.Enums;
|
||||
using North_Bridge_Contract.StoragesContracts;
|
||||
|
||||
namespace North_Bridge_BusinessLogics.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)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using North_Bridge_Contract.BusinessLogicsContracts;
|
||||
using North_Bridge_Contract.DataModels;
|
||||
using North_Bridge_Contract.StoragesContracts;
|
||||
|
||||
namespace North_Bridge_BusinessLogics.Implementations;
|
||||
|
||||
public 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)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using North_Bridge_Contract.BusinessLogicsContracts;
|
||||
using North_Bridge_Contract.DataModels;
|
||||
using North_Bridge_Contract.StoragesContracts;
|
||||
|
||||
namespace North_Bridge_BusinessLogics.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> GetAllSalesByProductByPeriod(string productId, DateTime fromDate, DateTime toDate)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public SaleDataModel GetSaleByData(string data)
|
||||
{
|
||||
return new("", "", 0, false, []);
|
||||
}
|
||||
|
||||
public void InsertSale(SaleDataModel saleDataModel)
|
||||
{
|
||||
}
|
||||
|
||||
public void CancelSale(string id)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using North_Bridge_Contract.BusinessLogicsContracts;
|
||||
using North_Bridge_Contract.DataModels;
|
||||
using North_Bridge_Contract.StoragesContracts;
|
||||
|
||||
namespace North_Bridge_BusinessLogics.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)
|
||||
{
|
||||
}
|
||||
}
|
@ -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="..\North_Bridge_Contract\North_Bridge_Contract.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -18,20 +18,11 @@ public class SaleDataModel : IValidation
|
||||
|
||||
public List<ProductForSaleDataModel> Products { get; private set; }
|
||||
|
||||
public SaleDataModel(string id, string workerId, DateTime saleDate, double sum, bool isCancel, List<ProductForSaleDataModel> products)
|
||||
{
|
||||
Id = id;
|
||||
WorkerId = workerId;
|
||||
SaleDate = saleDate;
|
||||
Sum = sum;
|
||||
IsCancel = isCancel;
|
||||
Products = products;
|
||||
}
|
||||
|
||||
public SaleDataModel(string? id, string? workerId, double sum, bool isCancel, List<ProductForSaleDataModel>? products)
|
||||
public SaleDataModel(string id, string workerId, double sum, bool isCancel, List<ProductForSaleDataModel> products)
|
||||
{
|
||||
Id = id;
|
||||
WorkerId = workerId;
|
||||
SaleDate = DateTime.UtcNow;
|
||||
Sum = sum;
|
||||
IsCancel = isCancel;
|
||||
Products = products;
|
||||
|
Loading…
x
Reference in New Issue
Block a user