Compare commits
No commits in common. "LabWork01" and "main" have entirely different histories.
@ -3,15 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.11.35219.272
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SewingFactoryView", "SewingFactoryView\SewingFactoryView.csproj", "{4FD708C9-AC45-40B8-B464-98163FFFD90A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SewingFactoryDataModels", "SewingFactoryDataModels\SewingFactoryDataModels.csproj", "{35061EB7-0B45-4A96-ACEF-3EA7FEAA57C4}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SewingFactoryContracts", "SewingFactoryContracts\SewingFactoryContracts.csproj", "{D979DF0C-B534-4563-97E5-04389DB2F6B9}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SewingFactoryListImplement", "SewingFactoryListImplement\SewingFactoryListImplement.csproj", "{31EA02DD-1E53-4FB5-A729-EF5D3F50E27D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SewingFactoryBusinessLogic", "SewingFactoryBusinessLogic\SewingFactoryBusinessLogic.csproj", "{909C9D71-212E-4544-BC3F-919BF60CBC14}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SewingFactoryView", "SewingFactoryView\SewingFactoryView.csproj", "{4FD708C9-AC45-40B8-B464-98163FFFD90A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -23,22 +15,6 @@ Global
|
||||
{4FD708C9-AC45-40B8-B464-98163FFFD90A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4FD708C9-AC45-40B8-B464-98163FFFD90A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4FD708C9-AC45-40B8-B464-98163FFFD90A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{35061EB7-0B45-4A96-ACEF-3EA7FEAA57C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{35061EB7-0B45-4A96-ACEF-3EA7FEAA57C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{35061EB7-0B45-4A96-ACEF-3EA7FEAA57C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{35061EB7-0B45-4A96-ACEF-3EA7FEAA57C4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D979DF0C-B534-4563-97E5-04389DB2F6B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D979DF0C-B534-4563-97E5-04389DB2F6B9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D979DF0C-B534-4563-97E5-04389DB2F6B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D979DF0C-B534-4563-97E5-04389DB2F6B9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{31EA02DD-1E53-4FB5-A729-EF5D3F50E27D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{31EA02DD-1E53-4FB5-A729-EF5D3F50E27D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{31EA02DD-1E53-4FB5-A729-EF5D3F50E27D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{31EA02DD-1E53-4FB5-A729-EF5D3F50E27D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{909C9D71-212E-4544-BC3F-919BF60CBC14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{909C9D71-212E-4544-BC3F-919BF60CBC14}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{909C9D71-212E-4544-BC3F-919BF60CBC14}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{909C9D71-212E-4544-BC3F-919BF60CBC14}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -1,115 +0,0 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SewingFactoryContracts.BindingModels;
|
||||
using SewingFactoryContracts.BusinessLogicContracts;
|
||||
using SewingFactoryContracts.SearchModels;
|
||||
using SewingFactoryContracts.StoragesContracts;
|
||||
using SewingFactoryContracts.ViewModels;
|
||||
|
||||
namespace SewingFactoryBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class ComponentLogic : IComponentLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly IComponentStorage _componentStorage;
|
||||
|
||||
public ComponentLogic(ILogger<ComponentLogic> logger, IComponentStorage componentStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_componentStorage = componentStorage;
|
||||
}
|
||||
|
||||
public List<ComponentViewModel>? ReadList(ComponentSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. ComponentName:{ComponentName}. Id:(Id))", model?.ComponentName, model?.Id);
|
||||
var list = model == null ? _componentStorage.GetFullList() : _componentStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
public ComponentViewModel? ReadElement(ComponentSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. ComponentName:{ComponentName}. Id:{Id})", model?.ComponentName, model?.Id);
|
||||
var element = _componentStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id})", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
public bool Create(ComponentBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_componentStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(ComponentBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_componentStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(ComponentBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id})", model.Id);
|
||||
if (_componentStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckModel(ComponentBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(string.IsNullOrEmpty(model.ComponentName))
|
||||
{
|
||||
throw new ArgumentNullException("Нет названия компонента", nameof(model.ComponentName));
|
||||
}
|
||||
if (model.Cost <= 0)
|
||||
{
|
||||
throw new ArgumentException("Цена компонента должна быть больше 0", nameof(model.Cost));
|
||||
}
|
||||
_logger.LogInformation("Component. ComponentName:(ComponentName}. Cost:{Cost}. Id:{Id})", model.ComponentName, model.Cost, model.Id);
|
||||
var element = _componentStorage.GetElement(new ComponentSearchModel
|
||||
{
|
||||
ComponentName = model.ComponentName,
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Компонента с таким названием уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
using SewingFactoryContracts.BindingModels;
|
||||
using SewingFactoryContracts.BusinessLogicContracts;
|
||||
using SewingFactoryContracts.SearchModels;
|
||||
using SewingFactoryContracts.ViewModels;
|
||||
|
||||
namespace SewingFactoryBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class OrderLogic : IOrderLogic
|
||||
{
|
||||
public bool CreateOrder(OrderBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool DeliveryOrder(OrderBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool FinishOrder(OrderBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public List<OrderViewModel>? ReadList(OrderSearchModel? model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool TakeOrderInWork(OrderBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
using SewingFactoryContracts.BindingModels;
|
||||
using SewingFactoryContracts.BusinessLogicContracts;
|
||||
using SewingFactoryContracts.SearchModels;
|
||||
using SewingFactoryContracts.ViewModels;
|
||||
|
||||
namespace SewingFactoryBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class TextileLogic : ITextileLogic
|
||||
{
|
||||
public bool Create(TextileBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Delete(TextileBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public TextileViewModel? ReadElement(TextileSearchModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public List<TextileViewModel>? ReadList(TextileSearchModel? model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Update(TextileBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SewingFactoryContracts\SewingFactoryContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,18 +0,0 @@
|
||||
using SewingFactoryDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewingFactoryContracts.BindingModels
|
||||
{
|
||||
public class ComponentBindingModel : IComponentModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string ComponentName { get; set; } = string.Empty;
|
||||
|
||||
public double Cost { get; set; }
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
using SewingFactoryDataModels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewingFactoryContracts.BindingModels
|
||||
{
|
||||
public class OrderBindingModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int TextileId { get; set; }
|
||||
|
||||
public int Count { get; set; }
|
||||
|
||||
public double Sum { get; set; }
|
||||
|
||||
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
||||
|
||||
DateTime DateCreate { get; set; } = DateTime.Now;
|
||||
|
||||
DateTime? DateImplement { get; set; }
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
using SewingFactoryDataModels;
|
||||
using SewingFactoryDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewingFactoryContracts.BindingModels
|
||||
{
|
||||
public class TextileBindingModel : ITextileModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string TextileName { get; set; } = string.Empty;
|
||||
|
||||
public double Price { get; set; }
|
||||
|
||||
public Dictionary<int, (IComponentModel, int)> TextileComponents { get; set; } = new();
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
using SewingFactoryContracts.BindingModels;
|
||||
using SewingFactoryContracts.SearchModels;
|
||||
using SewingFactoryContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewingFactoryContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IComponentLogic
|
||||
{
|
||||
List<ComponentViewModel>? ReadList(ComponentSearchModel? model);
|
||||
|
||||
ComponentViewModel? ReadElement(ComponentSearchModel model);
|
||||
|
||||
bool Create(ComponentBindingModel model);
|
||||
|
||||
bool Update(ComponentBindingModel model);
|
||||
|
||||
bool Delete(ComponentBindingModel model);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
using SewingFactoryContracts.BindingModels;
|
||||
using SewingFactoryContracts.SearchModels;
|
||||
using SewingFactoryContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewingFactoryContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IOrderLogic
|
||||
{
|
||||
List<OrderViewModel>? ReadList(OrderSearchModel? model);
|
||||
|
||||
bool CreateOrder(OrderBindingModel model);
|
||||
|
||||
bool TakeOrderInWork(OrderBindingModel model);
|
||||
|
||||
bool FinishOrder(OrderBindingModel model);
|
||||
|
||||
bool DeliveryOrder(OrderBindingModel model);
|
||||
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
using SewingFactoryContracts.BindingModels;
|
||||
using SewingFactoryContracts.SearchModels;
|
||||
using SewingFactoryContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewingFactoryContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface ITextileLogic
|
||||
{
|
||||
List<TextileViewModel>? ReadList(TextileSearchModel? model);
|
||||
|
||||
TextileViewModel? ReadElement(TextileSearchModel model);
|
||||
|
||||
bool Create(TextileBindingModel model);
|
||||
|
||||
bool Update(TextileBindingModel model);
|
||||
|
||||
bool Delete(TextileBindingModel model);
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewingFactoryContracts.SearchModels
|
||||
{
|
||||
public class ComponentSearchModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string? ComponentName { get; set; }
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewingFactoryContracts.SearchModels
|
||||
{
|
||||
public class OrderSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewingFactoryContracts.SearchModels
|
||||
{
|
||||
public class TextileSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
|
||||
public string? TextileName { get; set; }
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SewingFactoryDataModels\SewingFactoryDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -1,21 +0,0 @@
|
||||
using SewingFactoryContracts.BindingModels;
|
||||
using SewingFactoryContracts.SearchModels;
|
||||
using SewingFactoryContracts.ViewModels;
|
||||
|
||||
namespace SewingFactoryContracts.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);
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
using SewingFactoryContracts.BindingModels;
|
||||
using SewingFactoryContracts.SearchModels;
|
||||
using SewingFactoryContracts.ViewModels;
|
||||
|
||||
namespace SewingFactoryContracts.StoragesContracts
|
||||
{
|
||||
internal 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);
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
using SewingFactoryContracts.BindingModels;
|
||||
using SewingFactoryContracts.SearchModels;
|
||||
using SewingFactoryContracts.ViewModels;
|
||||
|
||||
namespace SewingFactoryContracts.StoragesContracts
|
||||
{
|
||||
public interface ITextileStorage
|
||||
{
|
||||
List<TextileViewModel> GetFullList();
|
||||
|
||||
List<TextileViewModel> GetFilteredList(TextileSearchModel model);
|
||||
|
||||
TextileViewModel? GetElement(TextileSearchModel model);
|
||||
|
||||
TextileViewModel? Insert(TextileBindingModel model);
|
||||
|
||||
TextileViewModel? Update(TextileBindingModel model);
|
||||
|
||||
TextileViewModel? Delete(TextileBindingModel model);
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
using SewingFactoryDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewingFactoryContracts.ViewModels
|
||||
{
|
||||
public class ComponentViewModel : IComponentModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Название компонента")]
|
||||
|
||||
public string ComponentName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Цена")]
|
||||
|
||||
public double Cost { get; set; }
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
using SewingFactoryDataModels;
|
||||
using SewingFactoryDataModels.Enums;
|
||||
using SewingFactoryDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace SewingFactoryContracts.ViewModels
|
||||
{
|
||||
public class OrderViewModel : IOrderModel
|
||||
{
|
||||
[DisplayName("Номер")]
|
||||
public int Id { get; set; }
|
||||
|
||||
public int TextileID { get; set; }
|
||||
public int TextileId { get; set; }
|
||||
[DisplayName("Изделие")]
|
||||
public string TextileName { 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; }
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
using SewingFactoryDataModels;
|
||||
using SewingFactoryDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewingFactoryContracts.ViewModels
|
||||
{
|
||||
public class TextileViewModel : ITextileModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Название изделия")]
|
||||
|
||||
public string TextileName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Цена")]
|
||||
|
||||
public double Price { get; set; }
|
||||
|
||||
public Dictionary<int, (IComponentModel, int)> TextileComponents { get; set; } = new();
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewingFactoryDataModels.Enums
|
||||
{
|
||||
public enum OrderStatus
|
||||
{
|
||||
Неизвестен = -1,
|
||||
|
||||
Принят = 0,
|
||||
|
||||
Выполняется = 1,
|
||||
|
||||
Готов = 2,
|
||||
|
||||
Выдан = 3
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewingFactoryDataModels
|
||||
{
|
||||
public interface IId
|
||||
{
|
||||
int Id { get; }
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewingFactoryDataModels.Models
|
||||
{
|
||||
public interface IComponentModel : IId
|
||||
{
|
||||
string ComponentName { get; }
|
||||
|
||||
double Cost { get; }
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
using SewingFactoryDataModels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewingFactoryDataModels.Models
|
||||
{
|
||||
public interface IOrderModel : IId
|
||||
{
|
||||
int TextileId{ get; }
|
||||
|
||||
int Count { get; }
|
||||
|
||||
double Sum { get; }
|
||||
|
||||
OrderStatus Status { get; }
|
||||
|
||||
DateTime DateCreate { get; }
|
||||
|
||||
DateTime? DateImplement { get; }
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewingFactoryDataModels.Models
|
||||
{
|
||||
public interface ITextileModel : IId
|
||||
{
|
||||
string TextileName { get; }
|
||||
|
||||
double Price { get; }
|
||||
|
||||
Dictionary<int, (IComponentModel, int)> TextileComponents { get; }
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
@ -1,43 +0,0 @@
|
||||
using SewingFactoryContracts.BindingModels;
|
||||
using SewingFactoryContracts.ViewModels;
|
||||
using SewingFactoryDataModels;
|
||||
using SewingFactoryDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewingFactoryListImplement.Models
|
||||
{
|
||||
internal class Component : IComponentModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string ComponentName { get; private set; } = string.Empty;
|
||||
|
||||
public double Cost { get; set; }
|
||||
|
||||
public static Component? Create(ComponentBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Component()
|
||||
{
|
||||
Id = model.Id,
|
||||
ComponentName = model.ComponentName,
|
||||
Cost = model.Cost
|
||||
};
|
||||
}
|
||||
|
||||
public ComponentViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
ComponentName = ComponentName,
|
||||
Cost = Cost
|
||||
};
|
||||
}
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
using SewingFactoryContracts.BindingModels;
|
||||
using SewingFactoryContracts.ViewModels;
|
||||
using SewingFactoryDataModels;
|
||||
using SewingFactoryDataModels.Enums;
|
||||
using SewingFactoryDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewingFactoryListImplement.Models
|
||||
{
|
||||
internal class Order : IOrderModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
|
||||
public int TextileId { get; private set; }
|
||||
|
||||
public int Count { get; private set; }
|
||||
|
||||
public double Sum { get; private set; }
|
||||
|
||||
public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен;
|
||||
|
||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||
|
||||
public DateTime? DateImplement { get; private set; }
|
||||
|
||||
public static Order? Create(OrderBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Order()
|
||||
{
|
||||
Id = model.Id,
|
||||
TextileId = model.TextileId,
|
||||
Count = model.Count,
|
||||
Sum = model.Sum,
|
||||
Status = model.Status,
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(OrderBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TextileId = TextileId;
|
||||
Count = model.Count;
|
||||
Sum = model.Sum;
|
||||
Status = model.Status;
|
||||
}
|
||||
|
||||
public OrderViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
TextileId = TextileId,
|
||||
Count = Count,
|
||||
Sum = Sum,
|
||||
Status = Status,
|
||||
DateCreate = DateCreate,
|
||||
DateImplement = DateImplement
|
||||
};
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
using SewingFactoryContracts.BindingModels;
|
||||
using SewingFactoryContracts.ViewModels;
|
||||
using SewingFactoryDataModels;
|
||||
using SewingFactoryDataModels.Models;
|
||||
|
||||
namespace SewingFactoryListImplement.Models
|
||||
{
|
||||
internal class Textile : ITextileModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
|
||||
public string ComponentName { get; private set; } = string.Empty;
|
||||
|
||||
public double Price { get; private set; }
|
||||
|
||||
public string TextileName { get; private set; } = string.Empty;
|
||||
|
||||
public Dictionary<int, (IComponentModel, int)> TextileComponents { get; private set; } = new Dictionary<int, (IComponentModel, int)>();
|
||||
|
||||
public static Textile? Create(TextileBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Textile()
|
||||
{
|
||||
Id = model.Id,
|
||||
TextileName = model.TextileName,
|
||||
Price = model.Price,
|
||||
TextileComponents = model.TextileComponents
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(TextileBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
TextileName = model.TextileName;
|
||||
Price = model.Price;
|
||||
TextileComponents = TextileComponents;
|
||||
}
|
||||
|
||||
public TextileViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
TextileName = TextileName,
|
||||
Price = Price,
|
||||
TextileComponents = TextileComponents
|
||||
};
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SewingFactoryContracts\SewingFactoryContracts.csproj" />
|
||||
<ProjectReference Include="..\SewingFactoryDataModels\SewingFactoryDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
39
SewingFactory/SewingFactoryView/Form1.Designer.cs
generated
Normal file
39
SewingFactory/SewingFactoryView/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,39 @@
|
||||
namespace SewingFactoryView
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "Form1";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
10
SewingFactory/SewingFactoryView/Form1.cs
Normal file
10
SewingFactory/SewingFactoryView/Form1.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace SewingFactoryView
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
120
SewingFactory/SewingFactoryView/Form1.resx
Normal file
120
SewingFactory/SewingFactoryView/Form1.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
Loading…
Reference in New Issue
Block a user