Реализация контрактов

This commit is contained in:
dasha 2023-04-01 16:33:03 +04:00
parent 6b618795f9
commit 4451a47e0e
17 changed files with 175 additions and 52 deletions

View File

@ -1,14 +1,15 @@
using HardwareShopDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HardwareShopContracts.BindingModels
{
public class ComponentBindingModel : IComponentModel
{
public int Id { get; set; }
public string ComponentName { get; set; } = string.Empty;
public double Cost { get; set; }
public int UserId { get; set; }
}
}

View File

@ -1,15 +1,21 @@
using HardwareShopDataModels.Enums;
using HardwareShopDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HardwareShopDataModels.Models;
namespace HardwareShopContracts.BindingModels
{
public class GoodBindingModel : IGoodModel
{
public int Id { get; set; }
public string GoodName { get; set; } = string.Empty;
public double Price { get; set; }
public int UserId { get; set; }
public Dictionary<int, (IComponentModel, int)> GoodComponents
{
get;
set;
} = new();
}
}

View File

@ -1,11 +1,24 @@
using HardwareShopDataModels.Enums;
using HardwareShopDataModels.Models;
using HardwareShopDataModels.Models;
using System.ComponentModel;
namespace HardwareShopContracts.BindingModels
{
public class OrderBindingModel : IOrderModel
{
public int Id { get; set; }
public int GoodId { get; set; }
public int UserId { get; set; }
public int Count { 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; }
}
}

View File

@ -1,6 +1,5 @@
using HardwareShopDataModels.Models;
using HardwareShopDataModels.Enums;
using System.ComponentModel;
namespace HardwareShopContracts.BindingModels
{

View File

@ -0,0 +1,15 @@
using HardwareShopContracts.BindingModels;
using HardwareShopContracts.SearchModels;
using HardwareShopContracts.ViewModels;
namespace HardwareShopContracts.BuisnessLogicsContracts
{
public interface IComponentLogic
{
List<ComponentViewModel>? ReadList(ComponentSearchModel? model);
ComponentViewModel? ReadElement(ComponentSearchModel model);
bool Create(ComponentBindingModel model);
bool Update(ComponentBindingModel model);
bool Delete(ComponentBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using HardwareShopContracts.BindingModels;
using HardwareShopContracts.SearchModels;
using HardwareShopContracts.ViewModels;
namespace HardwareShopContracts.BuisnessLogicsContracts
{
public interface IGoodLogic
{
List<GoodViewModel>? ReadList(GoodSearchModel? model);
GoodViewModel? ReadElement(GoodSearchModel model);
bool Create(GoodBindingModel model);
bool Update(GoodBindingModel model);
bool Delete(GoodBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using HardwareShopContracts.BindingModels;
using HardwareShopContracts.SearchModels;
using HardwareShopContracts.ViewModels;
namespace HardwareShopContracts.BuisnessLogicsContracts
{
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

@ -1,14 +1,8 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HardwareShopContracts.SearchModels
namespace HardwareShopContracts.SearchModels
{
public class ComponentSearchModel
{
public int? Id { get; set; }
public string? ComponentName { get; set; }
}
}

View File

@ -1,14 +1,8 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HardwareShopContracts.SearchModels
namespace HardwareShopContracts.SearchModels
{
public class GoodSearchModel
{
public int? Id { get; set; }
public string? GoodName { get; set; }
}
}

View File

@ -1,9 +1,9 @@

using System.ComponentModel;
namespace HardwareShopContracts.SearchModels
namespace HardwareShopContracts.SearchModels
{
public class OrderSearchModel
{
public int? Id { get; set; }
public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using HardwareShopContracts.BindingModels;
using HardwareShopContracts.SearchModels;
using HardwareShopContracts.ViewModels;
namespace HardwareShopContracts.StoragesContracts
{
public interface IComponentStorage
{
List<ComponentViewModel> GetFullList();
List<ComponentViewModel> GetFilteredList(ComponentSearchModel model);
ComponentViewModel? GetElement(ComponentSearchModel model);
ComponentViewModel? Insert(ComponentBindingModel model);
ComponentViewModel? Update(ComponentBindingModel model);
ComponentViewModel? Delete(ComponentBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using HardwareShopContracts.BindingModels;
using HardwareShopContracts.SearchModels;
using HardwareShopContracts.ViewModels;
namespace HardwareShopContracts.StoragesContracts
{
public interface IGoodStorage
{
List<GoodViewModel> GetFullList();
List<GoodViewModel> GetFilteredList(GoodSearchModel model);
GoodViewModel? GetElement(GoodSearchModel model);
GoodViewModel? Insert(GoodBindingModel model);
GoodViewModel? Update(GoodBindingModel model);
GoodViewModel? Delete(GoodBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using HardwareShopContracts.BindingModels;
using HardwareShopContracts.SearchModels;
using HardwareShopContracts.ViewModels;
namespace HardwareShopContracts.StoragesContracts
{
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);
}
}

View File

@ -4,18 +4,13 @@ using HardwareShopContracts.ViewModels;
namespace HardwareShopContracts.StoragesContracts
{
public interface IUsertorage
public interface IUserStorage
{
List<UserViewModel> GetFullList();
List<UserViewModel> GetFilteredList(UserSearchModel model);
UserViewModel? GetElement(UserSearchModel model);
UserViewModel? Insert(UserBindingModel model);
UserViewModel? Update(UserBindingModel model);
UserViewModel? Delete(UserBindingModel model);
}
}

View File

@ -1,14 +1,17 @@
using HardwareShopDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
namespace HardwareShopContracts.ViewModels
{
public class ComponentViewModel : IComponentModel
{
public int Id { get; set; }
[DisplayName("Компонент")]
public string ComponentName { get; set; } = string.Empty;
[DisplayName("Цена")]
public double Cost { get; set; }
public int UserId { get; set; }
[DisplayName("Логин кладовщика")]
public string UserLogin { get; set; } = string.Empty;
}
}

View File

@ -1,15 +1,22 @@

using HardwareShopDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HardwareShopDataModels.Models;
using System.ComponentModel;
namespace HardwareShopContracts.ViewModels
{
public class GoodViewModel : IGoodModel
{
public int Id { get; set; }
[DisplayName("Товар")]
public string GoodName { get; set; } = string.Empty;
[DisplayName("Цена")]
public double Price { get; set; }
public int UserId { get; set; }
[DisplayName("Логин кладовщика")]
public string UserLogin { get; set; } = string.Empty;
public Dictionary<int, (IComponentModel, int)> GoodComponents
{
get;
set;
} = new();
}
}

View File

@ -1,10 +1,28 @@
using HardwareShopDataModels.Enums;
using HardwareShopDataModels.Models;
using System.ComponentModel;
namespace HardwareShopContracts.ViewModels
{
public class OrderViewModel : IOrderModel
{
[DisplayName("Номер")]
public int Id { get; set; }
public int GoodId { get; set; }
public int UserId { get; set; }
[DisplayName("Комлектующая")]
public string GoodName { get; set; } = string.Empty;
[DisplayName("Логин кладовщика")]
public string UserLogin { get; set; } = string.Empty;
[DisplayName("Количество")]
public int Count{ get; set; }
[DisplayName("Сумма")]
public double Sum{ get; set; }
[DisplayName("Статус")]
public OrderStatus Status{ get; set; }
[DisplayName("Дата создания")]
public DateTime DateCreate{ get; set; }
[DisplayName("Дата выполнения")]
public DateTime? DateImplement{ get; set; }
}
}