Слой контрактов (проверить и добавить в некоторых классах поля со сборкой)
This commit is contained in:
parent
27d772da25
commit
c85123f1e3
27
ComputerShopContracts/BindingModels/OrderBindingModel.cs
Normal file
27
ComputerShopContracts/BindingModels/OrderBindingModel.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using ComputerShopDataModels.Enums;
|
||||
using ComputerShopDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopContracts.BindingModels
|
||||
{
|
||||
public class OrderBindingModel : IOrderModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int UserId { get; set; }
|
||||
|
||||
public Dictionary<int, IRequestModel> OrderRequests { get; set; } = new();
|
||||
|
||||
public Dictionary<int, IShipmentModel> OrderShipments { get; set; } = new();
|
||||
|
||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||
|
||||
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
||||
|
||||
public double Sum { get; set; }
|
||||
}
|
||||
}
|
23
ComputerShopContracts/BindingModels/RequestBindingModel.cs
Normal file
23
ComputerShopContracts/BindingModels/RequestBindingModel.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using ComputerShopDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopContracts.BindingModels
|
||||
{
|
||||
public class RequestBindingModel : IRequestModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int UserId { get; set; }
|
||||
|
||||
public DateTime DateMake { get; set; } = DateTime.Now;
|
||||
|
||||
//!!!МБ НЕ НАДО string.Empty
|
||||
public string ClientFIO { get; set; } = string.Empty;
|
||||
|
||||
//!!!ДОБАВИТЬ СТАТУС, ЕСЛИ БУДЕТ В ОБЫЧНОЙ МОДЕЛИ
|
||||
}
|
||||
}
|
@ -9,5 +9,13 @@ namespace ComputerShopContracts.BindingModels
|
||||
{
|
||||
public class ShipmentBindingModel : IShipmentModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int UserId { get; set; }
|
||||
|
||||
//!!!МБ НЕ НАДО string.Empty
|
||||
public string ProviderName { get; set; } = string.Empty;
|
||||
|
||||
public DateTime DateShipment { get; set; } = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
22
ComputerShopContracts/BusinessLogicContracts/IOrderLogic.cs
Normal file
22
ComputerShopContracts/BusinessLogicContracts/IOrderLogic.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using ComputerShopContracts.BindingModels;
|
||||
using ComputerShopContracts.SearchModels;
|
||||
using ComputerShopContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopContracts.BusinessLogicContracts
|
||||
{
|
||||
//!!!ПРОВЕРИТЬ, ЧТО НЕ НУЖНЫ ДРУГИЕ МЕТОДЫ
|
||||
public interface IOrderLogic
|
||||
{
|
||||
List<OrderViewModel>? ReadList(OrderSearchModel? model);
|
||||
OrderViewModel? ReadElement(OrderSearchModel model);
|
||||
bool CreateOrder(OrderBindingModel model);
|
||||
bool TakeOrderInWork(OrderBindingModel model);
|
||||
bool FinishOrder(OrderBindingModel model);
|
||||
bool DeliveryOrder(OrderBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using ComputerShopContracts.BindingModels;
|
||||
using ComputerShopContracts.SearchModels;
|
||||
using ComputerShopContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopContracts.BusinessLogicContracts
|
||||
{
|
||||
//!!!ПРОВЕРИТЬ, ЧТО НЕ НУЖНЫ ДРУГИЕ МЕТОДЫ
|
||||
public interface IRequestLogic
|
||||
{
|
||||
List<RequestViewModel>? ReadList(RequestSearchModel? model);
|
||||
RequestViewModel? ReadElement(RequestSearchModel model);
|
||||
bool Create(RequestBindingModel model);
|
||||
bool Update(RequestBindingModel model);
|
||||
bool Delete(RequestBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using ComputerShopContracts.BindingModels;
|
||||
using ComputerShopContracts.SearchModels;
|
||||
using ComputerShopContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopContracts.BusinessLogicContracts
|
||||
{
|
||||
//!!!ПРОВЕРИТЬ, ЧТО НЕ НУЖНЫ ДРУГИЕ МЕТОДЫ
|
||||
public interface IShipmentLogic
|
||||
{
|
||||
List<ShipmentViewModel>? ReadList(ShipmentSearchModel? model);
|
||||
ShipmentViewModel? ReadElement(ShipmentSearchModel model);
|
||||
bool Create(ShipmentBindingModel model);
|
||||
bool Update(ShipmentBindingModel model);
|
||||
bool Delete(ShipmentBindingModel model);
|
||||
}
|
||||
}
|
24
ComputerShopContracts/SearchModels/OrderSearchModel.cs
Normal file
24
ComputerShopContracts/SearchModels/OrderSearchModel.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using ComputerShopDataModels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopContracts.SearchModels
|
||||
{
|
||||
public class OrderSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public int? UserId { get; set; }
|
||||
|
||||
//!!!МБ НАДО ДОБАВИТЬ ПОИСК ПО ЗАЯВКАМ/ПАРТИЯМ ТОВАРОВ
|
||||
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
|
||||
public OrderStatus? Status { get; set; }
|
||||
|
||||
public double? Sum { get; set; }
|
||||
}
|
||||
}
|
24
ComputerShopContracts/SearchModels/RequestSearchModel.cs
Normal file
24
ComputerShopContracts/SearchModels/RequestSearchModel.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopContracts.SearchModels
|
||||
{
|
||||
public class RequestSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public int? UserId { get; set; }
|
||||
|
||||
//!!!ДОБАВИТЬ ПОИСК ПО СБОРКЕ (СУЩНОСТИ ОЛЕГА)
|
||||
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
|
||||
public string? ClientFIO { get; set; }
|
||||
|
||||
|
||||
//!!!МБ ДОБАВИТЬ ПОИСК ПО СТАТУСУ (ЕСЛИ ОСТАНЕТСЯ)
|
||||
}
|
||||
}
|
17
ComputerShopContracts/SearchModels/ShipmentSearchModel.cs
Normal file
17
ComputerShopContracts/SearchModels/ShipmentSearchModel.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopContracts.SearchModels
|
||||
{
|
||||
public class ShipmentSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public int? UserId { get; set; }
|
||||
public string? ProviderName { get; set; }
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
}
|
||||
}
|
21
ComputerShopContracts/StorageContracts/IOrderStorage.cs
Normal file
21
ComputerShopContracts/StorageContracts/IOrderStorage.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using ComputerShopContracts.BindingModels;
|
||||
using ComputerShopContracts.SearchModels;
|
||||
using ComputerShopContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopContracts.StorageContracts
|
||||
{
|
||||
public interface IOrderStorage
|
||||
{
|
||||
List<OrderViewModel> GetFullList();
|
||||
List<OrderViewModel> GetFilteredList(OrderSearchModel model);
|
||||
OrderViewModel? GetElement(OrderSearchModel model);
|
||||
OrderViewModel? Insert(OrderBindingModel model);
|
||||
OrderViewModel? Update(OrderBindingModel model);
|
||||
OrderViewModel? Delete(OrderBindingModel model);
|
||||
}
|
||||
}
|
21
ComputerShopContracts/StorageContracts/IRequestStorage.cs
Normal file
21
ComputerShopContracts/StorageContracts/IRequestStorage.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using ComputerShopContracts.BindingModels;
|
||||
using ComputerShopContracts.SearchModels;
|
||||
using ComputerShopContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopContracts.StorageContracts
|
||||
{
|
||||
public interface IRequestStorage
|
||||
{
|
||||
List<RequestViewModel> GetFullList();
|
||||
List<RequestViewModel> GetFilteredList(RequestSearchModel model);
|
||||
RequestViewModel? GetElement(RequestSearchModel model);
|
||||
RequestViewModel? Insert(RequestBindingModel model);
|
||||
RequestViewModel? Update(RequestBindingModel model);
|
||||
RequestViewModel? Delete(RequestBindingModel model);
|
||||
}
|
||||
}
|
21
ComputerShopContracts/StorageContracts/IShipmentStorage.cs
Normal file
21
ComputerShopContracts/StorageContracts/IShipmentStorage.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using ComputerShopContracts.BindingModels;
|
||||
using ComputerShopContracts.SearchModels;
|
||||
using ComputerShopContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopContracts.StorageContracts
|
||||
{
|
||||
public interface IShipmentStorage
|
||||
{
|
||||
List<ShipmentViewModel> GetFullList();
|
||||
List<ShipmentViewModel> GetFilteredList(ShipmentSearchModel model);
|
||||
ShipmentViewModel? GetElement(ShipmentSearchModel model);
|
||||
ShipmentViewModel? Insert(ShipmentBindingModel model);
|
||||
ShipmentViewModel? Update(ShipmentBindingModel model);
|
||||
ShipmentViewModel? Delete(ShipmentBindingModel model);
|
||||
}
|
||||
}
|
36
ComputerShopContracts/ViewModels/OrderViewModel.cs
Normal file
36
ComputerShopContracts/ViewModels/OrderViewModel.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using ComputerShopDataModels.Enums;
|
||||
using ComputerShopDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopContracts.ViewModels
|
||||
{
|
||||
public class OrderViewModel
|
||||
{
|
||||
[DisplayName("Номер")]
|
||||
public int Id { get; set; }
|
||||
|
||||
//!!!ТУТ МБ НЕ НУЖЕН DisplayName
|
||||
[DisplayName("Номер пользователя")]
|
||||
public int UserId { get; set; }
|
||||
|
||||
//!!!ТУТ МБ НАДО DisplayName (НО ВЯРД ЛИ)
|
||||
public Dictionary<int, IRequestModel> OrderRequests { get; set; } = new();
|
||||
public Dictionary<int, IShipmentModel> OrderShipments { get; set; } = new();
|
||||
|
||||
//!!!МБ НЕ НУЖНО DateTime.Now
|
||||
[DisplayName("Дата оформления")]
|
||||
public DateTime DateMake { get; set; } = DateTime.Now;
|
||||
|
||||
[DisplayName("Статус")]
|
||||
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
||||
|
||||
[DisplayName("Стоимость")]
|
||||
public double Sum { get; set; }
|
||||
|
||||
}
|
||||
}
|
34
ComputerShopContracts/ViewModels/RequestViewModel.cs
Normal file
34
ComputerShopContracts/ViewModels/RequestViewModel.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopContracts.ViewModels
|
||||
{
|
||||
public class RequestViewModel
|
||||
{
|
||||
[DisplayName("Номер")]
|
||||
public int Id { get; set; }
|
||||
|
||||
//!!!ТУТ МБ НЕ НУЖЕН DisplayName
|
||||
[DisplayName("Номер пользователя")]
|
||||
public int UserId { get; set; }
|
||||
|
||||
//!!!МБ ДОБАВИТЬ НИК ПОЛЬЗОВАТЕЛЯ, СОЗДАВШЕГО ЗАЯВКУ
|
||||
|
||||
//!!!МБ ДОБАВИТЬ ID СБОРКИ
|
||||
|
||||
//!!!МБ НЕ НУЖНО DateTime.Now
|
||||
[DisplayName("Дата оформления")]
|
||||
public DateTime DateMake { get; set; } = DateTime.Now;
|
||||
|
||||
//!!!МБ НЕ НУЖЕН string.Empty
|
||||
[DisplayName("ФИО клиента")]
|
||||
public string ClientFIO { get; set; } = string.Empty;
|
||||
|
||||
|
||||
//!!!ЧТО-ТО СДЕЛАТЬ СО СТАТУСОМ (МБ УБРАТЬ ИЗ ER)
|
||||
}
|
||||
}
|
31
ComputerShopContracts/ViewModels/ShipmentViewModel.cs
Normal file
31
ComputerShopContracts/ViewModels/ShipmentViewModel.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopContracts.ViewModels
|
||||
{
|
||||
public class ShipmentViewModel
|
||||
{
|
||||
//!!!ТУТ МБ НЕ НУЖЕН DisplayName
|
||||
[DisplayName("Номер")]
|
||||
public int Id { get; set; }
|
||||
|
||||
//!!!ТУТ МБ НЕ НУЖЕН DisplayName
|
||||
[DisplayName("Номер пользователя")]
|
||||
public int UserId { get; set; }
|
||||
|
||||
//!!!МБ ДОБАВИТЬ НИК ПОЛЬЗОВАТЕЛЯ, СОЗДАВШЕГО ПАРТИЮ
|
||||
|
||||
//!!!МБ НЕ НУЖЕН string.Empty
|
||||
[DisplayName("Поставщик")]
|
||||
public string ProviderName { get; set; } = string.Empty;
|
||||
|
||||
//!!!МБ НЕ НУЖНО DateTime.Now
|
||||
[DisplayName("Дата поставки")]
|
||||
public DateTime DateShipment { get; set; } = DateTime.Now;
|
||||
|
||||
}
|
||||
}
|
@ -14,8 +14,15 @@ namespace ComputerShopDataModels.Models
|
||||
//ID пользователя, создавшего заявку
|
||||
int UserId { get; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//!!!ДОБАВИТЬ ССЫЛКУ НА СБОРКУ ИЗ ЧАСТИ ОЛЕГА
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Дата создания заявки
|
||||
/// </summary>
|
||||
@ -26,6 +33,7 @@ namespace ComputerShopDataModels.Models
|
||||
/// </summary>
|
||||
string ClientFIO { get; }
|
||||
|
||||
|
||||
//!!!ЧТО-ТО СДЕЛАТЬ СО СТАТУСОМ (МБ УБРАТЬ ИЗ ER)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user