Контракты
This commit is contained in:
parent
f3422b63e8
commit
080802be5e
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using HamContract.DataModels;
|
||||||
|
|
||||||
|
namespace HamContract.BusinessLogicContract;
|
||||||
|
|
||||||
|
public interface IEmployeeBusinessLogicContract
|
||||||
|
{
|
||||||
|
List<EmployeeDataModel> GetAllEmployee(bool onlyActive = true);
|
||||||
|
List<EmployeeDataModel> GetAllEmployeeByPost(string postId, bool onlyActive = true);
|
||||||
|
List<EmployeeDataModel> GetAllEmployeeByDateofBirth(DateTime fromDate, DateTime toDate, bool onlyActive = true);
|
||||||
|
List<EmployeeDataModel> GetAllEmployeeByEmploymentDate(DateTime fromDate, DateTime toDate, bool onlyActive = true);
|
||||||
|
EmployeeDataModel GetEmployeeByData(string data);
|
||||||
|
void InsertEmployee(EmployeeDataModel employeeDataModel);
|
||||||
|
void UpdateEmployee(EmployeeDataModel employeeDataModel);
|
||||||
|
void DeleteEmployee(string id);
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using HamContract.DataModels;
|
||||||
|
|
||||||
|
namespace HamContract.BusinessLogicContract;
|
||||||
|
|
||||||
|
public interface IMeat_ProductBusinessLogicContract
|
||||||
|
{
|
||||||
|
List<Meat_productDataModel> GetAllProducts(bool onlyActive = true);
|
||||||
|
List<HistoryDataModel> GetProductHistoryByProduct(string productId);
|
||||||
|
Meat_productDataModel GetProductByData(string data);
|
||||||
|
void InsertProduct(Meat_productDataModel productDataModel);
|
||||||
|
void UpdateProduct(Meat_productDataModel productDataModel);
|
||||||
|
void DeleteProduct(string id);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using HamContract.DataModels;
|
||||||
|
|
||||||
|
namespace HamContract.BusinessLogicContract;
|
||||||
|
|
||||||
|
public interface IPostBusinessLogicContract
|
||||||
|
{ List<PostDataModel> GetAllPosts(bool onlyActive);
|
||||||
|
List<PostDataModel> GetAllDataOfPost(string postId);
|
||||||
|
PostDataModel GetPostByData(string data);
|
||||||
|
void InsertPost(PostDataModel postDataModel);
|
||||||
|
void UpdatePost(PostDataModel postDataModel);
|
||||||
|
void DeletePost(string id);
|
||||||
|
void RestorePost(string id);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using HamContract.DataModels;
|
||||||
|
|
||||||
|
namespace HamContract.BusinessLogicContract;
|
||||||
|
|
||||||
|
public interface ISalaryBusinessLogicContract
|
||||||
|
{
|
||||||
|
List<SalaryDataModel> GetAllSalariesByPeriod(DateTime fromDate, DateTime toDate);
|
||||||
|
List<SalaryDataModel> GetAllSalariesByPeriodByWorker(DateTime fromDate,DateTime toDate, string workerId);
|
||||||
|
void CalculateSalaryByMounth(DateTime date);
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using HamContract.DataModels;
|
||||||
|
|
||||||
|
namespace HamContract.BusinessLogicContract;
|
||||||
|
|
||||||
|
public interface ISaleBusinessLogicContract
|
||||||
|
{
|
||||||
|
List<SaleDataModel> GetAllSalesByPeriod(DateTime fromDate, DateTime toDate);
|
||||||
|
|
||||||
|
List<SaleDataModel> GetAllSalesByWorkerByPeriod(string employeeId, DateTime fromDate, DateTime toDate);
|
||||||
|
|
||||||
|
List<SaleDataModel> GetAllSalesByProductByPeriod(string productId, DateTime fromDate, DateTime toDate);
|
||||||
|
|
||||||
|
SaleDataModel GetSaleByData(string data);
|
||||||
|
|
||||||
|
void InsertSale(SaleDataModel saleDataModel);
|
||||||
|
|
||||||
|
void CancelSale(string id);
|
||||||
|
}
|
@ -10,7 +10,7 @@ using HamContract.Infrastructure;
|
|||||||
|
|
||||||
namespace HamContract.DataModels
|
namespace HamContract.DataModels
|
||||||
{
|
{
|
||||||
public class ProductDataModel(string id, string productName, ProductType productType, double price, bool isDeleted) : IValidation
|
public class Meat_productDataModel(string id, string productName, ProductType productType, double price, bool isDeleted) : IValidation
|
||||||
|
|
||||||
{
|
{
|
||||||
public string Id { get; private set; } = id;
|
public string Id { get; private set; } = id;
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using HamContract.DataModels;
|
||||||
|
|
||||||
|
namespace HamContract.StorageContracts;
|
||||||
|
|
||||||
|
public interface IEmployeeStorageContract
|
||||||
|
{
|
||||||
|
List<EmployeeDataModel> GetList(bool onlyActive = true, string? postId =
|
||||||
|
null, DateTime? fromDateofBirth= null, DateTime? toDateofBirth = null, DateTime?fromEmploymentDate = null, DateTime? toEmploymentDate = null);
|
||||||
|
EmployeeDataModel? GetElementById(string id);
|
||||||
|
EmployeeDataModel? GetElementByFIO(string name);
|
||||||
|
void AddElement(EmployeeDataModel employeeDataModel);
|
||||||
|
void UpdElement(EmployeeDataModel employeeDataModel);
|
||||||
|
void DelElement(string id);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using HamContract.DataModels;
|
||||||
|
|
||||||
|
namespace HamContract.StorageContracts;
|
||||||
|
|
||||||
|
public interface IMeat_productStorageContract
|
||||||
|
{
|
||||||
|
List<Meat_productDataModel>GetList(bool onlyActive = true);
|
||||||
|
List<HistoryDataModel> GetHistoryByProductId(string productId);
|
||||||
|
Meat_productDataModel? GetElementById(string id);
|
||||||
|
Meat_productDataModel? GetElementByName(string name);
|
||||||
|
void AddElement(Meat_productDataModel productDataModel);
|
||||||
|
void UpdElement(Meat_productDataModel productDataModel);
|
||||||
|
void DelElement(string id);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using HamContract.DataModels;
|
||||||
|
|
||||||
|
namespace HamContract.StorageContracts;
|
||||||
|
|
||||||
|
public interface IPostStorageContract
|
||||||
|
{
|
||||||
|
List<PostDataModel> GetList(bool onlyActual = true);
|
||||||
|
List<PostDataModel> GetPostWithHistory(string postId);
|
||||||
|
PostDataModel? GetElementById(string id);
|
||||||
|
PostDataModel? GetElementByName(string name);
|
||||||
|
void AddElement(PostDataModel postDataModel);
|
||||||
|
void UpdElement(PostDataModel postDataModel);
|
||||||
|
void DelElement(string id);
|
||||||
|
void ResElement(string id);
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using HamContract.DataModels;
|
||||||
|
|
||||||
|
namespace HamContract.StorageContracts
|
||||||
|
{
|
||||||
|
public interface ISalaryStorageContract
|
||||||
|
{
|
||||||
|
List<SalaryDataModel> GetList(DateTime startDate, DateTime endDate, string?employeeId = null);
|
||||||
|
void AddElement(SalaryDataModel salaryDataModel);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using HamContract.DataModels;
|
||||||
|
|
||||||
|
namespace HamContract.StorageContracts;
|
||||||
|
|
||||||
|
public interface ISaleStorageContract
|
||||||
|
{
|
||||||
|
List<SaleDataModel> GetList(DateTime? startDate = null, DateTime? endDate =
|
||||||
|
null, string? employeeId = null, string? productId = null);
|
||||||
|
SaleDataModel? GetElementById(string id);
|
||||||
|
void AddElement(SaleDataModel saleDataModel);
|
||||||
|
void DelElement(string id);
|
||||||
|
|
||||||
|
}
|
@ -73,7 +73,7 @@ namespace HamTests.DataModelsTest;
|
|||||||
Assert.That(product.IsDeleted, Is.EqualTo(productIsDelete));
|
Assert.That(product.IsDeleted, Is.EqualTo(productIsDelete));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
private static ProductDataModel CreateDataModel(string? id, string? productName, ProductType productType, double price, bool isDeleted) =>
|
private static Meat_productDataModel CreateDataModel(string? id, string? productName, ProductType productType, double price, bool isDeleted) =>
|
||||||
new(id, productName, productType, price, isDeleted);
|
new(id, productName, productType, price, isDeleted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
24
HamContract/TestProject1/TestProject1.csproj
Normal file
24
HamContract/TestProject1/TestProject1.csproj
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
<IsTestProject>true</IsTestProject>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="coverlet.collector" Version="6.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||||
|
<PackageReference Include="NUnit" Version="3.14.0" />
|
||||||
|
<PackageReference Include="NUnit.Analyzers" Version="3.9.0" />
|
||||||
|
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Using Include="NUnit.Framework" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
16
HamContract/TestProject1/UnitTest1.cs
Normal file
16
HamContract/TestProject1/UnitTest1.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
namespace TestProject1
|
||||||
|
{
|
||||||
|
public class Tests
|
||||||
|
{
|
||||||
|
[SetUp]
|
||||||
|
public void Setup()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Test1()
|
||||||
|
{
|
||||||
|
Assert.Pass();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user