Контракты
This commit is contained in:
parent
195fd57378
commit
07f7204aab
@ -0,0 +1,23 @@
|
||||
using PipingHotContrast.DataModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PipingHotContrast.BusinessLogicsContracts;
|
||||
|
||||
public interface IOrderBusinessLogicContract
|
||||
{
|
||||
List<OrderDataModel> GetAllOrdersByPeriod(DateTime fromDate, DateTime
|
||||
toDate);
|
||||
List<OrderDataModel> GetAllOrdersByWorkerByPeriod(string workerId, DateTime
|
||||
fromDate, DateTime toDate);
|
||||
List<OrderDataModel> GetAllOrdersByRestaurantByPeriod(string restaurantId, DateTime
|
||||
fromDate, DateTime toDate);
|
||||
List<OrderDataModel> GetAllOrdersByProductByPeriod(string productId, DateTime
|
||||
fromDate, DateTime toDate);
|
||||
OrderDataModel GetOrderByData(string data);
|
||||
void InsertOrder(OrderDataModel orderDataModel);
|
||||
void CancelOrder(string id);
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using PipingHotContrast.DataModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PipingHotContrast.BusinessLogicsContracts;
|
||||
|
||||
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,21 @@
|
||||
using PipingHotContrast.DataModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PipingHotContrast.BusinessLogicsContracts;
|
||||
|
||||
public interface IProductBusinessLogicContract
|
||||
{
|
||||
List<ProductDataModel> GetAllProducts(bool onlyActive = true);
|
||||
List<ProductDataModel> GetAllProductsByRestaurant(string restaurantId,
|
||||
bool onlyActive = true);
|
||||
List<ProductHistoryDataModel> GetProductHistoryByProduct(string productId);
|
||||
ProductDataModel GetProductByData(string data);
|
||||
void InsertProduct(ProductDataModel productDataModel);
|
||||
void UpdateProduct(ProductDataModel productDataModel);
|
||||
void DeleteProduct(string id);
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using PipingHotContrast.DataModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PipingHotContrast.BusinessLogicsContracts;
|
||||
|
||||
public interface IRestaurantBusinessLogicContract
|
||||
{
|
||||
|
||||
List<RestaurantDataModel> GetAllRestaurants();
|
||||
RestaurantDataModel GetRestaurantByData(string data);
|
||||
void InsertRestaurant(RestaurantDataModel restaurantDataModel);
|
||||
void UpdateRestaurant(RestaurantDataModel restaurantDataModel);
|
||||
|
||||
void DeleteRestaurant(string id);
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using PipingHotContrast.DataModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PipingHotContrast.BusinessLogicsContracts;
|
||||
|
||||
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,20 @@
|
||||
using PipingHotContrast.DataModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PipingHotContrast.BusinessLogicsContracts;
|
||||
|
||||
public interface IWorkerBusinessLogicContract
|
||||
{
|
||||
List<WorkerDataModel> GetAllWorkers(bool onlyActive = true);
|
||||
List<WorkerDataModel> GetAllWorkersByPost(string postId, bool onlyActive = true);
|
||||
List<WorkerDataModel> GetAllWorkersByBirthDate(DateTime fromDate, DateTime toDate, bool onlyActive = true);
|
||||
List<WorkerDataModel> GetAllWorkersByEmploymentDate(DateTime fromDate, DateTime toDate, bool onlyActive = true);
|
||||
WorkerDataModel GetWorkerByData(string data);
|
||||
void InsertWorker(WorkerDataModel workerDataModel);
|
||||
void UpdateWorker(WorkerDataModel workerDataModel);
|
||||
void DeleteWorker(string id);
|
||||
}
|
@ -9,11 +9,11 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace PipingHotContrast.DataModels;
|
||||
|
||||
public class OrderDataModel(string id, string workerId, string? restaurantId, double sum, bool isCancel, List<OrderProductDataModel> products):IValidation
|
||||
public class OrderDataModel(string id, string workerId, string restaurantId, double sum, bool isCancel, List<OrderProductDataModel> products):IValidation
|
||||
{
|
||||
public string Id { get; private set; } = id;
|
||||
public string WorkerId { get; private set; } = workerId;
|
||||
public string? RestaurantId { get; private set; } = restaurantId;
|
||||
public string RestaurantId { get; private set; } = restaurantId;
|
||||
public DateTime OrderDate { get; private set; } = DateTime.UtcNow;
|
||||
public double Sum { get; private set; } = sum;
|
||||
public bool IsCancel { get; private set; } = isCancel;
|
||||
@ -34,7 +34,10 @@ public class OrderDataModel(string id, string workerId, string? restaurantId, do
|
||||
if (!WorkerId.IsGuid())
|
||||
throw new ValidationException("The value in the field WorkerId is not a unique identifier");
|
||||
|
||||
if (!RestaurantId?.IsGuid() ?? !RestaurantId?.IsEmpty() ?? false)
|
||||
if (RestaurantId.IsEmpty())
|
||||
throw new ValidationException("Field RestaurantId is empty");
|
||||
|
||||
if (!RestaurantId.IsGuid())
|
||||
throw new ValidationException("The value in the field RestaurantId is not a unique identifier");
|
||||
|
||||
if (Sum <= 0)
|
||||
|
@ -0,0 +1,17 @@
|
||||
using PipingHotContrast.DataModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PipingHotContrast.StoragesContracts;
|
||||
|
||||
public interface IOrderStorageContract
|
||||
{
|
||||
List<OrderDataModel> GetList(DateTime? startDate = null, DateTime? endDate = null, string? workerId = null, string? restaurantId = null, string? productId = null);
|
||||
OrderDataModel? GetElementById(string id);
|
||||
void AddElement(OrderDataModel orderDataModel);
|
||||
void DelElement(string id);
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using PipingHotContrast.DataModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PipingHotContrast.StoragesContracts;
|
||||
|
||||
public interface ISalaryStorageContract
|
||||
{
|
||||
List<SalaryDataModel> GetList(DateTime startDate, DateTime engDate, string? workerId = null);
|
||||
void AddElement(SalaryDataModel salaryDataModel);
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
using PipingHotContrast.DataModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PipingHotContrast.StoragesContracts;
|
||||
|
||||
public interface IWorkerStorageContract
|
||||
{
|
||||
List<WorkerDataModel> GetList(bool onlyActive = true, string? postId = null, DateTime? fromBirtDate = null, DateTime? toBirtDate = null, DateTime? fromEmploymentDate = null, DateTime? toEmploymentDate = null);
|
||||
WorkerDataModel? GetElementById(string id);
|
||||
WorkerDataModel? GetElementByFIO(string fio);
|
||||
void AddElement(WorkerDataModel workerDataModel);
|
||||
void UpdElement(WorkerDataModel woworkerDataModel);
|
||||
void DelElement(string id);
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user