Compare commits
No commits in common. "lab8_base" and "main" have entirely different histories.
1
.gitignore
vendored
1
.gitignore
vendored
@ -398,4 +398,3 @@ FodyWeavers.xsd
|
|||||||
# JetBrains Rider
|
# JetBrains Rider
|
||||||
*.sln.iml
|
*.sln.iml
|
||||||
|
|
||||||
*.dll
|
|
||||||
|
@ -1,68 +0,0 @@
|
|||||||
using FurnitureAssemFileImplement.Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace FurnitureAssemFileImplement
|
|
||||||
{
|
|
||||||
public class DataFileSingleton
|
|
||||||
{
|
|
||||||
private static DataFileSingleton? instance;
|
|
||||||
private readonly string ComponentFileName = "Component.xml";
|
|
||||||
private readonly string OrderFileName = "Order.xml";
|
|
||||||
private readonly string FurnitureFileName = "Furniture.xml";
|
|
||||||
private readonly string ClientFileName = "Client.xml";
|
|
||||||
private readonly string ImplementerFileName = "Implementer.xml";
|
|
||||||
private readonly string MessageFileName = "Message.xml";
|
|
||||||
public List<Component> Components { get; private set; }
|
|
||||||
public List<Order> Orders { get; private set; }
|
|
||||||
public List<Furniture> Furnitures { get; private set; }
|
|
||||||
public List<Client> Clients { get; private set; }
|
|
||||||
public List<Implementer> Implementers { get; private set; }
|
|
||||||
public List<MessageInfo> Messages { get; private set; }
|
|
||||||
public static DataFileSingleton GetInstance()
|
|
||||||
{
|
|
||||||
if (instance == null)
|
|
||||||
{
|
|
||||||
instance = new DataFileSingleton();
|
|
||||||
}
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
public void SaveComponents() => SaveData(Components, ComponentFileName, "Components", x => x.GetXElement);
|
|
||||||
public void SaveFurnitures() => SaveData(Furnitures, FurnitureFileName, "Furnitures", x => x.GetXElement);
|
|
||||||
public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement);
|
|
||||||
public void SaveClients() => SaveData(Clients, ClientFileName, "Clients", x => x.GetXElement);
|
|
||||||
public void SaveImplementers() => SaveData(Implementers, ImplementerFileName, "Implementers", x => x.GetXElement);
|
|
||||||
public void SaveMessages() => SaveData(Messages, MessageFileName, "Messages", x => x.GetXElement);
|
|
||||||
private DataFileSingleton()
|
|
||||||
{
|
|
||||||
Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!;
|
|
||||||
Furnitures = LoadData(FurnitureFileName, "Furniture", x => Furniture.Create(x)!)!;
|
|
||||||
Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!;
|
|
||||||
Clients = LoadData(ClientFileName, "Client", x => Client.Create(x)!)!;
|
|
||||||
Implementers = LoadData(ImplementerFileName, "Implementer", x => Implementer.Create(x)!)!;
|
|
||||||
Messages = LoadData(MessageFileName, "Message", x => MessageInfo.Create(x)!)!;
|
|
||||||
}
|
|
||||||
private static List<T>? LoadData<T>(string filename, string xmlNodeName,
|
|
||||||
Func<XElement, T> selectFunction)
|
|
||||||
{
|
|
||||||
if (File.Exists(filename))
|
|
||||||
{
|
|
||||||
return XDocument.Load(filename)?.Root?.Elements(xmlNodeName)?.Select(selectFunction)?.ToList();
|
|
||||||
}
|
|
||||||
return new List<T>();
|
|
||||||
}
|
|
||||||
private static void SaveData<T>(List<T> data, string filename,
|
|
||||||
string xmlNodeName, Func<T, XElement> selectFunction)
|
|
||||||
{
|
|
||||||
if (data != null)
|
|
||||||
{
|
|
||||||
new XDocument(new XElement(xmlNodeName,
|
|
||||||
data.Select(selectFunction).ToArray())).Save(filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.DI;
|
|
||||||
using FurnitureAssemblyContracts.StoragesContracts;
|
|
||||||
using FurnitureAssemFileImplement.Implements;
|
|
||||||
|
|
||||||
namespace FurnitureAssemFileImplement
|
|
||||||
{
|
|
||||||
public class FileImplementationExtension : IImplementationExtension
|
|
||||||
{
|
|
||||||
public int Priority => 1;
|
|
||||||
|
|
||||||
public void RegisterServices()
|
|
||||||
{
|
|
||||||
DependencyManager.Instance.RegisterType<IClientStorage, ClientStorage>();
|
|
||||||
DependencyManager.Instance.RegisterType<IComponentStorage, ComponentStorage>();
|
|
||||||
DependencyManager.Instance.RegisterType<IImplementerStorage, ImplementerStorage>();
|
|
||||||
DependencyManager.Instance.RegisterType<IMessageInfoStorage, MessageInfoStorage>();
|
|
||||||
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
|
|
||||||
DependencyManager.Instance.RegisterType<IFurnitureStorage, FurnitureStorage>();
|
|
||||||
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\FurnitureAssemblyContracts\FurnitureAssemblyContracts.csproj" />
|
|
||||||
<ProjectReference Include="..\FurnitureAssemblyDataModels\FurnitureAssemblyDataModels.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
|
||||||
<Exec Command="copy /Y "$(TargetDir)*.dll" "$(SolutionDir)ImplementationExtensions\*.dll"" />
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
</Project>
|
|
@ -1,30 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.StoragesContracts;
|
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
namespace FurnitureAssemFileImplement.Implements
|
|
||||||
{
|
|
||||||
public class BackUpInfo : IBackUpInfo
|
|
||||||
{
|
|
||||||
public List<T>? GetList<T>() where T : class, new()
|
|
||||||
{
|
|
||||||
DataFileSingleton dataFileSingleton = DataFileSingleton.GetInstance();
|
|
||||||
return (List<T>?) dataFileSingleton.GetType().GetProperties()
|
|
||||||
.FirstOrDefault(x => x.PropertyType.IsGenericType && x.PropertyType.GetGenericArguments()[0] == typeof(T))?
|
|
||||||
.GetValue(dataFileSingleton);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Type? GetTypeByModelInterface(string modelInterfaceName)
|
|
||||||
{
|
|
||||||
var assembly = typeof(BackUpInfo).Assembly;
|
|
||||||
var types = assembly.GetTypes();
|
|
||||||
foreach (var type in types)
|
|
||||||
{
|
|
||||||
if (type.IsClass && type.GetInterface(modelInterfaceName) != null)
|
|
||||||
{
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,100 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.SearchModels;
|
|
||||||
using FurnitureAssemblyContracts.StoragesContracts;
|
|
||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
using FurnitureAssemFileImplement.Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FurnitureAssemFileImplement.Implements
|
|
||||||
{
|
|
||||||
public class ClientStorage : IClientStorage
|
|
||||||
{
|
|
||||||
private readonly DataFileSingleton source;
|
|
||||||
public ClientStorage()
|
|
||||||
{
|
|
||||||
source = DataFileSingleton.GetInstance();
|
|
||||||
}
|
|
||||||
public ClientViewModel? Delete(ClientBindingModel model)
|
|
||||||
{
|
|
||||||
var client = source.Clients.FirstOrDefault(x => x.Id == model.Id);
|
|
||||||
if (client != null)
|
|
||||||
{
|
|
||||||
source.Clients.Remove(client);
|
|
||||||
source.SaveClients();
|
|
||||||
return client.GetViewModel;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ClientViewModel? GetElement(ClientSearchModel model)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(model.Email) && !model.Id.HasValue && string.IsNullOrEmpty(model.Password))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (model.Id.HasValue)
|
|
||||||
{
|
|
||||||
return source.Clients.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
|
||||||
}
|
|
||||||
if (model.Email != null && model.Password != null)
|
|
||||||
{
|
|
||||||
return source.Clients
|
|
||||||
.FirstOrDefault(x => x.Email.Equals(model.Email) && x.Password.Equals(model.Password))
|
|
||||||
?.GetViewModel;
|
|
||||||
}
|
|
||||||
if (model.Email != null)
|
|
||||||
{
|
|
||||||
return source.Clients.FirstOrDefault(x => x.Email.Equals(model.Email))?.GetViewModel;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ClientViewModel> GetFilteredList(ClientSearchModel model)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(model.Email))
|
|
||||||
{
|
|
||||||
return new();
|
|
||||||
}
|
|
||||||
return source.Clients
|
|
||||||
.Where(x => x.Email.Equals(model.Email))
|
|
||||||
.Select(x => x.GetViewModel)
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ClientViewModel> GetFullList()
|
|
||||||
{
|
|
||||||
return source.Clients
|
|
||||||
.Select(x => x.GetViewModel)
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ClientViewModel? Insert(ClientBindingModel model)
|
|
||||||
{
|
|
||||||
model.Id = source.Clients.Count > 0 ? source.Clients.Max(x => x.Id) + 1 : 1;
|
|
||||||
var newClient = Client.Create(model);
|
|
||||||
if (newClient == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
source.Clients.Add(newClient);
|
|
||||||
source.SaveClients();
|
|
||||||
return newClient.GetViewModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ClientViewModel? Update(ClientBindingModel model)
|
|
||||||
{
|
|
||||||
var client = source.Clients.FirstOrDefault(x => x.Id == model.Id);
|
|
||||||
if (client == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
client.Update(model);
|
|
||||||
source.SaveClients();
|
|
||||||
return client.GetViewModel;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,92 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.SearchModels;
|
|
||||||
using FurnitureAssemblyContracts.StoragesContracts;
|
|
||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
using FurnitureAssemFileImplement.Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FurnitureAssemFileImplement.Implements
|
|
||||||
{
|
|
||||||
public class ComponentStorage : IComponentStorage
|
|
||||||
{
|
|
||||||
private readonly DataFileSingleton source;
|
|
||||||
public ComponentStorage()
|
|
||||||
{
|
|
||||||
source = DataFileSingleton.GetInstance();
|
|
||||||
}
|
|
||||||
public List<ComponentViewModel> GetFullList()
|
|
||||||
{
|
|
||||||
return source.Components
|
|
||||||
.Select(x => x.GetViewModel)
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
public List<ComponentViewModel> GetFilteredList(ComponentSearchModel
|
|
||||||
model)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(model.ComponentName))
|
|
||||||
{
|
|
||||||
return new();
|
|
||||||
}
|
|
||||||
return source.Components
|
|
||||||
.Where(x => x.ComponentName.Contains(model.ComponentName))
|
|
||||||
.Select(x => x.GetViewModel)
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
public ComponentViewModel? GetElement(ComponentSearchModel model)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(model.ComponentName) && !model.Id.HasValue)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return source.Components
|
|
||||||
.FirstOrDefault(x =>
|
|
||||||
(!string.IsNullOrEmpty(model.ComponentName) && x.ComponentName ==
|
|
||||||
model.ComponentName) ||
|
|
||||||
(model.Id.HasValue && x.Id == model.Id))
|
|
||||||
?.GetViewModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ComponentViewModel? Insert(ComponentBindingModel model)
|
|
||||||
{
|
|
||||||
model.Id = source.Components.Count > 0 ? source.Components.Max(x =>
|
|
||||||
x.Id) + 1 : 1;
|
|
||||||
var newComponent = Component.Create(model);
|
|
||||||
if (newComponent == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
source.Components.Add(newComponent);
|
|
||||||
source.SaveComponents();
|
|
||||||
return newComponent.GetViewModel;
|
|
||||||
}
|
|
||||||
public ComponentViewModel? Update(ComponentBindingModel model)
|
|
||||||
{
|
|
||||||
var component = source.Components.FirstOrDefault(x => x.Id ==
|
|
||||||
model.Id);
|
|
||||||
if (component == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
component.Update(model);
|
|
||||||
source.SaveComponents();
|
|
||||||
return component.GetViewModel;
|
|
||||||
}
|
|
||||||
public ComponentViewModel? Delete(ComponentBindingModel model)
|
|
||||||
{
|
|
||||||
var element = source.Components.FirstOrDefault(x => x.Id ==
|
|
||||||
model.Id);
|
|
||||||
if (element != null)
|
|
||||||
{
|
|
||||||
source.Components.Remove(element);
|
|
||||||
source.SaveComponents();
|
|
||||||
return element.GetViewModel;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,88 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.SearchModels;
|
|
||||||
using FurnitureAssemblyContracts.StoragesContracts;
|
|
||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
using FurnitureAssemFileImplement.Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FurnitureAssemFileImplement.Implements
|
|
||||||
{
|
|
||||||
public class FurnitureStorage : IFurnitureStorage
|
|
||||||
{
|
|
||||||
private readonly DataFileSingleton source;
|
|
||||||
public FurnitureStorage()
|
|
||||||
{
|
|
||||||
source = DataFileSingleton.GetInstance();
|
|
||||||
}
|
|
||||||
public FurnitureViewModel? GetElement(FurnitureSearchModel model)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(model.FurnitureName) && !model.Id.HasValue)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return source.Furnitures.FirstOrDefault(x =>
|
|
||||||
(model.Id.HasValue && x.Id == model.Id))
|
|
||||||
?.GetViewModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<FurnitureViewModel> GetFilteredList(FurnitureSearchModel model)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(model.FurnitureName))
|
|
||||||
{
|
|
||||||
return new();
|
|
||||||
}
|
|
||||||
return source.Furnitures
|
|
||||||
.Where(x => x.FurnitureName.Contains(model.FurnitureName))
|
|
||||||
.Select(x => x.GetViewModel)
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<FurnitureViewModel> GetFullList()
|
|
||||||
{
|
|
||||||
return source.Furnitures.Select(x => x.GetViewModel).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public FurnitureViewModel? Insert(FurnitureBindingModel model)
|
|
||||||
{
|
|
||||||
model.Id = source.Furnitures.Count > 0 ? source.Furnitures.Max(x =>
|
|
||||||
x.Id) + 1 : 1;
|
|
||||||
var newFurniture = Furniture.Create(model);
|
|
||||||
if (newFurniture == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
source.Furnitures.Add(newFurniture);
|
|
||||||
source.SaveFurnitures();
|
|
||||||
return newFurniture.GetViewModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FurnitureViewModel? Update(FurnitureBindingModel model)
|
|
||||||
{
|
|
||||||
var furniture = source.Furnitures.FirstOrDefault(x => x.Id == model.Id);
|
|
||||||
if (furniture == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
furniture.Update(model);
|
|
||||||
source.SaveFurnitures();
|
|
||||||
return furniture.GetViewModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FurnitureViewModel? Delete(FurnitureBindingModel model)
|
|
||||||
{
|
|
||||||
var element = source.Furnitures.FirstOrDefault(x => x.Id == model.Id);
|
|
||||||
if (element != null)
|
|
||||||
{
|
|
||||||
source.Furnitures.Remove(element);
|
|
||||||
source.SaveFurnitures();
|
|
||||||
return element.GetViewModel;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,99 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.SearchModels;
|
|
||||||
using FurnitureAssemblyContracts.StoragesContracts;
|
|
||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
using FurnitureAssemFileImplement.Models;
|
|
||||||
|
|
||||||
namespace FurnitureAssemFileImplement.Implements
|
|
||||||
{
|
|
||||||
public class ImplementerStorage : IImplementerStorage
|
|
||||||
{
|
|
||||||
private readonly DataFileSingleton source;
|
|
||||||
public ImplementerStorage()
|
|
||||||
{
|
|
||||||
source = DataFileSingleton.GetInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ImplementerViewModel? GetElement(ImplementerSearchModel model)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(model.ImplementerFIO) && !model.Id.HasValue && string.IsNullOrEmpty(model.Password))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (model.Id.HasValue)
|
|
||||||
{
|
|
||||||
return source.Implementers
|
|
||||||
.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)?.GetViewModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (model.ImplementerFIO != null && model.Password != null)
|
|
||||||
{
|
|
||||||
return source.Implementers
|
|
||||||
.FirstOrDefault(x =>
|
|
||||||
x.ImplementerFIO.Equals(model.ImplementerFIO) && x.Password.Equals(model.Password))
|
|
||||||
?.GetViewModel;
|
|
||||||
}
|
|
||||||
return source.Implementers
|
|
||||||
.FirstOrDefault(x =>
|
|
||||||
x.ImplementerFIO.Equals(model.ImplementerFIO))
|
|
||||||
?.GetViewModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ImplementerViewModel> GetFilteredList(ImplementerSearchModel model)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(model.ImplementerFIO))
|
|
||||||
{
|
|
||||||
return new();
|
|
||||||
}
|
|
||||||
return source.Implementers
|
|
||||||
.Where(x => x.ImplementerFIO.Equals(model.ImplementerFIO))
|
|
||||||
.Select(x => x.GetViewModel)
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ImplementerViewModel> GetFullList()
|
|
||||||
{
|
|
||||||
return source.Implementers
|
|
||||||
.Select(x => x.GetViewModel)
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ImplementerViewModel? Insert(ImplementerBindingModel model)
|
|
||||||
{
|
|
||||||
model.Id = source.Implementers.Count > 0 ? source.Implementers.Max(x => x.Id) + 1 : 1;
|
|
||||||
var newImpl = Implementer.Create(model);
|
|
||||||
if (newImpl == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
source.Implementers.Add(newImpl);
|
|
||||||
source.SaveComponents();
|
|
||||||
return newImpl.GetViewModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ImplementerViewModel? Update(ImplementerBindingModel model)
|
|
||||||
{
|
|
||||||
var implementer = source.Implementers.FirstOrDefault(x => x.Id == model.Id);
|
|
||||||
if (implementer == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
implementer.Update(model);
|
|
||||||
source.SaveComponents();
|
|
||||||
return implementer.GetViewModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ImplementerViewModel? Delete(ImplementerBindingModel model)
|
|
||||||
{
|
|
||||||
var element = source.Implementers.FirstOrDefault(x => x.Id == model.Id);
|
|
||||||
if (element != null)
|
|
||||||
{
|
|
||||||
source.Implementers.Remove(element);
|
|
||||||
source.SaveComponents();
|
|
||||||
return element.GetViewModel;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.SearchModels;
|
|
||||||
using FurnitureAssemblyContracts.StoragesContracts;
|
|
||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
using FurnitureAssemFileImplement.Models;
|
|
||||||
|
|
||||||
namespace FurnitureAssemFileImplement.Implements
|
|
||||||
{
|
|
||||||
public class MessageInfoStorage : IMessageInfoStorage
|
|
||||||
{
|
|
||||||
private readonly DataFileSingleton _source;
|
|
||||||
public MessageInfoStorage()
|
|
||||||
{
|
|
||||||
_source = DataFileSingleton.GetInstance();
|
|
||||||
}
|
|
||||||
public MessageInfoViewModel? GetElement(MessageInfoSearchModel model)
|
|
||||||
{
|
|
||||||
if (model.MessageId == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return _source.Messages.FirstOrDefault(x => x.MessageId.Equals(model.MessageId))?.GetViewModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MessageInfoViewModel> GetFilteredList(MessageInfoSearchModel model)
|
|
||||||
{
|
|
||||||
if (!model.ClientId.HasValue)
|
|
||||||
{
|
|
||||||
return new();
|
|
||||||
}
|
|
||||||
return _source.Messages
|
|
||||||
.Where(x => x.ClientId.Equals(model.ClientId))
|
|
||||||
.Select(x => x.GetViewModel)
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MessageInfoViewModel> GetFullList()
|
|
||||||
{
|
|
||||||
return _source.Messages
|
|
||||||
.Select(x => x.GetViewModel)
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public MessageInfoViewModel? Insert(MessageInfoBindingModel model)
|
|
||||||
{
|
|
||||||
|
|
||||||
var newClient = MessageInfo.Create(model);
|
|
||||||
if (newClient == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_source.Messages.Add(newClient);
|
|
||||||
_source.SaveMessages();
|
|
||||||
return newClient.GetViewModel;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.SearchModels;
|
|
||||||
using FurnitureAssemblyContracts.StoragesContracts;
|
|
||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
using FurnitureAssemFileImplement.Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace FurnitureAssemFileImplement.Implements
|
|
||||||
{
|
|
||||||
public class OrderStorage : IOrderStorage
|
|
||||||
{
|
|
||||||
private readonly DataFileSingleton source;
|
|
||||||
public OrderStorage()
|
|
||||||
{
|
|
||||||
source = DataFileSingleton.GetInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<OrderViewModel> GetFullList()
|
|
||||||
{
|
|
||||||
return source.Orders.Select(x => GetOrderViewModel(x)).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
|
||||||
{
|
|
||||||
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue && !model.ClientId.HasValue && !model.Status.HasValue)
|
|
||||||
{
|
|
||||||
return new();
|
|
||||||
}
|
|
||||||
if (model.Id.HasValue)
|
|
||||||
{
|
|
||||||
return source.Orders
|
|
||||||
.Where(x => x.Id.Equals(model.Id))
|
|
||||||
.Select(x => GetOrderViewModel(x))
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
return source.Orders
|
|
||||||
.Where(x => !(((model.DateFrom.HasValue) && (model.DateTo.HasValue)) && !(model.DateFrom <= x.DateCreate && x.DateCreate <= model.DateTo)
|
|
||||||
|| ((model.ClientId.HasValue) && !(x.ClientId.Equals(model.ClientId)))
|
|
||||||
|| ((model.Status.HasValue) && !(x.Status.Equals(model.Status)))
|
|
||||||
))
|
|
||||||
.Select(x => GetOrderViewModel(x))
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderViewModel? GetElement(OrderSearchModel model)
|
|
||||||
{
|
|
||||||
if (!model.Id.HasValue && (!model.ImplementerId.HasValue || !model.Status.HasValue))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
var order = source.Orders
|
|
||||||
.FirstOrDefault(x =>
|
|
||||||
(model.Id.HasValue && x.Id == model.Id) || (x.ImplementerId.Equals(model.ImplementerId) && x.Status.Equals(model.Status)));
|
|
||||||
return GetOrderViewModel(order);
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderViewModel? Insert(OrderBindingModel model)
|
|
||||||
{
|
|
||||||
model.Id = source.Orders.Count > 0 ? source.Orders.Max(x => x.Id) + 1 : 1;
|
|
||||||
var newOrder = Order.Create(model);
|
|
||||||
if (newOrder == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
source.Orders.Add(newOrder);
|
|
||||||
source.SaveOrders();
|
|
||||||
return GetOrderViewModel(newOrder);
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderViewModel? Update(OrderBindingModel model)
|
|
||||||
{
|
|
||||||
var order = source.Orders.FirstOrDefault(x => x.Id == model.Id);
|
|
||||||
if (order == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
order.Update(model);
|
|
||||||
source.SaveOrders();
|
|
||||||
return GetOrderViewModel(order);
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderViewModel? Delete(OrderBindingModel model)
|
|
||||||
{
|
|
||||||
var element = source.Orders.FirstOrDefault(x => x.Id == model.Id);
|
|
||||||
if (element != null)
|
|
||||||
{
|
|
||||||
source.Orders.Remove(element);
|
|
||||||
source.SaveOrders();
|
|
||||||
return GetOrderViewModel(element);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private OrderViewModel GetOrderViewModel(Order order)
|
|
||||||
{
|
|
||||||
OrderViewModel orderViewModel = order.GetViewModel;
|
|
||||||
|
|
||||||
foreach (var furniture in source.Furnitures)
|
|
||||||
{
|
|
||||||
if (furniture.Id == order.FurnitureId)
|
|
||||||
{
|
|
||||||
orderViewModel.FurnitureName = furniture.FurnitureName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach (var client in source.Clients)
|
|
||||||
{
|
|
||||||
if (client.Id == order.ClientId)
|
|
||||||
{
|
|
||||||
orderViewModel.ClientFIO = client.ClientFIO;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return orderViewModel;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,82 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
using FurnitureAssemblyDataModels.Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace FurnitureAssemFileImplement.Models
|
|
||||||
{
|
|
||||||
[DataContract]
|
|
||||||
public class Client : IClientModel
|
|
||||||
{
|
|
||||||
[DataMember]
|
|
||||||
public int Id { get; private set; }
|
|
||||||
[DataMember]
|
|
||||||
public string ClientFIO { get; private set; } = string.Empty;
|
|
||||||
[DataMember]
|
|
||||||
public string Email { get; private set; } = string.Empty;
|
|
||||||
[DataMember]
|
|
||||||
public string Password { get; private set; } = string.Empty;
|
|
||||||
|
|
||||||
public static Client? Create(ClientBindingModel model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new Client()
|
|
||||||
{
|
|
||||||
Id = model.Id,
|
|
||||||
ClientFIO = model.ClientFIO,
|
|
||||||
Email = model.Email,
|
|
||||||
Password = model.Password
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Client? Create(XElement element)
|
|
||||||
{
|
|
||||||
if (element == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new Client()
|
|
||||||
{
|
|
||||||
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
|
||||||
ClientFIO = element.Element("ClientFIO")!.Value,
|
|
||||||
Email = element.Element("Email")!.Value,
|
|
||||||
Password = element.Element("Password")!.Value
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Update(ClientBindingModel model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ClientFIO = model.ClientFIO;
|
|
||||||
Email = model.Email;
|
|
||||||
Password = model.Password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ClientViewModel GetViewModel => new()
|
|
||||||
{
|
|
||||||
Id = Id,
|
|
||||||
ClientFIO = ClientFIO,
|
|
||||||
Email = Email,
|
|
||||||
Password = Password
|
|
||||||
};
|
|
||||||
|
|
||||||
public XElement GetXElement => new("Client",
|
|
||||||
new XAttribute("Id", Id),
|
|
||||||
new XElement("ClientFIO", ClientFIO),
|
|
||||||
new XElement("Email", Email),
|
|
||||||
new XElement("Password", Password)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,66 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
using FurnitureAssemblyDataModels.Models;
|
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace FurnitureAssemFileImplement.Models
|
|
||||||
{
|
|
||||||
[DataContract]
|
|
||||||
public class Component : IComponentModel
|
|
||||||
{
|
|
||||||
[DataMember]
|
|
||||||
public int Id { get; private set; }
|
|
||||||
[DataMember]
|
|
||||||
public string ComponentName { get; private set; } = string.Empty;
|
|
||||||
[DataMember]
|
|
||||||
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 static Component? Create(XElement element)
|
|
||||||
{
|
|
||||||
if (element == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new Component()
|
|
||||||
{
|
|
||||||
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
|
||||||
ComponentName = element.Element("ComponentName")!.Value,
|
|
||||||
Cost = Convert.ToDouble(element.Element("Cost")!.Value)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
public void Update(ComponentBindingModel model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ComponentName = model.ComponentName;
|
|
||||||
Cost = model.Cost;
|
|
||||||
}
|
|
||||||
public ComponentViewModel GetViewModel => new()
|
|
||||||
{
|
|
||||||
Id = Id,
|
|
||||||
ComponentName = ComponentName,
|
|
||||||
Cost = Cost
|
|
||||||
};
|
|
||||||
public XElement GetXElement => new("Component",
|
|
||||||
new XAttribute("Id", Id),
|
|
||||||
new XElement("ComponentName", ComponentName),
|
|
||||||
new XElement("Cost", Cost.ToString()));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,95 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
using FurnitureAssemblyDataModels.Models;
|
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace FurnitureAssemFileImplement.Models
|
|
||||||
{
|
|
||||||
[DataContract]
|
|
||||||
public class Furniture : IFurnitureModel
|
|
||||||
{
|
|
||||||
[DataMember]
|
|
||||||
public int Id { get; private set; }
|
|
||||||
[DataMember]
|
|
||||||
public string FurnitureName { get; private set; } = string.Empty;
|
|
||||||
[DataMember]
|
|
||||||
public double Price { get; private set; }
|
|
||||||
public Dictionary<int, int> Components { get; private set; } = new();
|
|
||||||
private Dictionary<int, (IComponentModel, int)>? _furnitureComponents = null;
|
|
||||||
[DataMember]
|
|
||||||
public Dictionary<int, (IComponentModel, int)> FurnitureComponents
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_furnitureComponents == null)
|
|
||||||
{
|
|
||||||
var source = DataFileSingleton.GetInstance();
|
|
||||||
_furnitureComponents = Components.ToDictionary(x => x.Key, y =>
|
|
||||||
((source.Components.FirstOrDefault(z => z.Id == y.Key) as IComponentModel)!,
|
|
||||||
y.Value));
|
|
||||||
}
|
|
||||||
return _furnitureComponents;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Furniture? Create(FurnitureBindingModel model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new Furniture()
|
|
||||||
{
|
|
||||||
Id = model.Id,
|
|
||||||
FurnitureName = model.FurnitureName,
|
|
||||||
Price = model.Price,
|
|
||||||
Components = model.FurnitureComponents.ToDictionary(x => x.Key, x => x.Value.Item2)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Furniture? Create(XElement element)
|
|
||||||
{
|
|
||||||
if (element == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new Furniture()
|
|
||||||
{
|
|
||||||
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
|
||||||
FurnitureName = element.Element("FurnitureName")!.Value,
|
|
||||||
Price = Convert.ToDouble(element.Element("Price")!.Value),
|
|
||||||
Components = element.Element("FurnitureComponents")!.Elements("FurnitureComponent").ToDictionary(
|
|
||||||
x => Convert.ToInt32(x.Element("Key")?.Value),
|
|
||||||
x => Convert.ToInt32(x.Element("Value")?.Value))
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Update(FurnitureBindingModel model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
FurnitureName = model.FurnitureName;
|
|
||||||
Price = model.Price;
|
|
||||||
Components = model.FurnitureComponents.ToDictionary(x => x.Key, x =>
|
|
||||||
x.Value.Item2);
|
|
||||||
_furnitureComponents = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FurnitureViewModel GetViewModel => new()
|
|
||||||
{
|
|
||||||
Id = Id,
|
|
||||||
FurnitureName = FurnitureName,
|
|
||||||
Price = Price,
|
|
||||||
FurnitureComponents = FurnitureComponents
|
|
||||||
};
|
|
||||||
public XElement GetXElement => new("Furniture",
|
|
||||||
new XAttribute("Id", Id),
|
|
||||||
new XElement("FurnitureName", FurnitureName),
|
|
||||||
new XElement("Price", Price.ToString()),
|
|
||||||
new XElement("FurnitureComponents", Components.Select(
|
|
||||||
x => new XElement("FurnitureComponent", new XElement("Key", x.Key), new XElement("Value", x.Value))).ToArray()));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,83 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
using FurnitureAssemblyDataModels.Models;
|
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace FurnitureAssemFileImplement.Models
|
|
||||||
{
|
|
||||||
[DataContract]
|
|
||||||
public class Implementer : IImplementerModel
|
|
||||||
{
|
|
||||||
[DataMember]
|
|
||||||
public int Id { get; private set; }
|
|
||||||
[DataMember]
|
|
||||||
public string ImplementerFIO { get; private set; } = string.Empty;
|
|
||||||
[DataMember]
|
|
||||||
public string Password { get; private set; } = string.Empty;
|
|
||||||
[DataMember]
|
|
||||||
public int WorkExperience { get; private set; }
|
|
||||||
[DataMember]
|
|
||||||
public int Qualification { get; private set; }
|
|
||||||
|
|
||||||
public static Implementer? Create(ImplementerBindingModel? model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new Implementer()
|
|
||||||
{
|
|
||||||
Id = model.Id,
|
|
||||||
ImplementerFIO = model.ImplementerFIO,
|
|
||||||
Password = model.Password,
|
|
||||||
WorkExperience = model.WorkExperience,
|
|
||||||
Qualification = model.Qualification
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Implementer? Create(XElement element)
|
|
||||||
{
|
|
||||||
if (element == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new Implementer()
|
|
||||||
{
|
|
||||||
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
|
||||||
ImplementerFIO = element.Element("ImplementerFIO")!.Value,
|
|
||||||
Password = element.Element("Password")!.Value,
|
|
||||||
WorkExperience = Convert.ToInt32(element.Element("WorkExperience")!.Value),
|
|
||||||
Qualification = Convert.ToInt32(element.Element("Qualification")!.Value)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Update(ImplementerBindingModel? model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ImplementerFIO = model.ImplementerFIO;
|
|
||||||
Password = model.Password;
|
|
||||||
WorkExperience = model.WorkExperience;
|
|
||||||
Qualification = model.Qualification;
|
|
||||||
}
|
|
||||||
public ImplementerViewModel GetViewModel => new()
|
|
||||||
{
|
|
||||||
Id = Id,
|
|
||||||
ImplementerFIO = ImplementerFIO,
|
|
||||||
Password = Password,
|
|
||||||
WorkExperience = WorkExperience,
|
|
||||||
Qualification = Qualification
|
|
||||||
};
|
|
||||||
|
|
||||||
public XElement GetXElement => new("Implementer",
|
|
||||||
new XAttribute("Id", Id),
|
|
||||||
new XElement("ImplementerFIO", ImplementerFIO),
|
|
||||||
new XElement("Password", Password),
|
|
||||||
new XElement("WorkExperience", WorkExperience.ToString()),
|
|
||||||
new XElement("Qualification", Qualification.ToString())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,80 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
using FurnitureAssemblyDataModels.Models;
|
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace FurnitureAssemFileImplement.Models
|
|
||||||
{
|
|
||||||
[DataContract]
|
|
||||||
public class MessageInfo : IMessageInfoModel
|
|
||||||
{
|
|
||||||
[DataMember]
|
|
||||||
public string MessageId { get; private set; } = string.Empty;
|
|
||||||
[DataMember]
|
|
||||||
public int? ClientId { get; private set; }
|
|
||||||
[DataMember]
|
|
||||||
public string SenderName { get; private set; } = string.Empty;
|
|
||||||
[DataMember]
|
|
||||||
public DateTime DateDelivery { get; private set; } = DateTime.Now;
|
|
||||||
[DataMember]
|
|
||||||
public string Subject { get; private set; } = string.Empty;
|
|
||||||
[DataMember]
|
|
||||||
public string Body { get; private set; } = string.Empty;
|
|
||||||
|
|
||||||
public static MessageInfo? Create(MessageInfoBindingModel model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new()
|
|
||||||
{
|
|
||||||
MessageId = model.MessageId,
|
|
||||||
ClientId = model.ClientId,
|
|
||||||
Body = model.Body,
|
|
||||||
Subject = model.Subject,
|
|
||||||
SenderName = model.SenderName,
|
|
||||||
DateDelivery = model.DateDelivery,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MessageInfo? Create(XElement element)
|
|
||||||
{
|
|
||||||
if (element == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new MessageInfo()
|
|
||||||
{
|
|
||||||
MessageId = element.Element("MessageId")!.Value,
|
|
||||||
ClientId = Convert.ToInt32(element.Attribute("ClientId")!.Value),
|
|
||||||
Body = element.Element("Body")!.Value,
|
|
||||||
Subject = element.Element("Subject")!.Value,
|
|
||||||
SenderName = element.Element("SenderName")!.Value,
|
|
||||||
DateDelivery = DateTime.ParseExact(element.Element("DateDelivery")!.Value, "G", null)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public MessageInfoViewModel GetViewModel => new()
|
|
||||||
{
|
|
||||||
Body = Body,
|
|
||||||
Subject = Subject,
|
|
||||||
ClientId = ClientId,
|
|
||||||
MessageId = MessageId,
|
|
||||||
SenderName = SenderName,
|
|
||||||
DateDelivery = DateDelivery,
|
|
||||||
};
|
|
||||||
|
|
||||||
public XElement GetXElement => new("MessageInfo",
|
|
||||||
new XElement("SenderName", SenderName),
|
|
||||||
new XElement("ClientId", ClientId),
|
|
||||||
new XElement("DateDelivery", DateDelivery),
|
|
||||||
new XAttribute("MessageId", MessageId),
|
|
||||||
new XElement("Body", Body),
|
|
||||||
new XElement("Subject", Subject)
|
|
||||||
);
|
|
||||||
|
|
||||||
public int Id => throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,124 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
using FurnitureAssemblyDataModels.Enums;
|
|
||||||
using FurnitureAssemblyDataModels.Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace FurnitureAssemFileImplement.Models
|
|
||||||
{
|
|
||||||
[DataContract]
|
|
||||||
public class Order : IOrderModel
|
|
||||||
{
|
|
||||||
[DataMember]
|
|
||||||
public int FurnitureId { get; private set; }
|
|
||||||
public string FurnitureName { get; private set; } = string.Empty;
|
|
||||||
[DataMember]
|
|
||||||
public int Count { get; private set; }
|
|
||||||
[DataMember]
|
|
||||||
public double Sum { get; private set; }
|
|
||||||
[DataMember]
|
|
||||||
public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен;
|
|
||||||
[DataMember]
|
|
||||||
public DateTime DateCreate { get; private set; } = DateTime.Now;
|
|
||||||
[DataMember]
|
|
||||||
public DateTime? DateImplement { get; private set; }
|
|
||||||
[DataMember]
|
|
||||||
public int Id { get; private set; }
|
|
||||||
[DataMember]
|
|
||||||
public int ClientId { get; private set; }
|
|
||||||
[DataMember]
|
|
||||||
public int? ImplementerId { get; private set; } = null;
|
|
||||||
|
|
||||||
public static Order? Create(OrderBindingModel? model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new Order()
|
|
||||||
{
|
|
||||||
Id = model.Id,
|
|
||||||
FurnitureId = model.FurnitureId,
|
|
||||||
Count = model.Count,
|
|
||||||
Sum = model.Sum,
|
|
||||||
Status = model.Status,
|
|
||||||
DateCreate = model.DateCreate,
|
|
||||||
DateImplement = model.DateImplement,
|
|
||||||
ClientId = model.ClientId,
|
|
||||||
ImplementerId = model.ImplementerId
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Order? Create(XElement element)
|
|
||||||
{
|
|
||||||
if (element == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
var order = new Order()
|
|
||||||
{
|
|
||||||
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
|
||||||
FurnitureId = Convert.ToInt32(element.Element("FurnitureId")!.Value),
|
|
||||||
Count = Convert.ToInt32(element.Element("Count")!.Value),
|
|
||||||
Sum = Convert.ToDouble(element.Element("Sum")!.Value),
|
|
||||||
DateCreate = DateTime.ParseExact(element.Element("DateCreate")!.Value, "G", null),
|
|
||||||
ClientId = Convert.ToInt32(element.Element("ClientId")!.Value),
|
|
||||||
ImplementerId = Convert.ToInt32(element.Element("ImplementerId")?.Value)
|
|
||||||
};
|
|
||||||
DateTime.TryParse(element.Element("DateImplement")!.Value, out DateTime dateImpl);
|
|
||||||
|
|
||||||
order.DateImplement = dateImpl;
|
|
||||||
|
|
||||||
if (!Enum.TryParse(element.Element("Status")!.Value, out OrderStatus status))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
order.Status = status;
|
|
||||||
return order;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Update(OrderBindingModel? model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = model.Status;
|
|
||||||
DateImplement = model.DateImplement;
|
|
||||||
ImplementerId = model.ImplementerId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderViewModel GetViewModel => new()
|
|
||||||
{
|
|
||||||
Id = Id,
|
|
||||||
FurnitureId = FurnitureId,
|
|
||||||
Count = Count,
|
|
||||||
Sum = Sum,
|
|
||||||
Status = Status,
|
|
||||||
DateCreate = DateCreate,
|
|
||||||
DateImplement = DateImplement,
|
|
||||||
ClientId = ClientId,
|
|
||||||
ImplementerId = ImplementerId
|
|
||||||
};
|
|
||||||
|
|
||||||
public XElement GetXElement => new("Order",
|
|
||||||
new XAttribute("Id", Id),
|
|
||||||
new XElement("ClientId", ClientId),
|
|
||||||
new XElement("FurnitureId", FurnitureId),
|
|
||||||
new XElement("Count", Count.ToString()),
|
|
||||||
new XElement("Sum", Sum.ToString()),
|
|
||||||
new XElement("Status", Status.ToString()),
|
|
||||||
new XElement("DateCreate", DateCreate.ToString()),
|
|
||||||
new XElement("DateImplement", DateImplement.ToString()),
|
|
||||||
new XElement("ImplemwenterId", ImplementerId.ToString()));
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,23 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.3.32901.215
|
VisualStudioVersion = 17.3.32901.215
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FurnitureAssembly", "FurnitureAssembly\FurnitureAssembly.csproj", "{356DBB82-0345-4F3C-BD31-2B05E6DA369A}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FurnitureAssembly", "FurnitureAssembly\FurnitureAssembly.csproj", "{356DBB82-0345-4F3C-BD31-2B05E6DA369A}"
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FurnitureAssemblyDataModels", "FurnitureAssemblyDataModels\FurnitureAssemblyDataModels.csproj", "{179446B0-AC44-43BD-88EE-C3DF7CC4061E}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FurnitureAssemblyContracts", "FurnitureAssemblyContracts\FurnitureAssemblyContracts.csproj", "{6ACF0A8B-8F7C-4511-ABB1-7E688F1F3E8A}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FurnitureAssemblyBusinessLogic", "FurnitureAssemblyBusinessLogic\FurnitureAssemblyBusinessLogic.csproj", "{B51952FD-5EB4-4A80-8598-7B1EC39CD34C}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FurnitureAssemblyListImplement", "FurnitureAssemblyListImplement\FurnitureAssemblyListImplement.csproj", "{6662252C-A676-4376-AA01-0ACC6AE5B217}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FurnitureAssemFileImplement", "FurnitureAssemFileImplement\FurnitureAssemFileImplement.csproj", "{A6822E0E-DBF3-4DEA-A337-C6C64429C0DE}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FurnitureAssemblyDatabaseImplement", "FurnitureAssemblyDatabaseImplement\FurnitureAssemblyDatabaseImplement.csproj", "{F4FAEBEF-1E02-44DE-A13B-27A8C3838D98}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FurnitureAssemblyRestApi", "FurnitureAssemblyRestApi\FurnitureAssemblyRestApi.csproj", "{2BA2B5A8-DE7B-4E6F-A84A-04FD7566CE97}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FurnitureAssemblyClientApp", "FurnitureAssemblyClientApp\FurnitureAssemblyClientApp.csproj", "{01C17D7C-CA7C-48F7-98CC-8A658F3A7DD8}"
|
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -31,38 +15,6 @@ Global
|
|||||||
{356DBB82-0345-4F3C-BD31-2B05E6DA369A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{356DBB82-0345-4F3C-BD31-2B05E6DA369A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{356DBB82-0345-4F3C-BD31-2B05E6DA369A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{356DBB82-0345-4F3C-BD31-2B05E6DA369A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{356DBB82-0345-4F3C-BD31-2B05E6DA369A}.Release|Any CPU.Build.0 = Release|Any CPU
|
{356DBB82-0345-4F3C-BD31-2B05E6DA369A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{179446B0-AC44-43BD-88EE-C3DF7CC4061E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{179446B0-AC44-43BD-88EE-C3DF7CC4061E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{179446B0-AC44-43BD-88EE-C3DF7CC4061E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{179446B0-AC44-43BD-88EE-C3DF7CC4061E}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{6ACF0A8B-8F7C-4511-ABB1-7E688F1F3E8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{6ACF0A8B-8F7C-4511-ABB1-7E688F1F3E8A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{6ACF0A8B-8F7C-4511-ABB1-7E688F1F3E8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{6ACF0A8B-8F7C-4511-ABB1-7E688F1F3E8A}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{B51952FD-5EB4-4A80-8598-7B1EC39CD34C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{B51952FD-5EB4-4A80-8598-7B1EC39CD34C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{B51952FD-5EB4-4A80-8598-7B1EC39CD34C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{B51952FD-5EB4-4A80-8598-7B1EC39CD34C}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{6662252C-A676-4376-AA01-0ACC6AE5B217}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{6662252C-A676-4376-AA01-0ACC6AE5B217}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{6662252C-A676-4376-AA01-0ACC6AE5B217}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{6662252C-A676-4376-AA01-0ACC6AE5B217}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{A6822E0E-DBF3-4DEA-A337-C6C64429C0DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{A6822E0E-DBF3-4DEA-A337-C6C64429C0DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{A6822E0E-DBF3-4DEA-A337-C6C64429C0DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{A6822E0E-DBF3-4DEA-A337-C6C64429C0DE}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{F4FAEBEF-1E02-44DE-A13B-27A8C3838D98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{F4FAEBEF-1E02-44DE-A13B-27A8C3838D98}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{F4FAEBEF-1E02-44DE-A13B-27A8C3838D98}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{F4FAEBEF-1E02-44DE-A13B-27A8C3838D98}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{2BA2B5A8-DE7B-4E6F-A84A-04FD7566CE97}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{2BA2B5A8-DE7B-4E6F-A84A-04FD7566CE97}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{2BA2B5A8-DE7B-4E6F-A84A-04FD7566CE97}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{2BA2B5A8-DE7B-4E6F-A84A-04FD7566CE97}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{01C17D7C-CA7C-48F7-98CC-8A658F3A7DD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{01C17D7C-CA7C-48F7-98CC-8A658F3A7DD8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{01C17D7C-CA7C-48F7-98CC-8A658F3A7DD8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{01C17D7C-CA7C-48F7-98CC-8A658F3A7DD8}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<configuration>
|
|
||||||
<appSettings>
|
|
||||||
<add key="SmtpClientHost" value="smtp.gmail.com" />
|
|
||||||
<add key="SmtpClientPort" value="587" />
|
|
||||||
<add key="PopHost" value="pop.gmail.com" />
|
|
||||||
<add key="PopPort" value="995" />
|
|
||||||
<add key="MailLogin" value="MailNoNameLab@gmail.com" />
|
|
||||||
<add key="MailPassword" value="cpdj ykey loip jxwj" />
|
|
||||||
</appSettings>
|
|
||||||
</configuration>
|
|
@ -1,51 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.Attributes;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
public static class DataGridViewExtension
|
|
||||||
{
|
|
||||||
public static void FillandConfigGrid<T>(this DataGridView grid, List<T>? data)
|
|
||||||
{
|
|
||||||
if (data == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
grid.DataSource = data;
|
|
||||||
var type = typeof(T);
|
|
||||||
var properties = type.GetProperties();
|
|
||||||
foreach (DataGridViewColumn column in grid.Columns)
|
|
||||||
{
|
|
||||||
var property = properties.FirstOrDefault(x => x.Name == column.Name);
|
|
||||||
if (property == null)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException($"В типе {type.Name} не найдено свойство с именем { column.Name }");
|
|
||||||
}
|
|
||||||
var attribute = property.GetCustomAttributes(typeof(ColumnAttribute), true)?.SingleOrDefault();
|
|
||||||
if (attribute == null)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException($"Не найден атрибут типа ColumnAttribute для свойства { property.Name }");
|
|
||||||
}
|
|
||||||
// ищем нужный нам атрибут
|
|
||||||
if (attribute is ColumnAttribute columnAttr)
|
|
||||||
{
|
|
||||||
column.HeaderText = columnAttr.Title;
|
|
||||||
column.Visible = columnAttr.Visible;
|
|
||||||
if (columnAttr.IsUseAutoSize)
|
|
||||||
{
|
|
||||||
column.AutoSizeMode =
|
|
||||||
(DataGridViewAutoSizeColumnMode)Enum.Parse(typeof(DataGridViewAutoSizeColumnMode), columnAttr.GridViewAutoSize.ToString());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
column.Width = columnAttr.Width;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
39
FurnitureAssembly/FurnitureAssembly/Form1.Designer.cs
generated
Normal file
39
FurnitureAssembly/FurnitureAssembly/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
namespace FurnitureAssembly
|
||||||
|
{
|
||||||
|
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
FurnitureAssembly/FurnitureAssembly/Form1.cs
Normal file
10
FurnitureAssembly/FurnitureAssembly/Form1.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace FurnitureAssembly
|
||||||
|
{
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
FurnitureAssembly/FurnitureAssembly/Form1.resx
Normal file
120
FurnitureAssembly/FurnitureAssembly/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>
|
@ -1,75 +0,0 @@
|
|||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
partial class FormClients
|
|
||||||
{
|
|
||||||
/// <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.dataGridView = new System.Windows.Forms.DataGridView();
|
|
||||||
this.ButtonDel = new System.Windows.Forms.Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
this.dataGridView.Location = new System.Drawing.Point(12, 85);
|
|
||||||
this.dataGridView.Name = "dataGridView";
|
|
||||||
this.dataGridView.RowTemplate.Height = 25;
|
|
||||||
this.dataGridView.Size = new System.Drawing.Size(559, 453);
|
|
||||||
this.dataGridView.TabIndex = 6;
|
|
||||||
//
|
|
||||||
// ButtonDel
|
|
||||||
//
|
|
||||||
this.ButtonDel.Location = new System.Drawing.Point(466, 40);
|
|
||||||
this.ButtonDel.Name = "ButtonDel";
|
|
||||||
this.ButtonDel.Size = new System.Drawing.Size(105, 29);
|
|
||||||
this.ButtonDel.TabIndex = 11;
|
|
||||||
this.ButtonDel.Text = "Удалить";
|
|
||||||
this.ButtonDel.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonDel.Click += new System.EventHandler(this.ButtonDel_Click);
|
|
||||||
//
|
|
||||||
// FormClients
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(588, 549);
|
|
||||||
this.Controls.Add(this.ButtonDel);
|
|
||||||
this.Controls.Add(this.dataGridView);
|
|
||||||
this.Name = "FormClients";
|
|
||||||
this.Text = "Клиенты";
|
|
||||||
this.Load += new System.EventHandler(this.FormClients_Load);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
private Button ButtonDel;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,70 +0,0 @@
|
|||||||
using FurnitureAssemblyBusinessLogic;
|
|
||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
|
|
||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
public partial class FormClients : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IClientLogic _logic;
|
|
||||||
public FormClients(ILogger<FormClients> logger, IClientLogic clientLogic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = clientLogic;
|
|
||||||
}
|
|
||||||
private void FormClients_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadData()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
dataGridView.FillandConfigGrid(_logic.ReadList(null));
|
|
||||||
_logger.LogInformation("Загрузка клиентов");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки клиентов");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonDel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
if (MessageBox.Show("Удалить запись?", "Вопрос",
|
|
||||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
||||||
{
|
|
||||||
int id =
|
|
||||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
_logger.LogInformation("Удаление клиента");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!_logic.Delete(new ClientBindingModel
|
|
||||||
{
|
|
||||||
Id = id
|
|
||||||
}))
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка удаления клиента");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<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>
|
|
@ -1,119 +0,0 @@
|
|||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
partial class FormComponent
|
|
||||||
{
|
|
||||||
/// <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.textBoxName = new System.Windows.Forms.TextBox();
|
|
||||||
this.textBoxCost = new System.Windows.Forms.TextBox();
|
|
||||||
this.labelName = new System.Windows.Forms.Label();
|
|
||||||
this.labelCost = new System.Windows.Forms.Label();
|
|
||||||
this.ButtonSave = new System.Windows.Forms.Button();
|
|
||||||
this.ButtonCancel = new System.Windows.Forms.Button();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// textBoxName
|
|
||||||
//
|
|
||||||
this.textBoxName.Location = new System.Drawing.Point(138, 22);
|
|
||||||
this.textBoxName.Name = "textBoxName";
|
|
||||||
this.textBoxName.Size = new System.Drawing.Size(281, 23);
|
|
||||||
this.textBoxName.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// textBoxCost
|
|
||||||
//
|
|
||||||
this.textBoxCost.Location = new System.Drawing.Point(138, 62);
|
|
||||||
this.textBoxCost.Name = "textBoxCost";
|
|
||||||
this.textBoxCost.Size = new System.Drawing.Size(145, 23);
|
|
||||||
this.textBoxCost.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// labelName
|
|
||||||
//
|
|
||||||
this.labelName.AutoSize = true;
|
|
||||||
this.labelName.Location = new System.Drawing.Point(35, 27);
|
|
||||||
this.labelName.Name = "labelName";
|
|
||||||
this.labelName.Size = new System.Drawing.Size(59, 15);
|
|
||||||
this.labelName.TabIndex = 2;
|
|
||||||
this.labelName.Text = "Название";
|
|
||||||
//
|
|
||||||
// labelCost
|
|
||||||
//
|
|
||||||
this.labelCost.AutoSize = true;
|
|
||||||
this.labelCost.Location = new System.Drawing.Point(35, 65);
|
|
||||||
this.labelCost.Name = "labelCost";
|
|
||||||
this.labelCost.Size = new System.Drawing.Size(35, 15);
|
|
||||||
this.labelCost.TabIndex = 3;
|
|
||||||
this.labelCost.Text = "Цена";
|
|
||||||
//
|
|
||||||
// ButtonSave
|
|
||||||
//
|
|
||||||
this.ButtonSave.Location = new System.Drawing.Point(240, 93);
|
|
||||||
this.ButtonSave.Name = "ButtonSave";
|
|
||||||
this.ButtonSave.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.ButtonSave.TabIndex = 4;
|
|
||||||
this.ButtonSave.Text = "Сохранить";
|
|
||||||
this.ButtonSave.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
|
||||||
//
|
|
||||||
// ButtonCancel
|
|
||||||
//
|
|
||||||
this.ButtonCancel.Location = new System.Drawing.Point(344, 93);
|
|
||||||
this.ButtonCancel.Name = "ButtonCancel";
|
|
||||||
this.ButtonCancel.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.ButtonCancel.TabIndex = 5;
|
|
||||||
this.ButtonCancel.Text = "Отмена";
|
|
||||||
this.ButtonCancel.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
|
||||||
//
|
|
||||||
// FormComponent
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(459, 130);
|
|
||||||
this.Controls.Add(this.ButtonCancel);
|
|
||||||
this.Controls.Add(this.ButtonSave);
|
|
||||||
this.Controls.Add(this.labelCost);
|
|
||||||
this.Controls.Add(this.labelName);
|
|
||||||
this.Controls.Add(this.textBoxCost);
|
|
||||||
this.Controls.Add(this.textBoxName);
|
|
||||||
this.Name = "FormComponent";
|
|
||||||
this.Text = "Компонент";
|
|
||||||
this.Load += new System.EventHandler(this.FormComponent_Load);
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private TextBox textBoxName;
|
|
||||||
private TextBox textBoxCost;
|
|
||||||
private Label labelName;
|
|
||||||
private Label labelCost;
|
|
||||||
private Button ButtonSave;
|
|
||||||
private Button ButtonCancel;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,99 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
|
||||||
using FurnitureAssemblyContracts.SearchModels;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
public partial class FormComponent : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IComponentLogic _logic;
|
|
||||||
private int? _id;
|
|
||||||
public int Id { set { _id = value; } }
|
|
||||||
public FormComponent(ILogger<FormComponent> logger, IComponentLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FormComponent_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_id.HasValue)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Получение компонента");
|
|
||||||
var view = _logic.ReadElement(new ComponentSearchModel
|
|
||||||
{
|
|
||||||
Id =
|
|
||||||
_id.Value
|
|
||||||
});
|
|
||||||
if (view != null)
|
|
||||||
{
|
|
||||||
textBoxName.Text = view.ComponentName;
|
|
||||||
textBoxCost.Text = view.Cost.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка получения компонента");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(textBoxName.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните название", "Ошибка",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Сохранение компонента");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var model = new ComponentBindingModel
|
|
||||||
{
|
|
||||||
Id = _id ?? 0,
|
|
||||||
ComponentName = textBoxName.Text,
|
|
||||||
Cost = Convert.ToDouble(textBoxCost.Text)
|
|
||||||
};
|
|
||||||
var operationResult = _id.HasValue ? _logic.Update(model) :
|
|
||||||
_logic.Create(model);
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка сохранения компонента");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DialogResult = DialogResult.Cancel;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<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>
|
|
@ -1,114 +0,0 @@
|
|||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
partial class FormComponents
|
|
||||||
{
|
|
||||||
/// <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.dataGridView = new System.Windows.Forms.DataGridView();
|
|
||||||
this.ButtonAdd = new System.Windows.Forms.Button();
|
|
||||||
this.ButtonUpd = new System.Windows.Forms.Button();
|
|
||||||
this.ButtonDel = new System.Windows.Forms.Button();
|
|
||||||
this.ButtonRef = new System.Windows.Forms.Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
this.dataGridView.Location = new System.Drawing.Point(-2, 0);
|
|
||||||
this.dataGridView.Name = "dataGridView";
|
|
||||||
this.dataGridView.RowTemplate.Height = 25;
|
|
||||||
this.dataGridView.Size = new System.Drawing.Size(559, 453);
|
|
||||||
this.dataGridView.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// ButtonAdd
|
|
||||||
//
|
|
||||||
this.ButtonAdd.Location = new System.Drawing.Point(586, 59);
|
|
||||||
this.ButtonAdd.Name = "ButtonAdd";
|
|
||||||
this.ButtonAdd.Size = new System.Drawing.Size(105, 29);
|
|
||||||
this.ButtonAdd.TabIndex = 1;
|
|
||||||
this.ButtonAdd.Text = "Добавить";
|
|
||||||
this.ButtonAdd.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
|
|
||||||
//
|
|
||||||
// ButtonUpd
|
|
||||||
//
|
|
||||||
this.ButtonUpd.Location = new System.Drawing.Point(586, 115);
|
|
||||||
this.ButtonUpd.Name = "ButtonUpd";
|
|
||||||
this.ButtonUpd.Size = new System.Drawing.Size(105, 29);
|
|
||||||
this.ButtonUpd.TabIndex = 2;
|
|
||||||
this.ButtonUpd.Text = "Изменить";
|
|
||||||
this.ButtonUpd.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonUpd.Click += new System.EventHandler(this.ButtonUpd_Click);
|
|
||||||
//
|
|
||||||
// ButtonDel
|
|
||||||
//
|
|
||||||
this.ButtonDel.Location = new System.Drawing.Point(586, 172);
|
|
||||||
this.ButtonDel.Name = "ButtonDel";
|
|
||||||
this.ButtonDel.Size = new System.Drawing.Size(105, 29);
|
|
||||||
this.ButtonDel.TabIndex = 3;
|
|
||||||
this.ButtonDel.Text = "Удалить";
|
|
||||||
this.ButtonDel.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonDel.Click += new System.EventHandler(this.ButtonDel_Click);
|
|
||||||
//
|
|
||||||
// ButtonRef
|
|
||||||
//
|
|
||||||
this.ButtonRef.Location = new System.Drawing.Point(586, 230);
|
|
||||||
this.ButtonRef.Name = "ButtonRef";
|
|
||||||
this.ButtonRef.Size = new System.Drawing.Size(105, 29);
|
|
||||||
this.ButtonRef.TabIndex = 4;
|
|
||||||
this.ButtonRef.Text = "Обновить";
|
|
||||||
this.ButtonRef.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click);
|
|
||||||
//
|
|
||||||
// FormComponents
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(718, 450);
|
|
||||||
this.Controls.Add(this.ButtonRef);
|
|
||||||
this.Controls.Add(this.ButtonDel);
|
|
||||||
this.Controls.Add(this.ButtonUpd);
|
|
||||||
this.Controls.Add(this.ButtonAdd);
|
|
||||||
this.Controls.Add(this.dataGridView);
|
|
||||||
this.Name = "FormComponents";
|
|
||||||
this.Text = "Компоненты";
|
|
||||||
this.Load += new System.EventHandler(this.FormComponents_Load);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
private Button ButtonAdd;
|
|
||||||
private Button ButtonUpd;
|
|
||||||
private Button ButtonDel;
|
|
||||||
private Button ButtonRef;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,110 +0,0 @@
|
|||||||
using FurnitureAssemblyBusinessLogic;
|
|
||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
|
||||||
using FurnitureAssemblyContracts.DI;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
public partial class FormComponents : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IComponentLogic _logic;
|
|
||||||
|
|
||||||
public FormComponents(ILogger<FormComponents> logger, IComponentLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FormComponents_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadData()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
dataGridView.FillandConfigGrid(_logic.ReadList(null));
|
|
||||||
_logger.LogInformation("Загрузка компонентов");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки компонентов");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var form = DependencyManager.Instance.Resolve<FormComponent>();
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
var form = DependencyManager.Instance.Resolve<FormComponent>();
|
|
||||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonDel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
if (MessageBox.Show("Удалить запись?", "Вопрос",
|
|
||||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
||||||
{
|
|
||||||
int id =
|
|
||||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
_logger.LogInformation("Удаление компонента");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!_logic.Delete(new ComponentBindingModel
|
|
||||||
{
|
|
||||||
Id = id
|
|
||||||
}))
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка удаления компонента");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonRef_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<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>
|
|
@ -1,167 +0,0 @@
|
|||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
partial class FormCreateOrder
|
|
||||||
{
|
|
||||||
/// <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.labelFurniture = new System.Windows.Forms.Label();
|
|
||||||
this.labelCount = new System.Windows.Forms.Label();
|
|
||||||
this.labelSum = new System.Windows.Forms.Label();
|
|
||||||
this.textBoxCount = new System.Windows.Forms.TextBox();
|
|
||||||
this.comboBoxProduct = new System.Windows.Forms.ComboBox();
|
|
||||||
this.textBoxSum = new System.Windows.Forms.TextBox();
|
|
||||||
this.ButtonSave = new System.Windows.Forms.Button();
|
|
||||||
this.ButtonCancel = new System.Windows.Forms.Button();
|
|
||||||
this.comboBoxClientEmail = new System.Windows.Forms.ComboBox();
|
|
||||||
this.labelClient = new System.Windows.Forms.Label();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// labelFurniture
|
|
||||||
//
|
|
||||||
this.labelFurniture.AutoSize = true;
|
|
||||||
this.labelFurniture.Location = new System.Drawing.Point(28, 53);
|
|
||||||
this.labelFurniture.Name = "labelFurniture";
|
|
||||||
this.labelFurniture.Size = new System.Drawing.Size(56, 15);
|
|
||||||
this.labelFurniture.TabIndex = 0;
|
|
||||||
this.labelFurniture.Text = "Изделие:";
|
|
||||||
//
|
|
||||||
// labelCount
|
|
||||||
//
|
|
||||||
this.labelCount.AutoSize = true;
|
|
||||||
this.labelCount.Location = new System.Drawing.Point(28, 88);
|
|
||||||
this.labelCount.Name = "labelCount";
|
|
||||||
this.labelCount.Size = new System.Drawing.Size(75, 15);
|
|
||||||
this.labelCount.TabIndex = 1;
|
|
||||||
this.labelCount.Text = "Количество:";
|
|
||||||
//
|
|
||||||
// labelSum
|
|
||||||
//
|
|
||||||
this.labelSum.AutoSize = true;
|
|
||||||
this.labelSum.Location = new System.Drawing.Point(28, 124);
|
|
||||||
this.labelSum.Name = "labelSum";
|
|
||||||
this.labelSum.Size = new System.Drawing.Size(45, 15);
|
|
||||||
this.labelSum.TabIndex = 2;
|
|
||||||
this.labelSum.Text = "Сумма";
|
|
||||||
//
|
|
||||||
// textBoxCount
|
|
||||||
//
|
|
||||||
this.textBoxCount.Location = new System.Drawing.Point(124, 85);
|
|
||||||
this.textBoxCount.Name = "textBoxCount";
|
|
||||||
this.textBoxCount.Size = new System.Drawing.Size(297, 23);
|
|
||||||
this.textBoxCount.TabIndex = 3;
|
|
||||||
this.textBoxCount.TextChanged += new System.EventHandler(this.TextBoxCount_TextChanged);
|
|
||||||
//
|
|
||||||
// comboBoxProduct
|
|
||||||
//
|
|
||||||
this.comboBoxProduct.FormattingEnabled = true;
|
|
||||||
this.comboBoxProduct.Location = new System.Drawing.Point(124, 50);
|
|
||||||
this.comboBoxProduct.Name = "comboBoxProduct";
|
|
||||||
this.comboBoxProduct.Size = new System.Drawing.Size(297, 23);
|
|
||||||
this.comboBoxProduct.TabIndex = 4;
|
|
||||||
this.comboBoxProduct.SelectedIndexChanged += new System.EventHandler(this.ComboBoxProduct_SelectedIndexChanged);
|
|
||||||
//
|
|
||||||
// textBoxSum
|
|
||||||
//
|
|
||||||
this.textBoxSum.Location = new System.Drawing.Point(124, 121);
|
|
||||||
this.textBoxSum.Name = "textBoxSum";
|
|
||||||
this.textBoxSum.Size = new System.Drawing.Size(297, 23);
|
|
||||||
this.textBoxSum.TabIndex = 5;
|
|
||||||
//
|
|
||||||
// ButtonSave
|
|
||||||
//
|
|
||||||
this.ButtonSave.Location = new System.Drawing.Point(186, 150);
|
|
||||||
this.ButtonSave.Name = "ButtonSave";
|
|
||||||
this.ButtonSave.Size = new System.Drawing.Size(105, 29);
|
|
||||||
this.ButtonSave.TabIndex = 6;
|
|
||||||
this.ButtonSave.Text = "Сохранить";
|
|
||||||
this.ButtonSave.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
|
||||||
//
|
|
||||||
// ButtonCancel
|
|
||||||
//
|
|
||||||
this.ButtonCancel.Location = new System.Drawing.Point(316, 150);
|
|
||||||
this.ButtonCancel.Name = "ButtonCancel";
|
|
||||||
this.ButtonCancel.Size = new System.Drawing.Size(105, 29);
|
|
||||||
this.ButtonCancel.TabIndex = 7;
|
|
||||||
this.ButtonCancel.Text = "Отмена";
|
|
||||||
this.ButtonCancel.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
|
||||||
//
|
|
||||||
// comboBoxClientEmail
|
|
||||||
//
|
|
||||||
this.comboBoxClientEmail.FormattingEnabled = true;
|
|
||||||
this.comboBoxClientEmail.Location = new System.Drawing.Point(124, 12);
|
|
||||||
this.comboBoxClientEmail.Name = "comboBoxClientEmail";
|
|
||||||
this.comboBoxClientEmail.Size = new System.Drawing.Size(297, 23);
|
|
||||||
this.comboBoxClientEmail.TabIndex = 9;
|
|
||||||
//
|
|
||||||
// labelClient
|
|
||||||
//
|
|
||||||
this.labelClient.AutoSize = true;
|
|
||||||
this.labelClient.Location = new System.Drawing.Point(28, 15);
|
|
||||||
this.labelClient.Name = "labelClient";
|
|
||||||
this.labelClient.Size = new System.Drawing.Size(49, 15);
|
|
||||||
this.labelClient.TabIndex = 8;
|
|
||||||
this.labelClient.Text = "Клиент:";
|
|
||||||
//
|
|
||||||
// FormCreateOrder
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(453, 191);
|
|
||||||
this.Controls.Add(this.comboBoxClientEmail);
|
|
||||||
this.Controls.Add(this.labelClient);
|
|
||||||
this.Controls.Add(this.ButtonCancel);
|
|
||||||
this.Controls.Add(this.ButtonSave);
|
|
||||||
this.Controls.Add(this.textBoxSum);
|
|
||||||
this.Controls.Add(this.comboBoxProduct);
|
|
||||||
this.Controls.Add(this.textBoxCount);
|
|
||||||
this.Controls.Add(this.labelSum);
|
|
||||||
this.Controls.Add(this.labelCount);
|
|
||||||
this.Controls.Add(this.labelFurniture);
|
|
||||||
this.Name = "FormCreateOrder";
|
|
||||||
this.Text = "Создание заказа";
|
|
||||||
this.Load += new System.EventHandler(this.FormCreateOrder_Load);
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Label labelFurniture;
|
|
||||||
private Label labelCount;
|
|
||||||
private Label labelSum;
|
|
||||||
private TextBox textBoxCount;
|
|
||||||
private ComboBox comboBoxProduct;
|
|
||||||
private TextBox textBoxSum;
|
|
||||||
private Button ButtonSave;
|
|
||||||
private Button ButtonCancel;
|
|
||||||
private ComboBox comboBoxClientEmail;
|
|
||||||
private Label labelClient;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,151 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
|
||||||
using FurnitureAssemblyContracts.SearchModels;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Microsoft.VisualBasic.Logging;
|
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
public partial class FormCreateOrder : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IFurnitureLogic _logicF;
|
|
||||||
private readonly IOrderLogic _logicO;
|
|
||||||
private readonly IClientLogic _logicC;
|
|
||||||
public FormCreateOrder(ILogger<FormCreateOrder> logger, IFurnitureLogic logicF, IOrderLogic logicO, IClientLogic logicC)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logicF = logicF;
|
|
||||||
_logicO = logicO;
|
|
||||||
_logicC = logicC;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(textBoxCount.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните поле Количество", "Ошибка",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (comboBoxProduct.SelectedValue == null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Выберите изделие", "Ошибка",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (comboBoxClientEmail.SelectedValue == null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Выберите клиента", "Ошибка",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Создание заказа");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var operationResult = _logicO.CreateOrder(new OrderBindingModel
|
|
||||||
{
|
|
||||||
FurnitureId = Convert.ToInt32(comboBoxProduct.SelectedValue),
|
|
||||||
Count = Convert.ToInt32(textBoxCount.Text),
|
|
||||||
Sum = Convert.ToDouble(textBoxSum.Text),
|
|
||||||
ClientId = Convert.ToInt32(comboBoxClientEmail.SelectedValue)
|
|
||||||
});
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при создании заказа. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка создания заказа");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FormCreateOrder_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Загрузка изделий и клиентов для заказа");
|
|
||||||
// прописать логику
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
private void LoadData()
|
|
||||||
{
|
|
||||||
var _list = _logicF.ReadList(null);
|
|
||||||
if (_list != null)
|
|
||||||
{
|
|
||||||
comboBoxProduct.DisplayMember = "FurnitureName";
|
|
||||||
comboBoxProduct.ValueMember = "Id";
|
|
||||||
comboBoxProduct.DataSource = _list;
|
|
||||||
comboBoxProduct.SelectedItem = null;
|
|
||||||
}
|
|
||||||
var _listCli = _logicC.ReadList(null);
|
|
||||||
if (_listCli != null)
|
|
||||||
{
|
|
||||||
comboBoxClientEmail.DisplayMember = "Email"; // по нему однозначно можно определить клиента
|
|
||||||
comboBoxClientEmail.ValueMember = "Id";
|
|
||||||
comboBoxClientEmail.DataSource = _listCli;
|
|
||||||
comboBoxClientEmail.SelectedItem = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void CalcSum()
|
|
||||||
{
|
|
||||||
if (comboBoxProduct.SelectedValue != null &&
|
|
||||||
!string.IsNullOrEmpty(textBoxCount.Text))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int id = Convert.ToInt32(comboBoxProduct.SelectedValue);
|
|
||||||
var product = _logicF.ReadElement(new FurnitureSearchModel
|
|
||||||
{
|
|
||||||
Id
|
|
||||||
= id
|
|
||||||
});
|
|
||||||
int count = Convert.ToInt32(textBoxCount.Text);
|
|
||||||
textBoxSum.Text = Math.Round(count * (product?.Price ?? 0),
|
|
||||||
2).ToString();
|
|
||||||
_logger.LogInformation("Расчет суммы заказа");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка расчета суммы заказа");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void TextBoxCount_TextChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
CalcSum();
|
|
||||||
}
|
|
||||||
private void ComboBoxProduct_SelectedIndexChanged(object sender,
|
|
||||||
EventArgs e)
|
|
||||||
{
|
|
||||||
CalcSum();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DialogResult = DialogResult.Cancel;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<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>
|
|
@ -1,225 +0,0 @@
|
|||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
partial class FormFurniture
|
|
||||||
{
|
|
||||||
/// <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.labelName = new System.Windows.Forms.Label();
|
|
||||||
this.labelPrice = new System.Windows.Forms.Label();
|
|
||||||
this.textBoxName = new System.Windows.Forms.TextBox();
|
|
||||||
this.textBoxPrice = new System.Windows.Forms.TextBox();
|
|
||||||
this.groupBoxComponents = new System.Windows.Forms.GroupBox();
|
|
||||||
this.dataGridViewFurn = new System.Windows.Forms.DataGridView();
|
|
||||||
this.FurnitureId = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
|
||||||
this.FurnitureName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
|
||||||
this.Count = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
|
||||||
this.ButtonRef = new System.Windows.Forms.Button();
|
|
||||||
this.ButtonDel = new System.Windows.Forms.Button();
|
|
||||||
this.ButtonUpd = new System.Windows.Forms.Button();
|
|
||||||
this.ButtonAdd = new System.Windows.Forms.Button();
|
|
||||||
this.ButtonCancel = new System.Windows.Forms.Button();
|
|
||||||
this.ButtonSave = new System.Windows.Forms.Button();
|
|
||||||
this.groupBoxComponents.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridViewFurn)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// labelName
|
|
||||||
//
|
|
||||||
this.labelName.AutoSize = true;
|
|
||||||
this.labelName.Location = new System.Drawing.Point(45, 39);
|
|
||||||
this.labelName.Name = "labelName";
|
|
||||||
this.labelName.Size = new System.Drawing.Size(62, 15);
|
|
||||||
this.labelName.TabIndex = 0;
|
|
||||||
this.labelName.Text = "Название:";
|
|
||||||
//
|
|
||||||
// labelPrice
|
|
||||||
//
|
|
||||||
this.labelPrice.AutoSize = true;
|
|
||||||
this.labelPrice.Location = new System.Drawing.Point(45, 76);
|
|
||||||
this.labelPrice.Name = "labelPrice";
|
|
||||||
this.labelPrice.Size = new System.Drawing.Size(70, 15);
|
|
||||||
this.labelPrice.TabIndex = 1;
|
|
||||||
this.labelPrice.Text = "Стоимость:";
|
|
||||||
//
|
|
||||||
// textBoxName
|
|
||||||
//
|
|
||||||
this.textBoxName.Location = new System.Drawing.Point(160, 36);
|
|
||||||
this.textBoxName.Name = "textBoxName";
|
|
||||||
this.textBoxName.Size = new System.Drawing.Size(233, 23);
|
|
||||||
this.textBoxName.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// textBoxPrice
|
|
||||||
//
|
|
||||||
this.textBoxPrice.Location = new System.Drawing.Point(160, 73);
|
|
||||||
this.textBoxPrice.Name = "textBoxPrice";
|
|
||||||
this.textBoxPrice.Size = new System.Drawing.Size(151, 23);
|
|
||||||
this.textBoxPrice.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// groupBoxComponents
|
|
||||||
//
|
|
||||||
this.groupBoxComponents.Controls.Add(this.dataGridViewFurn);
|
|
||||||
this.groupBoxComponents.Controls.Add(this.ButtonRef);
|
|
||||||
this.groupBoxComponents.Controls.Add(this.ButtonDel);
|
|
||||||
this.groupBoxComponents.Controls.Add(this.ButtonUpd);
|
|
||||||
this.groupBoxComponents.Controls.Add(this.ButtonAdd);
|
|
||||||
this.groupBoxComponents.Location = new System.Drawing.Point(12, 122);
|
|
||||||
this.groupBoxComponents.Name = "groupBoxComponents";
|
|
||||||
this.groupBoxComponents.Size = new System.Drawing.Size(764, 300);
|
|
||||||
this.groupBoxComponents.TabIndex = 4;
|
|
||||||
this.groupBoxComponents.TabStop = false;
|
|
||||||
this.groupBoxComponents.Text = "Компоненты";
|
|
||||||
//
|
|
||||||
// dataGridViewFurn
|
|
||||||
//
|
|
||||||
this.dataGridViewFurn.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
this.dataGridViewFurn.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
|
||||||
this.FurnitureId,
|
|
||||||
this.FurnitureName,
|
|
||||||
this.Count});
|
|
||||||
this.dataGridViewFurn.Location = new System.Drawing.Point(0, 22);
|
|
||||||
this.dataGridViewFurn.Name = "dataGridViewFurn";
|
|
||||||
this.dataGridViewFurn.RowTemplate.Height = 25;
|
|
||||||
this.dataGridViewFurn.Size = new System.Drawing.Size(628, 278);
|
|
||||||
this.dataGridViewFurn.TabIndex = 9;
|
|
||||||
//
|
|
||||||
// FurnitureId
|
|
||||||
//
|
|
||||||
this.FurnitureId.HeaderText = "Id";
|
|
||||||
this.FurnitureId.Name = "FurnitureId";
|
|
||||||
this.FurnitureId.Visible = false;
|
|
||||||
//
|
|
||||||
// FurnitureName
|
|
||||||
//
|
|
||||||
this.FurnitureName.HeaderText = "Название";
|
|
||||||
this.FurnitureName.Name = "FurnitureName";
|
|
||||||
//
|
|
||||||
// Count
|
|
||||||
//
|
|
||||||
this.Count.HeaderText = "Количество";
|
|
||||||
this.Count.Name = "Count";
|
|
||||||
//
|
|
||||||
// ButtonRef
|
|
||||||
//
|
|
||||||
this.ButtonRef.Location = new System.Drawing.Point(643, 219);
|
|
||||||
this.ButtonRef.Name = "ButtonRef";
|
|
||||||
this.ButtonRef.Size = new System.Drawing.Size(105, 29);
|
|
||||||
this.ButtonRef.TabIndex = 8;
|
|
||||||
this.ButtonRef.Text = "Обновить";
|
|
||||||
this.ButtonRef.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click);
|
|
||||||
//
|
|
||||||
// ButtonDel
|
|
||||||
//
|
|
||||||
this.ButtonDel.Location = new System.Drawing.Point(643, 161);
|
|
||||||
this.ButtonDel.Name = "ButtonDel";
|
|
||||||
this.ButtonDel.Size = new System.Drawing.Size(105, 29);
|
|
||||||
this.ButtonDel.TabIndex = 7;
|
|
||||||
this.ButtonDel.Text = "Удалить";
|
|
||||||
this.ButtonDel.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonDel.Click += new System.EventHandler(this.ButtonDel_Click);
|
|
||||||
//
|
|
||||||
// ButtonUpd
|
|
||||||
//
|
|
||||||
this.ButtonUpd.Location = new System.Drawing.Point(643, 104);
|
|
||||||
this.ButtonUpd.Name = "ButtonUpd";
|
|
||||||
this.ButtonUpd.Size = new System.Drawing.Size(105, 29);
|
|
||||||
this.ButtonUpd.TabIndex = 6;
|
|
||||||
this.ButtonUpd.Text = "Изменить";
|
|
||||||
this.ButtonUpd.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonUpd.Click += new System.EventHandler(this.ButtonUpd_Click);
|
|
||||||
//
|
|
||||||
// ButtonAdd
|
|
||||||
//
|
|
||||||
this.ButtonAdd.Location = new System.Drawing.Point(643, 48);
|
|
||||||
this.ButtonAdd.Name = "ButtonAdd";
|
|
||||||
this.ButtonAdd.Size = new System.Drawing.Size(105, 29);
|
|
||||||
this.ButtonAdd.TabIndex = 5;
|
|
||||||
this.ButtonAdd.Text = "Добавить";
|
|
||||||
this.ButtonAdd.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
|
|
||||||
//
|
|
||||||
// ButtonCancel
|
|
||||||
//
|
|
||||||
this.ButtonCancel.Location = new System.Drawing.Point(669, 440);
|
|
||||||
this.ButtonCancel.Name = "ButtonCancel";
|
|
||||||
this.ButtonCancel.Size = new System.Drawing.Size(105, 29);
|
|
||||||
this.ButtonCancel.TabIndex = 9;
|
|
||||||
this.ButtonCancel.Text = "Отмена";
|
|
||||||
this.ButtonCancel.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
|
||||||
//
|
|
||||||
// ButtonSave
|
|
||||||
//
|
|
||||||
this.ButtonSave.Location = new System.Drawing.Point(535, 440);
|
|
||||||
this.ButtonSave.Name = "ButtonSave";
|
|
||||||
this.ButtonSave.Size = new System.Drawing.Size(105, 29);
|
|
||||||
this.ButtonSave.TabIndex = 8;
|
|
||||||
this.ButtonSave.Text = "Сохранить";
|
|
||||||
this.ButtonSave.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
|
||||||
//
|
|
||||||
// FormFurniture
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(799, 475);
|
|
||||||
this.Controls.Add(this.ButtonCancel);
|
|
||||||
this.Controls.Add(this.ButtonSave);
|
|
||||||
this.Controls.Add(this.groupBoxComponents);
|
|
||||||
this.Controls.Add(this.textBoxPrice);
|
|
||||||
this.Controls.Add(this.textBoxName);
|
|
||||||
this.Controls.Add(this.labelPrice);
|
|
||||||
this.Controls.Add(this.labelName);
|
|
||||||
this.Name = "FormFurniture";
|
|
||||||
this.Text = "Изделие";
|
|
||||||
this.Load += new System.EventHandler(this.FormFurniture_Load);
|
|
||||||
this.groupBoxComponents.ResumeLayout(false);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridViewFurn)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Label labelName;
|
|
||||||
private Label labelPrice;
|
|
||||||
private TextBox textBoxName;
|
|
||||||
private TextBox textBoxPrice;
|
|
||||||
private GroupBox groupBoxComponents;
|
|
||||||
private Button ButtonCancel;
|
|
||||||
private Button ButtonSave;
|
|
||||||
private Button ButtonRef;
|
|
||||||
private Button ButtonDel;
|
|
||||||
private Button ButtonUpd;
|
|
||||||
private Button ButtonAdd;
|
|
||||||
private DataGridView dataGridViewFurn;
|
|
||||||
private DataGridViewTextBoxColumn FurnitureId;
|
|
||||||
private DataGridViewTextBoxColumn FurnitureName;
|
|
||||||
private DataGridViewTextBoxColumn Count;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,228 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
|
||||||
using FurnitureAssemblyContracts.DI;
|
|
||||||
using FurnitureAssemblyContracts.SearchModels;
|
|
||||||
using FurnitureAssemblyDataModels.Models;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
public partial class FormFurniture : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IFurnitureLogic _logic;
|
|
||||||
private int? _id;
|
|
||||||
private Dictionary<int, (IComponentModel, int)> _productComponents;
|
|
||||||
public int Id { set { _id = value; } }
|
|
||||||
|
|
||||||
public FormFurniture(ILogger<FormFurniture> logger, IFurnitureLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
_productComponents = new Dictionary<int, (IComponentModel, int)>();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FormFurniture_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_id.HasValue)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Загрузка изделия");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var view = _logic.ReadElement(new FurnitureSearchModel
|
|
||||||
{
|
|
||||||
Id =
|
|
||||||
_id.Value
|
|
||||||
});
|
|
||||||
if (view != null)
|
|
||||||
{
|
|
||||||
textBoxName.Text = view.FurnitureName;
|
|
||||||
textBoxPrice.Text = view.Price.ToString();
|
|
||||||
_productComponents = view.FurnitureComponents ?? new
|
|
||||||
Dictionary<int, (IComponentModel, int)>();
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки изделия");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadData()
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Загрузка компонент изделия");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (_productComponents != null)
|
|
||||||
{
|
|
||||||
dataGridViewFurn.Rows.Clear();
|
|
||||||
foreach (var pc in _productComponents)
|
|
||||||
{
|
|
||||||
dataGridViewFurn.Rows.Add(new object[] { pc.Key, pc.Value.Item1.ComponentName, pc.Value.Item2 });
|
|
||||||
}
|
|
||||||
textBoxPrice.Text = CalcPrice().ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки компонент изделия");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var form = DependencyManager.Instance.Resolve<FormFurnitureComponent>();
|
|
||||||
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
if (form.ComponentModel == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Добавление нового компонента: { ComponentName}- { Count}", form.ComponentModel.ComponentName, form.Count);
|
|
||||||
if (_productComponents.ContainsKey(form.Id))
|
|
||||||
{
|
|
||||||
_productComponents[form.Id] = (form.ComponentModel,
|
|
||||||
form.Count);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_productComponents.Add(form.Id, (form.ComponentModel,
|
|
||||||
form.Count));
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridViewFurn.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
var service = DependencyManager.Instance.Resolve<FormFurnitureComponent>();
|
|
||||||
if (service is FormFurnitureComponent form)
|
|
||||||
{
|
|
||||||
int id =
|
|
||||||
Convert.ToInt32(dataGridViewFurn.SelectedRows[0].Cells[0].Value);
|
|
||||||
form.Id = id;
|
|
||||||
form.Count = _productComponents[id].Item2;
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
if (form.ComponentModel == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Изменение компонента: { ComponentName}- { Count}", form.ComponentModel.ComponentName, form.Count);
|
|
||||||
_productComponents[form.Id] = (form.ComponentModel, form.Count);
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonDel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridViewFurn.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
if (MessageBox.Show("Удалить запись?", "Вопрос",
|
|
||||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Удаление компонента: { ComponentName} - { Count}", dataGridViewFurn.SelectedRows[0].Cells[1].Value);
|
|
||||||
_productComponents?.Remove(Convert.ToInt32(dataGridViewFurn.SelectedRows[0].Cells[0].Value));
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonRef_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
private void ButtonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(textBoxName.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните название", "Ошибка",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(textBoxPrice.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните цену", "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (_productComponents == null || _productComponents.Count == 0)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните компоненты", "Ошибка",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Сохранение изделия");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var model = new FurnitureBindingModel
|
|
||||||
{
|
|
||||||
Id = _id ?? 0,
|
|
||||||
FurnitureName = textBoxName.Text,
|
|
||||||
Price = Convert.ToDouble(textBoxPrice.Text),
|
|
||||||
FurnitureComponents = _productComponents
|
|
||||||
};
|
|
||||||
var operationResult = _id.HasValue ? _logic.Update(model) :
|
|
||||||
_logic.Create(model);
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка сохранения изделия");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DialogResult = DialogResult.Cancel;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
private double CalcPrice()
|
|
||||||
{
|
|
||||||
double price = 0;
|
|
||||||
foreach (var elem in _productComponents)
|
|
||||||
{
|
|
||||||
price += ((elem.Value.Item1?.Cost ?? 0) * elem.Value.Item2);
|
|
||||||
}
|
|
||||||
return Math.Round(price * 1.1, 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,69 +0,0 @@
|
|||||||
<root>
|
|
||||||
<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>
|
|
||||||
<metadata name="FurnitureId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="FurnitureName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
</root>
|
|
@ -1,119 +0,0 @@
|
|||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
partial class FormFurnitureComponent
|
|
||||||
{
|
|
||||||
/// <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.ButtonCancel = new System.Windows.Forms.Button();
|
|
||||||
this.ButtonSave = new System.Windows.Forms.Button();
|
|
||||||
this.comboBoxComponent = new System.Windows.Forms.ComboBox();
|
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
|
||||||
this.textBoxCount = new System.Windows.Forms.TextBox();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// ButtonCancel
|
|
||||||
//
|
|
||||||
this.ButtonCancel.Location = new System.Drawing.Point(293, 109);
|
|
||||||
this.ButtonCancel.Name = "ButtonCancel";
|
|
||||||
this.ButtonCancel.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.ButtonCancel.TabIndex = 7;
|
|
||||||
this.ButtonCancel.Text = "Отмена";
|
|
||||||
this.ButtonCancel.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
|
||||||
//
|
|
||||||
// ButtonSave
|
|
||||||
//
|
|
||||||
this.ButtonSave.Location = new System.Drawing.Point(189, 109);
|
|
||||||
this.ButtonSave.Name = "ButtonSave";
|
|
||||||
this.ButtonSave.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.ButtonSave.TabIndex = 6;
|
|
||||||
this.ButtonSave.Text = "Сохранить";
|
|
||||||
this.ButtonSave.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
|
||||||
//
|
|
||||||
// comboBoxComponent
|
|
||||||
//
|
|
||||||
this.comboBoxComponent.FormattingEnabled = true;
|
|
||||||
this.comboBoxComponent.Location = new System.Drawing.Point(116, 18);
|
|
||||||
this.comboBoxComponent.Name = "comboBoxComponent";
|
|
||||||
this.comboBoxComponent.Size = new System.Drawing.Size(252, 23);
|
|
||||||
this.comboBoxComponent.TabIndex = 8;
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
this.label1.AutoSize = true;
|
|
||||||
this.label1.Location = new System.Drawing.Point(30, 21);
|
|
||||||
this.label1.Name = "label1";
|
|
||||||
this.label1.Size = new System.Drawing.Size(72, 15);
|
|
||||||
this.label1.TabIndex = 9;
|
|
||||||
this.label1.Text = "Компонент:";
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
this.label2.AutoSize = true;
|
|
||||||
this.label2.Location = new System.Drawing.Point(30, 62);
|
|
||||||
this.label2.Name = "label2";
|
|
||||||
this.label2.Size = new System.Drawing.Size(75, 15);
|
|
||||||
this.label2.TabIndex = 10;
|
|
||||||
this.label2.Text = "Количество:";
|
|
||||||
//
|
|
||||||
// textBoxCount
|
|
||||||
//
|
|
||||||
this.textBoxCount.Location = new System.Drawing.Point(116, 59);
|
|
||||||
this.textBoxCount.Name = "textBoxCount";
|
|
||||||
this.textBoxCount.Size = new System.Drawing.Size(252, 23);
|
|
||||||
this.textBoxCount.TabIndex = 11;
|
|
||||||
//
|
|
||||||
// FormFurnitureComponent
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(407, 146);
|
|
||||||
this.Controls.Add(this.textBoxCount);
|
|
||||||
this.Controls.Add(this.label2);
|
|
||||||
this.Controls.Add(this.label1);
|
|
||||||
this.Controls.Add(this.comboBoxComponent);
|
|
||||||
this.Controls.Add(this.ButtonCancel);
|
|
||||||
this.Controls.Add(this.ButtonSave);
|
|
||||||
this.Name = "FormFurnitureComponent";
|
|
||||||
this.Text = "Компонент изделия";
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Button ButtonCancel;
|
|
||||||
private Button ButtonSave;
|
|
||||||
private ComboBox comboBoxComponent;
|
|
||||||
private Label label1;
|
|
||||||
private Label label2;
|
|
||||||
private TextBox textBoxCount;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,94 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
|
||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
using FurnitureAssemblyDataModels.Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
public partial class FormFurnitureComponent : Form
|
|
||||||
{
|
|
||||||
private readonly List<ComponentViewModel>? _list;
|
|
||||||
public int Id
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Convert.ToInt32(comboBoxComponent.SelectedValue);
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
comboBoxComponent.SelectedValue = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public IComponentModel? ComponentModel
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_list == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
foreach (var elem in _list)
|
|
||||||
{
|
|
||||||
if (elem.Id == Id)
|
|
||||||
{
|
|
||||||
return elem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Count
|
|
||||||
{
|
|
||||||
get { return Convert.ToInt32(textBoxCount.Text); }
|
|
||||||
set
|
|
||||||
{ textBoxCount.Text = value.ToString(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public FormFurnitureComponent(IComponentLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_list = logic.ReadList(null);
|
|
||||||
if (_list != null)
|
|
||||||
{
|
|
||||||
comboBoxComponent.DisplayMember = "ComponentName";
|
|
||||||
comboBoxComponent.ValueMember = "Id";
|
|
||||||
comboBoxComponent.DataSource = _list;
|
|
||||||
comboBoxComponent.SelectedItem = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(textBoxCount.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните поле Количество", "Ошибка",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (comboBoxComponent.SelectedValue == null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Выберите компонент", "Ошибка",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DialogResult = DialogResult.Cancel;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<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>
|
|
@ -1,116 +0,0 @@
|
|||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
partial class FormFurnitures
|
|
||||||
{
|
|
||||||
/// <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.dataGridView = new System.Windows.Forms.DataGridView();
|
|
||||||
this.ButtonAdd = new System.Windows.Forms.Button();
|
|
||||||
this.ButtonDel = new System.Windows.Forms.Button();
|
|
||||||
this.ButtonUpd = new System.Windows.Forms.Button();
|
|
||||||
this.ButtonRef = new System.Windows.Forms.Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
this.dataGridView.Location = new System.Drawing.Point(-1, 1);
|
|
||||||
this.dataGridView.Name = "dataGridView";
|
|
||||||
this.dataGridView.RowTemplate.Height = 25;
|
|
||||||
this.dataGridView.Size = new System.Drawing.Size(559, 453);
|
|
||||||
this.dataGridView.TabIndex = 5;
|
|
||||||
//
|
|
||||||
// ButtonAdd
|
|
||||||
//
|
|
||||||
this.ButtonAdd.Location = new System.Drawing.Point(583, 52);
|
|
||||||
this.ButtonAdd.Name = "ButtonAdd";
|
|
||||||
this.ButtonAdd.Size = new System.Drawing.Size(105, 29);
|
|
||||||
this.ButtonAdd.TabIndex = 6;
|
|
||||||
this.ButtonAdd.Text = "Добавить";
|
|
||||||
this.ButtonAdd.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
|
|
||||||
//
|
|
||||||
// ButtonDel
|
|
||||||
//
|
|
||||||
this.ButtonDel.Location = new System.Drawing.Point(583, 106);
|
|
||||||
this.ButtonDel.Name = "ButtonDel";
|
|
||||||
this.ButtonDel.Size = new System.Drawing.Size(105, 29);
|
|
||||||
this.ButtonDel.TabIndex = 7;
|
|
||||||
this.ButtonDel.Text = "Удалить";
|
|
||||||
this.ButtonDel.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonDel.Click += new System.EventHandler(this.ButtonDel_Click);
|
|
||||||
//
|
|
||||||
// ButtonUpd
|
|
||||||
//
|
|
||||||
this.ButtonUpd.Location = new System.Drawing.Point(583, 161);
|
|
||||||
this.ButtonUpd.Name = "ButtonUpd";
|
|
||||||
this.ButtonUpd.Size = new System.Drawing.Size(105, 29);
|
|
||||||
this.ButtonUpd.TabIndex = 8;
|
|
||||||
this.ButtonUpd.Text = "Изменить";
|
|
||||||
this.ButtonUpd.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonUpd.Click += new System.EventHandler(this.ButtonUpd_Click);
|
|
||||||
//
|
|
||||||
// ButtonRef
|
|
||||||
//
|
|
||||||
this.ButtonRef.Location = new System.Drawing.Point(583, 216);
|
|
||||||
this.ButtonRef.Name = "ButtonRef";
|
|
||||||
this.ButtonRef.Size = new System.Drawing.Size(105, 29);
|
|
||||||
this.ButtonRef.TabIndex = 9;
|
|
||||||
this.ButtonRef.Text = "Обновить";
|
|
||||||
this.ButtonRef.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click);
|
|
||||||
//
|
|
||||||
// FormFurnitures
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(712, 453);
|
|
||||||
this.Controls.Add(this.ButtonRef);
|
|
||||||
this.Controls.Add(this.ButtonUpd);
|
|
||||||
this.Controls.Add(this.ButtonDel);
|
|
||||||
this.Controls.Add(this.ButtonAdd);
|
|
||||||
this.Controls.Add(this.dataGridView);
|
|
||||||
this.Name = "FormFurnitures";
|
|
||||||
this.Text = "Изделия";
|
|
||||||
this.Load += new System.EventHandler(this.FormFurnitures_Load);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
private DataGridView dataGridView1;
|
|
||||||
private Button ButtonAdd;
|
|
||||||
private Button ButtonDel;
|
|
||||||
private Button ButtonUpd;
|
|
||||||
private Button ButtonRef;
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,111 +0,0 @@
|
|||||||
using FurnitureAssemblyBusinessLogic;
|
|
||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
|
||||||
using FurnitureAssemblyContracts.DI;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
public partial class FormFurnitures : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IFurnitureLogic _logic;
|
|
||||||
public FormFurnitures(ILogger<FormComponents> logger, IFurnitureLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FormFurnitures_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadData()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
dataGridView.FillandConfigGrid(_logic.ReadList(null));
|
|
||||||
_logger.LogInformation("Загрузка изделий");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки изделий");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var form = DependencyManager.Instance.Resolve<FormFurniture>();
|
|
||||||
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
var form = DependencyManager.Instance.Resolve<FormFurniture>();
|
|
||||||
|
|
||||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonDel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
if (MessageBox.Show("Удалить запись?", "Вопрос",
|
|
||||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
||||||
{
|
|
||||||
int id =
|
|
||||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
_logger.LogInformation("Удаление изделия");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!_logic.Delete(new FurnitureBindingModel
|
|
||||||
{
|
|
||||||
Id = id
|
|
||||||
}))
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка удаления изделия");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonRef_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<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>
|
|
@ -1,167 +0,0 @@
|
|||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
partial class FormImplementer
|
|
||||||
{
|
|
||||||
/// <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.ButtonCancel = new System.Windows.Forms.Button();
|
|
||||||
this.ButtonSave = new System.Windows.Forms.Button();
|
|
||||||
this.textBoxFIO = new System.Windows.Forms.TextBox();
|
|
||||||
this.textBoxPassword = new System.Windows.Forms.TextBox();
|
|
||||||
this.labelName = new System.Windows.Forms.Label();
|
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
|
||||||
this.label3 = new System.Windows.Forms.Label();
|
|
||||||
this.numericUpDownWE = new System.Windows.Forms.NumericUpDown();
|
|
||||||
this.numericUpDownQual = new System.Windows.Forms.NumericUpDown();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWE)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownQual)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// ButtonCancel
|
|
||||||
//
|
|
||||||
this.ButtonCancel.Location = new System.Drawing.Point(335, 221);
|
|
||||||
this.ButtonCancel.Name = "ButtonCancel";
|
|
||||||
this.ButtonCancel.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.ButtonCancel.TabIndex = 7;
|
|
||||||
this.ButtonCancel.Text = "Отмена";
|
|
||||||
this.ButtonCancel.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
|
||||||
//
|
|
||||||
// ButtonSave
|
|
||||||
//
|
|
||||||
this.ButtonSave.Location = new System.Drawing.Point(231, 221);
|
|
||||||
this.ButtonSave.Name = "ButtonSave";
|
|
||||||
this.ButtonSave.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.ButtonSave.TabIndex = 6;
|
|
||||||
this.ButtonSave.Text = "Сохранить";
|
|
||||||
this.ButtonSave.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
|
||||||
//
|
|
||||||
// textBoxFIO
|
|
||||||
//
|
|
||||||
this.textBoxFIO.Location = new System.Drawing.Point(129, 33);
|
|
||||||
this.textBoxFIO.Name = "textBoxFIO";
|
|
||||||
this.textBoxFIO.Size = new System.Drawing.Size(281, 23);
|
|
||||||
this.textBoxFIO.TabIndex = 8;
|
|
||||||
//
|
|
||||||
// textBoxPassword
|
|
||||||
//
|
|
||||||
this.textBoxPassword.Location = new System.Drawing.Point(129, 74);
|
|
||||||
this.textBoxPassword.Name = "textBoxPassword";
|
|
||||||
this.textBoxPassword.Size = new System.Drawing.Size(281, 23);
|
|
||||||
this.textBoxPassword.TabIndex = 9;
|
|
||||||
//
|
|
||||||
// labelName
|
|
||||||
//
|
|
||||||
this.labelName.AutoSize = true;
|
|
||||||
this.labelName.Location = new System.Drawing.Point(31, 36);
|
|
||||||
this.labelName.Name = "labelName";
|
|
||||||
this.labelName.Size = new System.Drawing.Size(34, 15);
|
|
||||||
this.labelName.TabIndex = 12;
|
|
||||||
this.labelName.Text = "ФИО";
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
this.label1.AutoSize = true;
|
|
||||||
this.label1.Location = new System.Drawing.Point(31, 77);
|
|
||||||
this.label1.Name = "label1";
|
|
||||||
this.label1.Size = new System.Drawing.Size(49, 15);
|
|
||||||
this.label1.TabIndex = 13;
|
|
||||||
this.label1.Text = "Пароль";
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
this.label2.AutoSize = true;
|
|
||||||
this.label2.Location = new System.Drawing.Point(31, 117);
|
|
||||||
this.label2.Name = "label2";
|
|
||||||
this.label2.Size = new System.Drawing.Size(79, 15);
|
|
||||||
this.label2.TabIndex = 14;
|
|
||||||
this.label2.Text = "Стаж работы";
|
|
||||||
//
|
|
||||||
// label3
|
|
||||||
//
|
|
||||||
this.label3.AutoSize = true;
|
|
||||||
this.label3.Location = new System.Drawing.Point(31, 160);
|
|
||||||
this.label3.Name = "label3";
|
|
||||||
this.label3.Size = new System.Drawing.Size(88, 15);
|
|
||||||
this.label3.TabIndex = 15;
|
|
||||||
this.label3.Text = "Квалификация";
|
|
||||||
//
|
|
||||||
// numericUpDownWE
|
|
||||||
//
|
|
||||||
this.numericUpDownWE.Location = new System.Drawing.Point(129, 115);
|
|
||||||
this.numericUpDownWE.Name = "numericUpDownWE";
|
|
||||||
this.numericUpDownWE.Size = new System.Drawing.Size(120, 23);
|
|
||||||
this.numericUpDownWE.TabIndex = 16;
|
|
||||||
//
|
|
||||||
// numericUpDownQual
|
|
||||||
//
|
|
||||||
this.numericUpDownQual.Location = new System.Drawing.Point(129, 158);
|
|
||||||
this.numericUpDownQual.Name = "numericUpDownQual";
|
|
||||||
this.numericUpDownQual.Size = new System.Drawing.Size(120, 23);
|
|
||||||
this.numericUpDownQual.TabIndex = 17;
|
|
||||||
//
|
|
||||||
// FormImplementer
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(423, 263);
|
|
||||||
this.Controls.Add(this.numericUpDownQual);
|
|
||||||
this.Controls.Add(this.numericUpDownWE);
|
|
||||||
this.Controls.Add(this.label3);
|
|
||||||
this.Controls.Add(this.label2);
|
|
||||||
this.Controls.Add(this.label1);
|
|
||||||
this.Controls.Add(this.labelName);
|
|
||||||
this.Controls.Add(this.textBoxPassword);
|
|
||||||
this.Controls.Add(this.textBoxFIO);
|
|
||||||
this.Controls.Add(this.ButtonCancel);
|
|
||||||
this.Controls.Add(this.ButtonSave);
|
|
||||||
this.Name = "FormImplementer";
|
|
||||||
this.Text = "Исполнитель";
|
|
||||||
this.Load += new System.EventHandler(this.FormImplementer_Load);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWE)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownQual)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Button ButtonCancel;
|
|
||||||
private Button ButtonSave;
|
|
||||||
private TextBox textBoxFIO;
|
|
||||||
private TextBox textBoxPassword;
|
|
||||||
private Label labelName;
|
|
||||||
private Label label1;
|
|
||||||
private Label label2;
|
|
||||||
private Label label3;
|
|
||||||
private NumericUpDown numericUpDownWE;
|
|
||||||
private NumericUpDown numericUpDownQual;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,109 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
|
||||||
using FurnitureAssemblyContracts.SearchModels;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
public partial class FormImplementer : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IImplementerLogic _logic;
|
|
||||||
private int? _id;
|
|
||||||
public int Id { set { _id = value; } }
|
|
||||||
public FormImplementer(ILogger<FormImplementer> logger, IImplementerLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FormImplementer_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_id.HasValue)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Получение исполнителя");
|
|
||||||
var view = _logic.ReadElement(new ImplementerSearchModel
|
|
||||||
{
|
|
||||||
Id = _id.Value
|
|
||||||
});
|
|
||||||
if (view != null)
|
|
||||||
{
|
|
||||||
textBoxFIO.Text = view.ImplementerFIO;
|
|
||||||
textBoxPassword.Text = view.Password;
|
|
||||||
numericUpDownWE.Value = view.WorkExperience;
|
|
||||||
numericUpDownQual.Value = view.Qualification;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка получения исполнителя");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DialogResult = DialogResult.Cancel;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(textBoxFIO.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните ФИО", "Ошибка",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(textBoxPassword.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните пароль", "Ошибка",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Сохранение исполнителя");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var model = new ImplementerBindingModel
|
|
||||||
{
|
|
||||||
Id = _id ?? 0,
|
|
||||||
ImplementerFIO = textBoxFIO.Text,
|
|
||||||
Password = textBoxPassword.Text,
|
|
||||||
WorkExperience = Convert.ToInt32(numericUpDownWE.Value),
|
|
||||||
Qualification = Convert.ToInt32(numericUpDownQual.Value),
|
|
||||||
|
|
||||||
};
|
|
||||||
var operationResult = _id.HasValue ? _logic.Update(model) :
|
|
||||||
_logic.Create(model);
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка сохранения исполнителя");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<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>
|
|
@ -1,114 +0,0 @@
|
|||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
partial class FormImplementers
|
|
||||||
{
|
|
||||||
/// <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.dataGridView = new System.Windows.Forms.DataGridView();
|
|
||||||
this.ButtonRef = new System.Windows.Forms.Button();
|
|
||||||
this.ButtonDel = new System.Windows.Forms.Button();
|
|
||||||
this.ButtonUpd = new System.Windows.Forms.Button();
|
|
||||||
this.ButtonAdd = new System.Windows.Forms.Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
this.dataGridView.Location = new System.Drawing.Point(2, 0);
|
|
||||||
this.dataGridView.Name = "dataGridView";
|
|
||||||
this.dataGridView.RowTemplate.Height = 25;
|
|
||||||
this.dataGridView.Size = new System.Drawing.Size(559, 450);
|
|
||||||
this.dataGridView.TabIndex = 7;
|
|
||||||
//
|
|
||||||
// ButtonRef
|
|
||||||
//
|
|
||||||
this.ButtonRef.Location = new System.Drawing.Point(590, 244);
|
|
||||||
this.ButtonRef.Name = "ButtonRef";
|
|
||||||
this.ButtonRef.Size = new System.Drawing.Size(105, 29);
|
|
||||||
this.ButtonRef.TabIndex = 11;
|
|
||||||
this.ButtonRef.Text = "Обновить";
|
|
||||||
this.ButtonRef.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click);
|
|
||||||
//
|
|
||||||
// ButtonDel
|
|
||||||
//
|
|
||||||
this.ButtonDel.Location = new System.Drawing.Point(590, 186);
|
|
||||||
this.ButtonDel.Name = "ButtonDel";
|
|
||||||
this.ButtonDel.Size = new System.Drawing.Size(105, 29);
|
|
||||||
this.ButtonDel.TabIndex = 10;
|
|
||||||
this.ButtonDel.Text = "Удалить";
|
|
||||||
this.ButtonDel.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonDel.Click += new System.EventHandler(this.ButtonDel_Click);
|
|
||||||
//
|
|
||||||
// ButtonUpd
|
|
||||||
//
|
|
||||||
this.ButtonUpd.Location = new System.Drawing.Point(590, 129);
|
|
||||||
this.ButtonUpd.Name = "ButtonUpd";
|
|
||||||
this.ButtonUpd.Size = new System.Drawing.Size(105, 29);
|
|
||||||
this.ButtonUpd.TabIndex = 9;
|
|
||||||
this.ButtonUpd.Text = "Изменить";
|
|
||||||
this.ButtonUpd.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonUpd.Click += new System.EventHandler(this.ButtonUpd_Click);
|
|
||||||
//
|
|
||||||
// ButtonAdd
|
|
||||||
//
|
|
||||||
this.ButtonAdd.Location = new System.Drawing.Point(590, 73);
|
|
||||||
this.ButtonAdd.Name = "ButtonAdd";
|
|
||||||
this.ButtonAdd.Size = new System.Drawing.Size(105, 29);
|
|
||||||
this.ButtonAdd.TabIndex = 8;
|
|
||||||
this.ButtonAdd.Text = "Добавить";
|
|
||||||
this.ButtonAdd.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
|
|
||||||
//
|
|
||||||
// FormImplementers
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(718, 450);
|
|
||||||
this.Controls.Add(this.ButtonRef);
|
|
||||||
this.Controls.Add(this.ButtonDel);
|
|
||||||
this.Controls.Add(this.ButtonUpd);
|
|
||||||
this.Controls.Add(this.ButtonAdd);
|
|
||||||
this.Controls.Add(this.dataGridView);
|
|
||||||
this.Name = "FormImplementers";
|
|
||||||
this.Text = "Исполнители";
|
|
||||||
this.Load += new System.EventHandler(this.FormImplementers_Load);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
private Button ButtonRef;
|
|
||||||
private Button ButtonDel;
|
|
||||||
private Button ButtonUpd;
|
|
||||||
private Button ButtonAdd;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,103 +0,0 @@
|
|||||||
using FurnitureAssemblyBusinessLogic;
|
|
||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
|
||||||
using FurnitureAssemblyContracts.DI;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
|
|
||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
public partial class FormImplementers : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IImplementerLogic _logic;
|
|
||||||
public FormImplementers(ILogger<FormImplementers> logger, IImplementerLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FormImplementers_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadData()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
dataGridView.FillandConfigGrid(_logic.ReadList(null));
|
|
||||||
_logger.LogInformation("Загрузка исполнителей");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки исполнителей");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var form = DependencyManager.Instance.Resolve<FormImplementer>();
|
|
||||||
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
var form = DependencyManager.Instance.Resolve<FormImplementer>();
|
|
||||||
|
|
||||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonDel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
if (MessageBox.Show("Удалить запись?", "Вопрос",
|
|
||||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
||||||
{
|
|
||||||
int id =
|
|
||||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
_logger.LogInformation("Удаление исполнителя");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!_logic.Delete(new ImplementerBindingModel
|
|
||||||
{
|
|
||||||
Id = id
|
|
||||||
}))
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка удаления исполнителя");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonRef_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<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>
|
|
@ -1,62 +0,0 @@
|
|||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
partial class FormMail
|
|
||||||
{
|
|
||||||
/// <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.dataGridViewMail = new System.Windows.Forms.DataGridView();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridViewMail)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// dataGridViewMail
|
|
||||||
//
|
|
||||||
this.dataGridViewMail.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
this.dataGridViewMail.Location = new System.Drawing.Point(0, 0);
|
|
||||||
this.dataGridViewMail.Name = "dataGridViewMail";
|
|
||||||
this.dataGridViewMail.RowTemplate.Height = 25;
|
|
||||||
this.dataGridViewMail.Size = new System.Drawing.Size(801, 449);
|
|
||||||
this.dataGridViewMail.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// FormMail
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
|
||||||
this.Controls.Add(this.dataGridViewMail);
|
|
||||||
this.Name = "FormMail";
|
|
||||||
this.Text = "Письма";
|
|
||||||
this.Load += new System.EventHandler(this.FormMail_Load);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridViewMail)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private DataGridView dataGridViewMail;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
using FurnitureAssemblyBusinessLogic;
|
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
|
|
||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
public partial class FormMail : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IMessageInfoLogic _logic;
|
|
||||||
public FormMail(ILogger<FormMail> logger, IMessageInfoLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FormMail_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
dataGridViewMail.FillandConfigGrid(_logic.ReadList(null));
|
|
||||||
_logger.LogInformation("Загрузка писем");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки писем");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<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>
|
|
238
FurnitureAssembly/FurnitureAssembly/FormMain.Designer.cs
generated
238
FurnitureAssembly/FurnitureAssembly/FormMain.Designer.cs
generated
@ -1,238 +0,0 @@
|
|||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
partial class FormMain
|
|
||||||
{
|
|
||||||
/// <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.dataGridView = new System.Windows.Forms.DataGridView();
|
|
||||||
this.ButtonCreateOrder = new System.Windows.Forms.Button();
|
|
||||||
this.ButtonIssuedOrder = new System.Windows.Forms.Button();
|
|
||||||
this.ButtonRef = new System.Windows.Forms.Button();
|
|
||||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
|
||||||
this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.компонентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.изделияToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.ClientsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.ImplementersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.отчетыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.FurnituresToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.FurnituresComponentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.списокЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.doWorkToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.mailToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.CreateBackUpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
|
||||||
this.menuStrip1.SuspendLayout();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
this.dataGridView.Location = new System.Drawing.Point(2, 25);
|
|
||||||
this.dataGridView.Name = "dataGridView";
|
|
||||||
this.dataGridView.RowTemplate.Height = 25;
|
|
||||||
this.dataGridView.Size = new System.Drawing.Size(859, 425);
|
|
||||||
this.dataGridView.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// ButtonCreateOrder
|
|
||||||
//
|
|
||||||
this.ButtonCreateOrder.Location = new System.Drawing.Point(902, 72);
|
|
||||||
this.ButtonCreateOrder.Name = "ButtonCreateOrder";
|
|
||||||
this.ButtonCreateOrder.Size = new System.Drawing.Size(150, 25);
|
|
||||||
this.ButtonCreateOrder.TabIndex = 1;
|
|
||||||
this.ButtonCreateOrder.Text = "Создать заказ";
|
|
||||||
this.ButtonCreateOrder.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonCreateOrder.Click += new System.EventHandler(this.ButtonCreateOrder_Click);
|
|
||||||
//
|
|
||||||
// ButtonIssuedOrder
|
|
||||||
//
|
|
||||||
this.ButtonIssuedOrder.Location = new System.Drawing.Point(903, 116);
|
|
||||||
this.ButtonIssuedOrder.Name = "ButtonIssuedOrder";
|
|
||||||
this.ButtonIssuedOrder.Size = new System.Drawing.Size(150, 25);
|
|
||||||
this.ButtonIssuedOrder.TabIndex = 4;
|
|
||||||
this.ButtonIssuedOrder.Text = "Заказ выдан";
|
|
||||||
this.ButtonIssuedOrder.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonIssuedOrder.Click += new System.EventHandler(this.ButtonIssuedOrder_Click);
|
|
||||||
//
|
|
||||||
// ButtonRef
|
|
||||||
//
|
|
||||||
this.ButtonRef.Location = new System.Drawing.Point(902, 165);
|
|
||||||
this.ButtonRef.Name = "ButtonRef";
|
|
||||||
this.ButtonRef.Size = new System.Drawing.Size(150, 25);
|
|
||||||
this.ButtonRef.TabIndex = 5;
|
|
||||||
this.ButtonRef.Text = "Обновить список";
|
|
||||||
this.ButtonRef.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click);
|
|
||||||
//
|
|
||||||
// menuStrip1
|
|
||||||
//
|
|
||||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
||||||
this.справочникиToolStripMenuItem,
|
|
||||||
this.отчетыToolStripMenuItem,
|
|
||||||
this.doWorkToolStripMenuItem,
|
|
||||||
this.mailToolStripMenuItem,
|
|
||||||
this.CreateBackUpToolStripMenuItem});
|
|
||||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
|
||||||
this.menuStrip1.Name = "menuStrip1";
|
|
||||||
this.menuStrip1.Size = new System.Drawing.Size(1065, 24);
|
|
||||||
this.menuStrip1.TabIndex = 6;
|
|
||||||
this.menuStrip1.Text = "menuStrip1";
|
|
||||||
//
|
|
||||||
// справочникиToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
||||||
this.компонентыToolStripMenuItem,
|
|
||||||
this.изделияToolStripMenuItem,
|
|
||||||
this.ClientsMenuItem,
|
|
||||||
this.ImplementersToolStripMenuItem});
|
|
||||||
this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
|
||||||
this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(94, 20);
|
|
||||||
this.справочникиToolStripMenuItem.Text = "Справочники";
|
|
||||||
//
|
|
||||||
// компонентыToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
|
||||||
this.компонентыToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
|
|
||||||
this.компонентыToolStripMenuItem.Text = "Компоненты";
|
|
||||||
this.компонентыToolStripMenuItem.Click += new System.EventHandler(this.КомпонентыToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// изделияToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.изделияToolStripMenuItem.Name = "изделияToolStripMenuItem";
|
|
||||||
this.изделияToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
|
|
||||||
this.изделияToolStripMenuItem.Text = "Изделия";
|
|
||||||
this.изделияToolStripMenuItem.Click += new System.EventHandler(this.ИзделияToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// ClientsMenuItem
|
|
||||||
//
|
|
||||||
this.ClientsMenuItem.Name = "ClientsMenuItem";
|
|
||||||
this.ClientsMenuItem.Size = new System.Drawing.Size(149, 22);
|
|
||||||
this.ClientsMenuItem.Text = "Клиенты";
|
|
||||||
this.ClientsMenuItem.Click += new System.EventHandler(this.ClientsMenuItem_Click);
|
|
||||||
//
|
|
||||||
// ImplementersToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.ImplementersToolStripMenuItem.Name = "ImplementersToolStripMenuItem";
|
|
||||||
this.ImplementersToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
|
|
||||||
this.ImplementersToolStripMenuItem.Text = "Исполнители";
|
|
||||||
this.ImplementersToolStripMenuItem.Click += new System.EventHandler(this.ImplementersToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// отчетыToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.отчетыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
||||||
this.FurnituresToolStripMenuItem,
|
|
||||||
this.FurnituresComponentsToolStripMenuItem,
|
|
||||||
this.списокЗаказовToolStripMenuItem});
|
|
||||||
this.отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
|
||||||
this.отчетыToolStripMenuItem.Size = new System.Drawing.Size(60, 20);
|
|
||||||
this.отчетыToolStripMenuItem.Text = "Отчеты";
|
|
||||||
//
|
|
||||||
// FurnituresToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.FurnituresToolStripMenuItem.Name = "FurnituresToolStripMenuItem";
|
|
||||||
this.FurnituresToolStripMenuItem.Size = new System.Drawing.Size(216, 22);
|
|
||||||
this.FurnituresToolStripMenuItem.Text = "Список изделий";
|
|
||||||
this.FurnituresToolStripMenuItem.Click += new System.EventHandler(this.FurnituresToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// FurnituresComponentsToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.FurnituresComponentsToolStripMenuItem.Name = "FurnituresComponentsToolStripMenuItem";
|
|
||||||
this.FurnituresComponentsToolStripMenuItem.Size = new System.Drawing.Size(216, 22);
|
|
||||||
this.FurnituresComponentsToolStripMenuItem.Text = "Изделия по компонентам";
|
|
||||||
this.FurnituresComponentsToolStripMenuItem.Click += new System.EventHandler(this.FurnitureComponentsToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// списокЗаказовToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
|
|
||||||
this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(216, 22);
|
|
||||||
this.списокЗаказовToolStripMenuItem.Text = "Список заказов";
|
|
||||||
this.списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// doWorkToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.doWorkToolStripMenuItem.Name = "doWorkToolStripMenuItem";
|
|
||||||
this.doWorkToolStripMenuItem.Size = new System.Drawing.Size(92, 20);
|
|
||||||
this.doWorkToolStripMenuItem.Text = "Запуск работ";
|
|
||||||
this.doWorkToolStripMenuItem.Click += new System.EventHandler(this.doWorkToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// mailToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.mailToolStripMenuItem.Name = "mailToolStripMenuItem";
|
|
||||||
this.mailToolStripMenuItem.Size = new System.Drawing.Size(62, 20);
|
|
||||||
this.mailToolStripMenuItem.Text = "Письма";
|
|
||||||
this.mailToolStripMenuItem.Click += new System.EventHandler(this.mailToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// CreateBackUpToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.CreateBackUpToolStripMenuItem.Name = "CreateBackUpToolStripMenuItem";
|
|
||||||
this.CreateBackUpToolStripMenuItem.Size = new System.Drawing.Size(97, 20);
|
|
||||||
this.CreateBackUpToolStripMenuItem.Text = "Создать Бэкап";
|
|
||||||
this.CreateBackUpToolStripMenuItem.Click += new System.EventHandler(this.CreateBackUpToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// FormMain
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(1065, 450);
|
|
||||||
this.Controls.Add(this.ButtonRef);
|
|
||||||
this.Controls.Add(this.ButtonIssuedOrder);
|
|
||||||
this.Controls.Add(this.ButtonCreateOrder);
|
|
||||||
this.Controls.Add(this.dataGridView);
|
|
||||||
this.Controls.Add(this.menuStrip1);
|
|
||||||
this.MainMenuStrip = this.menuStrip1;
|
|
||||||
this.Name = "FormMain";
|
|
||||||
this.Text = "Магазин мебели";
|
|
||||||
this.Load += new System.EventHandler(this.FormMain_Load);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
|
||||||
this.menuStrip1.ResumeLayout(false);
|
|
||||||
this.menuStrip1.PerformLayout();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
private Button ButtonCreateOrder;
|
|
||||||
private Button ButtonIssuedOrder;
|
|
||||||
private Button ButtonRef;
|
|
||||||
private MenuStrip menuStrip1;
|
|
||||||
private ToolStripMenuItem справочникиToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem компонентыToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem изделияToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem отчетыToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem FurnituresToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem FurnituresComponentsToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem списокЗаказовToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem ClientsMenuItem;
|
|
||||||
private ToolStripMenuItem ImplementersToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem doWorkToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem mailToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem CreateBackUpToolStripMenuItem;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,236 +0,0 @@
|
|||||||
using FurnitureAssemblyBusinessLogic;
|
|
||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
|
||||||
using FurnitureAssemblyContracts.DI;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
public partial class FormMain : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IOrderLogic _orderLogic;
|
|
||||||
private readonly IReportLogic _reportLogic;
|
|
||||||
private readonly IWorkProcess _workModeling;
|
|
||||||
private readonly IBackUpLogic _backUpLogic;
|
|
||||||
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workModeling, IBackUpLogic backUpLogic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_orderLogic = orderLogic;
|
|
||||||
_reportLogic = reportLogic;
|
|
||||||
_workModeling = workModeling;
|
|
||||||
_backUpLogic = backUpLogic;
|
|
||||||
}
|
|
||||||
private void FormMain_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
private void LoadData()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
dataGridView.FillandConfigGrid(_orderLogic.ReadList(null));
|
|
||||||
_logger.LogInformation("Загрузка заказов");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки заказов");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void КомпонентыToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var form = DependencyManager.Instance.Resolve<FormComponents>();
|
|
||||||
|
|
||||||
form.ShowDialog();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ИзделияToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var form = DependencyManager.Instance.Resolve<FormFurnitures>();
|
|
||||||
|
|
||||||
form.ShowDialog();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCreateOrder_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var form = DependencyManager.Instance.Resolve<FormCreateOrder>();
|
|
||||||
|
|
||||||
form.ShowDialog();
|
|
||||||
LoadData();
|
|
||||||
|
|
||||||
}
|
|
||||||
private void ButtonTakeOrderInWork_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id });
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка передачи заказа в работу");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonOrderReady_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'",
|
|
||||||
id);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel { Id = id });
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка отметки о готовности заказа");
|
|
||||||
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonIssuedOrder_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'",
|
|
||||||
id);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel { Id = id });
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Заказ №{id} выдан", id);
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка отметки о выдачи заказа");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonRef_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FurnituresToolStripMenuItem_Click(object sender, EventArgs
|
|
||||||
e)
|
|
||||||
{
|
|
||||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
_reportLogic.SaveFurnituresToWordFile(new ReportBindingModel
|
|
||||||
{
|
|
||||||
FileName = dialog.FileName
|
|
||||||
});
|
|
||||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void FurnitureComponentsToolStripMenuItem_Click(object sender,
|
|
||||||
EventArgs e)
|
|
||||||
{
|
|
||||||
var form = DependencyManager.Instance.Resolve<FormReportFurnitureComponents>();
|
|
||||||
|
|
||||||
form.ShowDialog();
|
|
||||||
|
|
||||||
}
|
|
||||||
private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var form = DependencyManager.Instance.Resolve<FormReportOrders>();
|
|
||||||
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ClientsMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var form = DependencyManager.Instance.Resolve<FormClients>();
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ImplementersToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var form = DependencyManager.Instance.Resolve<FormImplementers>();
|
|
||||||
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void doWorkToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
_workModeling.DoWork((
|
|
||||||
DependencyManager.Instance.Resolve<IImplementerLogic>() as IImplementerLogic)!,
|
|
||||||
_orderLogic);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void mailToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var form = DependencyManager.Instance.Resolve<FormMail>();
|
|
||||||
form.ShowDialog();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CreateBackUpToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (_backUpLogic != null)
|
|
||||||
{
|
|
||||||
var fbd = new FolderBrowserDialog();
|
|
||||||
if (fbd.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
_backUpLogic.CreateBackUp(new BackUpSaveBinidngModel
|
|
||||||
{
|
|
||||||
FolderName = fbd.SelectedPath
|
|
||||||
});
|
|
||||||
MessageBox.Show("Бекап создан", "Сообщение",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
<root>
|
|
||||||
<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>
|
|
||||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>17, 17</value>
|
|
||||||
</metadata>
|
|
||||||
</root>
|
|
@ -1,104 +0,0 @@
|
|||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
partial class FormReportFurnitureComponents
|
|
||||||
{
|
|
||||||
/// <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.ButtonSaveToExcel = new System.Windows.Forms.Button();
|
|
||||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
|
||||||
this.Component = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
|
||||||
this.Furniture = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
|
||||||
this.Count = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// ButtonSaveToExcel
|
|
||||||
//
|
|
||||||
this.ButtonSaveToExcel.Location = new System.Drawing.Point(12, 31);
|
|
||||||
this.ButtonSaveToExcel.Name = "ButtonSaveToExcel";
|
|
||||||
this.ButtonSaveToExcel.Size = new System.Drawing.Size(166, 27);
|
|
||||||
this.ButtonSaveToExcel.TabIndex = 0;
|
|
||||||
this.ButtonSaveToExcel.Text = "Сохранить в Excel";
|
|
||||||
this.ButtonSaveToExcel.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonSaveToExcel.Click += new System.EventHandler(this.ButtonSaveToExcel_Click);
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
|
||||||
this.Component,
|
|
||||||
this.Furniture,
|
|
||||||
this.Count});
|
|
||||||
this.dataGridView.Location = new System.Drawing.Point(12, 80);
|
|
||||||
this.dataGridView.Name = "dataGridView";
|
|
||||||
this.dataGridView.RowTemplate.Height = 25;
|
|
||||||
this.dataGridView.Size = new System.Drawing.Size(600, 358);
|
|
||||||
this.dataGridView.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// Component
|
|
||||||
//
|
|
||||||
this.Component.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
this.Component.HeaderText = "Компонент";
|
|
||||||
this.Component.Name = "Component";
|
|
||||||
//
|
|
||||||
// Furniture
|
|
||||||
//
|
|
||||||
this.Furniture.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
this.Furniture.HeaderText = "Изделие";
|
|
||||||
this.Furniture.Name = "Furniture";
|
|
||||||
//
|
|
||||||
// Count
|
|
||||||
//
|
|
||||||
this.Count.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader;
|
|
||||||
this.Count.HeaderText = "Количество";
|
|
||||||
this.Count.Name = "Count";
|
|
||||||
this.Count.Width = 97;
|
|
||||||
//
|
|
||||||
// FormReportFurnitureComponents
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(627, 450);
|
|
||||||
this.Controls.Add(this.dataGridView);
|
|
||||||
this.Controls.Add(this.ButtonSaveToExcel);
|
|
||||||
this.Name = "FormReportFurnitureComponents";
|
|
||||||
this.Text = "Компоненты по изделиям";
|
|
||||||
this.Load += new System.EventHandler(this.FormReportProductComponents_Load);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Button ButtonSaveToExcel;
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
private DataGridViewTextBoxColumn Component;
|
|
||||||
private DataGridViewTextBoxColumn Furniture;
|
|
||||||
private DataGridViewTextBoxColumn Count;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,81 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
public partial class FormReportFurnitureComponents : Form
|
|
||||||
{
|
|
||||||
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IReportLogic _logic;
|
|
||||||
|
|
||||||
public FormReportFurnitureComponents(ILogger<FormReportFurnitureComponents> logger, IReportLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void FormReportProductComponents_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var dict = _logic.GetFurnitureComponent();
|
|
||||||
if (dict != null)
|
|
||||||
{
|
|
||||||
dataGridView.Rows.Clear();
|
|
||||||
foreach (var elem in dict)
|
|
||||||
{
|
|
||||||
dataGridView.Rows.Add(new object[] { elem.FurnitureName, "", "" });
|
|
||||||
foreach (var listElem in elem.Components)
|
|
||||||
{
|
|
||||||
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
|
|
||||||
}
|
|
||||||
dataGridView.Rows.Add(new object[] { "Итого", "", elem.TotalCount });
|
|
||||||
dataGridView.Rows.Add(Array.Empty<object>());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Загрузка списка изделий по компонентам");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки списка изделий по компонентам");
|
|
||||||
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonSaveToExcel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
using var dialog = new SaveFileDialog
|
|
||||||
{
|
|
||||||
Filter = "xlsx|*.xlsx"
|
|
||||||
};
|
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_logic.SaveFurnitureComponentToExcelFile(new
|
|
||||||
ReportBindingModel
|
|
||||||
{
|
|
||||||
FileName = dialog.FileName
|
|
||||||
});
|
|
||||||
_logger.LogInformation("Сохранение списка изделий по компонентам");
|
|
||||||
|
|
||||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка сохранения списка изделий по компонентам");
|
|
||||||
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,78 +0,0 @@
|
|||||||
<root>
|
|
||||||
<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>
|
|
||||||
<metadata name="Component.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="Furniture.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="Component.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="Furniture.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
</root>
|
|
@ -1,153 +0,0 @@
|
|||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
partial class FormReportOrders
|
|
||||||
{
|
|
||||||
/// <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.panel = new System.Windows.Forms.Panel();
|
|
||||||
this.buttonToPdf = new System.Windows.Forms.Button();
|
|
||||||
this.buttonMake = new System.Windows.Forms.Button();
|
|
||||||
this.dateTimePickerTo = new System.Windows.Forms.DateTimePicker();
|
|
||||||
this.labelTo = new System.Windows.Forms.Label();
|
|
||||||
this.dateTimePickerFrom = new System.Windows.Forms.DateTimePicker();
|
|
||||||
this.labelFrom = new System.Windows.Forms.Label();
|
|
||||||
this.button1 = new System.Windows.Forms.Button();
|
|
||||||
this.panel.SuspendLayout();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// panel
|
|
||||||
//
|
|
||||||
this.panel.Controls.Add(this.button1);
|
|
||||||
this.panel.Controls.Add(this.buttonToPdf);
|
|
||||||
this.panel.Controls.Add(this.buttonMake);
|
|
||||||
this.panel.Controls.Add(this.dateTimePickerTo);
|
|
||||||
this.panel.Controls.Add(this.labelTo);
|
|
||||||
this.panel.Controls.Add(this.dateTimePickerFrom);
|
|
||||||
this.panel.Controls.Add(this.labelFrom);
|
|
||||||
this.panel.Dock = System.Windows.Forms.DockStyle.Top;
|
|
||||||
this.panel.Location = new System.Drawing.Point(0, 0);
|
|
||||||
this.panel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
|
||||||
this.panel.Name = "panel";
|
|
||||||
this.panel.Size = new System.Drawing.Size(987, 40);
|
|
||||||
this.panel.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// buttonToPdf
|
|
||||||
//
|
|
||||||
this.buttonToPdf.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonToPdf.Location = new System.Drawing.Point(1665, 8);
|
|
||||||
this.buttonToPdf.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
|
||||||
this.buttonToPdf.Name = "buttonToPdf";
|
|
||||||
this.buttonToPdf.Size = new System.Drawing.Size(139, 27);
|
|
||||||
this.buttonToPdf.TabIndex = 5;
|
|
||||||
this.buttonToPdf.Text = "В Pdf";
|
|
||||||
this.buttonToPdf.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// buttonMake
|
|
||||||
//
|
|
||||||
this.buttonMake.Location = new System.Drawing.Point(476, 8);
|
|
||||||
this.buttonMake.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
|
||||||
this.buttonMake.Name = "buttonMake";
|
|
||||||
this.buttonMake.Size = new System.Drawing.Size(139, 27);
|
|
||||||
this.buttonMake.TabIndex = 4;
|
|
||||||
this.buttonMake.Text = "Сформировать";
|
|
||||||
this.buttonMake.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonMake.Click += new System.EventHandler(this.buttonMake_Click);
|
|
||||||
//
|
|
||||||
// dateTimePickerTo
|
|
||||||
//
|
|
||||||
this.dateTimePickerTo.Location = new System.Drawing.Point(237, 7);
|
|
||||||
this.dateTimePickerTo.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
|
||||||
this.dateTimePickerTo.Name = "dateTimePickerTo";
|
|
||||||
this.dateTimePickerTo.Size = new System.Drawing.Size(163, 23);
|
|
||||||
this.dateTimePickerTo.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// labelTo
|
|
||||||
//
|
|
||||||
this.labelTo.AutoSize = true;
|
|
||||||
this.labelTo.Location = new System.Drawing.Point(208, 10);
|
|
||||||
this.labelTo.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
|
||||||
this.labelTo.Name = "labelTo";
|
|
||||||
this.labelTo.Size = new System.Drawing.Size(21, 15);
|
|
||||||
this.labelTo.TabIndex = 2;
|
|
||||||
this.labelTo.Text = "по";
|
|
||||||
//
|
|
||||||
// dateTimePickerFrom
|
|
||||||
//
|
|
||||||
this.dateTimePickerFrom.Location = new System.Drawing.Point(37, 7);
|
|
||||||
this.dateTimePickerFrom.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
|
||||||
this.dateTimePickerFrom.Name = "dateTimePickerFrom";
|
|
||||||
this.dateTimePickerFrom.Size = new System.Drawing.Size(163, 23);
|
|
||||||
this.dateTimePickerFrom.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// labelFrom
|
|
||||||
//
|
|
||||||
this.labelFrom.AutoSize = true;
|
|
||||||
this.labelFrom.Location = new System.Drawing.Point(14, 10);
|
|
||||||
this.labelFrom.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
|
||||||
this.labelFrom.Name = "labelFrom";
|
|
||||||
this.labelFrom.Size = new System.Drawing.Size(15, 15);
|
|
||||||
this.labelFrom.TabIndex = 0;
|
|
||||||
this.labelFrom.Text = "С";
|
|
||||||
//
|
|
||||||
// button1
|
|
||||||
//
|
|
||||||
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.button1.Location = new System.Drawing.Point(777, 8);
|
|
||||||
this.button1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
|
||||||
this.button1.Name = "button1";
|
|
||||||
this.button1.Size = new System.Drawing.Size(139, 27);
|
|
||||||
this.button1.TabIndex = 6;
|
|
||||||
this.button1.Text = "В Pdf";
|
|
||||||
this.button1.UseVisualStyleBackColor = true;
|
|
||||||
this.button1.Click += new System.EventHandler(this.ButtonToPdf_Click);
|
|
||||||
//
|
|
||||||
// FormReportOrders
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(987, 596);
|
|
||||||
this.Controls.Add(this.panel);
|
|
||||||
this.Name = "FormReportOrders";
|
|
||||||
this.Text = "Заказы";
|
|
||||||
this.panel.ResumeLayout(false);
|
|
||||||
this.panel.PerformLayout();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Panel panel;
|
|
||||||
private Button button1;
|
|
||||||
private Button buttonToPdf;
|
|
||||||
private Button buttonMake;
|
|
||||||
private DateTimePicker dateTimePickerTo;
|
|
||||||
private Label labelTo;
|
|
||||||
private DateTimePicker dateTimePickerFrom;
|
|
||||||
private Label labelFrom;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,100 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Microsoft.Reporting.WinForms;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace FurnitureAssembly
|
|
||||||
{
|
|
||||||
public partial class FormReportOrders : Form
|
|
||||||
{
|
|
||||||
private readonly ReportViewer reportViewer;
|
|
||||||
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
|
|
||||||
private readonly IReportLogic _logic;
|
|
||||||
|
|
||||||
public FormReportOrders(ILogger<FormReportOrders> logger, IReportLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
reportViewer = new ReportViewer
|
|
||||||
{
|
|
||||||
Dock = DockStyle.Fill
|
|
||||||
};
|
|
||||||
reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrders.rdlc", FileMode.Open));
|
|
||||||
Controls.Clear();
|
|
||||||
Controls.Add(reportViewer);
|
|
||||||
Controls.Add(panel);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonMake_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var dataSource = _logic.GetOrders(new ReportBindingModel
|
|
||||||
{
|
|
||||||
DateFrom = dateTimePickerFrom.Value,
|
|
||||||
DateTo = dateTimePickerTo.Value
|
|
||||||
});
|
|
||||||
var source = new ReportDataSource("DataSetOrders", dataSource);
|
|
||||||
reportViewer.LocalReport.DataSources.Clear();
|
|
||||||
reportViewer.LocalReport.DataSources.Add(source);
|
|
||||||
var parameters = new[] { new ReportParameter("ReportParameterPeriod",
|
|
||||||
$"c {dateTimePickerFrom.Value.ToShortDateString()} по {dateTimePickerTo.Value.ToShortDateString()}") };
|
|
||||||
reportViewer.LocalReport.SetParameters(parameters);
|
|
||||||
|
|
||||||
reportViewer.RefreshReport();
|
|
||||||
_logger.LogInformation("Загрузка списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки списка заказов на период");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonToPdf_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" };
|
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_logic.SaveOrdersToPdfFile(new ReportBindingModel
|
|
||||||
{
|
|
||||||
FileName = dialog.FileName,
|
|
||||||
DateFrom = dateTimePickerFrom.Value,
|
|
||||||
DateTo = dateTimePickerTo.Value
|
|
||||||
});
|
|
||||||
_logger.LogInformation("Сохранение списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
|
|
||||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка сохранения списка заказов на период");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<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>
|
|
@ -8,42 +8,4 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Remove="nlog.config" />
|
|
||||||
<None Remove="ReportOrders.rdlc" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedResource Include="nlog.config">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<EmbeddedResource Include="ReportOrders.rdlc">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</EmbeddedResource>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.3">
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
|
|
||||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.1" />
|
|
||||||
<PackageReference Include="ReportViewerCore.WinForms" Version="15.1.17" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\FurnitureAssemblyBusinessLogic\FurnitureAssemblyBusinessLogic.csproj" />
|
|
||||||
<ProjectReference Include="..\FurnitureAssemblyContracts\FurnitureAssemblyContracts.csproj" />
|
|
||||||
<ProjectReference Include="..\FurnitureAssemblyDatabaseImplement\FurnitureAssemblyDatabaseImplement.csproj" />
|
|
||||||
<ProjectReference Include="..\FurnitureAssemblyListImplement\FurnitureAssemblyListImplement.csproj" />
|
|
||||||
<ProjectReference Include="..\FurnitureAssemFileImplement\FurnitureAssemFileImplement.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Properties\" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
@ -1,13 +1,3 @@
|
|||||||
using FurnitureAssemblyBusinessLogic;
|
|
||||||
using FurnitureAssemblyBusinessLogic.OfficePackage.Implements;
|
|
||||||
using FurnitureAssemblyBusinessLogic.OfficePackage;
|
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using NLog.Extensions.Logging;
|
|
||||||
using FurnitureAssemblyBusinessLogic.MailWorker;
|
|
||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.DI;
|
|
||||||
|
|
||||||
namespace FurnitureAssembly
|
namespace FurnitureAssembly
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
@ -21,83 +11,7 @@ namespace FurnitureAssembly
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
InitDependency();
|
Application.Run(new Form1());
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var mailSender = DependencyManager.Instance.Resolve<AbstractMailWorker>();
|
|
||||||
mailSender?.MailConfig(new MailConfigBindingModel
|
|
||||||
{
|
|
||||||
MailLogin =
|
|
||||||
System.Configuration.ConfigurationManager.AppSettings["MailLogin"] ??
|
|
||||||
string.Empty,
|
|
||||||
MailPassword =
|
|
||||||
System.Configuration.ConfigurationManager.AppSettings["MailPassword"] ??
|
|
||||||
string.Empty,
|
|
||||||
SmtpClientHost =
|
|
||||||
System.Configuration.ConfigurationManager.AppSettings["SmtpClientHost"] ??
|
|
||||||
string.Empty,
|
|
||||||
SmtpClientPort =
|
|
||||||
Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["SmtpClientPort"]),
|
|
||||||
PopHost = System.Configuration.ConfigurationManager.AppSettings["PopHost"] ?? string.Empty,
|
|
||||||
PopPort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["PopPort"])
|
|
||||||
});
|
|
||||||
// ñîçäàåì òàéìåð
|
|
||||||
var timer = new System.Threading.Timer(new
|
|
||||||
TimerCallback(MailCheck!), null, 0, 100000);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var logger = DependencyManager.Instance.Resolve<ILogger>();
|
|
||||||
logger?.LogError(ex, "Îøèáêà ðàáîòû ñ ïî÷òîé");
|
|
||||||
}
|
|
||||||
Application.Run(DependencyManager.Instance.Resolve<FormMain>());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static void InitDependency()
|
|
||||||
{
|
|
||||||
DependencyManager.InitDependency();
|
|
||||||
|
|
||||||
DependencyManager.Instance.AddLogging(option =>
|
|
||||||
{
|
|
||||||
option.SetMinimumLevel(LogLevel.Information);
|
|
||||||
option.AddNLog("nlog.config");
|
|
||||||
});
|
|
||||||
|
|
||||||
DependencyManager.Instance.RegisterType<IComponentLogic, ComponentLogic>();
|
|
||||||
DependencyManager.Instance.RegisterType<IOrderLogic, OrderLogic>();
|
|
||||||
DependencyManager.Instance.RegisterType<IFurnitureLogic, FurnitureLogic>();
|
|
||||||
DependencyManager.Instance.RegisterType<IReportLogic, ReportLogic>();
|
|
||||||
DependencyManager.Instance.RegisterType<IClientLogic, ClientLogic>();
|
|
||||||
DependencyManager.Instance.RegisterType<IImplementerLogic, ImplementerLogic>();
|
|
||||||
DependencyManager.Instance.RegisterType<IMessageInfoLogic, MessageInfoLogic>();
|
|
||||||
DependencyManager.Instance.RegisterType<IWorkProcess, WorkModeling>();
|
|
||||||
DependencyManager.Instance.RegisterType<IBackUpLogic, BackUpLogic>();
|
|
||||||
|
|
||||||
DependencyManager.Instance.RegisterType<AbstractMailWorker, MailKitWorker>(true);
|
|
||||||
|
|
||||||
DependencyManager.Instance.RegisterType<AbstractSaveToExcel, SaveToExcel>();
|
|
||||||
DependencyManager.Instance.RegisterType<AbstractSaveToWord, SaveToWord>();
|
|
||||||
DependencyManager.Instance.RegisterType<AbstractSaveToPdf, SaveToPdf>();
|
|
||||||
|
|
||||||
DependencyManager.Instance.RegisterType<FormMain>();
|
|
||||||
DependencyManager.Instance.RegisterType<FormComponent>();
|
|
||||||
DependencyManager.Instance.RegisterType<FormComponents>();
|
|
||||||
DependencyManager.Instance.RegisterType<FormCreateOrder>();
|
|
||||||
DependencyManager.Instance.RegisterType<FormFurniture>();
|
|
||||||
DependencyManager.Instance.RegisterType<FormFurnitureComponent>();
|
|
||||||
DependencyManager.Instance.RegisterType<FormFurnitures>();
|
|
||||||
DependencyManager.Instance.RegisterType<FormReportFurnitureComponents>();
|
|
||||||
DependencyManager.Instance.RegisterType<FormReportOrders>();
|
|
||||||
DependencyManager.Instance.RegisterType<FormClients>();
|
|
||||||
DependencyManager.Instance.RegisterType<FormImplementers>();
|
|
||||||
DependencyManager.Instance.RegisterType<FormImplementer>();
|
|
||||||
DependencyManager.Instance.RegisterType<FormMail>();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void MailCheck(object obj) => DependencyManager.Instance.Resolve<AbstractMailWorker>()?.MailCheck();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,600 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
|
|
||||||
<AutoRefresh>0</AutoRefresh>
|
|
||||||
<DataSources>
|
|
||||||
<DataSource Name="FurnitureAssemblyContractsViewModels">
|
|
||||||
<ConnectionProperties>
|
|
||||||
<DataProvider>System.Data.DataSet</DataProvider>
|
|
||||||
<ConnectString>/* Local Connection */</ConnectString>
|
|
||||||
</ConnectionProperties>
|
|
||||||
<rd:DataSourceID>10791c83-cee8-4a38-bbd0-245fc17cefb3</rd:DataSourceID>
|
|
||||||
</DataSource>
|
|
||||||
</DataSources>
|
|
||||||
<DataSets>
|
|
||||||
<DataSet Name="DataSetOrders">
|
|
||||||
<Query>
|
|
||||||
<DataSourceName>FurnitureAssemblyContractsViewModels</DataSourceName>
|
|
||||||
<CommandText>/* Local Query */</CommandText>
|
|
||||||
</Query>
|
|
||||||
<Fields>
|
|
||||||
<Field Name="Id">
|
|
||||||
<DataField>Id</DataField>
|
|
||||||
<rd:TypeName>System.Int32</rd:TypeName>
|
|
||||||
</Field>
|
|
||||||
<Field Name="DateCreate">
|
|
||||||
<DataField>DateCreate</DataField>
|
|
||||||
<rd:TypeName>System.DateTime</rd:TypeName>
|
|
||||||
</Field>
|
|
||||||
<Field Name="FurnitureName">
|
|
||||||
<DataField>FurnitureName</DataField>
|
|
||||||
<rd:TypeName>System.String</rd:TypeName>
|
|
||||||
</Field>
|
|
||||||
<Field Name="Sum">
|
|
||||||
<DataField>Sum</DataField>
|
|
||||||
<rd:TypeName>System.Decimal</rd:TypeName>
|
|
||||||
</Field>
|
|
||||||
<Field Name="OrderStatus">
|
|
||||||
<DataField>OrderStatus</DataField>
|
|
||||||
<rd:TypeName>FurnitureAssemblyDataModels.OrderStatus</rd:TypeName>
|
|
||||||
</Field>
|
|
||||||
</Fields>
|
|
||||||
<rd:DataSetInfo>
|
|
||||||
<rd:DataSetName>FurnitureAssemblyContracts.ViewModels</rd:DataSetName>
|
|
||||||
<rd:TableName>ReportOrdersViewModel</rd:TableName>
|
|
||||||
<rd:ObjectDataSourceType>FurnitureAssemblyContracts.ViewModels.ReportOrdersViewModel, ConfectioneryContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
|
|
||||||
</rd:DataSetInfo>
|
|
||||||
</DataSet>
|
|
||||||
</DataSets>
|
|
||||||
<ReportSections>
|
|
||||||
<ReportSection>
|
|
||||||
<Body>
|
|
||||||
<ReportItems>
|
|
||||||
<Textbox Name="ReportParameterPeriod">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Parameters!ReportParameterPeriod.Value</Value>
|
|
||||||
<Style>
|
|
||||||
<FontSize>14pt</FontSize>
|
|
||||||
<FontWeight>Bold</FontWeight>
|
|
||||||
</Style>
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style>
|
|
||||||
<TextAlign>Center</TextAlign>
|
|
||||||
</Style>
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>ReportParameterPeriod</rd:DefaultName>
|
|
||||||
<Top>1cm</Top>
|
|
||||||
<Height>1cm</Height>
|
|
||||||
<Width>21cm</Width>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Style>None</Style>
|
|
||||||
</Border>
|
|
||||||
<VerticalAlign>Middle</VerticalAlign>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
<Textbox Name="TextboxTitle">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Заказы</Value>
|
|
||||||
<Style>
|
|
||||||
<FontSize>16pt</FontSize>
|
|
||||||
<FontWeight>Bold</FontWeight>
|
|
||||||
</Style>
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style>
|
|
||||||
<TextAlign>Center</TextAlign>
|
|
||||||
</Style>
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<Height>1cm</Height>
|
|
||||||
<Width>21cm</Width>
|
|
||||||
<ZIndex>1</ZIndex>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Style>None</Style>
|
|
||||||
</Border>
|
|
||||||
<VerticalAlign>Middle</VerticalAlign>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
<Tablix Name="Tablix1">
|
|
||||||
<TablixBody>
|
|
||||||
<TablixColumns>
|
|
||||||
<TablixColumn>
|
|
||||||
<Width>2.5cm</Width>
|
|
||||||
</TablixColumn>
|
|
||||||
<TablixColumn>
|
|
||||||
<Width>3.21438cm</Width>
|
|
||||||
</TablixColumn>
|
|
||||||
<TablixColumn>
|
|
||||||
<Width>8.23317cm</Width>
|
|
||||||
</TablixColumn>
|
|
||||||
<TablixColumn>
|
|
||||||
<Width>3.02917cm</Width>
|
|
||||||
</TablixColumn>
|
|
||||||
<TablixColumn>
|
|
||||||
<Width>2.87042cm</Width>
|
|
||||||
</TablixColumn>
|
|
||||||
</TablixColumns>
|
|
||||||
<TablixRows>
|
|
||||||
<TablixRow>
|
|
||||||
<Height>0.6cm</Height>
|
|
||||||
<TablixCells>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="Textbox5">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Номер</Value>
|
|
||||||
<Style>
|
|
||||||
<FontWeight>Bold</FontWeight>
|
|
||||||
</Style>
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>Textbox5</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="Textbox1">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Дата создания</Value>
|
|
||||||
<Style>
|
|
||||||
<FontWeight>Bold</FontWeight>
|
|
||||||
</Style>
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>Textbox1</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="Textbox3">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Изделие</Value>
|
|
||||||
<Style>
|
|
||||||
<FontWeight>Bold</FontWeight>
|
|
||||||
</Style>
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>Textbox3</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="Textbox2">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Статус заказа</Value>
|
|
||||||
<Style>
|
|
||||||
<FontWeight>Bold</FontWeight>
|
|
||||||
</Style>
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>Textbox2</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="Textbox7">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Сумма</Value>
|
|
||||||
<Style>
|
|
||||||
<FontWeight>Bold</FontWeight>
|
|
||||||
</Style>
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>Textbox7</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
</TablixCells>
|
|
||||||
</TablixRow>
|
|
||||||
<TablixRow>
|
|
||||||
<Height>0.6cm</Height>
|
|
||||||
<TablixCells>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="Id">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Fields!Id.Value</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>Id</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="DateCreate">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Fields!DateCreate.Value</Value>
|
|
||||||
<Style>
|
|
||||||
<Format>d</Format>
|
|
||||||
</Style>
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>DateCreate</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="FurnitureName">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Fields!FurnitureName.Value</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>FurnitureName</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="OrderStatus">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Fields!OrderStatus.Value</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>OrderStatus</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
<rd:Selected>true</rd:Selected>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="Sum">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Fields!Sum.Value</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>Sum</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
</TablixCells>
|
|
||||||
</TablixRow>
|
|
||||||
</TablixRows>
|
|
||||||
</TablixBody>
|
|
||||||
<TablixColumnHierarchy>
|
|
||||||
<TablixMembers>
|
|
||||||
<TablixMember />
|
|
||||||
<TablixMember />
|
|
||||||
<TablixMember />
|
|
||||||
<TablixMember />
|
|
||||||
<TablixMember />
|
|
||||||
</TablixMembers>
|
|
||||||
</TablixColumnHierarchy>
|
|
||||||
<TablixRowHierarchy>
|
|
||||||
<TablixMembers>
|
|
||||||
<TablixMember>
|
|
||||||
<KeepWithGroup>After</KeepWithGroup>
|
|
||||||
</TablixMember>
|
|
||||||
<TablixMember>
|
|
||||||
<Group Name="Подробности" />
|
|
||||||
</TablixMember>
|
|
||||||
</TablixMembers>
|
|
||||||
</TablixRowHierarchy>
|
|
||||||
<DataSetName>DataSetOrders</DataSetName>
|
|
||||||
<Top>2.48391cm</Top>
|
|
||||||
<Left>0.55245cm</Left>
|
|
||||||
<Height>1.2cm</Height>
|
|
||||||
<Width>19.84713cm</Width>
|
|
||||||
<ZIndex>2</ZIndex>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Style>Double</Style>
|
|
||||||
</Border>
|
|
||||||
</Style>
|
|
||||||
</Tablix>
|
|
||||||
<Textbox Name="TextboxTotalSum">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Итого:</Value>
|
|
||||||
<Style>
|
|
||||||
<FontWeight>Bold</FontWeight>
|
|
||||||
</Style>
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style>
|
|
||||||
<TextAlign>Right</TextAlign>
|
|
||||||
</Style>
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<Top>4cm</Top>
|
|
||||||
<Left>15.39958cm</Left>
|
|
||||||
<Height>0.6cm</Height>
|
|
||||||
<Width>2.5cm</Width>
|
|
||||||
<ZIndex>3</ZIndex>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Style>None</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
<Textbox Name="SumTotal">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Sum(Fields!Sum.Value, "DataSetOrders")</Value>
|
|
||||||
<Style>
|
|
||||||
<FontWeight>Bold</FontWeight>
|
|
||||||
</Style>
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style>
|
|
||||||
<TextAlign>Right</TextAlign>
|
|
||||||
</Style>
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<Top>4cm</Top>
|
|
||||||
<Left>17.89958cm</Left>
|
|
||||||
<Height>0.6cm</Height>
|
|
||||||
<Width>2.5cm</Width>
|
|
||||||
<ZIndex>4</ZIndex>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Style>None</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</ReportItems>
|
|
||||||
<Height>5.72875cm</Height>
|
|
||||||
<Style />
|
|
||||||
</Body>
|
|
||||||
<Width>21cm</Width>
|
|
||||||
<Page>
|
|
||||||
<PageHeight>29.7cm</PageHeight>
|
|
||||||
<PageWidth>21cm</PageWidth>
|
|
||||||
<LeftMargin>2cm</LeftMargin>
|
|
||||||
<RightMargin>2cm</RightMargin>
|
|
||||||
<TopMargin>2cm</TopMargin>
|
|
||||||
<BottomMargin>2cm</BottomMargin>
|
|
||||||
<ColumnSpacing>0.13cm</ColumnSpacing>
|
|
||||||
<Style />
|
|
||||||
</Page>
|
|
||||||
</ReportSection>
|
|
||||||
</ReportSections>
|
|
||||||
<ReportParameters>
|
|
||||||
<ReportParameter Name="ReportParameterPeriod">
|
|
||||||
<DataType>String</DataType>
|
|
||||||
<Nullable>true</Nullable>
|
|
||||||
<Prompt>ReportParameter1</Prompt>
|
|
||||||
</ReportParameter>
|
|
||||||
</ReportParameters>
|
|
||||||
<ReportParametersLayout>
|
|
||||||
<GridLayoutDefinition>
|
|
||||||
<NumberOfColumns>4</NumberOfColumns>
|
|
||||||
<NumberOfRows>2</NumberOfRows>
|
|
||||||
<CellDefinitions>
|
|
||||||
<CellDefinition>
|
|
||||||
<ColumnIndex>0</ColumnIndex>
|
|
||||||
<RowIndex>0</RowIndex>
|
|
||||||
<ParameterName>ReportParameterPeriod</ParameterName>
|
|
||||||
</CellDefinition>
|
|
||||||
</CellDefinitions>
|
|
||||||
</GridLayoutDefinition>
|
|
||||||
</ReportParametersLayout>
|
|
||||||
<rd:ReportUnitType>Cm</rd:ReportUnitType>
|
|
||||||
<rd:ReportID>2de0031a-4d17-449d-922d-d9fc54572312</rd:ReportID>
|
|
||||||
</Report>
|
|
@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<configuration>
|
|
||||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
autoReload="true" internalLogLevel="Info">
|
|
||||||
<targets>
|
|
||||||
<target xsi:type="File" name="tofile" fileName="log-${shortdate}.log" />
|
|
||||||
</targets>
|
|
||||||
<rules>
|
|
||||||
<logger name="*" minlevel="Debug" writeTo="tofile" />
|
|
||||||
</rules>
|
|
||||||
</nlog>
|
|
||||||
</configuration>
|
|
@ -1,97 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
|
||||||
using FurnitureAssemblyContracts.StoragesContracts;
|
|
||||||
using FurnitureAssemblyDataModels;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System.IO.Compression;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Runtime.Serialization.Json;
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic
|
|
||||||
{
|
|
||||||
public class BackUpLogic : IBackUpLogic
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IBackUpInfo _backUpInfo;
|
|
||||||
public BackUpLogic(ILogger<BackUpLogic> logger, IBackUpInfo backUpInfo)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_backUpInfo = backUpInfo;
|
|
||||||
}
|
|
||||||
public void CreateBackUp(BackUpSaveBinidngModel model)
|
|
||||||
{
|
|
||||||
if (_backUpInfo == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_logger.LogDebug("Clear folder");
|
|
||||||
// зачистка папки и удаление старого архива
|
|
||||||
var dirInfo = new DirectoryInfo(model.FolderName);
|
|
||||||
if (dirInfo.Exists)
|
|
||||||
{
|
|
||||||
foreach (var file in dirInfo.GetFiles())
|
|
||||||
{
|
|
||||||
file.Delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_logger.LogDebug("Delete archive");
|
|
||||||
string fileName = $"{model.FolderName}.zip";
|
|
||||||
if (File.Exists(fileName))
|
|
||||||
{
|
|
||||||
File.Delete(fileName);
|
|
||||||
}
|
|
||||||
// берем метод для сохранения
|
|
||||||
_logger.LogDebug("Get assembly");
|
|
||||||
var typeIId = typeof(IId);
|
|
||||||
var assembly = typeIId.Assembly;
|
|
||||||
if (assembly == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Сборка не найдена",
|
|
||||||
nameof(assembly));
|
|
||||||
}
|
|
||||||
var types = assembly.GetTypes();
|
|
||||||
var method = GetType().GetMethod("SaveToFile", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
||||||
_logger.LogDebug("Find {count} types", types.Length);
|
|
||||||
foreach (var type in types)
|
|
||||||
{
|
|
||||||
if (type.IsInterface && type.GetInterface(typeIId.Name) != null)
|
|
||||||
{
|
|
||||||
var modelType = _backUpInfo.GetTypeByModelInterface(type.Name);
|
|
||||||
if (modelType == null)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException($"Не найден класс - модель для { type.Name }");
|
|
||||||
}
|
|
||||||
_logger.LogDebug("Call SaveToFile method for {name} type", type.Name);
|
|
||||||
// вызываем метод на выполнение
|
|
||||||
method?.MakeGenericMethod(modelType).Invoke(this, new
|
|
||||||
object[] { model.FolderName });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_logger.LogDebug("Create zip and remove folder");
|
|
||||||
// архивируем
|
|
||||||
ZipFile.CreateFromDirectory(model.FolderName, fileName);
|
|
||||||
// удаляем папку
|
|
||||||
dirInfo.Delete(true);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void SaveToFile<T>(string folderName) where T : class, new()
|
|
||||||
{
|
|
||||||
var records = _backUpInfo.GetList<T>();
|
|
||||||
if (records == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("{type} type get null list", typeof(T).Name);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var jsonFormatter = new DataContractJsonSerializer(typeof(List<T>));
|
|
||||||
using var fs = new FileStream(string.Format("{0}/{1}.json",
|
|
||||||
folderName, typeof(T).Name), FileMode.OpenOrCreate);
|
|
||||||
jsonFormatter.WriteObject(fs, records);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,135 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
|
||||||
using FurnitureAssemblyContracts.SearchModels;
|
|
||||||
using FurnitureAssemblyContracts.StoragesContracts;
|
|
||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic
|
|
||||||
{
|
|
||||||
public class ClientLogic : IClientLogic
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IClientStorage _clientStorage;
|
|
||||||
|
|
||||||
public ClientLogic(ILogger<ClientLogic> logger, IClientStorage clientStorage)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_clientStorage = clientStorage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Create(ClientBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (_clientStorage.Insert(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Insert operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Delete(ClientBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model, false);
|
|
||||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
|
||||||
if (_clientStorage.Delete(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Delete operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ClientViewModel? ReadElement(ClientSearchModel model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement. Email: {Email} Id:{ Id}", model.Email, model.Id);
|
|
||||||
var element = _clientStorage.GetElement(model);
|
|
||||||
if (element == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadElement element not found");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ClientViewModel>? ReadList(ClientSearchModel? model)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("ReadList. Email: {Email}. Id:{ Id}", model?.Email, model?.Id);
|
|
||||||
var list = model == null ? _clientStorage.GetFullList() : _clientStorage.GetFilteredList(model);
|
|
||||||
if (list == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadList return null list");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Update(ClientBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (_clientStorage.Update(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Update operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CheckModel(ClientBindingModel model, bool withParams = true)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
if (!withParams)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(model.ClientFIO))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет ФИО пользователя",
|
|
||||||
nameof(model.ClientFIO));
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(model.Email))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет почтового адреса пользователя",
|
|
||||||
nameof(model.Email));
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(model.Password))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет пароля пользователя",
|
|
||||||
nameof(model.Password));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Regex.IsMatch(model.Email, @"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,})+)$"))
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Некорректно введена почта клиента", nameof(model.Email));
|
|
||||||
}
|
|
||||||
if (!Regex.IsMatch(model.Password, @"^((\w+\d+\W+)|(\w+\W+\d+)|(\d+\w+\W+)|(\d+\W+\w+)|(\W+\w+\d+)|(\W+\d+\w+))[\w\d\W]*$"))
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Некорректно введен пароль клиента", nameof(model.Password));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_logger.LogInformation("Component. ClientFIO:{ClientFIO}. Email:{ Email}. Id: { Id}", model.ClientFIO, model.Email, model.Id);
|
|
||||||
var element = _clientStorage.GetElement(new ClientSearchModel { Email = model.Email });
|
|
||||||
if (element != null && element.Id != model.Id)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("Пользователь с таким логином уже есть");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,113 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
|
||||||
using FurnitureAssemblyContracts.SearchModels;
|
|
||||||
using FurnitureAssemblyContracts.StoragesContracts;
|
|
||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic
|
|
||||||
{
|
|
||||||
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("ReadElement 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 ArgumentNullException("Цена компонента должна быть больше 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,23 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="DocumentFormat.OpenXml" Version="2.19.0" />
|
|
||||||
<PackageReference Include="MailKit" Version="4.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
|
|
||||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.1" />
|
|
||||||
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\FurnitureAssemblyContracts\FurnitureAssemblyContracts.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
@ -1,115 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
|
||||||
using FurnitureAssemblyContracts.SearchModels;
|
|
||||||
using FurnitureAssemblyContracts.StoragesContracts;
|
|
||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic
|
|
||||||
{
|
|
||||||
public class FurnitureLogic : IFurnitureLogic
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IFurnitureStorage _furnitureStorage;
|
|
||||||
public FurnitureLogic(ILogger<FurnitureLogic> logger, IFurnitureStorage furnitureStorage)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_furnitureStorage = furnitureStorage;
|
|
||||||
}
|
|
||||||
public bool Create(FurnitureBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (_furnitureStorage.Insert(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Insert operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Delete(FurnitureBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model, false);
|
|
||||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
|
||||||
if (_furnitureStorage.Delete(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Delete operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FurnitureViewModel? ReadElement(FurnitureSearchModel model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement. FurnitureName:{FurnitureName}. Id:{ Id}", model.FurnitureName, model.Id);
|
|
||||||
var element = _furnitureStorage.GetElement(model);
|
|
||||||
if (element == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadElement element not found");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<FurnitureViewModel>? ReadList(FurnitureSearchModel? model)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("ReadList. FurnitureName:{FurnitureName}. Id:{ Id}", model?.FurnitureName, model?.Id);
|
|
||||||
var list = model == null ? _furnitureStorage.GetFullList() : _furnitureStorage.GetFilteredList(model);
|
|
||||||
if (list == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadList return null list");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Update(FurnitureBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (_furnitureStorage.Update(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Update operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CheckModel(FurnitureBindingModel model, bool withParams = true)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
if (!withParams)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(model.FurnitureName))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет названия изделия",
|
|
||||||
nameof(model.FurnitureName));
|
|
||||||
}
|
|
||||||
if (model.Price <= 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Цена изделия должна быть больше 0", nameof(model.Price));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Furniture. FurnitureName:{FurnitureName}. Price:{ Price}. Id: { Id}", model.FurnitureName, model.Price, model.Id);
|
|
||||||
var element = _furnitureStorage.GetElement(new FurnitureSearchModel { FurnitureName = model.FurnitureName });
|
|
||||||
if (element != null && element.Id != model.Id)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("Изделие с таким названием уже есть");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,131 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
|
||||||
using FurnitureAssemblyContracts.SearchModels;
|
|
||||||
using FurnitureAssemblyContracts.StoragesContracts;
|
|
||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic
|
|
||||||
{
|
|
||||||
public class ImplementerLogic : IImplementerLogic
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IImplementerStorage _implementerStorage;
|
|
||||||
|
|
||||||
public ImplementerLogic(ILogger<ImplementerLogic> logger, IImplementerStorage implementerStorage)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_implementerStorage = implementerStorage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Create(ImplementerBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (_implementerStorage.Insert(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Insert operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Delete(ImplementerBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model, false);
|
|
||||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
|
||||||
if (_implementerStorage.Delete(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Delete operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ImplementerViewModel? ReadElement(ImplementerSearchModel model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement. ImplementerFIO: {ImplementerFIO} Id:{ Id}", model.ImplementerFIO, model.Id);
|
|
||||||
var element = _implementerStorage.GetElement(model);
|
|
||||||
if (element == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadElement element not found");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ImplementerViewModel>? ReadList(ImplementerSearchModel? model)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("ReadList. ImplementerFIO: {ImplementerFIO}. Id:{ Id}", model?.ImplementerFIO, model?.Id);
|
|
||||||
var list = model == null ? _implementerStorage.GetFullList() : _implementerStorage.GetFilteredList(model);
|
|
||||||
if (list == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadList return null list");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Update(ImplementerBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (_implementerStorage.Update(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Update operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CheckModel(ImplementerBindingModel model, bool withParams = true)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!withParams)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(model.ImplementerFIO))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет ФИО исполнителя",
|
|
||||||
nameof(model.ImplementerFIO));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(model.Password))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет пароля пользователя",
|
|
||||||
nameof(model.Password));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (model.WorkExperience < 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Опыт работы не должен быть отрицательным", nameof(model.WorkExperience));
|
|
||||||
}
|
|
||||||
if (model.Qualification < 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Квалификация не должна быть отрицательной", nameof(model.Qualification));
|
|
||||||
}
|
|
||||||
|
|
||||||
_logger.LogInformation("Implementer. ImplementerFIO:{ImplementerFIO}. Id: { Id}", model.ImplementerFIO, model.Id);
|
|
||||||
var element = _implementerStorage.GetElement(new ImplementerSearchModel { ImplementerFIO = model.ImplementerFIO });
|
|
||||||
if (element != null && element.Id != model.Id)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("Исполнитель с таким логином уже есть");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,81 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic.MailWorker
|
|
||||||
{
|
|
||||||
public abstract class AbstractMailWorker
|
|
||||||
{
|
|
||||||
protected string _mailLogin = string.Empty;
|
|
||||||
protected string _mailPassword = string.Empty;
|
|
||||||
protected string _smtpClientHost = string.Empty;
|
|
||||||
protected int _smtpClientPort;
|
|
||||||
protected string _popHost = string.Empty;
|
|
||||||
protected int _popPort;
|
|
||||||
private readonly IMessageInfoLogic _messageInfoLogic;
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IClientLogic _clientLogic;
|
|
||||||
public AbstractMailWorker(ILogger<AbstractMailWorker> logger,
|
|
||||||
IMessageInfoLogic messageInfoLogic,
|
|
||||||
IClientLogic clientLogic)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_messageInfoLogic = messageInfoLogic;
|
|
||||||
_clientLogic = clientLogic;
|
|
||||||
}
|
|
||||||
public void MailConfig(MailConfigBindingModel config)
|
|
||||||
{
|
|
||||||
_mailLogin = config.MailLogin;
|
|
||||||
_mailPassword = config.MailPassword;
|
|
||||||
_smtpClientHost = config.SmtpClientHost;
|
|
||||||
_smtpClientPort = config.SmtpClientPort;
|
|
||||||
_popHost = config.PopHost;
|
|
||||||
_popPort = config.PopPort;
|
|
||||||
_logger.LogDebug("Config: {login}, {password}, {clientHost},{ clientPOrt}, { popHost}, { popPort}", _mailLogin, _mailPassword, _smtpClientHost,
|
|
||||||
_smtpClientPort, _popHost, _popPort);
|
|
||||||
}
|
|
||||||
public async void MailSendAsync(MailSendInfoBindingModel info)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(_mailLogin) || string.IsNullOrEmpty(_mailPassword))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(_smtpClientHost) || _smtpClientPort == 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(info.MailAddress) ||
|
|
||||||
string.IsNullOrEmpty(info.Subject) || string.IsNullOrEmpty(info.Text))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogDebug("Send Mail: {To}, {Subject}", info.MailAddress,
|
|
||||||
info.Subject);
|
|
||||||
await SendMailAsync(info);
|
|
||||||
}
|
|
||||||
public async void MailCheck()
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(_mailLogin) || string.IsNullOrEmpty(_mailPassword))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(_popHost) || _popPort == 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (_messageInfoLogic == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var list = await ReceiveMailAsync();
|
|
||||||
_logger.LogDebug("Check Mail: {Count} new mails", list.Count);
|
|
||||||
foreach (var mail in list)
|
|
||||||
{
|
|
||||||
mail.ClientId = _clientLogic.ReadElement(new() { Email = mail.SenderName })?.Id;
|
|
||||||
_messageInfoLogic.Create(mail);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
protected abstract Task SendMailAsync(MailSendInfoBindingModel info);
|
|
||||||
protected abstract Task<List<MessageInfoBindingModel>> ReceiveMailAsync();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,79 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System.Net.Mail;
|
|
||||||
using System.Net;
|
|
||||||
using System.Text;
|
|
||||||
using MailKit.Net.Pop3;
|
|
||||||
using MailKit.Security;
|
|
||||||
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic.MailWorker
|
|
||||||
{
|
|
||||||
public class MailKitWorker : AbstractMailWorker
|
|
||||||
{
|
|
||||||
public MailKitWorker(ILogger<MailKitWorker> logger, IMessageInfoLogic messageInfoLogic, IClientLogic clientLogic) : base(logger, messageInfoLogic, clientLogic) { }
|
|
||||||
protected override async Task SendMailAsync(MailSendInfoBindingModel
|
|
||||||
info)
|
|
||||||
{
|
|
||||||
using var objMailMessage = new MailMessage();
|
|
||||||
using var objSmtpClient = new SmtpClient(_smtpClientHost,_smtpClientPort);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
objMailMessage.From = new MailAddress(_mailLogin);
|
|
||||||
objMailMessage.To.Add(new MailAddress(info.MailAddress));
|
|
||||||
objMailMessage.Subject = info.Subject;
|
|
||||||
objMailMessage.Body = info.Text;
|
|
||||||
objMailMessage.SubjectEncoding = Encoding.UTF8;
|
|
||||||
objMailMessage.BodyEncoding = Encoding.UTF8;
|
|
||||||
objSmtpClient.UseDefaultCredentials = false;
|
|
||||||
objSmtpClient.EnableSsl = true;
|
|
||||||
objSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
|
|
||||||
objSmtpClient.Credentials = new NetworkCredential(_mailLogin,
|
|
||||||
_mailPassword);
|
|
||||||
await Task.Run(() => objSmtpClient.Send(objMailMessage));
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
protected override async Task<List<MessageInfoBindingModel>>
|
|
||||||
ReceiveMailAsync()
|
|
||||||
{
|
|
||||||
var list = new List<MessageInfoBindingModel>();
|
|
||||||
using var client = new Pop3Client();
|
|
||||||
await Task.Run(() =>
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
client.Connect(_popHost, _popPort, SecureSocketOptions.SslOnConnect);
|
|
||||||
client.Authenticate(_mailLogin, _mailPassword);
|
|
||||||
for (int i = 0; i < client.Count; i++)
|
|
||||||
{
|
|
||||||
var message = client.GetMessage(i);
|
|
||||||
foreach (var mail in message.From.Mailboxes)
|
|
||||||
{
|
|
||||||
list.Add(new MessageInfoBindingModel
|
|
||||||
{
|
|
||||||
DateDelivery = message.Date.DateTime,
|
|
||||||
MessageId = message.MessageId,
|
|
||||||
SenderName = mail.Address,
|
|
||||||
Subject = message.Subject,
|
|
||||||
Body = message.TextBody
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (AuthenticationException)
|
|
||||||
{ }
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
client.Disconnect(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
|
||||||
using FurnitureAssemblyContracts.SearchModels;
|
|
||||||
using FurnitureAssemblyContracts.StoragesContracts;
|
|
||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic
|
|
||||||
{
|
|
||||||
public class MessageInfoLogic : IMessageInfoLogic
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IMessageInfoStorage _messageInfoStorage;
|
|
||||||
|
|
||||||
public MessageInfoLogic(ILogger<MessageInfoLogic> logger, IMessageInfoStorage messageInfoStorage)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_messageInfoStorage = messageInfoStorage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Create(MessageInfoBindingModel model)
|
|
||||||
{
|
|
||||||
if (_messageInfoStorage.Insert(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Insert operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MessageInfoViewModel>? ReadList(MessageInfoSearchModel? model)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("ReadList. ClientId:{ClientId}. MessageId:{ MessageId}", model?.ClientId, model?.MessageId);
|
|
||||||
var list = model == null ? _messageInfoStorage.GetFullList() : _messageInfoStorage.GetFilteredList(model);
|
|
||||||
if (list == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadList return null list");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,102 +0,0 @@
|
|||||||
using FurnitureAssemblyBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
using FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic.OfficePackage
|
|
||||||
{
|
|
||||||
public abstract class AbstractSaveToExcel
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Создание отчета
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="info"></param>
|
|
||||||
public void CreateReport(ExcelInfo info)
|
|
||||||
{
|
|
||||||
CreateExcel(info);
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "A",
|
|
||||||
RowIndex = 1,
|
|
||||||
Text = info.Title,
|
|
||||||
StyleInfo = ExcelStyleInfoType.Title
|
|
||||||
});
|
|
||||||
MergeCells(new ExcelMergeParameters
|
|
||||||
{
|
|
||||||
CellFromName = "A1",
|
|
||||||
CellToName = "C1"
|
|
||||||
});
|
|
||||||
uint rowIndex = 2;
|
|
||||||
foreach (var pc in info.FurnitureComponents)
|
|
||||||
{
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "A",
|
|
||||||
RowIndex = rowIndex,
|
|
||||||
Text = pc.FurnitureName,
|
|
||||||
StyleInfo = ExcelStyleInfoType.Text
|
|
||||||
});
|
|
||||||
rowIndex++;
|
|
||||||
foreach (var product in pc.Components)
|
|
||||||
{
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "B",
|
|
||||||
RowIndex = rowIndex,
|
|
||||||
Text = product.Item1,
|
|
||||||
StyleInfo =
|
|
||||||
ExcelStyleInfoType.TextWithBroder
|
|
||||||
});
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "C",
|
|
||||||
RowIndex = rowIndex,
|
|
||||||
Text = product.Item2.ToString(),
|
|
||||||
StyleInfo =
|
|
||||||
ExcelStyleInfoType.TextWithBroder
|
|
||||||
});
|
|
||||||
rowIndex++;
|
|
||||||
}
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "A",
|
|
||||||
RowIndex = rowIndex,
|
|
||||||
Text = "Итого",
|
|
||||||
StyleInfo = ExcelStyleInfoType.Text
|
|
||||||
});
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "C",
|
|
||||||
RowIndex = rowIndex,
|
|
||||||
Text = pc.TotalCount.ToString(),
|
|
||||||
StyleInfo = ExcelStyleInfoType.Text
|
|
||||||
});
|
|
||||||
rowIndex++;
|
|
||||||
}
|
|
||||||
SaveExcel(info);
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Создание excel-файла
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="info"></param>
|
|
||||||
protected abstract void CreateExcel(ExcelInfo info);
|
|
||||||
/// <summary>
|
|
||||||
/// Добавляем новую ячейку в лист
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="cellParameters"></param>
|
|
||||||
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
|
|
||||||
/// <summary>
|
|
||||||
/// Объединение ячеек
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="mergeParameters"></param>
|
|
||||||
protected abstract void MergeCells(ExcelMergeParameters excelParams);
|
|
||||||
/// <summary>
|
|
||||||
/// Сохранение файла
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="info"></param>
|
|
||||||
protected abstract void SaveExcel(ExcelInfo info);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,80 +0,0 @@
|
|||||||
using FurnitureAssemblyBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
using FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic.OfficePackage
|
|
||||||
{
|
|
||||||
public abstract class AbstractSaveToPdf
|
|
||||||
{
|
|
||||||
public void CreateDoc(PdfInfo info)
|
|
||||||
{
|
|
||||||
CreatePdf(info);
|
|
||||||
CreateParagraph(new PdfParagraph
|
|
||||||
{
|
|
||||||
Text = info.Title,
|
|
||||||
Style = "NormalTitle",
|
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
|
||||||
});
|
|
||||||
CreateParagraph(new PdfParagraph
|
|
||||||
{
|
|
||||||
Text = $"с { info.DateFrom.ToShortDateString() } по { info.DateTo.ToShortDateString() }", Style = "Normal",
|
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
|
||||||
});
|
|
||||||
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm", "3cm" });
|
|
||||||
CreateRow(new PdfRowParameters
|
|
||||||
{
|
|
||||||
Texts = new List<string> { "Номер", "Дата заказа", "Изделие", "Статус", "Сумма" },
|
|
||||||
Style = "NormalTitle",
|
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
|
||||||
});
|
|
||||||
foreach (var order in info.Orders)
|
|
||||||
{
|
|
||||||
CreateRow(new PdfRowParameters
|
|
||||||
{
|
|
||||||
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.FurnitureName, order.OrderStatus, order.Sum.ToString() },
|
|
||||||
Style = "Normal",
|
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
|
||||||
});
|
|
||||||
}
|
|
||||||
CreateParagraph(new PdfParagraph
|
|
||||||
{
|
|
||||||
Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t",
|
|
||||||
Style = "Normal",
|
|
||||||
ParagraphAlignment =
|
|
||||||
PdfParagraphAlignmentType.Right
|
|
||||||
});
|
|
||||||
SavePdf(info);
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Создание doc-файла
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="info"></param>
|
|
||||||
protected abstract void CreatePdf(PdfInfo info);
|
|
||||||
/// <summary>
|
|
||||||
/// Создание параграфа с текстом
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="title"></param>
|
|
||||||
/// <param name="style"></param>
|
|
||||||
protected abstract void CreateParagraph(PdfParagraph paragraph);
|
|
||||||
/// <summary>
|
|
||||||
/// Создание таблицы
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="title"></param>
|
|
||||||
/// <param name="style"></param>
|
|
||||||
protected abstract void CreateTable(List<string> columns);
|
|
||||||
/// <summary>
|
|
||||||
/// Создание и заполнение строки
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="rowParameters"></param>
|
|
||||||
protected abstract void CreateRow(PdfRowParameters rowParameters);
|
|
||||||
/// <summary>
|
|
||||||
/// Сохранение файла
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="info"></param>
|
|
||||||
protected abstract void SavePdf(PdfInfo info);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,53 +0,0 @@
|
|||||||
using FurnitureAssemblyBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
using FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels;
|
|
||||||
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic.OfficePackage
|
|
||||||
{
|
|
||||||
public abstract class AbstractSaveToWord
|
|
||||||
{
|
|
||||||
public void CreateDoc(WordInfo info)
|
|
||||||
{
|
|
||||||
CreateWord(info);
|
|
||||||
CreateParagraph(new WordParagraph
|
|
||||||
{
|
|
||||||
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
|
|
||||||
TextProperties = new WordTextProperties
|
|
||||||
{
|
|
||||||
Size = "24",
|
|
||||||
JustificationType = WordJustificationType.Center
|
|
||||||
}
|
|
||||||
});
|
|
||||||
foreach (var furniture in info.Furnitures)
|
|
||||||
{
|
|
||||||
CreateParagraph(new WordParagraph
|
|
||||||
{
|
|
||||||
Texts = new List<(string, WordTextProperties)> { (furniture.FurnitureName, new WordTextProperties { Size = "24", Bold=true}), (" - " + furniture.Price.ToString(), new WordTextProperties { Size = "24", }) },
|
|
||||||
TextProperties = new WordTextProperties
|
|
||||||
{
|
|
||||||
Size = "24",
|
|
||||||
JustificationType = WordJustificationType.Both
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
SaveWord(info);
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Создание doc-файла
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="info"></param>
|
|
||||||
protected abstract void CreateWord(WordInfo info);
|
|
||||||
/// <summary>
|
|
||||||
/// Создание абзаца с текстом
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="paragraph"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
protected abstract void CreateParagraph(WordParagraph paragraph);
|
|
||||||
/// <summary>
|
|
||||||
/// Сохранение файла
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="info"></param>
|
|
||||||
protected abstract void SaveWord(WordInfo info);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic.OfficePackage.HelperEnums
|
|
||||||
{
|
|
||||||
public enum ExcelStyleInfoType
|
|
||||||
{
|
|
||||||
Title,
|
|
||||||
Text,
|
|
||||||
TextWithBroder
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic.OfficePackage.HelperEnums
|
|
||||||
{
|
|
||||||
public enum PdfParagraphAlignmentType
|
|
||||||
{
|
|
||||||
Center,
|
|
||||||
Left,
|
|
||||||
Right
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
namespace FurnitureAssemblyBusinessLogic.OfficePackage.HelperEnums
|
|
||||||
{
|
|
||||||
public enum WordJustificationType
|
|
||||||
{
|
|
||||||
Center,
|
|
||||||
Both
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
using FurnitureAssemblyBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class ExcelCellParameters
|
|
||||||
{
|
|
||||||
public string ColumnName { get; set; } = string.Empty;
|
|
||||||
public uint RowIndex { get; set; }
|
|
||||||
public string Text { get; set; } = string.Empty;
|
|
||||||
public string CellReference => $"{ColumnName}{RowIndex}";
|
|
||||||
public ExcelStyleInfoType StyleInfo { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class ExcelInfo
|
|
||||||
{
|
|
||||||
public string FileName { get; set; } = string.Empty;
|
|
||||||
public string Title { get; set; } = string.Empty;
|
|
||||||
public List<ReportFurnitureComponentViewModel> FurnitureComponents
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
set;
|
|
||||||
} = new();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class ExcelMergeParameters
|
|
||||||
{
|
|
||||||
public string CellFromName { get; set; } = string.Empty;
|
|
||||||
public string CellToName { get; set; } = string.Empty;
|
|
||||||
public string Merge => $"{CellFromName}:{CellToName}";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class PdfInfo
|
|
||||||
{
|
|
||||||
public string FileName { get; set; } = string.Empty;
|
|
||||||
public string Title { get; set; } = string.Empty;
|
|
||||||
public DateTime DateFrom { get; set; }
|
|
||||||
public DateTime DateTo { get; set; }
|
|
||||||
public List<ReportOrdersViewModel> Orders { get; set; } = new();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
using FurnitureAssemblyBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class PdfParagraph
|
|
||||||
{
|
|
||||||
public string Text { get; set; } = string.Empty;
|
|
||||||
public string Style { get; set; } = string.Empty;
|
|
||||||
public PdfParagraphAlignmentType ParagraphAlignment { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
using FurnitureAssemblyBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class PdfRowParameters
|
|
||||||
{
|
|
||||||
public List<string> Texts { get; set; } = new();
|
|
||||||
public string Style { get; set; } = string.Empty;
|
|
||||||
public PdfParagraphAlignmentType ParagraphAlignment { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class WordInfo
|
|
||||||
{
|
|
||||||
public string FileName { get; set; } = string.Empty;
|
|
||||||
public string Title { get; set; } = string.Empty;
|
|
||||||
public List<FurnitureViewModel> Furnitures { get; set; } = new();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class WordParagraph
|
|
||||||
{
|
|
||||||
public List<(string, WordTextProperties)> Texts { get; set; } = new();
|
|
||||||
public WordTextProperties? TextProperties { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
using FurnitureAssemblyBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class WordTextProperties
|
|
||||||
{
|
|
||||||
public string Size { get; set; } = string.Empty;
|
|
||||||
public bool Bold { get; set; }
|
|
||||||
public WordJustificationType JustificationType { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,352 +0,0 @@
|
|||||||
using FurnitureAssemblyBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
using FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels;
|
|
||||||
using DocumentFormat.OpenXml;
|
|
||||||
using DocumentFormat.OpenXml.Office2010.Excel;
|
|
||||||
using DocumentFormat.OpenXml.Office2013.Excel;
|
|
||||||
using DocumentFormat.OpenXml.Packaging;
|
|
||||||
using DocumentFormat.OpenXml.Spreadsheet;
|
|
||||||
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic.OfficePackage.Implements
|
|
||||||
{
|
|
||||||
public class SaveToExcel : AbstractSaveToExcel
|
|
||||||
{
|
|
||||||
private SpreadsheetDocument? _spreadsheetDocument;
|
|
||||||
private SharedStringTablePart? _shareStringPart;
|
|
||||||
private Worksheet? _worksheet;
|
|
||||||
/// <summary>
|
|
||||||
/// Настройка стилей для файла
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="workbookpart"></param>
|
|
||||||
private static void CreateStyles(WorkbookPart workbookpart)
|
|
||||||
{
|
|
||||||
var sp = workbookpart.AddNewPart<WorkbookStylesPart>();
|
|
||||||
sp.Stylesheet = new Stylesheet();
|
|
||||||
var fonts = new Fonts() { Count = 2U, KnownFonts = true };
|
|
||||||
var fontUsual = new Font();
|
|
||||||
fontUsual.Append(new FontSize() { Val = 12D });
|
|
||||||
fontUsual.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
|
||||||
{ Theme = 1U });
|
|
||||||
fontUsual.Append(new FontName() { Val = "Times New Roman" });
|
|
||||||
fontUsual.Append(new FontFamilyNumbering() { Val = 2 });
|
|
||||||
fontUsual.Append(new FontScheme() { Val = FontSchemeValues.Minor });
|
|
||||||
var fontTitle = new Font();
|
|
||||||
fontTitle.Append(new Bold());
|
|
||||||
fontTitle.Append(new FontSize() { Val = 14D });
|
|
||||||
fontTitle.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
|
||||||
{ Theme = 1U });
|
|
||||||
fontTitle.Append(new FontName() { Val = "Times New Roman" });
|
|
||||||
fontTitle.Append(new FontFamilyNumbering() { Val = 2 });
|
|
||||||
fontTitle.Append(new FontScheme() { Val = FontSchemeValues.Minor });
|
|
||||||
fonts.Append(fontUsual);
|
|
||||||
fonts.Append(fontTitle);
|
|
||||||
var fills = new Fills() { Count = 2U };
|
|
||||||
var fill1 = new Fill();
|
|
||||||
fill1.Append(new PatternFill() { PatternType = PatternValues.None });
|
|
||||||
var fill2 = new Fill();
|
|
||||||
fill2.Append(new PatternFill()
|
|
||||||
{
|
|
||||||
PatternType = PatternValues.Gray125
|
|
||||||
});
|
|
||||||
fills.Append(fill1);
|
|
||||||
fills.Append(fill2);
|
|
||||||
var borders = new Borders() { Count = 2U };
|
|
||||||
var borderNoBorder = new Border();
|
|
||||||
borderNoBorder.Append(new LeftBorder());
|
|
||||||
borderNoBorder.Append(new RightBorder());
|
|
||||||
borderNoBorder.Append(new TopBorder());
|
|
||||||
borderNoBorder.Append(new BottomBorder());
|
|
||||||
borderNoBorder.Append(new DiagonalBorder());
|
|
||||||
var borderThin = new Border();
|
|
||||||
var leftBorder = new LeftBorder() { Style = BorderStyleValues.Thin };
|
|
||||||
leftBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
|
||||||
{ Indexed = 64U });
|
|
||||||
var rightBorder = new RightBorder()
|
|
||||||
{
|
|
||||||
Style = BorderStyleValues.Thin
|
|
||||||
};
|
|
||||||
rightBorder.Append(new
|
|
||||||
DocumentFormat.OpenXml.Office2010.Excel.Color()
|
|
||||||
{ Indexed = 64U });
|
|
||||||
var topBorder = new TopBorder() { Style = BorderStyleValues.Thin };
|
|
||||||
topBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
|
||||||
{ Indexed = 64U });
|
|
||||||
var bottomBorder = new BottomBorder()
|
|
||||||
{
|
|
||||||
Style =
|
|
||||||
BorderStyleValues.Thin
|
|
||||||
};
|
|
||||||
bottomBorder.Append(new
|
|
||||||
DocumentFormat.OpenXml.Office2010.Excel.Color()
|
|
||||||
{ Indexed = 64U });
|
|
||||||
borderThin.Append(leftBorder);
|
|
||||||
borderThin.Append(rightBorder);
|
|
||||||
borderThin.Append(topBorder);
|
|
||||||
borderThin.Append(bottomBorder);
|
|
||||||
borderThin.Append(new DiagonalBorder());
|
|
||||||
borders.Append(borderNoBorder);
|
|
||||||
borders.Append(borderThin);
|
|
||||||
var cellStyleFormats = new CellStyleFormats() { Count = 1U };
|
|
||||||
var cellFormatStyle = new CellFormat()
|
|
||||||
{
|
|
||||||
NumberFormatId = 0U,
|
|
||||||
FontId
|
|
||||||
= 0U,
|
|
||||||
FillId = 0U,
|
|
||||||
BorderId = 0U
|
|
||||||
};
|
|
||||||
cellStyleFormats.Append(cellFormatStyle);
|
|
||||||
var cellFormats = new CellFormats() { Count = 3U };
|
|
||||||
var cellFormatFont = new CellFormat()
|
|
||||||
{
|
|
||||||
NumberFormatId = 0U,
|
|
||||||
FontId =
|
|
||||||
0U,
|
|
||||||
FillId = 0U,
|
|
||||||
BorderId = 0U,
|
|
||||||
FormatId = 0U,
|
|
||||||
ApplyFont = true
|
|
||||||
};
|
|
||||||
var cellFormatFontAndBorder = new CellFormat()
|
|
||||||
{
|
|
||||||
NumberFormatId = 0U,
|
|
||||||
FontId = 0U,
|
|
||||||
FillId = 0U,
|
|
||||||
BorderId = 1U,
|
|
||||||
FormatId = 0U,
|
|
||||||
ApplyFont = true,
|
|
||||||
ApplyBorder = true
|
|
||||||
};
|
|
||||||
var cellFormatTitle = new CellFormat()
|
|
||||||
{
|
|
||||||
NumberFormatId = 0U,
|
|
||||||
FontId
|
|
||||||
= 1U,
|
|
||||||
FillId = 0U,
|
|
||||||
BorderId = 0U,
|
|
||||||
FormatId = 0U,
|
|
||||||
Alignment = new Alignment()
|
|
||||||
{
|
|
||||||
Vertical = VerticalAlignmentValues.Center,
|
|
||||||
WrapText = true,
|
|
||||||
Horizontal =
|
|
||||||
HorizontalAlignmentValues.Center
|
|
||||||
},
|
|
||||||
ApplyFont = true
|
|
||||||
};
|
|
||||||
cellFormats.Append(cellFormatFont);
|
|
||||||
cellFormats.Append(cellFormatFontAndBorder);
|
|
||||||
cellFormats.Append(cellFormatTitle);
|
|
||||||
var cellStyles = new CellStyles() { Count = 1U };
|
|
||||||
cellStyles.Append(new CellStyle()
|
|
||||||
{
|
|
||||||
Name = "Normal",
|
|
||||||
FormatId = 0U,
|
|
||||||
BuiltinId = 0U
|
|
||||||
});
|
|
||||||
var differentialFormats = new
|
|
||||||
DocumentFormat.OpenXml.Office2013.Excel.DifferentialFormats()
|
|
||||||
{ Count = 0U };
|
|
||||||
|
|
||||||
var tableStyles = new TableStyles()
|
|
||||||
{
|
|
||||||
Count = 0U,
|
|
||||||
DefaultTableStyle =
|
|
||||||
"TableStyleMedium2",
|
|
||||||
DefaultPivotStyle = "PivotStyleLight16"
|
|
||||||
};
|
|
||||||
var stylesheetExtensionList = new StylesheetExtensionList();
|
|
||||||
var stylesheetExtension1 = new StylesheetExtension()
|
|
||||||
{
|
|
||||||
Uri =
|
|
||||||
"{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}"
|
|
||||||
};
|
|
||||||
stylesheetExtension1.AddNamespaceDeclaration("x14",
|
|
||||||
"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
|
|
||||||
stylesheetExtension1.Append(new SlicerStyles()
|
|
||||||
{
|
|
||||||
DefaultSlicerStyle =
|
|
||||||
"SlicerStyleLight1"
|
|
||||||
});
|
|
||||||
var stylesheetExtension2 = new StylesheetExtension()
|
|
||||||
{
|
|
||||||
Uri =
|
|
||||||
"{9260A510-F301-46a8-8635-F512D64BE5F5}"
|
|
||||||
};
|
|
||||||
stylesheetExtension2.AddNamespaceDeclaration("x15",
|
|
||||||
"http://schemas.microsoft.com/office/spreadsheetml/2010/11/main");
|
|
||||||
stylesheetExtension2.Append(new TimelineStyles()
|
|
||||||
{
|
|
||||||
DefaultTimelineStyle = "TimeSlicerStyleLight1"
|
|
||||||
});
|
|
||||||
stylesheetExtensionList.Append(stylesheetExtension1);
|
|
||||||
stylesheetExtensionList.Append(stylesheetExtension2);
|
|
||||||
sp.Stylesheet.Append(fonts);
|
|
||||||
sp.Stylesheet.Append(fills);
|
|
||||||
sp.Stylesheet.Append(borders);
|
|
||||||
sp.Stylesheet.Append(cellStyleFormats);
|
|
||||||
sp.Stylesheet.Append(cellFormats);
|
|
||||||
sp.Stylesheet.Append(cellStyles);
|
|
||||||
sp.Stylesheet.Append(differentialFormats);
|
|
||||||
sp.Stylesheet.Append(tableStyles);
|
|
||||||
sp.Stylesheet.Append(stylesheetExtensionList);
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Получение номера стиля из типа
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="styleInfo"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private static uint GetStyleValue(ExcelStyleInfoType styleInfo)
|
|
||||||
{
|
|
||||||
return styleInfo switch
|
|
||||||
{
|
|
||||||
ExcelStyleInfoType.Title => 2U,
|
|
||||||
ExcelStyleInfoType.TextWithBroder => 1U,
|
|
||||||
ExcelStyleInfoType.Text => 0U,
|
|
||||||
_ => 0U,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
protected override void CreateExcel(ExcelInfo info)
|
|
||||||
{
|
|
||||||
_spreadsheetDocument = SpreadsheetDocument.Create(info.FileName,
|
|
||||||
SpreadsheetDocumentType.Workbook);
|
|
||||||
// Создаем книгу (в ней хранятся листы)
|
|
||||||
var workbookpart = _spreadsheetDocument.AddWorkbookPart();
|
|
||||||
workbookpart.Workbook = new Workbook();
|
|
||||||
CreateStyles(workbookpart);
|
|
||||||
// Получаем/создаем хранилище текстов для книги
|
|
||||||
_shareStringPart =
|
|
||||||
_spreadsheetDocument.WorkbookPart!.GetPartsOfType<SharedStringTablePart>().Any()
|
|
||||||
?
|
|
||||||
_spreadsheetDocument.WorkbookPart.GetPartsOfType<SharedStringTablePart>().First()
|
|
||||||
:
|
|
||||||
_spreadsheetDocument.WorkbookPart.AddNewPart<SharedStringTablePart>();
|
|
||||||
// Создаем SharedStringTable, если его нет
|
|
||||||
if (_shareStringPart.SharedStringTable == null)
|
|
||||||
{
|
|
||||||
_shareStringPart.SharedStringTable = new SharedStringTable();
|
|
||||||
}
|
|
||||||
// Создаем лист в книгу
|
|
||||||
var worksheetPart = workbookpart.AddNewPart<WorksheetPart>();
|
|
||||||
worksheetPart.Worksheet = new Worksheet(new SheetData());
|
|
||||||
// Добавляем лист в книгу
|
|
||||||
var sheets =
|
|
||||||
_spreadsheetDocument.WorkbookPart.Workbook.AppendChild(new Sheets());
|
|
||||||
var sheet = new Sheet()
|
|
||||||
{
|
|
||||||
Id =
|
|
||||||
_spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart),
|
|
||||||
SheetId = 1,
|
|
||||||
Name = "Лист"
|
|
||||||
};
|
|
||||||
sheets.Append(sheet);
|
|
||||||
_worksheet = worksheetPart.Worksheet;
|
|
||||||
}
|
|
||||||
protected override void InsertCellInWorksheet(ExcelCellParameters
|
|
||||||
excelParams)
|
|
||||||
{
|
|
||||||
if (_worksheet == null || _shareStringPart == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var sheetData = _worksheet.GetFirstChild<SheetData>();
|
|
||||||
if (sheetData == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Ищем строку, либо добавляем ее
|
|
||||||
Row row;
|
|
||||||
if (sheetData.Elements<Row>().Where(r => r.RowIndex! ==
|
|
||||||
excelParams.RowIndex).Any())
|
|
||||||
{
|
|
||||||
row = sheetData.Elements<Row>().Where(r => r.RowIndex! ==
|
|
||||||
excelParams.RowIndex).First();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
row = new Row() { RowIndex = excelParams.RowIndex };
|
|
||||||
sheetData.Append(row);
|
|
||||||
}
|
|
||||||
// Ищем нужную ячейку
|
|
||||||
Cell cell;
|
|
||||||
if (row.Elements<Cell>().Where(c => c.CellReference!.Value ==
|
|
||||||
excelParams.CellReference).Any())
|
|
||||||
{
|
|
||||||
cell = row.Elements<Cell>().Where(c => c.CellReference!.Value ==
|
|
||||||
excelParams.CellReference).First();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Все ячейки должны быть последовательно друг за другом расположены
|
|
||||||
// нужно определить, после какой вставлять
|
|
||||||
Cell? refCell = null;
|
|
||||||
foreach (Cell rowCell in row.Elements<Cell>())
|
|
||||||
{
|
|
||||||
if (string.Compare(rowCell.CellReference!.Value,
|
|
||||||
excelParams.CellReference, true) > 0)
|
|
||||||
{
|
|
||||||
refCell = rowCell;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var newCell = new Cell()
|
|
||||||
{
|
|
||||||
CellReference =
|
|
||||||
excelParams.CellReference
|
|
||||||
};
|
|
||||||
row.InsertBefore(newCell, refCell);
|
|
||||||
cell = newCell;
|
|
||||||
}
|
|
||||||
// вставляем новый текст
|
|
||||||
_shareStringPart.SharedStringTable.AppendChild(new
|
|
||||||
SharedStringItem(new Text(excelParams.Text)));
|
|
||||||
_shareStringPart.SharedStringTable.Save();
|
|
||||||
cell.CellValue = new
|
|
||||||
CellValue((_shareStringPart.SharedStringTable.Elements<SharedStringItem>().Count(
|
|
||||||
) - 1).ToString());
|
|
||||||
cell.DataType = new EnumValue<CellValues>(CellValues.SharedString);
|
|
||||||
cell.StyleIndex = GetStyleValue(excelParams.StyleInfo);
|
|
||||||
}
|
|
||||||
protected override void MergeCells(ExcelMergeParameters excelParams)
|
|
||||||
{
|
|
||||||
if (_worksheet == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MergeCells mergeCells;
|
|
||||||
if (_worksheet.Elements<MergeCells>().Any())
|
|
||||||
{
|
|
||||||
mergeCells = _worksheet.Elements<MergeCells>().First();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mergeCells = new MergeCells();
|
|
||||||
if (_worksheet.Elements<CustomSheetView>().Any())
|
|
||||||
{
|
|
||||||
_worksheet.InsertAfter(mergeCells,
|
|
||||||
_worksheet.Elements<CustomSheetView>().First());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_worksheet.InsertAfter(mergeCells,
|
|
||||||
_worksheet.Elements<SheetData>().First());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var mergeCell = new MergeCell()
|
|
||||||
{
|
|
||||||
Reference = new StringValue(excelParams.Merge)
|
|
||||||
};
|
|
||||||
mergeCells.Append(mergeCell);
|
|
||||||
}
|
|
||||||
protected override void SaveExcel(ExcelInfo info)
|
|
||||||
{
|
|
||||||
if (_spreadsheetDocument == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_spreadsheetDocument.WorkbookPart!.Workbook.Save();
|
|
||||||
_spreadsheetDocument.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,100 +0,0 @@
|
|||||||
using FurnitureAssemblyBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
using FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels;
|
|
||||||
using MigraDoc.DocumentObjectModel;
|
|
||||||
using MigraDoc.DocumentObjectModel.Tables;
|
|
||||||
using MigraDoc.Rendering;
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic.OfficePackage.Implements
|
|
||||||
{
|
|
||||||
public class SaveToPdf : AbstractSaveToPdf
|
|
||||||
{
|
|
||||||
private Document? _document;
|
|
||||||
private Section? _section;
|
|
||||||
private Table? _table;
|
|
||||||
private static ParagraphAlignment GetParagraphAlignment(PdfParagraphAlignmentType type)
|
|
||||||
{
|
|
||||||
return type switch
|
|
||||||
{
|
|
||||||
PdfParagraphAlignmentType.Center => ParagraphAlignment.Center,
|
|
||||||
PdfParagraphAlignmentType.Left => ParagraphAlignment.Left,
|
|
||||||
PdfParagraphAlignmentType.Right => ParagraphAlignment.Right,
|
|
||||||
_ => ParagraphAlignment.Justify,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Создание стилей для документа
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="document"></param>
|
|
||||||
private static void DefineStyles(Document document)
|
|
||||||
{
|
|
||||||
var style = document.Styles["Normal"];
|
|
||||||
style.Font.Name = "Times New Roman";
|
|
||||||
style.Font.Size = 14;
|
|
||||||
style = document.Styles.AddStyle("NormalTitle", "Normal");
|
|
||||||
style.Font.Bold = true;
|
|
||||||
}
|
|
||||||
protected override void CreatePdf(PdfInfo info)
|
|
||||||
{
|
|
||||||
_document = new Document();
|
|
||||||
DefineStyles(_document);
|
|
||||||
_section = _document.AddSection();
|
|
||||||
}
|
|
||||||
protected override void CreateParagraph(PdfParagraph pdfParagraph)
|
|
||||||
{
|
|
||||||
if (_section == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var paragraph = _section.AddParagraph(pdfParagraph.Text);
|
|
||||||
paragraph.Format.SpaceAfter = "1cm";
|
|
||||||
paragraph.Format.Alignment =
|
|
||||||
GetParagraphAlignment(pdfParagraph.ParagraphAlignment);
|
|
||||||
paragraph.Style = pdfParagraph.Style;
|
|
||||||
}
|
|
||||||
protected override void CreateTable(List<string> columns)
|
|
||||||
{
|
|
||||||
if (_document == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_table = _document.LastSection.AddTable();
|
|
||||||
foreach (var elem in columns)
|
|
||||||
{
|
|
||||||
_table.AddColumn(elem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
protected override void CreateRow(PdfRowParameters rowParameters)
|
|
||||||
{
|
|
||||||
if (_table == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var row = _table.AddRow();
|
|
||||||
for (int i = 0; i < rowParameters.Texts.Count; ++i)
|
|
||||||
{
|
|
||||||
row.Cells[i].AddParagraph(rowParameters.Texts[i]);
|
|
||||||
if (!string.IsNullOrEmpty(rowParameters.Style))
|
|
||||||
{
|
|
||||||
row.Cells[i].Style = rowParameters.Style;
|
|
||||||
}
|
|
||||||
Unit borderWidth = 0.5;
|
|
||||||
row.Cells[i].Borders.Left.Width = borderWidth;
|
|
||||||
row.Cells[i].Borders.Right.Width = borderWidth;
|
|
||||||
row.Cells[i].Borders.Top.Width = borderWidth;
|
|
||||||
row.Cells[i].Borders.Bottom.Width = borderWidth;
|
|
||||||
row.Cells[i].Format.Alignment =
|
|
||||||
GetParagraphAlignment(rowParameters.ParagraphAlignment);
|
|
||||||
row.Cells[i].VerticalAlignment = VerticalAlignment.Center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
protected override void SavePdf(PdfInfo info)
|
|
||||||
{
|
|
||||||
var renderer = new PdfDocumentRenderer(true)
|
|
||||||
{
|
|
||||||
Document = _document
|
|
||||||
};
|
|
||||||
renderer.RenderDocument();
|
|
||||||
renderer.PdfDocument.Save(info.FileName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,126 +0,0 @@
|
|||||||
using FurnitureAssemblyBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
using FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels;
|
|
||||||
using DocumentFormat.OpenXml;
|
|
||||||
using DocumentFormat.OpenXml.Packaging;
|
|
||||||
using DocumentFormat.OpenXml.Wordprocessing;
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic.OfficePackage.Implements
|
|
||||||
{
|
|
||||||
public class SaveToWord : AbstractSaveToWord
|
|
||||||
{
|
|
||||||
private WordprocessingDocument? _wordDocument;
|
|
||||||
private Body? _docBody;
|
|
||||||
/// <summary>
|
|
||||||
/// Получение типа выравнивания
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="type"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private static JustificationValues
|
|
||||||
GetJustificationValues(WordJustificationType type)
|
|
||||||
{
|
|
||||||
return type switch
|
|
||||||
{
|
|
||||||
WordJustificationType.Both => JustificationValues.Both,
|
|
||||||
WordJustificationType.Center => JustificationValues.Center,
|
|
||||||
_ => JustificationValues.Left,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Настройки страницы
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
private static SectionProperties CreateSectionProperties()
|
|
||||||
{
|
|
||||||
var properties = new SectionProperties();
|
|
||||||
var pageSize = new PageSize
|
|
||||||
{
|
|
||||||
Orient = PageOrientationValues.Portrait
|
|
||||||
};
|
|
||||||
properties.AppendChild(pageSize);
|
|
||||||
return properties;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Задание форматирования для абзаца
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="paragraphProperties"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private static ParagraphProperties?
|
|
||||||
CreateParagraphProperties(WordTextProperties? paragraphProperties)
|
|
||||||
{
|
|
||||||
if (paragraphProperties == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
var properties = new ParagraphProperties();
|
|
||||||
properties.AppendChild(new Justification()
|
|
||||||
{
|
|
||||||
Val =
|
|
||||||
GetJustificationValues(paragraphProperties.JustificationType)
|
|
||||||
});
|
|
||||||
properties.AppendChild(new SpacingBetweenLines
|
|
||||||
{
|
|
||||||
LineRule = LineSpacingRuleValues.Auto
|
|
||||||
});
|
|
||||||
properties.AppendChild(new Indentation());
|
|
||||||
var paragraphMarkRunProperties = new ParagraphMarkRunProperties();
|
|
||||||
if (!string.IsNullOrEmpty(paragraphProperties.Size))
|
|
||||||
{
|
|
||||||
paragraphMarkRunProperties.AppendChild(new FontSize
|
|
||||||
{
|
|
||||||
Val =
|
|
||||||
paragraphProperties.Size
|
|
||||||
});
|
|
||||||
}
|
|
||||||
properties.AppendChild(paragraphMarkRunProperties);
|
|
||||||
return properties;
|
|
||||||
}
|
|
||||||
protected override void CreateWord(WordInfo info)
|
|
||||||
{
|
|
||||||
_wordDocument = WordprocessingDocument.Create(info.FileName,
|
|
||||||
WordprocessingDocumentType.Document);
|
|
||||||
MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart();
|
|
||||||
mainPart.Document = new Document();
|
|
||||||
_docBody = mainPart.Document.AppendChild(new Body());
|
|
||||||
}
|
|
||||||
protected override void CreateParagraph(WordParagraph paragraph)
|
|
||||||
{
|
|
||||||
if (_docBody == null || paragraph == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var docParagraph = new Paragraph();
|
|
||||||
|
|
||||||
docParagraph.AppendChild(CreateParagraphProperties(paragraph.TextProperties));
|
|
||||||
foreach (var run in paragraph.Texts)
|
|
||||||
{
|
|
||||||
var docRun = new Run();
|
|
||||||
var properties = new RunProperties();
|
|
||||||
properties.AppendChild(new FontSize { Val = run.Item2.Size });
|
|
||||||
if (run.Item2.Bold)
|
|
||||||
{
|
|
||||||
properties.AppendChild(new Bold());
|
|
||||||
}
|
|
||||||
docRun.AppendChild(properties);
|
|
||||||
docRun.AppendChild(new Text
|
|
||||||
{
|
|
||||||
Text = run.Item1,
|
|
||||||
Space =
|
|
||||||
SpaceProcessingModeValues.Preserve
|
|
||||||
});
|
|
||||||
docParagraph.AppendChild(docRun);
|
|
||||||
}
|
|
||||||
_docBody.AppendChild(docParagraph);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void SaveWord(WordInfo info)
|
|
||||||
{
|
|
||||||
if (_docBody == null || _wordDocument == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_docBody.AppendChild(CreateSectionProperties());
|
|
||||||
_wordDocument.MainDocumentPart!.Document.Save();
|
|
||||||
_wordDocument.Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,196 +0,0 @@
|
|||||||
using FurnitureAssemblyBusinessLogic.MailWorker;
|
|
||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
|
||||||
using FurnitureAssemblyContracts.SearchModels;
|
|
||||||
using FurnitureAssemblyContracts.StoragesContracts;
|
|
||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
using FurnitureAssemblyDataModels.Enums;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic
|
|
||||||
{
|
|
||||||
public class OrderLogic : IOrderLogic
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IOrderStorage _orderStorage;
|
|
||||||
private readonly AbstractMailWorker _mailWorker;
|
|
||||||
private readonly IClientLogic _clientLogic;
|
|
||||||
|
|
||||||
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, IClientLogic clientLogic, AbstractMailWorker abstractMailWorker)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_orderStorage = orderStorage;
|
|
||||||
_clientLogic = clientLogic;
|
|
||||||
_mailWorker = abstractMailWorker;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool ChangeStatus(OrderBindingModel model, OrderStatus orderStatus)
|
|
||||||
{
|
|
||||||
if (model.Status + 1 != orderStatus)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
model.Status = orderStatus;
|
|
||||||
SendMail(model.ClientId, $"Статус заказа {model.Id} изменен", $"Заказ {model.Id} переведен в статус {model.Status}");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool CreateOrder(OrderBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
|
|
||||||
if (!ChangeStatus(model, OrderStatus.Принят))
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Order's status is wrong");
|
|
||||||
throw new InvalidOperationException("Order's status is wrong");
|
|
||||||
}
|
|
||||||
var order = _orderStorage.Insert(model);
|
|
||||||
if (order == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Insert operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
SendMail(model.ClientId, $"Создание заказа {order.Id}", $"Заказ под номером {order.Id} создан {model.DateCreate}");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool TakeOrderInWork(OrderBindingModel model)
|
|
||||||
{
|
|
||||||
var modelNew = ReadElement(new OrderSearchModel { Id = model.Id }); // в связи с обновлением контракта, предыдущий метод не нужен
|
|
||||||
if (modelNew == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
model.Status = modelNew.Status;
|
|
||||||
model.ClientId = modelNew.ClientId;
|
|
||||||
if (!ChangeStatus(model, OrderStatus.Выполняется))
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Order's status is wrong");
|
|
||||||
throw new InvalidOperationException("Order's status is wrong");
|
|
||||||
}
|
|
||||||
_orderStorage.Update(model);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool FinishOrder(OrderBindingModel model)
|
|
||||||
{
|
|
||||||
var modelNew = ReadElement(new OrderSearchModel { Id = model.Id}); // в связи с обновлением контракта, предыдущий метод не нужен
|
|
||||||
if (modelNew == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
model.Status = modelNew.Status;
|
|
||||||
model.ClientId = modelNew.ClientId;
|
|
||||||
model.ImplementerId = modelNew.ImplementerId;
|
|
||||||
if (!ChangeStatus(model, OrderStatus.Готов))
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Order's status is wrong");
|
|
||||||
throw new InvalidOperationException("Order's status is wrong");
|
|
||||||
}
|
|
||||||
model.DateImplement = DateTime.Now;
|
|
||||||
_orderStorage.Update(model);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool DeliveryOrder(OrderBindingModel model)
|
|
||||||
{
|
|
||||||
var modelNew = ReadElement(new OrderSearchModel { Id = model.Id }); // в связи с обновлением контракта, предыдущий метод не нужен
|
|
||||||
if (modelNew == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
model.Status = modelNew.Status;
|
|
||||||
model.ClientId = modelNew.ClientId;
|
|
||||||
model.ImplementerId = modelNew.ImplementerId;
|
|
||||||
model.DateImplement = modelNew.DateImplement;
|
|
||||||
if (!ChangeStatus(model, OrderStatus.Выдан))
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Order's status is wrong");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
_orderStorage.Update(model);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public List<OrderViewModel>? ReadList(OrderSearchModel? model)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("ReadList. Id:{ Id}", model?.Id);
|
|
||||||
var list = model == null ? _orderStorage.GetFullList() : _orderStorage.GetFilteredList(model);
|
|
||||||
if (list == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadList return null list");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void CheckModel(OrderBindingModel model, bool withParams = true)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
if (!withParams)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (model.FurnitureId <= 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Неверный идентификатор изделия", nameof(model.FurnitureId));
|
|
||||||
}
|
|
||||||
if (model.Count <= 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Количество изделий должно быть больше 0", nameof(model.Count));
|
|
||||||
}
|
|
||||||
if (model.Sum <= 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Стоимость заказа должна быть больше 0", nameof(model.Sum));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Order. OrderId: { Id}. OrderStatus: {OrderStatus} DateCreate: {DateCreate} " +
|
|
||||||
"FurnitureId:{FurnitureId}. Count:{ Count}. Sum:{ Sum}. ",
|
|
||||||
model.Id, model.Status, model.DateCreate, model.FurnitureId, model.Count, model.Sum);
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderViewModel? ReadElement(OrderSearchModel? model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement. Status: {Status}. ImplementerId: {ImplementerId} Id:{ Id}", model.Status, model.ImplementerId, model.Id);
|
|
||||||
var element = _orderStorage.GetElement(model);
|
|
||||||
if (element == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadElement element not found");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool SendMail(int clientId, string subject, string text)
|
|
||||||
{
|
|
||||||
var client = _clientLogic.ReadElement(new() { Id = clientId});
|
|
||||||
if (client == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Email sending failed. Client with id {Id} not found", clientId);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_mailWorker.MailSendAsync(new MailSendInfoBindingModel()
|
|
||||||
{
|
|
||||||
Subject = subject,
|
|
||||||
Text = text,
|
|
||||||
MailAddress = client.Email
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,121 +0,0 @@
|
|||||||
using FurnitureAssemblyBusinessLogic.OfficePackage;
|
|
||||||
using FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels;
|
|
||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
|
||||||
using FurnitureAssemblyContracts.SearchModels;
|
|
||||||
using FurnitureAssemblyContracts.StoragesContracts;
|
|
||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic
|
|
||||||
{
|
|
||||||
public class ReportLogic : IReportLogic
|
|
||||||
{
|
|
||||||
private readonly IFurnitureStorage _furnitureStorage;
|
|
||||||
private readonly IOrderStorage _orderStorage;
|
|
||||||
private readonly AbstractSaveToExcel _saveToExcel;
|
|
||||||
private readonly AbstractSaveToWord _saveToWord;
|
|
||||||
private readonly AbstractSaveToPdf _saveToPdf;
|
|
||||||
public ReportLogic(IFurnitureStorage furnitureStorage, IOrderStorage orderStorage,
|
|
||||||
AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
|
|
||||||
{
|
|
||||||
_furnitureStorage = furnitureStorage;
|
|
||||||
_orderStorage = orderStorage;
|
|
||||||
_saveToExcel = saveToExcel;
|
|
||||||
_saveToWord = saveToWord;
|
|
||||||
_saveToPdf = saveToPdf;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Получение списка компонент с указанием, в каких изделиях используются
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public List<ReportFurnitureComponentViewModel> GetFurnitureComponent()
|
|
||||||
{
|
|
||||||
var furnitures = _furnitureStorage.GetFullList();
|
|
||||||
var list = new List<ReportFurnitureComponentViewModel>();
|
|
||||||
foreach (var furniture in furnitures)
|
|
||||||
{
|
|
||||||
var record = new ReportFurnitureComponentViewModel
|
|
||||||
{
|
|
||||||
FurnitureName = furniture.FurnitureName,
|
|
||||||
Components = new List<Tuple<string, int>>(),
|
|
||||||
TotalCount = 0
|
|
||||||
};
|
|
||||||
foreach (var componentCount in furniture.FurnitureComponents.Values)
|
|
||||||
{
|
|
||||||
record.Components.Add(new Tuple<string, int>(componentCount.Item1.ComponentName, componentCount.Item2));
|
|
||||||
record.TotalCount += componentCount.Item2;
|
|
||||||
}
|
|
||||||
list.Add(record);
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Получение списка заказов за определенный период
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public List<ReportOrdersViewModel> GetOrders(ReportBindingModel model)
|
|
||||||
{
|
|
||||||
return _orderStorage.GetFilteredList(new OrderSearchModel
|
|
||||||
{
|
|
||||||
DateFrom = model.DateFrom,
|
|
||||||
DateTo = model.DateTo
|
|
||||||
})
|
|
||||||
.Select(x => new ReportOrdersViewModel
|
|
||||||
{
|
|
||||||
Id = x.Id,
|
|
||||||
DateCreate = x.DateCreate,
|
|
||||||
FurnitureName = x.FurnitureName,
|
|
||||||
Sum = x.Sum,
|
|
||||||
OrderStatus = x.Status.ToString()
|
|
||||||
})
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Сохранение компонент в файл-Word
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
public void SaveFurnituresToWordFile(ReportBindingModel model)
|
|
||||||
{
|
|
||||||
_saveToWord.CreateDoc(new WordInfo
|
|
||||||
{
|
|
||||||
FileName = model.FileName,
|
|
||||||
Title = "Список изделий",
|
|
||||||
Furnitures = _furnitureStorage.GetFullList()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Сохранение компонент с указаеним продуктов в файл-Excel
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
public void SaveFurnitureComponentToExcelFile(ReportBindingModel model)
|
|
||||||
{
|
|
||||||
_saveToExcel.CreateReport(new ExcelInfo
|
|
||||||
{
|
|
||||||
FileName = model.FileName,
|
|
||||||
Title = "Список изделий",
|
|
||||||
FurnitureComponents = GetFurnitureComponent()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Сохранение заказов в файл-Pdf
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
public void SaveOrdersToPdfFile(ReportBindingModel model)
|
|
||||||
{
|
|
||||||
_saveToPdf.CreateDoc(new PdfInfo
|
|
||||||
{
|
|
||||||
FileName = model.FileName,
|
|
||||||
Title = "Список заказов",
|
|
||||||
DateFrom = model.DateFrom!.Value,
|
|
||||||
DateTo = model.DateTo!.Value,
|
|
||||||
Orders = GetOrders(model)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,144 +0,0 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
|
||||||
using FurnitureAssemblyContracts.SearchModels;
|
|
||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
using FurnitureAssemblyDataModels.Enums;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyBusinessLogic
|
|
||||||
{
|
|
||||||
public class WorkModeling : IWorkProcess
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly Random _rnd;
|
|
||||||
private IOrderLogic? _orderLogic;
|
|
||||||
public WorkModeling(ILogger<WorkModeling> logger)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_rnd = new Random(1000);
|
|
||||||
}
|
|
||||||
public void DoWork(IImplementerLogic implementerLogic, IOrderLogic
|
|
||||||
orderLogic)
|
|
||||||
{
|
|
||||||
_orderLogic = orderLogic;
|
|
||||||
var implementers = implementerLogic.ReadList(null);
|
|
||||||
if (implementers == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("DoWork. Implementers is null");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var orders = _orderLogic.ReadList(new OrderSearchModel
|
|
||||||
{
|
|
||||||
Status = OrderStatus.Принят
|
|
||||||
});
|
|
||||||
if (orders == null || orders.Count == 0)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("DoWork. Orders is null or empty");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogDebug("DoWork for {Count} orders", orders.Count);
|
|
||||||
foreach (var implementer in implementers)
|
|
||||||
{
|
|
||||||
Task.Run(() => WorkerWorkAsync(implementer, orders));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Иммитация работы исполнителя
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="implementer"></param>
|
|
||||||
/// <param name="orders"></param>
|
|
||||||
private async Task WorkerWorkAsync(ImplementerViewModel implementer, List<OrderViewModel> orders)
|
|
||||||
{
|
|
||||||
if (_orderLogic == null || implementer == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await RunOrderInWork(implementer);
|
|
||||||
await Task.Run(() =>
|
|
||||||
{
|
|
||||||
foreach (var order in orders)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_logger.LogDebug("DoWork. Worker {Id} try get order { Order}", implementer.Id, order.Id);
|
|
||||||
// пытаемся назначить заказ на исполнителя
|
|
||||||
_orderLogic.TakeOrderInWork(new OrderBindingModel
|
|
||||||
{
|
|
||||||
Id = order.Id,
|
|
||||||
ImplementerId = implementer.Id
|
|
||||||
});
|
|
||||||
// делаем работу
|
|
||||||
Thread.Sleep(implementer.WorkExperience * _rnd.Next(100,
|
|
||||||
1000) * order.Count);
|
|
||||||
_logger.LogDebug("DoWork. Worker {Id} finish order{ Order} ", implementer.Id, order.Id);
|
|
||||||
_orderLogic.FinishOrder(new OrderBindingModel
|
|
||||||
{
|
|
||||||
Id = order.Id
|
|
||||||
});
|
|
||||||
// отдыхаем
|
|
||||||
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
|
|
||||||
}
|
|
||||||
// кто-то мог уже перехватить заказ, игнорируем ошибку
|
|
||||||
catch (InvalidOperationException ex)
|
|
||||||
{
|
|
||||||
_logger.LogWarning(ex, "Error try get work");
|
|
||||||
}
|
|
||||||
// заканчиваем выполнение имитации в случае иной ошибки
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Error while do work");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Ищем заказ, которые уже в работе (вдруг исполнителя прервали)
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="implementer"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private async Task RunOrderInWork(ImplementerViewModel implementer)
|
|
||||||
{
|
|
||||||
if (_orderLogic == null || implementer == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var runOrder = await Task.Run(() => _orderLogic.ReadElement(new OrderSearchModel
|
|
||||||
{
|
|
||||||
ImplementerId = implementer.Id,
|
|
||||||
Status = OrderStatus.Выполняется
|
|
||||||
}));
|
|
||||||
if (runOrder == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogDebug("DoWork. Worker {Id} back to order {Order}",
|
|
||||||
implementer.Id, runOrder.Id);
|
|
||||||
// доделываем работу
|
|
||||||
Thread.Sleep(implementer.WorkExperience * _rnd.Next(100, 300) *
|
|
||||||
runOrder.Count);
|
|
||||||
_logger.LogDebug("DoWork. Worker {Id} finish order {Order}",
|
|
||||||
implementer.Id, runOrder.Id);
|
|
||||||
_orderLogic.FinishOrder(new OrderBindingModel
|
|
||||||
{
|
|
||||||
Id = runOrder.Id
|
|
||||||
});
|
|
||||||
// отдыхаем
|
|
||||||
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
|
|
||||||
}
|
|
||||||
// заказа может не быть, просто игнорируем ошибку
|
|
||||||
catch (InvalidOperationException ex)
|
|
||||||
{
|
|
||||||
_logger.LogWarning(ex, "Error try get work");
|
|
||||||
}
|
|
||||||
// а может возникнуть иная ошибка, тогда просто заканчиваем выполнение имитации
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Error while do work");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
using System.Net.Http.Headers;
|
|
||||||
using System.Text;
|
|
||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyClientApp
|
|
||||||
{
|
|
||||||
public static class APIClient
|
|
||||||
{
|
|
||||||
private static readonly HttpClient _client = new();
|
|
||||||
public static ClientViewModel? Client { get; set; } = null;
|
|
||||||
public static void Connect(IConfiguration configuration)
|
|
||||||
{
|
|
||||||
_client.BaseAddress = new Uri(configuration["IPAddress"]);
|
|
||||||
_client.DefaultRequestHeaders.Accept.Clear();
|
|
||||||
_client.DefaultRequestHeaders.Accept.Add(new
|
|
||||||
MediaTypeWithQualityHeaderValue("application/json"));
|
|
||||||
}
|
|
||||||
public static T? GetRequest<T>(string requestUrl)
|
|
||||||
{
|
|
||||||
var response = _client.GetAsync(requestUrl);
|
|
||||||
var result = response.Result.Content.ReadAsStringAsync().Result;
|
|
||||||
if (response.Result.IsSuccessStatusCode)
|
|
||||||
{
|
|
||||||
return JsonConvert.DeserializeObject<T>(result);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new Exception(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static void PostRequest<T>(string requestUrl, T model)
|
|
||||||
{
|
|
||||||
var json = JsonConvert.SerializeObject(model);
|
|
||||||
var data = new StringContent(json, Encoding.UTF8, "application/json");
|
|
||||||
var response = _client.PostAsync(requestUrl, data);
|
|
||||||
var result = response.Result.Content.ReadAsStringAsync().Result;
|
|
||||||
if (!response.Result.IsSuccessStatusCode)
|
|
||||||
{
|
|
||||||
throw new Exception(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,161 +0,0 @@
|
|||||||
using FurnitureAssemblyClientApp.Models;
|
|
||||||
using FurnitureAssemblyContracts.BindingModels;
|
|
||||||
using FurnitureAssemblyContracts.ViewModels;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyClientApp.Controllers
|
|
||||||
{
|
|
||||||
public class HomeController : Controller
|
|
||||||
{
|
|
||||||
private readonly ILogger<HomeController> _logger;
|
|
||||||
|
|
||||||
public HomeController(ILogger<HomeController> logger)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IActionResult Index()
|
|
||||||
{
|
|
||||||
if (APIClient.Client == null)
|
|
||||||
{
|
|
||||||
return Redirect("~/Home/Enter");
|
|
||||||
}
|
|
||||||
return
|
|
||||||
View(APIClient.GetRequest<List<OrderViewModel>>($"api/main/getorders?clientId={APIClient.Client.Id}"));
|
|
||||||
}
|
|
||||||
[HttpGet]
|
|
||||||
public IActionResult Privacy()
|
|
||||||
{
|
|
||||||
if (APIClient.Client == null)
|
|
||||||
{
|
|
||||||
return Redirect("~/Home/Enter");
|
|
||||||
}
|
|
||||||
return View(APIClient.Client);
|
|
||||||
}
|
|
||||||
[HttpPost]
|
|
||||||
public void Privacy(string login, string password, string fio)
|
|
||||||
{
|
|
||||||
if (APIClient.Client == null)
|
|
||||||
{
|
|
||||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(login) ||
|
|
||||||
string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
|
|
||||||
{
|
|
||||||
throw new Exception("Введите логин, пароль и ФИО");
|
|
||||||
}
|
|
||||||
APIClient.PostRequest("api/client/updatedata", new
|
|
||||||
ClientBindingModel
|
|
||||||
{
|
|
||||||
Id = APIClient.Client.Id,
|
|
||||||
ClientFIO = fio,
|
|
||||||
Email = login,
|
|
||||||
Password = password
|
|
||||||
});
|
|
||||||
APIClient.Client.ClientFIO = fio;
|
|
||||||
APIClient.Client.Email = login;
|
|
||||||
APIClient.Client.Password = password;
|
|
||||||
Response.Redirect("Index");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
|
||||||
public IActionResult Error()
|
|
||||||
{
|
|
||||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
public IActionResult Enter()
|
|
||||||
{
|
|
||||||
return View();
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost]
|
|
||||||
public void Enter(string login, string password)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(login) ||
|
|
||||||
string.IsNullOrEmpty(password))
|
|
||||||
{
|
|
||||||
throw new Exception("Введите логин и пароль");
|
|
||||||
}
|
|
||||||
APIClient.Client =
|
|
||||||
APIClient.GetRequest<ClientViewModel>($"api/client/login?login={login}&password={password}");
|
|
||||||
if (APIClient.Client == null)
|
|
||||||
{
|
|
||||||
throw new Exception("Неверный логин/пароль");
|
|
||||||
}
|
|
||||||
Response.Redirect("Index");
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
public IActionResult Register()
|
|
||||||
{
|
|
||||||
return View();
|
|
||||||
}
|
|
||||||
[HttpPost]
|
|
||||||
public void Register(string login, string password, string fio)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(login) ||
|
|
||||||
string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
|
|
||||||
{
|
|
||||||
throw new Exception("Введите логин, пароль и ФИО");
|
|
||||||
}
|
|
||||||
APIClient.PostRequest("api/client/register", new
|
|
||||||
ClientBindingModel
|
|
||||||
{
|
|
||||||
ClientFIO = fio,
|
|
||||||
Email = login,
|
|
||||||
Password = password
|
|
||||||
});
|
|
||||||
Response.Redirect("Enter");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IActionResult Create()
|
|
||||||
{
|
|
||||||
ViewBag.Furnitures = APIClient.GetRequest<List<FurnitureViewModel>>("api/main/getfurniturelist");
|
|
||||||
return View();
|
|
||||||
}
|
|
||||||
[HttpPost]
|
|
||||||
public void Create(int furniture, int count)
|
|
||||||
{
|
|
||||||
if (APIClient.Client == null)
|
|
||||||
{
|
|
||||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
|
||||||
}
|
|
||||||
if (count <= 0)
|
|
||||||
{
|
|
||||||
throw new Exception("Количество и сумма должны быть больше 0");
|
|
||||||
}
|
|
||||||
APIClient.PostRequest("api/main/createorder", new OrderBindingModel
|
|
||||||
{
|
|
||||||
ClientId = APIClient.Client.Id,
|
|
||||||
FurnitureId = furniture,
|
|
||||||
Count = count,
|
|
||||||
Sum = Calc(count, furniture)
|
|
||||||
});
|
|
||||||
Response.Redirect("Index");
|
|
||||||
}
|
|
||||||
[HttpPost]
|
|
||||||
public double Calc(int count, int furniture)
|
|
||||||
{
|
|
||||||
var prod = APIClient.GetRequest<FurnitureViewModel>($"api/main/getfurniture?furnitureId={furniture}"
|
|
||||||
);
|
|
||||||
return count * (prod?.Price ?? 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
public IActionResult Mails()
|
|
||||||
{
|
|
||||||
if (APIClient.Client == null)
|
|
||||||
{
|
|
||||||
return Redirect("~/Home/Enter");
|
|
||||||
}
|
|
||||||
return View(APIClient.GetRequest<List<MessageInfoViewModel>>($"api/client/getmessages?clientId={ APIClient.Client.Id}"));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\FurnitureAssemblyContracts\FurnitureAssemblyContracts.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
@ -1,9 +0,0 @@
|
|||||||
namespace FurnitureAssemblyClientApp.Models
|
|
||||||
{
|
|
||||||
public class ErrorViewModel
|
|
||||||
{
|
|
||||||
public string? RequestId { get; set; }
|
|
||||||
|
|
||||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
|
||||||
}
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user