models and contracts are ready

This commit is contained in:
Алина Батылкина 2023-04-07 21:53:52 +04:00
parent 7c8efd4ea7
commit 6d3c7c0a5d
47 changed files with 94 additions and 247 deletions

View File

@ -11,12 +11,8 @@ namespace CanteenContracts.BindingModels
{ {
public int Id { get; set; } public int Id { get; set; }
public int ManagerId { get; set; } public int ManagerId { get; set; }
public string Name { get; set; } = string.Empty; public string FIO { get; set; } = string.Empty;
public string Surname { get; set; } = string.Empty;
public string Patronymic { get; set; } = string.Empty;
public string Position { get; set; } = string.Empty; public string Position { get; set; } = string.Empty;
} }
} }

View File

@ -11,8 +11,9 @@ namespace CanteenContracts.BindingModels
{ {
public int Id { get; set; } public int Id { get; set; }
public string DishName { get; set; } = string.Empty; public string DishName { get; set; } = string.Empty;
public double Cost { get; set; } public double Price { get; set; }
public int ManagerId { get; set; } public int ManagerId { get; set; }
public Dictionary<int, (IProductModel, int)> DishProducts { get; set; } = new(); public Dictionary<int, (IProductModel, int)> DishProducts { get; set; } = new();
} }
} }

View File

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.BindingModels
{
public class DishLinkBindingModel
{
public int Id { get; set; }
}
}

View File

@ -13,9 +13,11 @@ namespace CanteenContracts.BindingModels
public int Id { get; set; } public int Id { get; set; }
public int VisitorId { get; set; } public int VisitorId { get; set; }
public string LunchName { get; set; } = string.Empty; public string LunchName { get; set; } = string.Empty;
public double Cost { get; set; } public double Sum { get; set; }
public Dictionary<int, (IProductModel, int)> LunchProducts { get; set; } = new(); public LunchStatus Status { get; set; }
public DateTime DateCreate { get; set; } = DateTime.Now;
public DateTime? DateImplement { get; set; }
public Dictionary<int, (IProductModel, int)> LunchProducts { get; set; } = new Dictionary<int, (IProductModel, int)>();
}
} }
}

View File

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.BindingModels
{
public class LunchLinkBindingModel
{
public int Id { get; set; }
}
}

View File

@ -18,7 +18,5 @@ namespace CanteenContracts.BindingModels
public string PhoneNumber { get; set; } = string.Empty; public string PhoneNumber { get; set; } = string.Empty;
public int RoleId { get; set; }
} }
} }

View File

@ -13,7 +13,8 @@ namespace CanteenContracts.BindingModels
public int Id { get; set; } public int Id { get; set; }
public int VisitorId { get; set; } public int VisitorId { get; set; }
public string Description { get; set; } = string.Empty; public string Description { get; set; } = string.Empty;
public double Sum { get; set; } public double? Sum { get; set; }
public DateTime DateCreate { get; } = DateTime.Now; public Dictionary<int, (IDishModel, int)> OrderDishes { get; set; } = new ();
} }
} }

View File

@ -11,12 +11,8 @@ namespace CanteenContracts.BindingModels
{ {
public int Id { get; set; } public int Id { get; set; }
public string ProductName { get; set; } = string.Empty; public string ProductName { get; set; } = string.Empty;
public double Price { get; set; }
public double Cost { get; set; }
public int ManagerId { get; set; } public int ManagerId { get; set; }
public Dictionary<int, ICookModel> ProductCooks { get; set; } = new Dictionary<int, ICookModel>();
public Dictionary<int, ICookModel> ProductCooks{ get; set; } = new();
} }
} }

View File

@ -1,16 +0,0 @@
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 int Id { get; set; }
public string RoleName { get; set; } = string.Empty;
}
}

View File

@ -10,10 +10,9 @@ namespace CanteenContracts.BindingModels
public class TablewareBindingModel : ITablewareModel public class TablewareBindingModel : ITablewareModel
{ {
public int Id { get; set; } public int Id { get; set; }
public int VisitorId { get; set; }
public int OrderId { get; set; }
public string TablewareName { get; set; } = string.Empty; public string TablewareName { get; set; } = string.Empty;
public int Count { get; set; } public int Count { get; set; }
public int ManagerId { get; set; }
public int OrderId { get; set; }
} }
} }

