Contracts

This commit is contained in:
VictoriaPresnyakova 2023-02-05 18:55:08 +04:00
parent e1c0c1942e
commit 226ebea674
29 changed files with 436 additions and 19 deletions

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>

View File

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

View File

@ -0,0 +1,8 @@
namespace AbstractJewelryStoreDataModels
{
public interface IId
{
int Id { get; }
}
}

View File

@ -4,11 +4,12 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace AbstractJewelryStoreModels.Models namespace AbstractJewelryStoreDataModels.Models
{ {
internal class IComponentModel : IId public interface IComponentModel : IId
{ {
string ComponentName { get; } string ComponentName { get; }
double Cost { get; } double Cost { get; }
} }
} }

View File

@ -1,13 +1,13 @@
using AbstractJewelryStoreModels.Enums; using AbstractJewelryStoreDataModels.Enums;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace AbstractJewelryStoreModels.Models namespace AbstractJewelryStoreDataModels.Models
{ {
internal class IOrderModel : IId public interface IOrderModel : IId
{ {
int ProductId { get; } int ProductId { get; }
int Count { get; } int Count { get; }
@ -15,6 +15,6 @@ namespace AbstractJewelryStoreModels.Models
OrderStatus Status { get; } OrderStatus Status { get; }
DateTime DateCreate { get; } DateTime DateCreate { get; }
DateTime? DateImplement { get; } DateTime? DateImplement { get; }
}
} }
}

View File

@ -4,13 +4,12 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace AbstractJewelryStoreModels.Models namespace AbstractJewelryStoreDataModels.Models
{ {
internal class IProductModel : IId public interface IProductModel : IId
{ {
string ProductName { get; } string ProductName { get; }
double Price { get; } double Price { get; }
Dictionary<int, (IComponentModel, int)> ProductComponents { get; } Dictionary<int, (IComponentModel, int)> ProductComponents { get; }
} }
} }

View File

