ПИбд-22 Боровков М В 1 лабораторная работа #1

Closed
bekodeg wants to merge 22 commits from labWork1 into main
22 changed files with 235 additions and 29 deletions
Showing only changes of commit 3f5418a520 - Show all commits

View File

@ -1,25 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.34031.279
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AbstractSushiBarDataModels", "AbstractSushiBarDataModels\AbstractSushiBarDataModels.csproj", "{3CA94B77-00EA-45B6-BD88-BDD3EAD3C887}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3CA94B77-00EA-45B6-BD88-BDD3EAD3C887}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3CA94B77-00EA-45B6-BD88-BDD3EAD3C887}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3CA94B77-00EA-45B6-BD88-BDD3EAD3C887}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3CA94B77-00EA-45B6-BD88-BDD3EAD3C887}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {73292010-42D8-482B-90B6-CD302C7EA849}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,11 @@
using AbstractSushiBarDataModels.Models;
namespace AbstractSushiBarContracts.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,16 @@
using AbstractSushiBarDataModels.Enums;
using AbstractSushiBarDataModels.Models;
namespace AbstractSushiBarContracts.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; }
}
}

View File

@ -0,0 +1,16 @@
using AbstractSushiBarDataModels.Models;
namespace AbstractSushiBarContracts.BindingModels
{
public class ProductBindingModel : IProductModel
{
public int Id { get; set; }
public string ProductName { get; set; } = string.Empty;
public double Price { get; set; }
public Dictionary<int, (IComponentModel, int)> ProductComponents
{
get;
set;
} = new();
}
}

View File

@ -0,0 +1,16 @@
using AbstractSushiBarContracts.BindingModels;
using AbstractSushiBarContracts.SearchModels;
using AbstractSushiBarContracts.ViewModels;
namespace AbstractSushiBarContracts.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,15 @@
using AbstractSushiBarContracts.BindingModels;
using AbstractSushiBarContracts.SearchModels;
using AbstractSushiBarContracts.ViewModels;
namespace AbstractSushiBarContracts.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,15 @@
using AbstractSushiBarContracts.BindingModels;
using AbstractSushiBarContracts.SearchModels;
using AbstractSushiBarContracts.ViewModels;
namespace AbstractSushiBarContracts.BusinessLogicsContracts
{
public interface IProductLogic
{
List<ProductViewModel>? ReadList(ProductSearchModel? model);
ProductViewModel? ReadElement(ProductSearchModel model);
bool Create(ProductBindingModel model);
bool Update(ProductBindingModel model);
bool Delete(ProductBindingModel model);
}
}

View File

@ -0,0 +1,8 @@
namespace AbstractSushiBarContracts.SearchModels
{
public class ComponentSearchModel
{
public int? Id { get; set; }
public string? ComponentName { get; set; }
}
}

View File

@ -0,0 +1,7 @@
namespace AbstractSushiBarContracts.SearchModels
{
public class OrderSearchModel
{
public int? Id { get; set; }
}
}

View File

@ -0,0 +1,8 @@
namespace AbstractSushiBarContracts.SearchModels
{
public class ProductSearchModel
{
public int? Id { get; set; }
public string? ProductName { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using AbstractSushiBarContracts.BindingModels;
using AbstractSushiBarContracts.SearchModels;
using AbstractSushiBarContracts.ViewModels;
namespace AbstractSushiBarContracts.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 AbstractSushiBarContracts.BindingModels;
using AbstractSushiBarContracts.SearchModels;
using AbstractSushiBarContracts.ViewModels;
namespace AbstractSushiBarContracts.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,16 @@
using AbstractSushiBarContracts.BindingModels;
using AbstractSushiBarContracts.SearchModels;
using AbstractSushiBarContracts.ViewModels;
namespace AbstractSushiBarContracts.StoragesContracts
{
public interface IProductStorage
{
List<ProductViewModel> GetFullList();
List<ProductViewModel> GetFilteredList(ProductSearchModel model);
ProductViewModel? GetElement(ProductSearchModel model);
ProductViewModel? Insert(ProductBindingModel model);
ProductViewModel? Update(ProductBindingModel model);
ProductViewModel? Delete(ProductBindingModel model);
}
}

View File

@ -0,0 +1,14 @@
using AbstractSushiBarDataModels.Models;
using System.ComponentModel;
namespace AbstractSushiBarContracts.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 AbstractSushiBarDataModels.Enums;
using AbstractSushiBarDataModels.Models;
using System.ComponentModel;
namespace AbstractSushiBarContracts.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; }
}
}

View File

@ -0,0 +1,20 @@
using AbstractSushiBarDataModels.Models;
using System.ComponentModel;
namespace AbstractSushiBarContracts.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<int, (IComponentModel, int)> ProductComponents
{
get;
set;
} = new();
}
}

View File

@ -1,6 +1,6 @@
namespace AbstractSushiBarDataModels.Models namespace AbstractSushiBarDataModels.Models
{ {
internal interface IComponentModel : IId public interface IComponentModel : IId
{ {
string ComponentName { get; } string ComponentName { get; }
double Cost { get; } double Cost { get; }

View File

@ -2,7 +2,7 @@
namespace AbstractSushiBarDataModels.Models namespace AbstractSushiBarDataModels.Models
{ {
internal interface IOrderModel : IId public interface IOrderModel : IId
{ {
int ProductId { get; } int ProductId { get; }
int Count { get; } int Count { get; }

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace AbstractSushiBarDataModels.Models namespace AbstractSushiBarDataModels.Models
{ {
internal interface IProductModel : IId public interface IProductModel : IId
{ {
string ProductName { get; } string ProductName { get; }
double Price { get; } double Price { get; }

View File

@ -3,7 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.7.34031.279 VisualStudioVersion = 17.7.34031.279
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBar", "SushiBar\SushiBar.csproj", "{B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBar", "SushiBar\SushiBar.csproj", "{B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AbstractSushiBarDataModels", "AbstractSushiBarDataModels\AbstractSushiBarDataModels.csproj", "{6F64D0ED-EAFC-495F-AFAC-FFC9CD4C53BA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AbstractSushiBarContracts", "AbstractSushiBarContracts\AbstractSushiBarContracts.csproj", "{E02D432A-1BC9-4C65-B8D3-57EC53336DD3}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -15,6 +19,14 @@ Global
{B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}.Debug|Any CPU.Build.0 = Debug|Any CPU {B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}.Release|Any CPU.ActiveCfg = Release|Any CPU {B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}.Release|Any CPU.Build.0 = Release|Any CPU {B9AC543F-20EE-47B1-9BC4-3F5DADAD931C}.Release|Any CPU.Build.0 = Release|Any CPU
{6F64D0ED-EAFC-495F-AFAC-FFC9CD4C53BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6F64D0ED-EAFC-495F-AFAC-FFC9CD4C53BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F64D0ED-EAFC-495F-AFAC-FFC9CD4C53BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6F64D0ED-EAFC-495F-AFAC-FFC9CD4C53BA}.Release|Any CPU.Build.0 = Release|Any CPU
{E02D432A-1BC9-4C65-B8D3-57EC53336DD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E02D432A-1BC9-4C65-B8D3-57EC53336DD3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E02D432A-1BC9-4C65-B8D3-57EC53336DD3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E02D432A-1BC9-4C65-B8D3-57EC53336DD3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE