add contracts

This commit is contained in:
Alina Batylkina 2023-04-06 14:34:58 +04:00
parent 618c41a5a0
commit 8a359f676f
47 changed files with 875 additions and 0 deletions

View File

@ -5,6 +5,8 @@ VisualStudioVersion = 17.4.33403.182
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CanteenDataModels", "CanteenDataModels\CanteenDataModels.csproj", "{F11EA5AA-83D7-4D06-9DC5-E2C8E726BC4A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CanteenContracts", "CanteenContracts\CanteenContracts.csproj", "{A4B80B56-049E-4BBE-938A-7AFB99F13B6E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -15,6 +17,10 @@ Global
{F11EA5AA-83D7-4D06-9DC5-E2C8E726BC4A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F11EA5AA-83D7-4D06-9DC5-E2C8E726BC4A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F11EA5AA-83D7-4D06-9DC5-E2C8E726BC4A}.Release|Any CPU.Build.0 = Release|Any CPU
{A4B80B56-049E-4BBE-938A-7AFB99F13B6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A4B80B56-049E-4BBE-938A-7AFB99F13B6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A4B80B56-049E-4BBE-938A-7AFB99F13B6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A4B80B56-049E-4BBE-938A-7AFB99F13B6E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -0,0 +1,26 @@
using CanteenDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.BindingModels
{
public class CookBindingModel : ICookModel
{
public string Name { get; set; } = string.Empty;
public string Surname { get; set; } = string.Empty;
public string Patronymic { get; set; } = string.Empty;
public DateTime DateOfBirth { get; set; }
public string Position { get; set; }
public int ClientId { get; set; }
public int Id { get; set; }
}
}

View File

@ -0,0 +1,22 @@
using CanteenDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.BindingModels
{
public class DishBindingModel : IDishModel
{
public string DishName { get; set; } = string.Empty;
public double Cost { get; set; }
public int ClientId { get; set; }
public int ProductId { get; set; }
public int Id { get; set; }
}
}

View File

@ -0,0 +1,22 @@
using CanteenDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.BindingModels
{
public class LunchBindingModel : ILunchModel
{
public string LunchName { get; set; } = string.Empty;
public double Cost { get; set; }
public int VisitorId { get; set; }
public Dictionary<int, (IProductModel, int)> LunchProducts { get; set; } = new();
public int Id { get; set; }
}
}

View File

@ -0,0 +1,24 @@
using CanteenDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.BindingModels
{
public class ManagerBindingModel : IManagerModel
{
public string FIO { get; set; } = string.Empty;
public string Login { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
public string PhoneNumber { get; set; } = string.Empty;
public int RoleId { get; set; }
public int Id { get; set; }
}
}

View File

@ -0,0 +1,25 @@
using CanteenDataModels.Enums;
using CanteenDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.BindingModels
{
public class OrderBindingModel : IOrderModel
{
public int ClientId { get; set; }
public double Sum { get; set; }
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
public DateTime DateCreate { get; set; } = DateTime.Now;
public DateTime? DateImplement { get; set; }
public int Id { get; set; }
}
}

View File

@ -0,0 +1,22 @@
using CanteenDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.BindingModels
{
public class ProductBindingModel : IProductModel
{
public string ProductName { get; set; } = string.Empty;
public double Cost { get; set; }
public int ClientId { get; set; }
public Dictionary<int, ICookModel> ProductCooks{ get; set; } = new();
public int Id { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using CanteenDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.BindingModels
{
public class RoleBindingModel : IRoleModel
{
public string RoleName { get; set; } = string.Empty;
public int Id { get; set; }
}
}

View File

@ -0,0 +1,20 @@
using CanteenDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.BindingModels
{
public class TablewareBindingModel : ITablewareModel
{
public string TablewareName { get; set; } = string.Empty;
public int ClientId { get; set; }
public int OrderId { get; set; }
public int Id { get; set; }
}
}

View File

@ -0,0 +1,24 @@
using CanteenDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.BindingModels
{
public class VisitorBindingModel : IVisitorModel
{
public string FIO { get; set; } = string.Empty;
public string Login { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
public string PhoneNumber { get; set; } = string.Empty;
public int RoleId { get; set; }
public int Id { get; set; }
}
}

View File

@ -0,0 +1,20 @@
using CanteenContracts.BindingModels;
using CanteenContracts.SearchModel;
using CanteenContracts.View;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.BusinessLogicsContracts
{
public interface ICookLogic
{
List<CookViewModel>? ReadList(CookSearchModel? model);
CookViewModel? ReadElement(CookSearchModel model);
bool Create(CookBindingModel model);
bool Update(CookBindingModel model);
bool Delete(CookBindingModel model);
}
}

View File

@ -0,0 +1,20 @@
using CanteenContracts.BindingModels;
using CanteenContracts.SearchModel;
using CanteenContracts.View;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.BusinessLogicsContracts
{
public interface IDishLogic
{
List<DishViewModel>? ReadList(DishSearchModel? model);
DishViewModel? ReadElement(DishSearchModel model);
bool Create(DishBindingModel model);
bool Update(DishBindingModel model);
bool Delete(DishBindingModel model);
}
}

View File

@ -0,0 +1,20 @@
using CanteenContracts.BindingModels;
using CanteenContracts.SearchModel;
using CanteenContracts.View;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.BusinessLogicsContracts
{
public interface ILunchLogic
{
List<LunchViewModel>? ReadList(LunchSearchModel? model);
LunchViewModel? ReadElement(LunchSearchModel model);
bool Create(LunchBindingModel model);
bool Update(LunchBindingModel model);
bool Delete(LunchBindingModel model);
}
}

View File

@ -0,0 +1,20 @@
using CanteenContracts.BindingModels;
using CanteenContracts.SearchModel;
using CanteenContracts.View;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.BusinessLogicsContracts
{
public interface IManagerLogic
{
List<ManagerViewModel>? ReadList(ManagerSearchModel? model);
ManagerViewModel? ReadElement(ManagerSearchModel model);
bool Create(ManagerBindingModel model);
bool Update(ManagerBindingModel model);
bool Delete(ManagerBindingModel model);
}
}

View File

@ -0,0 +1,20 @@
using CanteenContracts.BindingModels;
using CanteenContracts.SearchModel;
using CanteenContracts.View;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.BusinessLogicsContracts
{
public interface IOrderLogic
{
List<OrderViewModel>? ReadList(OrderSearchModel? model);
bool CreateOrder(OrderBindingModel model);
bool TakeOrderInWork(OrderBindingModel model);
bool FinishOrder(OrderBindingModel model);
bool DeliveryOrder(OrderBindingModel model);
}
}

View File

@ -0,0 +1,20 @@
using CanteenContracts.BindingModels;
using CanteenContracts.SearchModel;
using CanteenContracts.View;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.BusinessLogicsContracts
{
public interface IProductLogic
{
List<ProductViewModel>? ReadList(ProductSearchModel? model);
ProductViewModel? ReadElement(ProductSearchModel model);
bool Create(ProductBindingModel model);
bool Update(ProductBindingModel model);
bool Delete(ProductBindingModel model);
}
}

View File

@ -0,0 +1,20 @@
using CanteenContracts.BindingModels;
using CanteenContracts.SearchModel;
using CanteenContracts.View;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.BusinessLogicsContracts
{
public interface IRoleLogic
{
List<RoleViewModel>? ReadList(RoleSearchModel? model);
RoleViewModel? ReadElement(RoleSearchModel model);
bool Create(RoleBindingModel model);
bool Update(RoleBindingModel model);
bool Delete(RoleBindingModel model);
}
}

View File

@ -0,0 +1,20 @@
using CanteenContracts.BindingModels;
using CanteenContracts.SearchModel;
using CanteenContracts.View;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.BusinessLogicsContracts
{
public interface ITablewareLogic
{
List<TablewareViewModel>? ReadList(TablewareSearchModel? model);
TablewareViewModel? ReadElement(TablewareSearchModel model);
bool Create(TablewareBindingModel model);
bool Update(TablewareBindingModel model);
bool Delete(TablewareBindingModel model);
}
}

View File

@ -0,0 +1,20 @@
using CanteenContracts.BindingModels;
using CanteenContracts.SearchModel;
using CanteenContracts.View;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.BusinessLogicsContracts
{
public interface IVisitorLogic
{
List<VisitorViewModel>? ReadList(VisitorSearchModel? model);
VisitorViewModel? ReadElement(VisitorSearchModel model);
bool Create(VisitorBindingModel model);
bool Update(VisitorBindingModel model);
bool Delete(VisitorBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\CanteenDataModels\CanteenDataModels.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="ViewModels\" />
<Folder Include="BindingModels\" />
<Folder Include="BusinessLogicsContracts\" />
<Folder Include="SearchModels\" />
<Folder Include="StoragesContracts\" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.SearchModel
{
public class CookSearchModel
{
public int? Id { get; set; }
public string? Name { get; set; }
public string? Surname { get; set; }
public string? Patronymic { get; set; }
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.SearchModel
{
public class DishSearchModel
{
public int? Id { get; set; }
public string? DishName { get; set; }
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.SearchModel
{
public class LunchSearchModel
{
public int? Id { get; set; }
public string? LunchName { get; set; }
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.SearchModel
{
public class ManagerSearchModel
{
public int? Id { get; set; }
public string? ClientFIO { get; set; }
public string? PhoneNumber { get; set; }
public string? Login { get; set; }
public string? Password { 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 CanteenContracts.SearchModel
{
public class OrderSearchModel
{
public int? Id { get; set; }
public int? ClientId { get; set; }
public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set; }
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.SearchModel
{
public class ProductSearchModel
{
public int? Id { get; set; }
public string? ProductName { 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 CanteenContracts.SearchModel
{
public class RoleSearchModel
{
public int? Id { get; set; }
public string? RoleName { get; set; }
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.SearchModel
{
public class TablewareSearchModel
{
public int? Id { get; set; }
public string? TablewareName { get; set; }
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.SearchModel
{
public class VisitorSearchModel
{
public int? Id { get; set; }
public string? ClientFIO { get; set; }
public string? PhoneNumber { get; set; }
public string? Login { get; set; }
public string? Password { get; set; }
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.StoragesContracts
{
internal interface ICookStorage
{
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.StoragesContracts
{
internal interface IDishStorage
{
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.StoragesContracts
{
internal interface ILunchStorage
{
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.StoragesContracts
{
internal interface IManagerStorage
{
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.StoragesContracts
{
internal interface IOrderStorage
{
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.StoragesContracts
{
internal interface IProductStorage
{
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.StoragesContracts
{
internal interface IRoleStorage
{
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.StoragesContracts
{
internal interface ITablewarerStorage
{
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.StoragesContracts
{
internal interface IVisitorStorage
{
}
}

View File

@ -0,0 +1,28 @@
using CanteenDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.View
{
public class CookViewModel : ICookModel
{
[DisplayName("Имя")]
public string Name { get; set; } = string.Empty;
[DisplayName("Фамилия")]
public string Surname { get; set; } = string.Empty;
[DisplayName("Отчество")]
public string? Patronymic { get; set; } = string.Empty;
[DisplayName("Дата рождения")]
public DateTime DateOfBirth { get; set; }
[DisplayName("Должность")]
public string Position { get; set; } = string.Empty;
public int ClientId { get; set; }
public int Id { get; set; }
}
}

View File

@ -0,0 +1,21 @@
using CanteenDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.View
{
public class DishViewModel : IDishModel
{
public int Id { get; set; }
public int VisitorId { get; set; }
public int ProductId { get; set; }
[DisplayName("Название блюда")]
public string DishName { get; set; } = string.Empty;
[DisplayName("Цена")]
public double Cost { get; set; }
}
}

View File

@ -0,0 +1,21 @@
using CanteenDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.View
{
public class LunchViewModel : ILunchModel
{
public int Id { get; set; }
public int VisitorId { get; set; }
[DisplayName("Название обеда")]
public string LunchName { get; set; } = string.Empty;
[DisplayName("Цена")]
public double Cost { get; set; }
public Dictionary<int, (IProductModel, int)> LunchProducts { get; set; } = new();
}
}

View File

@ -0,0 +1,26 @@
using CanteenDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.View
{
public class ManagerViewModel : IManagerModel
{
[DisplayName("ФИО управляющего")]
public string FIO { get; set; } = string.Empty;
[DisplayName("Логин")]
public string Login { get; set; } = string.Empty;
[DisplayName("Пароль")]
public string Password { get; set; } = string.Empty;
[DisplayName("Номер телефона")]
public string PhoneNumber { get; set; } = string.Empty;
public int RoleId { get; set; }
public int Id { get; set; }
}
}

View File

@ -0,0 +1,35 @@
using CanteenDataModels.Enums;
using CanteenDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.View
{
public class OrderViewModel : IOrderModel
{
[DisplayName("Номер")]
public int Id { get; set; }
public int LunchId { get; set; }
public int ClientId { get; set; }
[DisplayName("ФИО посетителя")]
public string ClientFIO { get; set; } = string.Empty;
[DisplayName("Обед")]
public string LunchName { get; set; } = string.Empty;
[DisplayName("Количество")]
public int Count { get; set; }
[DisplayName("Сумма")]
public double Sum { get; set; }
[DisplayName("Статус")]
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
[DisplayName("Дата создания")]
public DateTime DateCreate { get; set; } = DateTime.Now;
[DisplayName("Дата выполнения")]
public DateTime? DateImplement { get; set; }
}
}

View File

@ -0,0 +1,24 @@
using CanteenDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.View
{
public class ProductViewModel : IProductModel
{
[DisplayName("Название продукта")]
public string ProductName { get; set; } = string.Empty;
[DisplayName("Цена")]
public double Cost { get; set; }
public int ClientId { get; set; }
public Dictionary<int, ICookModel> ProductCooks { get; set; } = new();
public int Id { get; set; }
}
}

View File

@ -0,0 +1,19 @@
using CanteenDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.View
{
public class RoleViewModel : IRoleModel
{
[DisplayName("Название роли")]
public string RoleName { get; set; } = string.Empty;
public int Id { get; set; }
}
}

View File

@ -0,0 +1,22 @@
using CanteenDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.View
{
public class TablewareViewModel : ITablewareModel
{
[DisplayName("Название прибора")]
public string TablewareName { get; set; } = string.Empty;
public int ClientId { get; set; }
public int OrderId { get; set; }
public int Id { get; set; }
}
}

View File

@ -0,0 +1,26 @@
using CanteenDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.View
{
public class VisitorViewModel : IVisitorModel
{
[DisplayName("ФИО посетителя")]
public string FIO { get; set; } = string.Empty;
[DisplayName("Логин")]
public string Login { get; set; } = string.Empty;
[DisplayName("Пароль")]
public string Password { get; set; } = string.Empty;
[DisplayName("Номер телефона")]
public string PhoneNumber { get; set; } = string.Empty;
public int RoleId { get; set; }
public int Id { get; set; }
}
}