View File

@ -17,7 +17,5 @@ namespace CanteenContracts.BindingModels
public string Password { get; set; } = string.Empty; public string Password { get; set; } = string.Empty;
public string PhoneNumber { get; set; } = string.Empty; public string PhoneNumber { get; set; } = string.Empty;
public int RoleId { get; set; }
} }
} }

View File

@ -15,6 +15,7 @@ namespace CanteenContracts.BusinessLogicsContracts
LunchViewModel? ReadElement(LunchSearchModel model); LunchViewModel? ReadElement(LunchSearchModel model);
bool Create(LunchBindingModel model); bool Create(LunchBindingModel model);
bool Update(LunchBindingModel model); bool Update(LunchBindingModel model);
bool Delete(LunchBindingModel model); bool Finish(LunchBindingModel model);
bool AddOrder(OrderBindingModel model);
} }
} }

View File

@ -13,9 +13,9 @@ namespace CanteenContracts.BusinessLogicsContracts
{ {
List<OrderViewModel>? ReadList(OrderSearchModel? model); List<OrderViewModel>? ReadList(OrderSearchModel? model);
OrderViewModel? ReadElement(OrderSearchModel model); OrderViewModel? ReadElement(OrderSearchModel model);
bool CreateOrder(OrderBindingModel model); bool Create(OrderBindingModel model);
bool AddLunch(LunchLinkBindingModel model); bool Delete(OrderBindingModel model);
bool AddDish(DishLinkBindingModel model); bool Update(OrderBindingModel model);
bool AddCook(CookLinkBindingModel model); bool AddCook(CookBindingModel model);
} }
} }

View File

@ -1,20 +0,0 @@
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

@ -12,7 +12,6 @@
<ItemGroup> <ItemGroup>
<Folder Include="ViewModels\" /> <Folder Include="ViewModels\" />
<Folder Include="BusinessLogicsContracts\" />
<Folder Include="SearchModels\" /> <Folder Include="SearchModels\" />
<Folder Include="StoragesContracts\" /> <Folder Include="StoragesContracts\" />
</ItemGroup> </ItemGroup>

View File

@ -10,8 +10,5 @@ namespace CanteenContracts.SearchModel
{ {
public int? Id { get; set; } public int? Id { get; set; }
public int? ManagerId { get; set; } public int? ManagerId { get; set; }
public string? Name { get; set; }
public string? Surname { get; set; }
public string? Patronymic { get; set; }
} }
} }

View File

@ -10,6 +10,5 @@ namespace CanteenContracts.SearchModel
{ {
public int? Id { get; set; } public int? Id { get; set; }
public int? ManagerId { get; set; } public int? ManagerId { get; set; }
public string? DishName { get; set; }
} }
} }

View File

@ -10,6 +10,7 @@ namespace CanteenContracts.SearchModel
{ {
public int? Id { get; set; } public int? Id { get; set; }
public int? VisitorId { get; set; } public int? VisitorId { get; set; }
public string? LunchName { get; set; } public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set; }
} }
} }

View File

@ -9,9 +9,8 @@ namespace CanteenContracts.SearchModel
public class ManagerSearchModel public class ManagerSearchModel
{ {
public int? Id { get; set; } public int? Id { get; set; }
public string? ClientFIO { get; set; }
public string? PhoneNumber { get; set; }
public string? Login { get; set; } public string? Login { get; set; }
public string? Password { get; set; } public string? Password { get; set; }
public string? PhoneNumber { get; set; }
} }
} }

View File

@ -10,7 +10,5 @@ namespace CanteenContracts.SearchModel
{ {
public int? Id { get; set; } public int? Id { get; set; }
public int? VisitorId { get; set; } public int? VisitorId { get; set; }
public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set; }
} }
} }

View File

@ -10,6 +10,5 @@ namespace CanteenContracts.SearchModel
{ {
public int? Id { get; set; } public int? Id { get; set; }
public int? ManagerId { get; set; } public int? ManagerId { get; set; }
public string? ProductName { get; set; }
} }
} }

View File

@ -1,15 +0,0 @@
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

@ -10,6 +10,5 @@ namespace CanteenContracts.SearchModel
{ {
public int? Id { get; set; } public int? Id { get; set; }
public int? VisitorId { get; set; } public int? VisitorId { get; set; }
public string? TablewareName { get; set; }
} }
} }

View File

@ -9,9 +9,8 @@ namespace CanteenContracts.SearchModel
public class VisitorSearchModel public class VisitorSearchModel
{ {
public int? Id { get; set; } public int? Id { get; set; }
public string? ClientFIO { get; set; }
public string? PhoneNumber { get; set; }
public string? Login { get; set; } public string? Login { get; set; }
public string? Password { get; set; } public string? Password { get; set; }
public string? PhoneNumber { get; set; }
} }
} }

View File

@ -17,5 +17,6 @@ namespace CanteenContracts.StoragesContracts
LunchViewModel? Insert(LunchBindingModel model); LunchViewModel? Insert(LunchBindingModel model);
LunchViewModel? Update(LunchBindingModel model); LunchViewModel? Update(LunchBindingModel model);
LunchViewModel? Delete(LunchBindingModel model); LunchViewModel? Delete(LunchBindingModel model);
OrderViewModel? AddOrder(OrderBindingModel model);
} }
} }

View File

@ -17,8 +17,6 @@ namespace CanteenContracts.StoragesContracts
OrderViewModel? Insert(OrderBindingModel model); OrderViewModel? Insert(OrderBindingModel model);
OrderViewModel? Update(OrderBindingModel model); OrderViewModel? Update(OrderBindingModel model);
OrderViewModel? Delete(OrderBindingModel model); OrderViewModel? Delete(OrderBindingModel model);
OrderViewModel? AddLunch(LunchLinkBindingModel model); OrderViewModel? AddCook(CookBindingModel model);
OrderViewModel? AddDish(DishLinkBindingModel model);
OrderViewModel? AddCook(CookLinkBindingModel model);
} }
} }

View File

@ -1,21 +0,0 @@
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.StoragesContracts
{
public interface IRoleStorage
{
List<RoleViewModel> GetFullList();
List<RoleViewModel> GetFilteredList(RoleSearchModel model);
RoleViewModel? GetElement(RoleSearchModel model);
RoleViewModel? Insert(RoleBindingModel model);
RoleViewModel? Update(RoleBindingModel model);
RoleViewModel? Delete(RoleBindingModel model);
}
}

View File

@ -10,17 +10,12 @@ namespace CanteenContracts.View
{ {
public class CookViewModel : ICookModel public class CookViewModel : ICookModel
{ {
[DisplayName("Имя")] [DisplayName("ФИО")]
public string Name { get; set; } = string.Empty; public string FIO { get; set; } = string.Empty;
[DisplayName("Фамилия")]
public string Surname { get; set; } = string.Empty;
[DisplayName("Отчество")]
public string? Patronymic { get; set; } = string.Empty;
[DisplayName("Должность")] [DisplayName("Должность")]
public string Position { get; set; } = string.Empty; public string Position { get; set; } = string.Empty;
[DisplayName("ID менеджера")]
public int ManagerId { get; set; } public int ManagerId { get; set; }
public int Id { get; set; } public int Id { get; set; }
} }
} }

View File

@ -10,12 +10,13 @@ namespace CanteenContracts.View
{ {
public class DishViewModel : IDishModel public class DishViewModel : IDishModel
{ {
public int Id { get; set; }
public int ManagerId { get; set; }
[DisplayName("Название блюда")] [DisplayName("Название блюда")]
public string DishName { get; set; } = string.Empty; public string DishName { get; set; }
[DisplayName("Цена")] [DisplayName("Цена")]
public double Cost { get; set; } public double Price { get; set; }
public Dictionary<int, (IProductModel, int)> DishProducts { get; set; } = new(); [DisplayName("ID менеджера")]
public int ManagerId { get; set; }
public int Id { get; set; }
public Dictionary<int, (IProductModel, int)> DishProducts { get; set; }
} }
} }

View File

@ -1,4 +1,5 @@
using CanteenDataModels.Models; using CanteenDataModels.Enums;
using CanteenDataModels.Models;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@ -11,11 +12,18 @@ namespace CanteenContracts.View
public class LunchViewModel : ILunchModel public class LunchViewModel : ILunchModel
{ {
public int Id { get; set; } public int Id { get; set; }
[DisplayName("ID посетителя")]
public int VisitorId { get; set; } public int VisitorId { get; set; }
[DisplayName("Название обеда")] [DisplayName("Название обеда")]
public string LunchName { get; set; } = string.Empty; public string LunchName { get; set; } = string.Empty;
[DisplayName("Цена")] [DisplayName("Сумма")]
public double Cost { get; set; } public double Sum { get; set; }
[DisplayName("Статус")]
public LunchStatus Status { get; set; }
[DisplayName("Дата создания")]
public DateTime DateCreate { get; set; }
[DisplayName("Дата реализации")]
public DateTime? DateImplement { get; set; }
public Dictionary<int, (IProductModel, int)> LunchProducts { get; set; } = new(); public Dictionary<int, (IProductModel, int)> LunchProducts { get; set; } = new();
} }
} }

View File

@ -10,7 +10,7 @@ namespace CanteenContracts.View
{ {
public class ManagerViewModel : IManagerModel public class ManagerViewModel : IManagerModel
{ {
[DisplayName("ФИО управляющего")] [DisplayName("ФИО")]
public string FIO { get; set; } = string.Empty; public string FIO { get; set; } = string.Empty;
[DisplayName("Логин")] [DisplayName("Логин")]
public string Login { get; set; } = string.Empty; public string Login { get; set; } = string.Empty;
@ -18,9 +18,7 @@ namespace CanteenContracts.View
public string Password { get; set; } = string.Empty; public string Password { get; set; } = string.Empty;
[DisplayName("Номер телефона")] [DisplayName("Номер телефона")]
public string PhoneNumber { get; set; } = string.Empty; public string PhoneNumber { get; set; } = string.Empty;
public int RoleId { get; set; }
public int Id { get; set; } public int Id { get; set; }
} }
} }

View File

@ -11,15 +11,15 @@ namespace CanteenContracts.View
{ {
public class OrderViewModel : IOrderModel public class OrderViewModel : IOrderModel
{ {
[DisplayName("Номер")] [DisplayName("ID посетителя")]
public int Id { get; set; }
public int VisitorId { get; set; } public int VisitorId { get; set; }
[DisplayName("ФИО посетителя")] [DisplayName("Описание")]
public string VisitorFIO { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty; public string Description { get; set; } = string.Empty;
[DisplayName("Сумма")] [DisplayName("Сумма")]
public double Sum { get; set; } public double? Sum { get; set; }
[DisplayName("Дата создания")] [DisplayName("Блюда в заказе")]
public DateTime DateCreate { get; set; } = DateTime.Now; public Dictionary<int, (IDishModel, int)> OrderDishes { get; set; } = new Dictionary<int, (IDishModel, int)>();
public int Id { get; set; }
} }
} }

View File

@ -10,12 +10,18 @@ namespace CanteenContracts.View
{ {
public class ProductViewModel : IProductModel public class ProductViewModel : IProductModel
{ {
public int Id { get; set; }
public int ManagerId { get; set; }
[DisplayName("Название продукта")] [DisplayName("Название продукта")]
public string ProductName { get; set; } = string.Empty; public string ProductName { get; set; } = string.Empty;
[DisplayName("Цена")] [DisplayName("Цена")]
public double Cost { get; set; } public double Price { get; set; }
[DisplayName("ID менеджера")]
public int ManagerId { get; set; }
public Dictionary<int, ICookModel> ProductCooks { get; set; } = new(); public Dictionary<int, ICookModel> ProductCooks { get; set; } = new();
public int Id { get; set; }
} }
} }

View File

@ -1,19 +0,0 @@
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

@ -10,13 +10,19 @@ namespace CanteenContracts.View
{ {
public class TablewareViewModel : ITablewareModel public class TablewareViewModel : ITablewareModel
{ {
[DisplayName("ID посетителя")]
public int Id { get; set; }
public int VisitorId { get; set; } public int VisitorId { get; set; }
[DisplayName("ID заказа")]
public int OrderId { get; set; } public int OrderId { get; set; }
[DisplayName("Название прибора")] [DisplayName("Название прибора")]
public string TablewareName { get; set; } = string.Empty; public string TablewareName { get; set; } = string.Empty;
[DisplayName("Количество")]
public int Count { get; set; } public int Count { get; set; }
public int Id { get; set; }
} }
} }

View File

@ -11,14 +11,17 @@ namespace CanteenContracts.View
public class VisitorViewModel : IVisitorModel public class VisitorViewModel : IVisitorModel
{ {
public int Id { get; set; } public int Id { get; set; }
[DisplayName("ФИО посетителя")] [DisplayName("ФИО посетителя")]
public string FIO { get; set; } = string.Empty; public string FIO { get; set; } = string.Empty;
[DisplayName("Логин")] [DisplayName("Логин")]
public string Login { get; set; } = string.Empty; public string Login { get; set; } = string.Empty;
[DisplayName("Пароль")] [DisplayName("Пароль")]
public string Password { get; set; } = string.Empty; public string Password { get; set; } = string.Empty;
[DisplayName("Номер телефона")] [DisplayName("Номер телефона")]
public string PhoneNumber { get; set; } = string.Empty; public string PhoneNumber { get; set; } = string.Empty;
public int RoleId { get; set; }
} }
} }

