Щаг 3. Создание контрактов

This commit is contained in:
Кашин Максим 2023-01-30 21:21:58 +04:00
parent f9296b7d5c
commit 8cfc61cd4c
18 changed files with 333 additions and 2 deletions

View File

@ -5,7 +5,9 @@ VisualStudioVersion = 17.3.32825.248
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PrecastConcretePlant", "PrecastConcretePlant\PrecastConcretePlant.csproj", "{DF873295-2C69-4C9A-A993-0B436DB14B95}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrecastConcretePlantDataModels", "PrecastConcretePlantDataModels\PrecastConcretePlantDataModels.csproj", "{AFE873D8-CDF1-4780-A98B-058EF19F37D8}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PrecastConcretePlantDataModels", "PrecastConcretePlantDataModels\PrecastConcretePlantDataModels.csproj", "{AFE873D8-CDF1-4780-A98B-058EF19F37D8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrecastConcretePlantContracts", "PrecastConcretePlantContracts\PrecastConcretePlantContracts.csproj", "{163A22A6-D3C3-478F-9DAF-DA03FBF2AF48}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -21,6 +23,10 @@ Global
{AFE873D8-CDF1-4780-A98B-058EF19F37D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AFE873D8-CDF1-4780-A98B-058EF19F37D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AFE873D8-CDF1-4780-A98B-058EF19F37D8}.Release|Any CPU.Build.0 = Release|Any CPU
{163A22A6-D3C3-478F-9DAF-DA03FBF2AF48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{163A22A6-D3C3-478F-9DAF-DA03FBF2AF48}.Debug|Any CPU.Build.0 = Debug|Any CPU
{163A22A6-D3C3-478F-9DAF-DA03FBF2AF48}.Release|Any CPU.ActiveCfg = Release|Any CPU
{163A22A6-D3C3-478F-9DAF-DA03FBF2AF48}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PrecastConcretePlantDataModels.Models;
namespace PrecastConcretePlantContracts.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,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PrecastConcretePlantDataModels.Models;
using PrecastConcretePlantDataModels.Enums;
namespace PrecastConcretePlantContracts.BindingModels
{
public class OrderBindingModel : IOrderModel
{
public int Id { get; set; }
public int ReinforcedId { 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 System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PrecastConcretePlantDataModels.Models;
namespace PrecastConcretePlantContracts.BindingModels
{
public class ReinforcedBindingModel : IReinforcedModel
{
public int Id { get; set; }
public string ReinforcedName { get; set; } = string.Empty;
public double Price { get; set; }
public Dictionary<int, (IComponentModel, int)> ReinforcedComponents
{
get;
set;
} = new();
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PrecastConcretePlantContracts.BindingModels;
using PrecastConcretePlantContracts.SearchModels;
using PrecastConcretePlantContracts.ViewModels;
namespace PrecastConcretePlantContracts.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,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PrecastConcretePlantContracts.BindingModels;
using PrecastConcretePlantContracts.SearchModels;
using PrecastConcretePlantContracts.ViewModels;
namespace PrecastConcretePlantContracts.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,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PrecastConcretePlantContracts.BindingModels;
using PrecastConcretePlantContracts.SearchModels;
using PrecastConcretePlantContracts.ViewModels;
namespace PrecastConcretePlantContracts.BusinessLogicsContracts
{
public interface IReinforcedLogic
{
List<ReinforcedViewModel>? ReadList(ReinforcedSearchModel? model);
ReinforcedViewModel? ReadElement(ReinforcedSearchModel model);
bool Create(ReinforcedBindingModel model);
bool Update(ReinforcedBindingModel model);
bool Delete(ReinforcedBindingModel 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="..\PrecastConcretePlantDataModels\PrecastConcretePlantDataModels.csproj" />
</ItemGroup>
</Project>

View File

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

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PrecastConcretePlantContracts.SearchModels
{
public class ReinforcedSearchModel
{
public int? Id { get; set; }
public string? ReinforcedName { get; set; }
}
}

View File

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

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PrecastConcretePlantDataModels.Models;
using System.ComponentModel;
namespace PrecastConcretePlantContracts.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,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PrecastConcretePlantDataModels.Enums;
using PrecastConcretePlantDataModels.Models;
using System.ComponentModel;
namespace PrecastConcretePlantContracts.ViewModels
{
public class OrderViewModel : IOrderModel
{
[DisplayName("Номер")]
public int Id { get; set; }
public int ReinforcedId { get; set; }
[DisplayName("Изделие")]
public string ReinforcedName { 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

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PrecastConcretePlantDataModels.Models;
using System.ComponentModel;
namespace PrecastConcretePlantContracts.ViewModels
{
public class ReinforcedViewModel : IReinforcedModel
{
public int Id { get; set; }
[DisplayName("Название изделия")]
public string ReinforcedName { get; set; } = string.Empty;
[DisplayName("Цена")]
public double Price { get; set; }
public Dictionary<int, (IComponentModel, int)> ReinforcedComponents
{
get;
set;
}
}
}

View File

@ -9,7 +9,7 @@ namespace PrecastConcretePlantDataModels.Enums
{
public interface IOrderModel : IId
{
int ProductId { get; }
int ReinforcedId { get; }
int Count { get; }
double Sum { get; }
OrderStatus Status { get; }