diff --git a/RenovationWork/RenovationWork.sln b/RenovationWork/RenovationWork.sln index 19d54ee..edb8110 100644 --- a/RenovationWork/RenovationWork.sln +++ b/RenovationWork/RenovationWork.sln @@ -5,6 +5,10 @@ VisualStudioVersion = 17.3.32929.385 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RenovationWork", "RenovationWork\RenovationWork.csproj", "{5BBB144E-CAB1-44F6-BBE1-DE94CFE95D3E}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RenovationWorkDataModels", "RenovationWorkDataModels\RenovationWorkDataModels.csproj", "{86A30CF6-0224-46EA-AAE0-AE991E425638}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RenovationWorkContracts", "RenovationWorkContracts\RenovationWorkContracts.csproj", "{D1C7E6BC-D47F-4727-B51B-AD1954A27272}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,6 +19,14 @@ Global {5BBB144E-CAB1-44F6-BBE1-DE94CFE95D3E}.Debug|Any CPU.Build.0 = Debug|Any CPU {5BBB144E-CAB1-44F6-BBE1-DE94CFE95D3E}.Release|Any CPU.ActiveCfg = Release|Any CPU {5BBB144E-CAB1-44F6-BBE1-DE94CFE95D3E}.Release|Any CPU.Build.0 = Release|Any CPU + {86A30CF6-0224-46EA-AAE0-AE991E425638}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {86A30CF6-0224-46EA-AAE0-AE991E425638}.Debug|Any CPU.Build.0 = Debug|Any CPU + {86A30CF6-0224-46EA-AAE0-AE991E425638}.Release|Any CPU.ActiveCfg = Release|Any CPU + {86A30CF6-0224-46EA-AAE0-AE991E425638}.Release|Any CPU.Build.0 = Release|Any CPU + {D1C7E6BC-D47F-4727-B51B-AD1954A27272}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D1C7E6BC-D47F-4727-B51B-AD1954A27272}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D1C7E6BC-D47F-4727-B51B-AD1954A27272}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D1C7E6BC-D47F-4727-B51B-AD1954A27272}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/RenovationWork/RenovationWorkContracts/BindingModels/ComponentBindingModel.cs b/RenovationWork/RenovationWorkContracts/BindingModels/ComponentBindingModel.cs new file mode 100644 index 0000000..76f6b02 --- /dev/null +++ b/RenovationWork/RenovationWorkContracts/BindingModels/ComponentBindingModel.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RenovationWorkDataModels.Models; + +namespace RenovationWorkContracts.BindingModels +{ + public class ComponentBindingModel : IComponentModel + { + public int Id { get; set; } + public string ComponentName { get; set; } = string.Empty; + public double Cost { get; set; } + } +} diff --git a/RenovationWork/RenovationWorkContracts/BindingModels/OrderBindingModel.cs b/RenovationWork/RenovationWorkContracts/BindingModels/OrderBindingModel.cs new file mode 100644 index 0000000..e30ef6b --- /dev/null +++ b/RenovationWork/RenovationWorkContracts/BindingModels/OrderBindingModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RenovationWorkDataModels.Enums; +using RenovationWorkDataModels.Models; + +namespace RenovationWorkContracts.BindingModels +{ + public class OrderBindingModel : IOrderModel + { + public int Id { get; set; } + public int ProductId { 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; } + } +} diff --git a/RenovationWork/RenovationWorkContracts/BindingModels/ProductBindingModel.cs b/RenovationWork/RenovationWorkContracts/BindingModels/ProductBindingModel.cs new file mode 100644 index 0000000..09bdd99 --- /dev/null +++ b/RenovationWork/RenovationWorkContracts/BindingModels/ProductBindingModel.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RenovationWorkDataModels.Models; + +namespace RenovationWorkContracts.BindingModels +{ + public class ProductBindingModel : IProductModel + { + public int Id { get; set; } + public string ProductName { get; set; } = string.Empty; + public double Price { get; set; } + public Dictionary ProductComponents + { + get; + set; + } = new(); + + } +} diff --git a/RenovationWork/RenovationWorkContracts/BusinessLogicsContracts/IComponentLogic.cs b/RenovationWork/RenovationWorkContracts/BusinessLogicsContracts/IComponentLogic.cs new file mode 100644 index 0000000..a4726c5 --- /dev/null +++ b/RenovationWork/RenovationWorkContracts/BusinessLogicsContracts/IComponentLogic.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RenovationWorkContracts.BindingModels; +using RenovationWorkContracts.SearchModels; +using RenovationWorkContracts.ViewModels; + +namespace RenovationWorkContracts.BusinessLogicsContracts +{ + public interface IComponentLogic + { + List? ReadList(ComponentSearchModel? model); + ComponentViewModel? ReadElement(ComponentSearchModel model); + bool Create(ComponentBindingModel model); + bool Update(ComponentBindingModel model); + bool Delete(ComponentBindingModel model); + } +} diff --git a/RenovationWork/RenovationWorkContracts/BusinessLogicsContracts/IOrderLogic.cs b/RenovationWork/RenovationWorkContracts/BusinessLogicsContracts/IOrderLogic.cs new file mode 100644 index 0000000..2c9d044 --- /dev/null +++ b/RenovationWork/RenovationWorkContracts/BusinessLogicsContracts/IOrderLogic.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RenovationWorkContracts.BindingModels; +using RenovationWorkContracts.SearchModels; +using RenovationWorkContracts.ViewModels; + +namespace RenovationWorkContracts.BusinessLogicsContracts +{ + public interface IOrderLogic + { + List? ReadList(OrderSearchModel? model); + bool CreateOrder(OrderBindingModel model); + bool TakeOrderInWork(OrderBindingModel model); + bool FinishOrder(OrderBindingModel model); + bool DeliveryOrder(OrderBindingModel model); + } +} diff --git a/RenovationWork/RenovationWorkContracts/BusinessLogicsContracts/IProductLogic.cs b/RenovationWork/RenovationWorkContracts/BusinessLogicsContracts/IProductLogic.cs new file mode 100644 index 0000000..99db1d4 --- /dev/null +++ b/RenovationWork/RenovationWorkContracts/BusinessLogicsContracts/IProductLogic.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RenovationWorkContracts.BindingModels; +using RenovationWorkContracts.SearchModels; +using RenovationWorkContracts.ViewModels; + +namespace RenovationWorkContracts.BusinessLogicsContracts +{ + public interface IProductLogic + { + List? ReadList(ProductSearchModel? model); + ProductViewModel? ReadElement(ProductSearchModel model); + bool Create(ProductBindingModel model); + bool Update(ProductBindingModel model); + bool Delete(ProductBindingModel model); + } +} diff --git a/RenovationWork/RenovationWorkContracts/Class1.cs b/RenovationWork/RenovationWorkContracts/Class1.cs new file mode 100644 index 0000000..2969912 --- /dev/null +++ b/RenovationWork/RenovationWorkContracts/Class1.cs @@ -0,0 +1,7 @@ +namespace RenovationWorkContracts +{ + public class Class1 + { + + } +} \ No newline at end of file diff --git a/RenovationWork/RenovationWorkContracts/RenovationWorkContracts.csproj b/RenovationWork/RenovationWorkContracts/RenovationWorkContracts.csproj new file mode 100644 index 0000000..96ab30f --- /dev/null +++ b/RenovationWork/RenovationWorkContracts/RenovationWorkContracts.csproj @@ -0,0 +1,13 @@ + + + + net6.0 + enable + enable + + + + + + + diff --git a/RenovationWork/RenovationWorkContracts/SearchModels/ComponentSearchModel.cs b/RenovationWork/RenovationWorkContracts/SearchModels/ComponentSearchModel.cs new file mode 100644 index 0000000..6c4981f --- /dev/null +++ b/RenovationWork/RenovationWorkContracts/SearchModels/ComponentSearchModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RenovationWorkContracts.SearchModels +{ + public class ComponentSearchModel + { + public int? Id { get; set; } + public string? ComponentName { get; set; } + } +} diff --git a/RenovationWork/RenovationWorkContracts/SearchModels/OrderSearchModel.cs b/RenovationWork/RenovationWorkContracts/SearchModels/OrderSearchModel.cs new file mode 100644 index 0000000..6fd313e --- /dev/null +++ b/RenovationWork/RenovationWorkContracts/SearchModels/OrderSearchModel.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RenovationWorkContracts.SearchModels +{ + public class OrderSearchModel + { + public int? Id { get; set; } + } +} diff --git a/RenovationWork/RenovationWorkContracts/SearchModels/ProductSearchModel.cs b/RenovationWork/RenovationWorkContracts/SearchModels/ProductSearchModel.cs new file mode 100644 index 0000000..1789304 --- /dev/null +++ b/RenovationWork/RenovationWorkContracts/SearchModels/ProductSearchModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RenovationWorkContracts.SearchModels +{ + public class ProductSearchModel + { + public int? Id { get; set; } + public string? ProductName { get; set; } + } +} diff --git a/RenovationWork/RenovationWorkContracts/StoragesContracts/IComponentStorage.cs b/RenovationWork/RenovationWorkContracts/StoragesContracts/IComponentStorage.cs new file mode 100644 index 0000000..f10b3e4 --- /dev/null +++ b/RenovationWork/RenovationWorkContracts/StoragesContracts/IComponentStorage.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RenovationWorkContracts.BindingModels; +using RenovationWorkContracts.SearchModels; +using RenovationWorkContracts.ViewModels; + +namespace RenovationWorkContracts.StoragesContracts +{ + public interface IComponentStorage + { + List GetFullList(); + List GetFilteredList(ComponentSearchModel model); + ComponentViewModel? GetElement(ComponentSearchModel model); + ComponentViewModel? Insert(ComponentBindingModel model); + ComponentViewModel? Update(ComponentBindingModel model); + ComponentViewModel? Delete(ComponentBindingModel model); + } +} diff --git a/RenovationWork/RenovationWorkContracts/StoragesContracts/IOrderStorage.cs b/RenovationWork/RenovationWorkContracts/StoragesContracts/IOrderStorage.cs new file mode 100644 index 0000000..d7e583d --- /dev/null +++ b/RenovationWork/RenovationWorkContracts/StoragesContracts/IOrderStorage.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RenovationWorkContracts.BindingModels; +using RenovationWorkContracts.SearchModels; +using RenovationWorkContracts.ViewModels; + +namespace RenovationWorkContracts.StoragesContracts +{ + public interface IOrderStorage + { + List GetFullList(); + List GetFilteredList(OrderSearchModel model); + OrderViewModel? GetElement(OrderSearchModel model); + OrderViewModel? Insert(OrderBindingModel model); + OrderViewModel? Update(OrderBindingModel model); + OrderViewModel? Delete(OrderBindingModel model); + } +} diff --git a/RenovationWork/RenovationWorkContracts/StoragesContracts/IProductStorage.cs b/RenovationWork/RenovationWorkContracts/StoragesContracts/IProductStorage.cs new file mode 100644 index 0000000..e4e2971 --- /dev/null +++ b/RenovationWork/RenovationWorkContracts/StoragesContracts/IProductStorage.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RenovationWorkContracts.BindingModels; +using RenovationWorkContracts.SearchModels; +using RenovationWorkContracts.ViewModels; + +namespace RenovationWorkContracts.StoragesContracts +{ + public interface IProductStorage + { + List GetFullList(); + List GetFilteredList(ProductSearchModel model); + ProductViewModel? GetElement(ProductSearchModel model); + ProductViewModel? Insert(ProductBindingModel model); + ProductViewModel? Update(ProductBindingModel model); + ProductViewModel? Delete(ProductBindingModel model); + } +} diff --git a/RenovationWork/RenovationWorkContracts/ViewModels/ComponentViewModel.cs b/RenovationWork/RenovationWorkContracts/ViewModels/ComponentViewModel.cs new file mode 100644 index 0000000..35dc12b --- /dev/null +++ b/RenovationWork/RenovationWorkContracts/ViewModels/ComponentViewModel.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RenovationWorkDataModels.Models; +using System.ComponentModel; +namespace RenovationWorkContracts.ViewModels +{ + public class ComponentViewModel : IComponentModel + { + public int Id { get; set; } + [DisplayName("Название компонента")] + public string ComponentName { get; set; } = string.Empty; + [DisplayName("Цена")] + public double Cost { get; set; } + } +} diff --git a/RenovationWork/RenovationWorkContracts/ViewModels/OrderViewModel.cs b/RenovationWork/RenovationWorkContracts/ViewModels/OrderViewModel.cs new file mode 100644 index 0000000..76a36b7 --- /dev/null +++ b/RenovationWork/RenovationWorkContracts/ViewModels/OrderViewModel.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RenovationWorkDataModels.Enums; +using RenovationWorkDataModels.Models; +using System.ComponentModel; + +namespace RenovationWorkContracts.ViewModels +{ + public class OrderViewModel : IOrderModel + { + [DisplayName("Номер")] + public int Id { get; set; } + public int ProductId { get; set; } + [DisplayName("Изделие")] + public string ProductName { 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; } + + } +} diff --git a/RenovationWork/RenovationWorkContracts/ViewModels/ProductViewModel.cs b/RenovationWork/RenovationWorkContracts/ViewModels/ProductViewModel.cs new file mode 100644 index 0000000..fa8f04a --- /dev/null +++ b/RenovationWork/RenovationWorkContracts/ViewModels/ProductViewModel.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RenovationWorkDataModels.Models; +using System.ComponentModel; + +namespace RenovationWorkContracts.ViewModels +{ + public class ProductViewModel : IProductModel + { + public int Id { get; set; } + [DisplayName("Название изделия")] + public string ProductName { get; set; } = string.Empty; + [DisplayName("Цена")] + public double Price { get; set; } + public Dictionary ProductComponents + { + get; + set; + } = new(); + } +} diff --git a/RenovationWork/RenovationWorkDataModels/Enums/OrderStatus.cs b/RenovationWork/RenovationWorkDataModels/Enums/OrderStatus.cs new file mode 100644 index 0000000..9c6b5ca --- /dev/null +++ b/RenovationWork/RenovationWorkDataModels/Enums/OrderStatus.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RenovationWorkDataModels.Enums +{ + public enum OrderStatus + { + Неизвестен = -1, + + Принят = 0, + + Выполняется = 1, + + Готов = 2, + + Выдан = 3 + + } +} \ No newline at end of file diff --git a/RenovationWork/RenovationWorkDataModels/IId.cs b/RenovationWork/RenovationWorkDataModels/IId.cs new file mode 100644 index 0000000..9d33399 --- /dev/null +++ b/RenovationWork/RenovationWorkDataModels/IId.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography; +using System.Text; +using System.Threading.Tasks; + +namespace RenovationWorkDataModels +{ + public interface IId + { + int Id { get; } + } +} diff --git a/RenovationWork/RenovationWorkDataModels/Models/IComponentModel.cs b/RenovationWork/RenovationWorkDataModels/Models/IComponentModel.cs new file mode 100644 index 0000000..852d354 --- /dev/null +++ b/RenovationWork/RenovationWorkDataModels/Models/IComponentModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RenovationWorkDataModels.Models +{ + public interface IComponentModel : IId + { + string ComponentName { get; } + double Cost { get; } + } +} diff --git a/RenovationWork/RenovationWorkDataModels/Models/IOrderModel.cs b/RenovationWork/RenovationWorkDataModels/Models/IOrderModel.cs new file mode 100644 index 0000000..b222696 --- /dev/null +++ b/RenovationWork/RenovationWorkDataModels/Models/IOrderModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using RenovationWorkDataModels.Enums; + +namespace RenovationWorkDataModels.Models +{ + public interface IOrderModel : IId + { + int ProductId { get; } + int Count { get; } + double Sum { get; } + OrderStatus Status { get; } + DateTime DateCreate { get; } + DateTime? DateImplement { get; } + + } +} diff --git a/RenovationWork/RenovationWorkDataModels/Models/IProductModel.cs b/RenovationWork/RenovationWorkDataModels/Models/IProductModel.cs new file mode 100644 index 0000000..1967d22 --- /dev/null +++ b/RenovationWork/RenovationWorkDataModels/Models/IProductModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RenovationWorkDataModels.Models +{ + public interface IProductModel : IId + { + string ProductName { get; } + double Price { get; } + Dictionary ProductComponents { get; } + } +} diff --git a/RenovationWork/RenovationWorkDataModels/RenovationWorkDataModels.csproj b/RenovationWork/RenovationWorkDataModels/RenovationWorkDataModels.csproj new file mode 100644 index 0000000..27ac386 --- /dev/null +++ b/RenovationWork/RenovationWorkDataModels/RenovationWorkDataModels.csproj @@ -0,0 +1,9 @@ + + + + net6.0 + enable + enable + + +