@ -5,7 +5,9 @@ VisualStudioVersion = 17.4.33122.133
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JewelryStore", "JewelryStore.csproj", "{F1AEB85A-E5E1-4B07-8D6B-E46870480FFA}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JewelryStore", "JewelryStore.csproj", "{F1AEB85A-E5E1-4B07-8D6B-E46870480FFA}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AbstractJewelryStoreModels", "..\..\..\..\..\..\Users\60652\Downloads\AbstractJewelryStoreModels\AbstractJewelryStoreModels.csproj", "{95570735-2DC2-4EF7-9CCB-D6A99E21E97F}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JewelryStoreContracts", "..\JewelryStoreContracts\JewelryStoreContracts.csproj", "{763B1FD7-7D30-4689-869C-1FEAD240B29B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JewelryStoreDataModels", "..\JewelryStoreDataModels\JewelryStoreDataModels.csproj", "{84BF2156-F821-46F4-8EED-F371084C0129}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -17,10 +19,14 @@ Global
{F1AEB85A-E5E1-4B07-8D6B-E46870480FFA}.Debug|Any CPU.Build.0 = Debug|Any CPU {F1AEB85A-E5E1-4B07-8D6B-E46870480FFA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F1AEB85A-E5E1-4B07-8D6B-E46870480FFA}.Release|Any CPU.ActiveCfg = Release|Any CPU {F1AEB85A-E5E1-4B07-8D6B-E46870480FFA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F1AEB85A-E5E1-4B07-8D6B-E46870480FFA}.Release|Any CPU.Build.0 = Release|Any CPU {F1AEB85A-E5E1-4B07-8D6B-E46870480FFA}.Release|Any CPU.Build.0 = Release|Any CPU
{95570735-2DC2-4EF7-9CCB-D6A99E21E97F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {763B1FD7-7D30-4689-869C-1FEAD240B29B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{95570735-2DC2-4EF7-9CCB-D6A99E21E97F}.Debug|Any CPU.Build.0 = Debug|Any CPU {763B1FD7-7D30-4689-869C-1FEAD240B29B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{95570735-2DC2-4EF7-9CCB-D6A99E21E97F}.Release|Any CPU.ActiveCfg = Release|Any CPU {763B1FD7-7D30-4689-869C-1FEAD240B29B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{95570735-2DC2-4EF7-9CCB-D6A99E21E97F}.Release|Any CPU.Build.0 = Release|Any CPU {763B1FD7-7D30-4689-869C-1FEAD240B29B}.Release|Any CPU.Build.0 = Release|Any CPU
{84BF2156-F821-46F4-8EED-F371084C0129}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{84BF2156-F821-46F4-8EED-F371084C0129}.Debug|Any CPU.Build.0 = Debug|Any CPU
{84BF2156-F821-46F4-8EED-F371084C0129}.Release|Any CPU.ActiveCfg = Release|Any CPU
{84BF2156-F821-46F4-8EED-F371084C0129}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using JewelryStoreDataModels.Models;
namespace JewelryStoreContracts.BindingModels
{
public class ComponentBindingModel : IComponentModel
{
public int Id { get; set; }
public string ComponentName { get; set; } = string.Empty;
public double Cost { get; set; }
}
}

View File

@ -0,0 +1,17 @@
using JewelryStoreDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JewelryStoreContracts.BindingModels
{
public class JewelBindingModel : IJewelModel
{
public int Id { get; set; }
public string JewelName { get; set; } = string.Empty;
public double Price { get; set; }
public Dictionary<int, (IComponentModel, int)> JewelComponents { get; set;} = new();
}
}

View File

@ -0,0 +1,22 @@
using JewelryStoreDataModels.Enums;
using JewelryStoreDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JewelryStoreContracts.BindingModels
{
public class OrderBindingModel : IOrderModel
{
public int Id { get; set; }
public int JewelId { 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

@ -0,0 +1,21 @@
using JewelryStoreContracts.BindingModels;
using JewelryStoreContracts.SearchModels;
using JewelryStoreContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JewelryStoreContracts.BusinessLogicsContracts
{
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,23 @@
using JewelryStoreContracts.SearchModels;
using JewelryStoreContracts.ViewModels;
using JewelryStoreContracts.BindingModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JewelryStoreContracts.BusinessLogicsContracts
{
public interface IJewelLogic
{
List<JewelViewModel>? ReadList(JewelSearchModel? model);
JewelViewModel? ReadElement(JewelSearchModel model);
bool Create(JewelBindingModel model);
bool Update(JewelBindingModel model);
bool Delete(JewelBindingModel model);
}
}

View File

@ -0,0 +1,20 @@
using JewelryStoreContracts.BindingModels;
using JewelryStoreContracts.SearchModels;
using JewelryStoreContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JewelryStoreContracts.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,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\JewelryStoreDataModels\JewelryStoreDataModels.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JewelryStoreContracts.SearchModels
{
public class ComponentSearchModel
{
public int? Id { get; set; }
public string? ComponentName { 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 JewelryStoreContracts.SearchModels
{
public class JewelSearchModel
{
public int? Id { get; set; }
public string? JewelName { get; set; }
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JewelryStoreContracts.SearchModels
{
public class OrderSearchModel
{
public int? Id { get; set; }
}
}

View File

@ -0,0 +1,22 @@
using JewelryStoreContracts.BindingModels;
using JewelryStoreContracts.SearchModels;
using JewelryStoreContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JewelryStoreContracts.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,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using JewelryStoreContracts.BindingModels;
using JewelryStoreContracts.SearchModels;
using JewelryStoreContracts.ViewModels;
namespace JewelryStoreContracts.StoragesContracts
{
public interface IJewelStorage
{
List<JewelViewModel> GetFullList();
List<JewelViewModel> GetFilteredList(JewelSearchModel model);
JewelViewModel? GetElement(JewelSearchModel model);
JewelViewModel? Insert(JewelBindingModel model);
JewelViewModel? Update(JewelBindingModel model);
JewelViewModel? Delete(JewelBindingModel model);
}
}

View File

@ -0,0 +1,22 @@
using JewelryStoreContracts.BindingModels;
using JewelryStoreContracts.SearchModels;
using JewelryStoreContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JewelryStoreContracts.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

@ -0,0 +1,19 @@
using JewelryStoreDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JewelryStoreContracts.ViewModels
{
public class ComponentViewModel : IComponentModel
{
public int Id { get; set; }
[DisplayName("Название компонента")]
public string ComponentName { get; set; } = string.Empty;
[DisplayName("Цена")]
public double Cost { get; set; }
}
}

View File

@ -0,0 +1,25 @@
using JewelryStoreDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JewelryStoreContracts.ViewModels
{
public class JewelViewModel : IJewelModel
{
public int Id { get; set; }
[DisplayName("Название драгоценности")]
public string JewelName { get; set; } = string.Empty;
[DisplayName("Цена")]
public double Price { get; set; }
public Dictionary<int, (IComponentModel, int)> JewelComponents
{
get;
set;
} = new();
}
}

View File

@ -0,0 +1,33 @@
using JewelryStoreDataModels.Enums;
using JewelryStoreDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JewelryStoreContracts.ViewModels
{
public class OrderViewModel : IOrderModel
{
[DisplayName("Номер")]
public int Id { get; set; }
public int JewelId { get; set; }
[DisplayName("Драгоценность")]
public string JewelName { 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

@ -1,4 +1,10 @@
namespace AbstractJewelryStoreModels.Enums using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JewelryStoreDataModels.Enums
{ {
public enum OrderStatus public enum OrderStatus
{ {

View File

@ -1,4 +1,4 @@
namespace AbstractJewelryStoreModels namespace JewelryStoreDataModels
{ {
public interface IId public interface IId
{ {

View File

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace JewelryStoreDataModels.Models
{
public interface IComponentModel : IId
{
string ComponentName { get; }
double Cost { get; }
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace JewelryStoreDataModels.Models
{
public interface IJewelModel : IId
{
string JewelName { get; }
double Price { get; }
Dictionary<int, (IComponentModel, int)> JewelComponents { get; }
}
}

View File

@ -0,0 +1,21 @@
using JewelryStoreDataModels.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace JewelryStoreDataModels.Models
{
public interface IOrderModel : IId
{
int JewelId { get; }
int Count { get; }
double Sum { get; }
OrderStatus Status { get; }
DateTime DateCreate { get; }
DateTime? DateImplement { get; }
}
}