View File

@ -7,7 +7,6 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Enums\" />
<Folder Include="Models\" /> <Folder Include="Models\" />
</ItemGroup> </ItemGroup>

View File

@ -4,10 +4,11 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace CanteenContracts.BindingModels namespace CanteenDataModels.Enums
{ {
public class CookLinkBindingModel public enum LunchStatus
{ {
public int Id { get; set; } Создан = 0,
Окончен = 1
} }
} }

View File

@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenDataModels.Enums
{
public enum OrderStatus
{
Неизвестен = -1,
Принят = 0,
Выполняется = 1,
Готов = 2,
Выдан = 3
}
}

View File

@ -9,12 +9,7 @@ namespace CanteenDataModels.Models
public interface ICookModel : IId public interface ICookModel : IId
{ {
int ManagerId { get; } int ManagerId { get; }
string Name { get; } string FIO { get; }
string Surname { get; }
string Patronymic { get; }
string Position { get; } string Position { get; }
} }
} }

View File

@ -9,7 +9,7 @@ namespace CanteenDataModels.Models
public interface IDishModel : IId public interface IDishModel : IId
{ {
string DishName { get; } string DishName { get; }
double Cost { get; } double Price { get; }
int ManagerId { get; } int ManagerId { get; }
Dictionary<int, (IProductModel, int)> DishProducts { get; } Dictionary<int, (IProductModel, int)> DishProducts { get; }
} }

View File

@ -1,4 +1,5 @@
using System; using CanteenDataModels.Enums;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -10,7 +11,10 @@ namespace CanteenDataModels.Models
{ {
int VisitorId { get; } int VisitorId { get; }
string LunchName { get; } string LunchName { get; }
double Cost { get; } double Sum { get; }
LunchStatus Status { get; }
DateTime DateCreate { get; }
DateTime? DateImplement { get; }
Dictionary<int, (IProductModel, int)> LunchProducts { get; } Dictionary<int, (IProductModel, int)> LunchProducts { get; }
} }
} }

View File

@ -15,7 +15,5 @@ namespace CanteenDataModels.Models
string Password { get; } string Password { get; }
string PhoneNumber { get; } string PhoneNumber { get; }
int RoleId { get; }
} }
} }

View File

@ -11,7 +11,7 @@ namespace CanteenDataModels.Models
{ {
int VisitorId { get; } int VisitorId { get; }
string Description { get; } string Description { get; }
double Sum { get; } double? Sum { get; }
DateTime DateCreate { get; } Dictionary<int, (IDishModel, int)> OrderDishes { get; }
} }
} }

View File

@ -9,7 +9,7 @@ namespace CanteenDataModels.Models
public interface IProductModel : IId public interface IProductModel : IId
{ {
string ProductName { get; } string ProductName { get; }
double Cost { get; } double Price { get; }
int ManagerId { get; } int ManagerId { get; }
Dictionary<int, ICookModel> ProductCooks { get; } Dictionary<int, ICookModel> ProductCooks { get; }
} }

View File

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenDataModels.Models
{
public interface IRoleModel : IId
{
string RoleName { get; }
}
}

View File

@ -12,6 +12,5 @@ namespace CanteenDataModels.Models
string Login { get; } string Login { get; }
string Password { get; } string Password { get; }
string PhoneNumber { get; } string PhoneNumber { get; }
int RoleId { get; }
} }
} }