8lab
This commit is contained in:
parent
a54010df45
commit
4d18ba7e8b
@ -0,0 +1,134 @@
|
||||
using FurnitureAssemblyContracts.BindingModels;
|
||||
using FurnitureAssemblyContracts.BusinessLogicsContracts;
|
||||
using FurnitureAssemblyContracts.StoragesContracts;
|
||||
using FurnitureAssemblyDataModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization.Json;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
||||
{
|
||||
// Класс, реализующий логику для BackUp
|
||||
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(BackUpSaveBindingModel 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)
|
||||
{
|
||||
// Проверка на то, является ли тип интерфейсом и унаследован ли он от IId
|
||||
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);
|
||||
|
||||
// Вызываем метод на выполнение (Вызываем метод типа MethodInfo)
|
||||
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;
|
||||
}
|
||||
|
||||
// Три строчки ниже - сериализация файлов в json
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
@ -86,7 +86,7 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
||||
{
|
||||
CheckModel(model);
|
||||
|
||||
if(model.Status != OrderStatus.Неизвестен)
|
||||
if (model.Status != OrderStatus.Неизвестен)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed, incorrect order status");
|
||||
return false;
|
||||
@ -179,13 +179,13 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
||||
var viewModel = _orderStorage.GetElement(new OrderSearchModel { Id = model.Id });
|
||||
|
||||
// Если не смогли найти указанный заказ по его Id
|
||||
if(viewModel == null)
|
||||
if (viewModel == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
|
||||
// Проверка на возможность обновления статуса на следующий
|
||||
if(viewModel.Status + 1 != newOrderStatus)
|
||||
if (viewModel.Status + 1 != newOrderStatus)
|
||||
{
|
||||
_logger.LogWarning("Status update operation failed. New status " + newOrderStatus.ToString() + "incorrect");
|
||||
return false;
|
||||
@ -214,7 +214,7 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
||||
// Финальная проверка на возможность обновления
|
||||
var result = _orderStorage.Update(model);
|
||||
|
||||
if(result == null)
|
||||
if (result == null)
|
||||
{
|
||||
model.Status--;
|
||||
|
||||
|
@ -14,7 +14,7 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels
|
||||
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
//список заготовок для вывода и сохранения
|
||||
// Cписок заготовок для вывода и сохранения
|
||||
public List<FurnitureViewModel> Furnitures { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels
|
||||
// Набор текстов в абзаце (для случая, если в абзаце текст разных стилей)
|
||||
public List<(string, WordTextProperties)> Texts { get; set; } = new();
|
||||
|
||||
//свойства параграфа, если они есть
|
||||
// Cвойства параграфа, если они есть
|
||||
public WordTextProperties? TextProperties { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyContracts.Attributes
|
||||
{
|
||||
// Укажем, что данный атрибут можно прописать только в Property
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public class ColumnAttribute : Attribute
|
||||
{
|
||||
public ColumnAttribute(string title = "", bool visible = true, int width = 0,
|
||||
GridViewAutoSize gridViewAutoSize = GridViewAutoSize.None, bool isUseAutoSize = false)
|
||||
{
|
||||
Title = title;
|
||||
Visible = visible;
|
||||
Width = width;
|
||||
GridViewAutoSize = gridViewAutoSize;
|
||||
IsUseAutoSize = isUseAutoSize;
|
||||
}
|
||||
|
||||
public string Title { get; private set; }
|
||||
|
||||
public bool Visible { get; private set; }
|
||||
|
||||
public int Width { get; private set; }
|
||||
|
||||
public GridViewAutoSize GridViewAutoSize { get; private set; }
|
||||
|
||||
public bool IsUseAutoSize { get; private set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyContracts.Attributes
|
||||
{
|
||||
public enum GridViewAutoSize
|
||||
{
|
||||
NotSet = 0,
|
||||
|
||||
None = 1,
|
||||
|
||||
ColumnHeader = 2,
|
||||
|
||||
AllCellsExceptHeader = 4,
|
||||
|
||||
AllCells = 6,
|
||||
|
||||
DisplayedCellsExceptHeader = 8,
|
||||
|
||||
DisplayedCells = 10,
|
||||
|
||||
Fill = 16
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyContracts.BindingModels
|
||||
{
|
||||
public class BackUpSaveBindingModel
|
||||
{
|
||||
public string FolderName { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -7,9 +7,11 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyContracts.BindingModels
|
||||
{
|
||||
// Реализации сущности "Сообщение"
|
||||
// Реализация сущности "Сообщение"
|
||||
public class MessageInfoBindingModel : IMessageInfoModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string MessageId { get; set; } = string.Empty;
|
||||
|
||||
public int? ClientId { get; set; }
|
||||
|
@ -0,0 +1,16 @@
|
||||
using FurnitureAssemblyContracts.BindingModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyContracts.BusinessLogicsContracts
|
||||
{
|
||||
// Интерфейс создания бекапа
|
||||
public interface IBackUpLogic
|
||||
{
|
||||
// Путь и имя файла для архивации
|
||||
void CreateBackUp(BackUpSaveBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyContracts.DI
|
||||
{
|
||||
// Менеджер для работы с зависимостями
|
||||
public class DependencyManager
|
||||
{
|
||||
private readonly IDependencyContainer _dependencyManager;
|
||||
|
||||
private static DependencyManager? _manager;
|
||||
|
||||
private static readonly object _locjObject = new();
|
||||
|
||||
private DependencyManager()
|
||||
{
|
||||
_dependencyManager = new UnityDependencyContainer();
|
||||
}
|
||||
|
||||
public static DependencyManager Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_manager == null) { lock (_locjObject) { _manager = new DependencyManager(); } }
|
||||
|
||||
return _manager;
|
||||
}
|
||||
}
|
||||
|
||||
// Инициализация библиотек, в которых идут установки зависимостей
|
||||
public static void InitDependency()
|
||||
{
|
||||
var ext = ServiceProviderLoader.GetImplementationExtensions();
|
||||
|
||||
if (ext == null)
|
||||
{
|
||||
throw new ArgumentNullException("Отсутствуют компоненты для загрузки зависимостей по модулям");
|
||||
}
|
||||
|
||||
// Регистрируем зависимости
|
||||
ext.RegisterServices();
|
||||
}
|
||||
|
||||
// Регистрация логгера
|
||||
public void AddLogging(Action<ILoggingBuilder> configure) => _dependencyManager.AddLogging(configure);
|
||||
|
||||
// Добавление зависимости
|
||||
public void RegisterType<T, U>(bool isSingle = false) where U : class, T where T : class => _dependencyManager.RegisterType<T, U>(isSingle);
|
||||
|
||||
// Добавление зависимости
|
||||
public void RegisterType<T>(bool isSingle = false) where T : class => _dependencyManager.RegisterType<T>(isSingle);
|
||||
|
||||
// Получение класса со всеми зависимостями
|
||||
public T Resolve<T>() => _dependencyManager.Resolve<T>();
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyContracts.DI
|
||||
{
|
||||
// Интерфейс установки зависимости между элементами
|
||||
public interface IDependencyContainer
|
||||
{
|
||||
// Регистрация логгера
|
||||
void AddLogging(Action<ILoggingBuilder> configure);
|
||||
|
||||
// Добавление зависимости
|
||||
void RegisterType<T, U>(bool isSingle) where U : class, T where T :
|
||||
class;
|
||||
|
||||
// Добавление зависимости
|
||||
void RegisterType<T>(bool isSingle) where T : class;
|
||||
|
||||
// Получение класса со всеми зависимостями
|
||||
T Resolve<T>();
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyContracts.DI
|
||||
{
|
||||
// Интерфейс для регистрации зависимостей в модулях
|
||||
public interface IImplementationExtension
|
||||
{
|
||||
// Для установления приоритета
|
||||
public int Priority { get; }
|
||||
|
||||
// Регистрация сервисов
|
||||
public void RegisterServices();
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyContracts.DI
|
||||
{
|
||||
public class ServiceDependencyContainer : IDependencyContainer
|
||||
{
|
||||
private ServiceProvider? _serviceProvider;
|
||||
|
||||
private readonly ServiceCollection _serviceCollection;
|
||||
|
||||
public ServiceDependencyContainer()
|
||||
{
|
||||
_serviceCollection = new ServiceCollection();
|
||||
}
|
||||
|
||||
public void AddLogging(Action<ILoggingBuilder> configure)
|
||||
{
|
||||
_serviceCollection.AddLogging(configure);
|
||||
}
|
||||
|
||||
public void RegisterType<T, U>(bool isSingle) where U : class, T where T : class
|
||||
{
|
||||
if (isSingle)
|
||||
{
|
||||
_serviceCollection.AddSingleton<T, U>();
|
||||
}
|
||||
else
|
||||
{
|
||||
_serviceCollection.AddTransient<T, U>();
|
||||
}
|
||||
|
||||
_serviceProvider = null;
|
||||
}
|
||||
|
||||
public void RegisterType<T>(bool isSingle) where T : class
|
||||
{
|
||||
if (isSingle)
|
||||
{
|
||||
_serviceCollection.AddSingleton<T>();
|
||||
}
|
||||
else
|
||||
{
|
||||
_serviceCollection.AddTransient<T>();
|
||||
}
|
||||
|
||||
_serviceProvider = null;
|
||||
}
|
||||
|
||||
public T Resolve<T>()
|
||||
{
|
||||
if (_serviceProvider == null)
|
||||
{
|
||||
_serviceProvider = _serviceCollection.BuildServiceProvider();
|
||||
}
|
||||
|
||||
return _serviceProvider.GetService<T>()!;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyContracts.DI
|
||||
{
|
||||
// Загрузчик данных
|
||||
public static partial class ServiceProviderLoader
|
||||
{
|
||||
// Загрузка всех классов-реализаций IImplementationExtension
|
||||
public static IImplementationExtension? GetImplementationExtensions()
|
||||
{
|
||||
IImplementationExtension? source = null;
|
||||
|
||||
var files = Directory.GetFiles(TryGetImplementationExtensionsFolder(), "*.dll", SearchOption.AllDirectories);
|
||||
|
||||
foreach (var file in files.Distinct())
|
||||
{
|
||||
Assembly asm = Assembly.LoadFrom(file);
|
||||
|
||||
foreach (var t in asm.GetExportedTypes())
|
||||
{
|
||||
if (t.IsClass && typeof(IImplementationExtension).IsAssignableFrom(t))
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
source = (IImplementationExtension)Activator.CreateInstance(t)!;
|
||||
}
|
||||
else
|
||||
{
|
||||
var newSource = (IImplementationExtension)Activator.CreateInstance(t)!;
|
||||
|
||||
if (newSource.Priority > source.Priority)
|
||||
{
|
||||
source = newSource;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
private static string TryGetImplementationExtensionsFolder()
|
||||
{
|
||||
var directory = new DirectoryInfo(Directory.GetCurrentDirectory());
|
||||
|
||||
while (directory != null && !directory.GetDirectories("ImplementationExtensions",
|
||||
SearchOption.AllDirectories).Any(x => x.Name == "ImplementationExtensions"))
|
||||
{
|
||||
directory = directory.Parent;
|
||||
}
|
||||
|
||||
return $"{directory?.FullName}\\ImplementationExtensions";
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Unity.Microsoft.Logging;
|
||||
using Unity;
|
||||
|
||||
namespace FurnitureAssemblyContracts.DI
|
||||
{
|
||||
public class UnityDependencyContainer : IDependencyContainer
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
public UnityDependencyContainer()
|
||||
{
|
||||
_container = new UnityContainer();
|
||||
}
|
||||
|
||||
public void AddLogging(Action<ILoggingBuilder> configure)
|
||||
{
|
||||
var factory = LoggerFactory.Create(configure);
|
||||
_container.AddExtension(new LoggingExtension(factory));
|
||||
}
|
||||
|
||||
public void RegisterType<T>(bool isSingle) where T : class
|
||||
{
|
||||
_container.RegisterType<T>(isSingle ? TypeLifetime.Singleton : TypeLifetime.Transient);
|
||||
}
|
||||
|
||||
public T Resolve<T>()
|
||||
{
|
||||
return _container.Resolve<T>();
|
||||
}
|
||||
|
||||
void IDependencyContainer.RegisterType<T, U>(bool isSingle)
|
||||
{
|
||||
_container.RegisterType<T, U>(isSingle ? TypeLifetime.Singleton : TypeLifetime.Transient);
|
||||
}
|
||||
}
|
||||
}
|
@ -6,6 +6,12 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||
<PackageReference Include="Unity" Version="5.10.0" />
|
||||
<PackageReference Include="Unity.Microsoft.Logging" Version="5.10.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\FurnitureAssemblyDataModels\FurnitureAssemblyDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyContracts.StoragesContracts
|
||||
{
|
||||
// Интерфейс получения данных по всем сущностям
|
||||
public interface IBackUpInfo
|
||||
{
|
||||
// Метод получения данных по всем сущностям
|
||||
List<T>? GetList<T>() where T : class, new();
|
||||
|
||||
Type? GetTypeByModelInterface(string modelInterfaceName);
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using FurnitureAssemblyDataModels.Models;
|
||||
using FurnitureAssemblyContracts.Attributes;
|
||||
using FurnitureAssemblyDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@ -11,15 +12,16 @@ namespace FurnitureAssemblyContracts.ViewModels
|
||||
// Класс для отображения информации о клиентах
|
||||
public class ClientViewModel : IClientModel
|
||||
{
|
||||
[Column(visible: false)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("ФИО клиента")]
|
||||
[Column(title: "ФИО клиента", width: 150)]
|
||||
public string ClientFIO { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Логин (эл. почта)")]
|
||||
[Column(title: "Логин (эл. почта)", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Пароль")]
|
||||
[Column(title: "Пароль", width: 150)]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using FurnitureAssemblyDataModels.Models;
|
||||
using FurnitureAssemblyContracts.Attributes;
|
||||
using FurnitureAssemblyDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@ -11,14 +12,16 @@ namespace FurnitureAssemblyContracts.ViewModels
|
||||
// Класс для отображения пользователю информации о продуктах (изделиях)
|
||||
public class FurnitureViewModel : IFurnitureModel
|
||||
{
|
||||
[Column(visible: false)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Название изделия")]
|
||||
[Column(title: "Название изделия", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
public string FurnitureName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Цена")]
|
||||
[Column(title: "Цена", width: 150)]
|
||||
public double Price { get; set; }
|
||||
|
||||
[Column(visible: false)]
|
||||
public Dictionary<int, (IWorkPieceModel, int)> FurnitureWorkPieces { get; set; } = new();
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using FurnitureAssemblyDataModels.Models;
|
||||
using FurnitureAssemblyContracts.Attributes;
|
||||
using FurnitureAssemblyDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@ -11,18 +12,19 @@ namespace FurnitureAssemblyContracts.ViewModels
|
||||
// Класс для отображения информации об исполнителях
|
||||
public class ImplementerViewModel : IImplementerModel
|
||||
{
|
||||
[Column(visible: false)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("ФИО исполнителя")]
|
||||
[Column(title: "ФИО исполнителя", width: 150)]
|
||||
public string ImplementerFIO { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Пароль")]
|
||||
[Column(title: "Пароль", width: 150)]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Стаж")]
|
||||
[Column(title: "Стаж", width: 150)]
|
||||
public int WorkExperience { get; set; }
|
||||
|
||||
[DisplayName("Квалификация")]
|
||||
[Column(title: "Квалификация", width: 150)]
|
||||
public int Qualification { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using FurnitureAssemblyDataModels.Models;
|
||||
using FurnitureAssemblyContracts.Attributes;
|
||||
using FurnitureAssemblyDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@ -11,20 +12,25 @@ namespace FurnitureAssemblyContracts.ViewModels
|
||||
// Класс для отображения пользователю информации о сообщениях
|
||||
public class MessageInfoViewModel : IMessageInfoModel
|
||||
{
|
||||
[Column(visible: false)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(visible: false)]
|
||||
public string MessageId { get; set; } = string.Empty;
|
||||
|
||||
[Column(visible: false)]
|
||||
public int? ClientId { get; set; }
|
||||
|
||||
[DisplayName("Отправитель")]
|
||||
[Column(title: "Отправитель", width: 150)]
|
||||
public string SenderName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Дата отправки")]
|
||||
[Column(title: "Дата отправки", width: 150)]
|
||||
public DateTime DateDelivery { get; set; } = DateTime.Now;
|
||||
|
||||
[DisplayName("Заголовок")]
|
||||
[Column(title: "Заголовок", width: 150)]
|
||||
public string Subject { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Текст")]
|
||||
[Column(title: "Текст", width: 150)]
|
||||
public string Body { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using FurnitureAssemblyDataModels.Enums;
|
||||
using FurnitureAssemblyContracts.Attributes;
|
||||
using FurnitureAssemblyDataModels.Enums;
|
||||
using FurnitureAssemblyDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -12,37 +13,40 @@ namespace FurnitureAssemblyContracts.ViewModels
|
||||
// Класс для отображения пользователю информации о заказах
|
||||
public class OrderViewModel : IOrderModel
|
||||
{
|
||||
[DisplayName("Номер")]
|
||||
[Column(visible: false)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(visible: false)]
|
||||
public int ClientId { get; set; }
|
||||
|
||||
[DisplayName("ФИО клиента")]
|
||||
[Column(title: "ФИО клиента", width: 150)]
|
||||
public string ClientFIO { get; set; } = string.Empty;
|
||||
|
||||
[Column(visible: false)]
|
||||
public int? ImplementerId { get; set; }
|
||||
|
||||
[DisplayName("ФИО исполнителя")]
|
||||
[Column(title: "ФИО исполнителя", width: 150)]
|
||||
public string ImplementerFIO { get; set; } = string.Empty;
|
||||
|
||||
[Column(visible: false)]
|
||||
public int FurnitureId { get; set; }
|
||||
|
||||
[DisplayName("Изделие")]
|
||||
[Column(title: "Изделие", width: 150)]
|
||||
public string FurnitureName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Количество")]
|
||||
[Column(title: "Количество", width: 150)]
|
||||
public int Count { get; set; }
|
||||
|
||||
[DisplayName("Сумма")]
|
||||
[Column(title: "Сумма", width: 150)]
|
||||
public double Sum { get; set; }
|
||||
|
||||
[DisplayName("Статус")]
|
||||
[Column(title: "Статус", width: 150)]
|
||||
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
||||
|
||||
[DisplayName("Дата создания")]
|
||||
[Column(title: "Дата создания", width: 150)]
|
||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||
|
||||
[DisplayName("Дата выполнения")]
|
||||
[Column(title: "Дата выполнения", width: 150)]
|
||||
public DateTime? DateImplement { get; set; }
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using FurnitureAssemblyDataModels.Models;
|
||||
using FurnitureAssemblyContracts.Attributes;
|
||||
using FurnitureAssemblyDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@ -11,12 +12,13 @@ namespace FurnitureAssemblyContracts.ViewModels
|
||||
// Класс для отображения пользователю данных о заготовке (заготовках)
|
||||
public class WorkPieceViewModel : IWorkPieceModel
|
||||
{
|
||||
[Column(visible: false)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Название заготовки")]
|
||||
[Column(title: "Название заготовки", width: 150)]
|
||||
public string WorkPieceName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Цена")]
|
||||
[Column(title: "Цена", width: 150)]
|
||||
public double Cost { get; set; }
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
namespace FurnitureAssemblyDataModels.Models
|
||||
{
|
||||
// Интерфейс, отвечающий за сообщения
|
||||
public interface IMessageInfoModel
|
||||
public interface IMessageInfoModel : IId
|
||||
{
|
||||
string MessageId { get; }
|
||||
|
||||
|
@ -0,0 +1,33 @@
|
||||
using FurnitureAssemblyContracts.DI;
|
||||
using FurnitureAssemblyContracts.StoragesContracts;
|
||||
using FurnitureAssemblyDatabaseImplement.Implements;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyDatabaseImplement
|
||||
{
|
||||
public class DataBaseImplementationExtension : IImplementationExtension
|
||||
{
|
||||
public int Priority => 2;
|
||||
|
||||
public void RegisterServices()
|
||||
{
|
||||
DependencyManager.Instance.RegisterType<IClientStorage, ClientStorage>();
|
||||
|
||||
DependencyManager.Instance.RegisterType<IWorkPieceStorage, WorkPieceStorage>();
|
||||
|
||||
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>();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
using FurnitureAssemblyContracts.StoragesContracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyDatabaseImplement.Implements
|
||||
{
|
||||
public class BackUpInfo : IBackUpInfo
|
||||
{
|
||||
public List<T>? GetList<T>() where T : class, new()
|
||||
{
|
||||
using var context = new FurnitureAssemblyDatabase();
|
||||
|
||||
return context.Set<T>().ToList();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
298
FurnitureAssembly/FurnitureAssemblyDatabaseImplement/Migrations/20240621135519_lab8.Designer.cs
generated
Normal file
298
FurnitureAssembly/FurnitureAssemblyDatabaseImplement/Migrations/20240621135519_lab8.Designer.cs
generated
Normal file
@ -0,0 +1,298 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using FurnitureAssemblyDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FurnitureAssemblyDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(FurnitureAssemblyDatabase))]
|
||||
[Migration("20240621135519_lab8")]
|
||||
partial class lab8
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.17")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClientFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Clients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Furniture", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("FurnitureName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Furnitures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.FurnitureWorkPiece", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("FurnitureId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("WorkPieceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("FurnitureId");
|
||||
|
||||
b.HasIndex("WorkPieceId");
|
||||
|
||||
b.ToTable("FurnitureWorkPieces");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Implementer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ImplementerFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Qualification")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("WorkExperience")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Implementers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.MessageInfo", b =>
|
||||
{
|
||||
b.Property<string>("MessageId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("Body")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateDelivery")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("SenderName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Subject")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("MessageId");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.ToTable("Messages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("FurnitureId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("ImplementerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.HasIndex("FurnitureId");
|
||||
|
||||
b.HasIndex("ImplementerId");
|
||||
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.WorkPiece", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("WorkPieceName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("WorkPieces");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.FurnitureWorkPiece", b =>
|
||||
{
|
||||
b.HasOne("FurnitureAssemblyDatabaseImplement.Models.Furniture", "Furniture")
|
||||
.WithMany("WorkPieces")
|
||||
.HasForeignKey("FurnitureId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FurnitureAssemblyDatabaseImplement.Models.WorkPiece", "WorkPiece")
|
||||
.WithMany("FurnitureWorkPieces")
|
||||
.HasForeignKey("WorkPieceId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Furniture");
|
||||
|
||||
b.Navigation("WorkPiece");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.MessageInfo", b =>
|
||||
{
|
||||
b.HasOne("FurnitureAssemblyDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("Messages")
|
||||
.HasForeignKey("ClientId");
|
||||
|
||||
b.Navigation("Client");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("FurnitureAssemblyDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FurnitureAssemblyDatabaseImplement.Models.Furniture", "Furniture")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("FurnitureId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FurnitureAssemblyDatabaseImplement.Models.Implementer", "Implementer")
|
||||
.WithMany("Order")
|
||||
.HasForeignKey("ImplementerId");
|
||||
|
||||
b.Navigation("Client");
|
||||
|
||||
b.Navigation("Furniture");
|
||||
|
||||
b.Navigation("Implementer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("Messages");
|
||||
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Furniture", b =>
|
||||
{
|
||||
b.Navigation("Orders");
|
||||
|
||||
b.Navigation("WorkPieces");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Implementer", b =>
|
||||
{
|
||||
b.Navigation("Order");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.WorkPiece", b =>
|
||||
{
|
||||
b.Navigation("FurnitureWorkPieces");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FurnitureAssemblyDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class lab8 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -8,20 +8,26 @@ using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace FurnitureAssemblyDatabaseImplement.Models
|
||||
{
|
||||
[DataContract]
|
||||
public class Client : IClientModel
|
||||
{
|
||||
[DataMember]
|
||||
public int Id { get; private set; }
|
||||
|
||||
[Required]
|
||||
[DataMember]
|
||||
public string ClientFIO { get; private set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[DataMember]
|
||||
public string Email { get; private set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[DataMember]
|
||||
public string Password { get; private set; } = string.Empty;
|
||||
|
||||
// Для реализации связи многие-ко-многим с заказами (клиенты могу сделать одинаковый заказ)
|
||||
|
@ -7,25 +7,31 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyDatabaseImplement.Models
|
||||
{
|
||||
[DataContract]
|
||||
public class Furniture : IFurnitureModel
|
||||
{
|
||||
[DataMember]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[DataMember]
|
||||
public string FurnitureName { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[DataMember]
|
||||
public double Price { get; set; }
|
||||
|
||||
public Dictionary<int, (IWorkPieceModel, int)>? _furnitureWorkPieces = null;
|
||||
|
||||
// Это поле не будет "мапиться" в бд
|
||||
[NotMapped]
|
||||
[DataMember]
|
||||
public Dictionary<int, (IWorkPieceModel, int)> FurnitureWorkPieces
|
||||
{
|
||||
get
|
||||
|
@ -2,11 +2,13 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyDatabaseImplement.Models
|
||||
{
|
||||
[DataContract]
|
||||
public class FurnitureWorkPiece
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
@ -8,23 +8,30 @@ using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace FurnitureAssemblyDatabaseImplement.Models
|
||||
{
|
||||
[DataContract]
|
||||
public class Implementer : IImplementerModel
|
||||
{
|
||||
[DataMember]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[DataMember]
|
||||
public string ImplementerFIO { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[DataMember]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[DataMember]
|
||||
public int WorkExperience { get; set; }
|
||||
|
||||
[Required]
|
||||
[DataMember]
|
||||
public int Qualification { get; set; }
|
||||
|
||||
// Для реализации связи один ко многим с заказами
|
||||
|
@ -5,29 +5,30 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyDatabaseImplement.Models
|
||||
{
|
||||
[DataContract]
|
||||
public class MessageInfo : IMessageInfoModel
|
||||
{
|
||||
public int Id => throw new NotImplementedException();
|
||||
|
||||
[Key]
|
||||
[DataMember]
|
||||
public string MessageId { get; set; } = string.Empty;
|
||||
|
||||
public int? ClientId { get; set; }
|
||||
|
||||
[Required]
|
||||
public string SenderName { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public DateTime DateDelivery { get; set; } = DateTime.Now;
|
||||
|
||||
[Required]
|
||||
public string Subject { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public string Body { get; set; } = string.Empty;
|
||||
|
||||
public virtual Client? Client { get; set; }
|
||||
|
@ -6,35 +6,46 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyDatabaseImplement.Models
|
||||
{
|
||||
[DataContract]
|
||||
public class Order : IOrderModel
|
||||
{
|
||||
[DataMember]
|
||||
public int Id { get; private set; }
|
||||
|
||||
[Required]
|
||||
[DataMember]
|
||||
public int FurnitureId { get; private set; }
|
||||
|
||||
[Required]
|
||||
[DataMember]
|
||||
public int ClientId { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public int? ImplementerId { get; private set; }
|
||||
|
||||
[Required]
|
||||
[DataMember]
|
||||
public int Count { get; private set; }
|
||||
|
||||
[Required]
|
||||
[DataMember]
|
||||
public double Sum { get; private set; }
|
||||
|
||||
[Required]
|
||||
[DataMember]
|
||||
public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен;
|
||||
|
||||
[Required]
|
||||
[DataMember]
|
||||
public DateTime DateCreate { get; private set; } = DateTime.Now;
|
||||
|
||||
[DataMember]
|
||||
public DateTime? DateImplement { get; private set; }
|
||||
|
||||
// Для передачи названия изделия
|
||||
|
@ -6,19 +6,24 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyDatabaseImplement.Models
|
||||
{
|
||||
[DataContract]
|
||||
public class WorkPiece : IWorkPieceModel
|
||||
{
|
||||
[DataMember]
|
||||
public int Id { get; private set; }
|
||||
|
||||
[Required]
|
||||
[DataMember]
|
||||
public string WorkPieceName { get; private set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[DataMember]
|
||||
public double Cost { get; set; }
|
||||
|
||||
// для реализации связи многие ко многим с изделиями
|
||||
|
@ -0,0 +1,34 @@
|
||||
using FurnitureAssemblyContracts.DI;
|
||||
using FurnitureAssemblyContracts.StoragesContracts;
|
||||
using FurnitureAssemblyFileImplement.Implements;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyFileImplement
|
||||
{
|
||||
// Для реализации нужных нам зависимостей в данном варианте хранения информации
|
||||
public class FileImplementationExtension : IImplementationExtension
|
||||
{
|
||||
public int Priority => 1;
|
||||
|
||||
public void RegisterServices()
|
||||
{
|
||||
DependencyManager.Instance.RegisterType<IClientStorage, ClientStorage>();
|
||||
|
||||
DependencyManager.Instance.RegisterType<IWorkPieceStorage, WorkPieceStorage>();
|
||||
|
||||
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>();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
using FurnitureAssemblyContracts.StoragesContracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyFileImplement.Implements
|
||||
{
|
||||
public class BackUpInfo : IBackUpInfo
|
||||
{
|
||||
public List<T>? GetList<T>() where T : class, new()
|
||||
{
|
||||
var source = DataFileSingleton.GetInstance();
|
||||
|
||||
return (List<T>?)source.GetType().GetProperties()
|
||||
.FirstOrDefault(x => x.PropertyType.IsGenericType && x.PropertyType.GetGenericArguments()[0] == typeof(T))
|
||||
?.GetValue(source);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
@ -4,20 +4,26 @@ 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 FurnitureAssemblyFileImplement.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)
|
||||
|
@ -4,6 +4,7 @@ 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;
|
||||
@ -11,18 +12,23 @@ using System.Xml.Linq;
|
||||
namespace FurnitureAssemblyFileImplement.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> WorkPieces { get; private set; } = new();
|
||||
|
||||
private Dictionary<int, (IWorkPieceModel, int)>? _furnitureWorkPieces = null;
|
||||
|
||||
[DataMember]
|
||||
public Dictionary<int, (IWorkPieceModel, int)> FurnitureWorkPieces
|
||||
{
|
||||
get
|
||||
|
@ -4,22 +4,29 @@ 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 FurnitureAssemblyFileImplement.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)
|
||||
|
@ -4,6 +4,7 @@ using FurnitureAssemblyDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@ -11,18 +12,27 @@ using System.Xml.Linq;
|
||||
|
||||
namespace FurnitureAssemblyFileImplement.Models
|
||||
{
|
||||
[DataContract]
|
||||
public class MessageInfo : IMessageInfoModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[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;
|
||||
|
||||
|
||||
public string Body { get; private set; } = string.Empty;
|
||||
|
||||
public static MessageInfo? Create(MessageInfoBindingModel model)
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
@ -12,24 +13,34 @@ using System.Xml.Linq;
|
||||
namespace FurnitureAssemblyFileImplement.Models
|
||||
{
|
||||
// Класс, реализующий интерфейс модели заказа
|
||||
[DataContract]
|
||||
public class Order : IOrderModel
|
||||
{
|
||||
[DataMember]
|
||||
public int Id { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public int FurnitureId { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public int ClientId { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public int? ImplementerId { get; private set; }
|
||||
|
||||
[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; }
|
||||
|
||||
public static Order? Create(OrderBindingModel model)
|
||||
|
@ -4,6 +4,7 @@ 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;
|
||||
@ -11,12 +12,16 @@ using System.Xml.Linq;
|
||||
namespace FurnitureAssemblyFileImplement.Models
|
||||
{
|
||||
// Класс, реализующий интерфейс модели заготовки
|
||||
[DataContract]
|
||||
public class WorkPiece : IWorkPieceModel
|
||||
{
|
||||
[DataMember]
|
||||
public int Id { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public string WorkPieceName { get; private set; } = string.Empty;
|
||||
|
||||
[DataMember]
|
||||
public double Cost { get; set; }
|
||||
|
||||
public static WorkPiece? Create(WorkPieceBindingModel model)
|
||||
|
@ -0,0 +1,22 @@
|
||||
using FurnitureAssemblyContracts.StoragesContracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyListImplement.Implements
|
||||
{
|
||||
public class BackUpInfo : IBackUpInfo
|
||||
{
|
||||
public List<T>? GetList<T>() where T : class, new()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Type? GetTypeByModelInterface(string modelInterfaceName)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
using FurnitureAssemblyContracts.DI;
|
||||
using FurnitureAssemblyContracts.StoragesContracts;
|
||||
using FurnitureAssemblyListImplement.Implements;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyListImplement
|
||||
{
|
||||
public class ListImplementationExtension : IImplementationExtension
|
||||
{
|
||||
public int Priority => 0;
|
||||
|
||||
public void RegisterServices()
|
||||
{
|
||||
DependencyManager.Instance.RegisterType<IClientStorage, ClientStorage>();
|
||||
|
||||
DependencyManager.Instance.RegisterType<IWorkPieceStorage, WorkPieceStorage>();
|
||||
|
||||
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>();
|
||||
}
|
||||
}
|
||||
}
|
@ -12,6 +12,8 @@ namespace FurnitureAssemblyListImplement.Models
|
||||
{
|
||||
public class MessageInfo : IMessageInfoModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
|
||||
public string MessageId { get; private set; } = string.Empty;
|
||||
|
||||
public int? ClientId { get; private set; }
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\FurnitureAssemblyBusinessLogic\FurnitureAssemblyBusinessLogic.csproj" />
|
||||
<ProjectReference Include="..\FurnitureAssemblyContracts\FurnitureAssemblyContracts.csproj" />
|
||||
<ProjectReference Include="..\FurnitureAssemblyDatabaseImplement\FurnitureAssemblyDatabaseImplement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -0,0 +1,62 @@
|
||||
using FurnitureAssemblyContracts.Attributes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureAssemblyView
|
||||
{
|
||||
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,14 +39,7 @@ namespace FurnitureAssemblyView
|
||||
|
||||
try
|
||||
{
|
||||
var list = _clientLogic.ReadList(null);
|
||||
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["ClientFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
|
||||
dataGridView.FillandConfigGrid(_clientLogic.ReadList(null));
|
||||
_logger.LogInformation("Успешная загрузка клиентов");
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -38,11 +38,11 @@
|
||||
this.buttonUpdate = new System.Windows.Forms.Button();
|
||||
this.buttonAdd = new System.Windows.Forms.Button();
|
||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||
this.buttonSave = new System.Windows.Forms.Button();
|
||||
this.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.ColumnID = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ColumnName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ColumnPrice = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.buttonSave = new System.Windows.Forms.Button();
|
||||
this.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.groupBoxWorkPiece.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
@ -50,35 +50,33 @@
|
||||
// labelName
|
||||
//
|
||||
this.labelName.AutoSize = true;
|
||||
this.labelName.Location = new System.Drawing.Point(48, 23);
|
||||
this.labelName.Location = new System.Drawing.Point(23, 30);
|
||||
this.labelName.Name = "labelName";
|
||||
this.labelName.Size = new System.Drawing.Size(62, 15);
|
||||
this.labelName.Size = new System.Drawing.Size(80, 20);
|
||||
this.labelName.TabIndex = 0;
|
||||
this.labelName.Text = "Название:";
|
||||
//
|
||||
// labelCost
|
||||
//
|
||||
this.labelCost.AutoSize = true;
|
||||
this.labelCost.Location = new System.Drawing.Point(38, 63);
|
||||
this.labelCost.Location = new System.Drawing.Point(23, 84);
|
||||
this.labelCost.Name = "labelCost";
|
||||
this.labelCost.Size = new System.Drawing.Size(70, 15);
|
||||
this.labelCost.Size = new System.Drawing.Size(86, 20);
|
||||
this.labelCost.TabIndex = 1;
|
||||
this.labelCost.Text = "Стоимость:";
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
this.textBoxName.Location = new System.Drawing.Point(116, 20);
|
||||
this.textBoxName.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.textBoxName.Location = new System.Drawing.Point(133, 27);
|
||||
this.textBoxName.Name = "textBoxName";
|
||||
this.textBoxName.Size = new System.Drawing.Size(291, 23);
|
||||
this.textBoxName.Size = new System.Drawing.Size(332, 27);
|
||||
this.textBoxName.TabIndex = 2;
|
||||
//
|
||||
// textBoxPrice
|
||||
//
|
||||
this.textBoxPrice.Location = new System.Drawing.Point(116, 60);
|
||||
this.textBoxPrice.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.textBoxPrice.Location = new System.Drawing.Point(133, 81);
|
||||
this.textBoxPrice.Name = "textBoxPrice";
|
||||
this.textBoxPrice.Size = new System.Drawing.Size(291, 23);
|
||||
this.textBoxPrice.Size = new System.Drawing.Size(196, 27);
|
||||
this.textBoxPrice.TabIndex = 3;
|
||||
//
|
||||
// groupBoxWorkPiece
|
||||
@ -88,21 +86,18 @@
|
||||
this.groupBoxWorkPiece.Controls.Add(this.buttonUpdate);
|
||||
this.groupBoxWorkPiece.Controls.Add(this.buttonAdd);
|
||||
this.groupBoxWorkPiece.Controls.Add(this.dataGridView);
|
||||
this.groupBoxWorkPiece.Location = new System.Drawing.Point(12, 87);
|
||||
this.groupBoxWorkPiece.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.groupBoxWorkPiece.Location = new System.Drawing.Point(23, 126);
|
||||
this.groupBoxWorkPiece.Name = "groupBoxWorkPiece";
|
||||
this.groupBoxWorkPiece.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.groupBoxWorkPiece.Size = new System.Drawing.Size(491, 225);
|
||||
this.groupBoxWorkPiece.Size = new System.Drawing.Size(567, 300);
|
||||
this.groupBoxWorkPiece.TabIndex = 4;
|
||||
this.groupBoxWorkPiece.TabStop = false;
|
||||
this.groupBoxWorkPiece.Text = "Заготовки";
|
||||
//
|
||||
// buttonRefresh
|
||||
//
|
||||
this.buttonRefresh.Location = new System.Drawing.Point(397, 120);
|
||||
this.buttonRefresh.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonRefresh.Location = new System.Drawing.Point(454, 196);
|
||||
this.buttonRefresh.Name = "buttonRefresh";
|
||||
this.buttonRefresh.Size = new System.Drawing.Size(82, 27);
|
||||
this.buttonRefresh.Size = new System.Drawing.Size(94, 29);
|
||||
this.buttonRefresh.TabIndex = 4;
|
||||
this.buttonRefresh.Text = "Обновить";
|
||||
this.buttonRefresh.UseVisualStyleBackColor = true;
|
||||
@ -110,10 +105,9 @@
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
this.buttonDelete.Location = new System.Drawing.Point(397, 91);
|
||||
this.buttonDelete.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonDelete.Location = new System.Drawing.Point(454, 145);
|
||||
this.buttonDelete.Name = "buttonDelete";
|
||||
this.buttonDelete.Size = new System.Drawing.Size(82, 25);
|
||||
this.buttonDelete.Size = new System.Drawing.Size(94, 29);
|
||||
this.buttonDelete.TabIndex = 3;
|
||||
this.buttonDelete.Text = "Удалить";
|
||||
this.buttonDelete.UseVisualStyleBackColor = true;
|
||||
@ -121,10 +115,9 @@
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
this.buttonUpdate.Location = new System.Drawing.Point(397, 62);
|
||||
this.buttonUpdate.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonUpdate.Location = new System.Drawing.Point(454, 95);
|
||||
this.buttonUpdate.Name = "buttonUpdate";
|
||||
this.buttonUpdate.Size = new System.Drawing.Size(82, 25);
|
||||
this.buttonUpdate.Size = new System.Drawing.Size(94, 29);
|
||||
this.buttonUpdate.TabIndex = 2;
|
||||
this.buttonUpdate.Text = "Изменить";
|
||||
this.buttonUpdate.UseVisualStyleBackColor = true;
|
||||
@ -132,10 +125,9 @@
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
this.buttonAdd.Location = new System.Drawing.Point(397, 32);
|
||||
this.buttonAdd.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonAdd.Location = new System.Drawing.Point(454, 43);
|
||||
this.buttonAdd.Name = "buttonAdd";
|
||||
this.buttonAdd.Size = new System.Drawing.Size(82, 26);
|
||||
this.buttonAdd.Size = new System.Drawing.Size(94, 29);
|
||||
this.buttonAdd.TabIndex = 1;
|
||||
this.buttonAdd.Text = "Добавить";
|
||||
this.buttonAdd.UseVisualStyleBackColor = true;
|
||||
@ -148,14 +140,33 @@
|
||||
this.ColumnID,
|
||||
this.ColumnName,
|
||||
this.ColumnPrice});
|
||||
this.dataGridView.Location = new System.Drawing.Point(5, 20);
|
||||
this.dataGridView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.dataGridView.Location = new System.Drawing.Point(6, 26);
|
||||
this.dataGridView.Name = "dataGridView";
|
||||
this.dataGridView.RowHeadersWidth = 51;
|
||||
this.dataGridView.RowTemplate.Height = 29;
|
||||
this.dataGridView.Size = new System.Drawing.Size(382, 201);
|
||||
this.dataGridView.Size = new System.Drawing.Size(436, 268);
|
||||
this.dataGridView.TabIndex = 0;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
this.buttonSave.Location = new System.Drawing.Point(340, 448);
|
||||
this.buttonSave.Name = "buttonSave";
|
||||
this.buttonSave.Size = new System.Drawing.Size(95, 29);
|
||||
this.buttonSave.TabIndex = 5;
|
||||
this.buttonSave.Text = "Сохранить";
|
||||
this.buttonSave.UseVisualStyleBackColor = true;
|
||||
this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
this.buttonCancel.Location = new System.Drawing.Point(458, 448);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(94, 29);
|
||||
this.buttonCancel.TabIndex = 6;
|
||||
this.buttonCancel.Text = "Отмена";
|
||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||
//
|
||||
// ColumnID
|
||||
//
|
||||
this.ColumnID.HeaderText = "Id";
|
||||
@ -178,33 +189,11 @@
|
||||
this.ColumnPrice.MinimumWidth = 6;
|
||||
this.ColumnPrice.Name = "ColumnPrice";
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
this.buttonSave.Location = new System.Drawing.Point(271, 316);
|
||||
this.buttonSave.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonSave.Name = "buttonSave";
|
||||
this.buttonSave.Size = new System.Drawing.Size(83, 22);
|
||||
this.buttonSave.TabIndex = 5;
|
||||
this.buttonSave.Text = "Сохранить";
|
||||
this.buttonSave.UseVisualStyleBackColor = true;
|
||||
this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
this.buttonCancel.Location = new System.Drawing.Point(360, 316);
|
||||
this.buttonCancel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(82, 22);
|
||||
this.buttonCancel.TabIndex = 6;
|
||||
this.buttonCancel.Text = "Отмена";
|
||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||
//
|
||||
// FormFurniture
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(517, 357);
|
||||
this.ClientSize = new System.Drawing.Size(619, 500);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.Controls.Add(this.buttonSave);
|
||||
this.Controls.Add(this.groupBoxWorkPiece);
|
||||
@ -212,7 +201,6 @@
|
||||
this.Controls.Add(this.textBoxName);
|
||||
this.Controls.Add(this.labelCost);
|
||||
this.Controls.Add(this.labelName);
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.Name = "FormFurniture";
|
||||
this.Text = "Изделие";
|
||||
this.Load += new System.EventHandler(this.FormFurniture_Load);
|
||||
|
@ -1,5 +1,6 @@
|
||||
using FurnitureAssemblyContracts.BindingModels;
|
||||
using FurnitureAssemblyContracts.BusinessLogicsContracts;
|
||||
using FurnitureAssemblyContracts.DI;
|
||||
using FurnitureAssemblyContracts.SearchModels;
|
||||
using FurnitureAssemblyDataModels.Models;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@ -46,7 +47,7 @@ namespace FurnitureAssemblyView
|
||||
{
|
||||
var view = _logic.ReadElement(new FurnitureSearchModel { Id = _id.Value });
|
||||
|
||||
if(view != null)
|
||||
if (view != null)
|
||||
{
|
||||
textBoxName.Text = view.FurnitureName;
|
||||
textBoxPrice.Text = view.Price.ToString();
|
||||
@ -54,7 +55,7 @@ namespace FurnitureAssemblyView
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки изделия");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
@ -68,11 +69,11 @@ namespace FurnitureAssemblyView
|
||||
|
||||
try
|
||||
{
|
||||
if(_furnitureWorkPieces != null)
|
||||
if (_furnitureWorkPieces != null)
|
||||
{
|
||||
dataGridView.Rows.Clear();
|
||||
|
||||
foreach(var awp in _furnitureWorkPieces)
|
||||
foreach (var awp in _furnitureWorkPieces)
|
||||
{
|
||||
dataGridView.Rows.Add(new object[] { awp.Key, awp.Value.Item1.WorkPieceName, awp.Value.Item2 });
|
||||
}
|
||||
@ -80,7 +81,7 @@ namespace FurnitureAssemblyView
|
||||
textBoxPrice.Text = CalcPrice().ToString();
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки заготовки для изделия");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
@ -89,10 +90,8 @@ namespace FurnitureAssemblyView
|
||||
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormFurnitureWorkPiece));
|
||||
var form = DependencyManager.Instance.Resolve<FormFurnitureWorkPiece>();
|
||||
|
||||
if (service is FormFurnitureWorkPiece form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (form.WorkPieceModel == null)
|
||||
@ -114,16 +113,13 @@ namespace FurnitureAssemblyView
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormFurnitureWorkPiece));
|
||||
var form = DependencyManager.Instance.Resolve<FormFurnitureWorkPiece>();
|
||||
|
||||
if (service is FormFurnitureWorkPiece form)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value);
|
||||
form.Id = id;
|
||||
form.Count = _furnitureWorkPieces[id].Item2;
|
||||
@ -142,7 +138,6 @@ namespace FurnitureAssemblyView
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
@ -28,87 +28,79 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.buttonAdd = new System.Windows.Forms.Button();
|
||||
this.buttonUpdate = new System.Windows.Forms.Button();
|
||||
this.buttonDelete = new System.Windows.Forms.Button();
|
||||
this.buttonRef = new System.Windows.Forms.Button();
|
||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
buttonAdd = new Button();
|
||||
buttonUpdate = new Button();
|
||||
buttonDelete = new Button();
|
||||
buttonRefresh = new Button();
|
||||
dataGridView = new DataGridView();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
this.buttonAdd.Location = new System.Drawing.Point(560, 26);
|
||||
this.buttonAdd.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonAdd.Name = "buttonAdd";
|
||||
this.buttonAdd.Size = new System.Drawing.Size(102, 38);
|
||||
this.buttonAdd.TabIndex = 0;
|
||||
this.buttonAdd.Text = "Добавить";
|
||||
this.buttonAdd.UseVisualStyleBackColor = true;
|
||||
this.buttonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
|
||||
buttonAdd.Location = new Point(640, 35);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(116, 50);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.Text = "Добавить";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
this.buttonUpdate.Location = new System.Drawing.Point(560, 79);
|
||||
this.buttonUpdate.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonUpdate.Name = "buttonUpdate";
|
||||
this.buttonUpdate.Size = new System.Drawing.Size(102, 38);
|
||||
this.buttonUpdate.TabIndex = 1;
|
||||
this.buttonUpdate.Text = "Изменить";
|
||||
this.buttonUpdate.UseVisualStyleBackColor = true;
|
||||
this.buttonUpdate.Click += new System.EventHandler(this.ButtonUpdate_Click);
|
||||
buttonUpdate.Location = new Point(640, 105);
|
||||
buttonUpdate.Name = "buttonUpdate";
|
||||
buttonUpdate.Size = new Size(116, 50);
|
||||
buttonUpdate.TabIndex = 1;
|
||||
buttonUpdate.Text = "Изменить";
|
||||
buttonUpdate.UseVisualStyleBackColor = true;
|
||||
buttonUpdate.Click += ButtonUpdate_Click;
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
this.buttonDelete.Location = new System.Drawing.Point(560, 131);
|
||||
this.buttonDelete.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonDelete.Name = "buttonDelete";
|
||||
this.buttonDelete.Size = new System.Drawing.Size(102, 38);
|
||||
this.buttonDelete.TabIndex = 2;
|
||||
this.buttonDelete.Text = "Удалить";
|
||||
this.buttonDelete.UseVisualStyleBackColor = true;
|
||||
this.buttonDelete.Click += new System.EventHandler(this.ButtonDelete_Click);
|
||||
buttonDelete.Location = new Point(640, 175);
|
||||
buttonDelete.Name = "buttonDelete";
|
||||
buttonDelete.Size = new Size(116, 50);
|
||||
buttonDelete.TabIndex = 2;
|
||||
buttonDelete.Text = "Удалить";
|
||||
buttonDelete.UseVisualStyleBackColor = true;
|
||||
buttonDelete.Click += ButtonDelete_Click;
|
||||
//
|
||||
// buttonRef
|
||||
//
|
||||
this.buttonRef.Location = new System.Drawing.Point(560, 184);
|
||||
this.buttonRef.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonRef.Name = "buttonRef";
|
||||
this.buttonRef.Size = new System.Drawing.Size(102, 38);
|
||||
this.buttonRef.TabIndex = 3;
|
||||
this.buttonRef.Text = "Обновить";
|
||||
this.buttonRef.UseVisualStyleBackColor = true;
|
||||
this.buttonRef.Click += new System.EventHandler(this.ButtonRef_Click);
|
||||
buttonRefresh.Location = new Point(640, 245);
|
||||
buttonRefresh.Name = "buttonRef";
|
||||
buttonRefresh.Size = new Size(116, 50);
|
||||
buttonRefresh.TabIndex = 3;
|
||||
buttonRefresh.Text = "Обновить";
|
||||
buttonRefresh.UseVisualStyleBackColor = true;
|
||||
buttonRefresh.Click += ButtonRefresh_Click;
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView.Location = new System.Drawing.Point(10, 9);
|
||||
this.dataGridView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.dataGridView.Name = "dataGridView";
|
||||
this.dataGridView.RowHeadersWidth = 51;
|
||||
this.dataGridView.RowTemplate.Height = 29;
|
||||
this.dataGridView.Size = new System.Drawing.Size(528, 320);
|
||||
this.dataGridView.TabIndex = 4;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Location = new Point(12, 12);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.RowTemplate.Height = 29;
|
||||
dataGridView.Size = new Size(604, 426);
|
||||
dataGridView.TabIndex = 4;
|
||||
//
|
||||
// FormFurnitures
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(683, 338);
|
||||
this.Controls.Add(this.dataGridView);
|
||||
this.Controls.Add(this.buttonRef);
|
||||
this.Controls.Add(this.buttonDelete);
|
||||
this.Controls.Add(this.buttonUpdate);
|
||||
this.Controls.Add(this.buttonAdd);
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.Name = "FormFurnitures";
|
||||
this.Text = "Изделия";
|
||||
this.Load += new System.EventHandler(this.FormFurnitures_Load);
|
||||
this.Click += new System.EventHandler(this.FormFurnitures_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(781, 450);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(buttonRefresh);
|
||||
Controls.Add(buttonDelete);
|
||||
Controls.Add(buttonUpdate);
|
||||
Controls.Add(buttonAdd);
|
||||
Name = "FormFurnitures";
|
||||
Text = "Изделия";
|
||||
Load += FormFurnitures_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -116,7 +108,7 @@
|
||||
private Button buttonAdd;
|
||||
private Button buttonUpdate;
|
||||
private Button buttonDelete;
|
||||
private Button buttonRef;
|
||||
private Button buttonRefresh;
|
||||
private DataGridView dataGridView;
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using FurnitureAssemblyContracts.BindingModels;
|
||||
using FurnitureAssemblyContracts.BusinessLogicsContracts;
|
||||
using FurnitureAssemblyContracts.DI;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -37,15 +38,7 @@ namespace FurnitureAssemblyView
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _logic.ReadList(null);
|
||||
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["Id"].Visible = false;
|
||||
dataGridView.Columns["FurnitureWorkPieces"].Visible = false;
|
||||
dataGridView.Columns["FurnitureName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
dataGridView.FillandConfigGrid(_logic.ReadList(null));
|
||||
|
||||
_logger.LogInformation("Загрузка изделий");
|
||||
}
|
||||
@ -58,25 +51,20 @@ namespace FurnitureAssemblyView
|
||||
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormFurniture));
|
||||
var form = DependencyManager.Instance.Resolve<FormFurniture>();
|
||||
|
||||
if (service is FormFurniture form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormFurniture));
|
||||
var form = DependencyManager.Instance.Resolve<FormFurniture>();
|
||||
|
||||
if (service is FormFurniture form)
|
||||
{
|
||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
@ -85,7 +73,6 @@ namespace FurnitureAssemblyView
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
@ -118,7 +105,7 @@ namespace FurnitureAssemblyView
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonRef_Click(object sender, EventArgs e)
|
||||
private void ButtonRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
@ -1,4 +1,64 @@
|
||||
<root>
|
||||
<?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">
|
||||
|
@ -1,5 +1,6 @@
|
||||
using FurnitureAssemblyContracts.BindingModels;
|
||||
using FurnitureAssemblyContracts.BusinessLogicsContracts;
|
||||
using FurnitureAssemblyContracts.DI;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -36,6 +37,9 @@ namespace FurnitureAssemblyView
|
||||
{
|
||||
try
|
||||
{
|
||||
dataGridView.FillandConfigGrid(_logic.ReadList(null));
|
||||
|
||||
_logger.LogInformation("Загрузка исполнителей");
|
||||
var list = _logic.ReadList(null);
|
||||
|
||||
// Растягиваем колонку Название на всю ширину, колонку Id скрываем
|
||||
@ -58,32 +62,27 @@ namespace FurnitureAssemblyView
|
||||
|
||||
private void ButtonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormImplementer));
|
||||
var form = DependencyManager.Instance.Resolve<FormImplementer>();
|
||||
|
||||
if (service is FormImplementer form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonChange_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormImplementer));
|
||||
var form = DependencyManager.Instance.Resolve<FormImplementer>();
|
||||
|
||||
if (service is FormImplementer form)
|
||||
{
|
||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,15 +37,7 @@ namespace FurnitureAssemblyView
|
||||
|
||||
try
|
||||
{
|
||||
var list = _messageLogic.ReadList(null);
|
||||
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["MessageId"].Visible = false;
|
||||
dataGridView.Columns["ClientId"].Visible = false;
|
||||
dataGridView.Columns["Body"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
dataGridView.FillandConfigGrid(_messageLogic.ReadList(null));
|
||||
|
||||
_logger.LogInformation("Успешная загрузка писем");
|
||||
}
|
||||
|
@ -28,196 +28,202 @@
|
||||
/// </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.buttonRefresh = new System.Windows.Forms.Button();
|
||||
this.menuStrip = new System.Windows.Forms.MenuStrip();
|
||||
this.toolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.workPieceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.furnitureToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mailsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.reportsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.workPiecesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.workPieceFurnituresToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ordersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.workWithClientsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.clientsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.workWithImplementerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.implementerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.startingWorkToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||
this.menuStrip.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
dataGridView = new DataGridView();
|
||||
buttonCreateOrder = new Button();
|
||||
buttonIssuedOrder = new Button();
|
||||
buttonRefresh = new Button();
|
||||
menuStrip = new MenuStrip();
|
||||
toolStripMenuItem = new ToolStripMenuItem();
|
||||
workPieceToolStripMenuItem = new ToolStripMenuItem();
|
||||
furnitureToolStripMenuItem = new ToolStripMenuItem();
|
||||
mailsToolStripMenuItem = new ToolStripMenuItem();
|
||||
reportsToolStripMenuItem = new ToolStripMenuItem();
|
||||
workPiecesToolStripMenuItem = new ToolStripMenuItem();
|
||||
workPieceFurnituresToolStripMenuItem = new ToolStripMenuItem();
|
||||
ordersToolStripMenuItem = new ToolStripMenuItem();
|
||||
workWithClientsToolStripMenuItem = new ToolStripMenuItem();
|
||||
clientsToolStripMenuItem = new ToolStripMenuItem();
|
||||
workWithImplementerToolStripMenuItem = new ToolStripMenuItem();
|
||||
implementerToolStripMenuItem = new ToolStripMenuItem();
|
||||
startingWorkToolStripMenuItem = new ToolStripMenuItem();
|
||||
createBackUpToolStripMenuItem = new ToolStripMenuItem();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
menuStrip.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView.Location = new System.Drawing.Point(10, 27);
|
||||
this.dataGridView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.dataGridView.Name = "dataGridView";
|
||||
this.dataGridView.RowHeadersWidth = 51;
|
||||
this.dataGridView.RowTemplate.Height = 29;
|
||||
this.dataGridView.Size = new System.Drawing.Size(820, 302);
|
||||
this.dataGridView.TabIndex = 0;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Location = new Point(10, 27);
|
||||
dataGridView.Margin = new Padding(3, 2, 3, 2);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.RowTemplate.Height = 29;
|
||||
dataGridView.Size = new Size(820, 302);
|
||||
dataGridView.TabIndex = 0;
|
||||
//
|
||||
// buttonCreateOrder
|
||||
//
|
||||
this.buttonCreateOrder.Location = new System.Drawing.Point(887, 50);
|
||||
this.buttonCreateOrder.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonCreateOrder.Name = "buttonCreateOrder";
|
||||
this.buttonCreateOrder.Size = new System.Drawing.Size(206, 34);
|
||||
this.buttonCreateOrder.TabIndex = 1;
|
||||
this.buttonCreateOrder.Text = "Создать заказ";
|
||||
this.buttonCreateOrder.UseVisualStyleBackColor = true;
|
||||
buttonCreateOrder.Location = new Point(887, 50);
|
||||
buttonCreateOrder.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonCreateOrder.Name = "buttonCreateOrder";
|
||||
buttonCreateOrder.Size = new Size(206, 34);
|
||||
buttonCreateOrder.TabIndex = 1;
|
||||
buttonCreateOrder.Text = "Создать заказ";
|
||||
buttonCreateOrder.UseVisualStyleBackColor = true;
|
||||
buttonCreateOrder.Click += ButtonCreateOrder_Click;
|
||||
//
|
||||
// buttonIssuedOrder
|
||||
//
|
||||
this.buttonIssuedOrder.Location = new System.Drawing.Point(887, 100);
|
||||
this.buttonIssuedOrder.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonIssuedOrder.Name = "buttonIssuedOrder";
|
||||
this.buttonIssuedOrder.Size = new System.Drawing.Size(206, 33);
|
||||
this.buttonIssuedOrder.TabIndex = 4;
|
||||
this.buttonIssuedOrder.Text = "Заказ выдан";
|
||||
this.buttonIssuedOrder.UseVisualStyleBackColor = true;
|
||||
buttonIssuedOrder.Location = new Point(887, 100);
|
||||
buttonIssuedOrder.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonIssuedOrder.Name = "buttonIssuedOrder";
|
||||
buttonIssuedOrder.Size = new Size(206, 33);
|
||||
buttonIssuedOrder.TabIndex = 4;
|
||||
buttonIssuedOrder.Text = "Заказ выдан";
|
||||
buttonIssuedOrder.UseVisualStyleBackColor = true;
|
||||
buttonIssuedOrder.Click += ButtonIssuedOrder_Click;
|
||||
//
|
||||
// buttonRefresh
|
||||
//
|
||||
this.buttonRefresh.Location = new System.Drawing.Point(887, 152);
|
||||
this.buttonRefresh.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonRefresh.Name = "buttonRefresh";
|
||||
this.buttonRefresh.Size = new System.Drawing.Size(206, 29);
|
||||
this.buttonRefresh.TabIndex = 5;
|
||||
this.buttonRefresh.Text = "Обновить";
|
||||
this.buttonRefresh.UseVisualStyleBackColor = true;
|
||||
buttonRefresh.Location = new Point(887, 152);
|
||||
buttonRefresh.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonRefresh.Name = "buttonRefresh";
|
||||
buttonRefresh.Size = new Size(206, 29);
|
||||
buttonRefresh.TabIndex = 5;
|
||||
buttonRefresh.Text = "Обновить";
|
||||
buttonRefresh.UseVisualStyleBackColor = true;
|
||||
buttonRefresh.Click += ButtonRefresh_Click;
|
||||
//
|
||||
// menuStrip
|
||||
//
|
||||
this.menuStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripMenuItem,
|
||||
this.reportsToolStripMenuItem,
|
||||
this.workWithClientsToolStripMenuItem,
|
||||
this.workWithImplementerToolStripMenuItem,
|
||||
this.startingWorkToolStripMenuItem});
|
||||
this.menuStrip.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip.Name = "menuStrip";
|
||||
this.menuStrip.Padding = new System.Windows.Forms.Padding(5, 2, 0, 2);
|
||||
this.menuStrip.Size = new System.Drawing.Size(1135, 24);
|
||||
this.menuStrip.TabIndex = 6;
|
||||
this.menuStrip.Text = "menuStrip";
|
||||
menuStrip.ImageScalingSize = new Size(20, 20);
|
||||
menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, reportsToolStripMenuItem, workWithClientsToolStripMenuItem, workWithImplementerToolStripMenuItem, startingWorkToolStripMenuItem, createBackUpToolStripMenuItem });
|
||||
menuStrip.Location = new Point(0, 0);
|
||||
menuStrip.Name = "menuStrip";
|
||||
menuStrip.Padding = new Padding(5, 2, 0, 2);
|
||||
menuStrip.Size = new Size(1135, 24);
|
||||
menuStrip.TabIndex = 6;
|
||||
menuStrip.Text = "menuStrip";
|
||||
//
|
||||
// toolStripMenuItem
|
||||
//
|
||||
this.toolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.workPieceToolStripMenuItem,
|
||||
this.furnitureToolStripMenuItem,
|
||||
this.mailsToolStripMenuItem});
|
||||
this.toolStripMenuItem.Name = "toolStripMenuItem";
|
||||
this.toolStripMenuItem.Size = new System.Drawing.Size(94, 20);
|
||||
this.toolStripMenuItem.Text = "Справочники";
|
||||
toolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { workPieceToolStripMenuItem, furnitureToolStripMenuItem, mailsToolStripMenuItem });
|
||||
toolStripMenuItem.Name = "toolStripMenuItem";
|
||||
toolStripMenuItem.Size = new Size(94, 20);
|
||||
toolStripMenuItem.Text = "Справочники";
|
||||
//
|
||||
// workPieceToolStripMenuItem
|
||||
//
|
||||
this.workPieceToolStripMenuItem.Name = "workPieceToolStripMenuItem";
|
||||
this.workPieceToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.workPieceToolStripMenuItem.Text = "Заготовки";
|
||||
workPieceToolStripMenuItem.Name = "workPieceToolStripMenuItem";
|
||||
workPieceToolStripMenuItem.Size = new Size(130, 22);
|
||||
workPieceToolStripMenuItem.Text = "Заготовки";
|
||||
workPieceToolStripMenuItem.Click += WorkPieceToolStripMenuItem_Click;
|
||||
//
|
||||
// furnitureToolStripMenuItem
|
||||
//
|
||||
this.furnitureToolStripMenuItem.Name = "furnitureToolStripMenuItem";
|
||||
this.furnitureToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.furnitureToolStripMenuItem.Text = "Изделия";
|
||||
furnitureToolStripMenuItem.Name = "furnitureToolStripMenuItem";
|
||||
furnitureToolStripMenuItem.Size = new Size(130, 22);
|
||||
furnitureToolStripMenuItem.Text = "Изделия";
|
||||
furnitureToolStripMenuItem.Click += FurnitureToolStripMenuItem_Click;
|
||||
//
|
||||
// mailsToolStripMenuItem
|
||||
//
|
||||
this.mailsToolStripMenuItem.Name = "mailsToolStripMenuItem";
|
||||
this.mailsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.mailsToolStripMenuItem.Text = "Письма";
|
||||
this.mailsToolStripMenuItem.Click += new System.EventHandler(this.MailsToolStripMenuItem_Click);
|
||||
mailsToolStripMenuItem.Name = "mailsToolStripMenuItem";
|
||||
mailsToolStripMenuItem.Size = new Size(130, 22);
|
||||
mailsToolStripMenuItem.Text = "Письма";
|
||||
mailsToolStripMenuItem.Click += MailsToolStripMenuItem_Click;
|
||||
//
|
||||
// reportsToolStripMenuItem
|
||||
//
|
||||
this.reportsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.workPiecesToolStripMenuItem,
|
||||
this.workPieceFurnituresToolStripMenuItem,
|
||||
this.ordersToolStripMenuItem});
|
||||
this.reportsToolStripMenuItem.Name = "reportsToolStripMenuItem";
|
||||
this.reportsToolStripMenuItem.Size = new System.Drawing.Size(60, 20);
|
||||
this.reportsToolStripMenuItem.Text = "Отчёты";
|
||||
reportsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { workPiecesToolStripMenuItem, workPieceFurnituresToolStripMenuItem, ordersToolStripMenuItem });
|
||||
reportsToolStripMenuItem.Name = "reportsToolStripMenuItem";
|
||||
reportsToolStripMenuItem.Size = new Size(60, 20);
|
||||
reportsToolStripMenuItem.Text = "Отчёты";
|
||||
//
|
||||
// workPiecesToolStripMenuItem
|
||||
//
|
||||
this.workPiecesToolStripMenuItem.Name = "workPiecesToolStripMenuItem";
|
||||
this.workPiecesToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
|
||||
this.workPiecesToolStripMenuItem.Text = "Список заготовок";
|
||||
workPiecesToolStripMenuItem.Name = "workPiecesToolStripMenuItem";
|
||||
workPiecesToolStripMenuItem.Size = new Size(203, 22);
|
||||
workPiecesToolStripMenuItem.Text = "Список заготовок";
|
||||
workPiecesToolStripMenuItem.Click += WorkPiecesToolStripMenuItem_Click;
|
||||
//
|
||||
// workPieceFurnituresToolStripMenuItem
|
||||
//
|
||||
this.workPieceFurnituresToolStripMenuItem.Name = "workPieceFurnituresToolStripMenuItem";
|
||||
this.workPieceFurnituresToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
|
||||
this.workPieceFurnituresToolStripMenuItem.Text = "Заготовки по изделиям";
|
||||
workPieceFurnituresToolStripMenuItem.Name = "workPieceFurnituresToolStripMenuItem";
|
||||
workPieceFurnituresToolStripMenuItem.Size = new Size(203, 22);
|
||||
workPieceFurnituresToolStripMenuItem.Text = "Заготовки по изделиям";
|
||||
workPieceFurnituresToolStripMenuItem.Click += WorkPieceFurnituresToolStripMenuItem_Click;
|
||||
//
|
||||
// ordersToolStripMenuItem
|
||||
//
|
||||
this.ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
|
||||
this.ordersToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
|
||||
this.ordersToolStripMenuItem.Text = "Список заказов";
|
||||
ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
|
||||
ordersToolStripMenuItem.Size = new Size(203, 22);
|
||||
ordersToolStripMenuItem.Text = "Список заказов";
|
||||
ordersToolStripMenuItem.Click += OrdersToolStripMenuItem_Click;
|
||||
//
|
||||
// workWithClientsToolStripMenuItem
|
||||
//
|
||||
this.workWithClientsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.clientsToolStripMenuItem});
|
||||
this.workWithClientsToolStripMenuItem.Name = "workWithClientsToolStripMenuItem";
|
||||
this.workWithClientsToolStripMenuItem.Size = new System.Drawing.Size(129, 20);
|
||||
this.workWithClientsToolStripMenuItem.Text = "Работа с клиентами";
|
||||
workWithClientsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { clientsToolStripMenuItem });
|
||||
workWithClientsToolStripMenuItem.Name = "workWithClientsToolStripMenuItem";
|
||||
workWithClientsToolStripMenuItem.Size = new Size(129, 20);
|
||||
workWithClientsToolStripMenuItem.Text = "Работа с клиентами";
|
||||
//
|
||||
// clientsToolStripMenuItem
|
||||
//
|
||||
this.clientsToolStripMenuItem.Name = "clientsToolStripMenuItem";
|
||||
this.clientsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.clientsToolStripMenuItem.Text = "Клиенты";
|
||||
clientsToolStripMenuItem.Name = "clientsToolStripMenuItem";
|
||||
clientsToolStripMenuItem.Size = new Size(122, 22);
|
||||
clientsToolStripMenuItem.Text = "Клиенты";
|
||||
clientsToolStripMenuItem.Click += ClientsToolStripMenuItem_Click;
|
||||
//
|
||||
// workWithImplementerToolStripMenuItem
|
||||
//
|
||||
this.workWithImplementerToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.implementerToolStripMenuItem});
|
||||
this.workWithImplementerToolStripMenuItem.Name = "workWithImplementerToolStripMenuItem";
|
||||
this.workWithImplementerToolStripMenuItem.Size = new System.Drawing.Size(157, 20);
|
||||
this.workWithImplementerToolStripMenuItem.Text = "Работа с исполнителями";
|
||||
workWithImplementerToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { implementerToolStripMenuItem });
|
||||
workWithImplementerToolStripMenuItem.Name = "workWithImplementerToolStripMenuItem";
|
||||
workWithImplementerToolStripMenuItem.Size = new Size(157, 20);
|
||||
workWithImplementerToolStripMenuItem.Text = "Работа с исполнителями";
|
||||
//
|
||||
// implementerToolStripMenuItem
|
||||
//
|
||||
this.implementerToolStripMenuItem.Name = "implementerToolStripMenuItem";
|
||||
this.implementerToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.implementerToolStripMenuItem.Text = "Исполнители";
|
||||
implementerToolStripMenuItem.Name = "implementerToolStripMenuItem";
|
||||
implementerToolStripMenuItem.Size = new Size(149, 22);
|
||||
implementerToolStripMenuItem.Text = "Исполнители";
|
||||
implementerToolStripMenuItem.Click += ImplementerToolStripMenuItem_Click;
|
||||
//
|
||||
// startingWorkToolStripMenuItem
|
||||
//
|
||||
this.startingWorkToolStripMenuItem.Name = "startingWorkToolStripMenuItem";
|
||||
this.startingWorkToolStripMenuItem.Size = new System.Drawing.Size(92, 20);
|
||||
this.startingWorkToolStripMenuItem.Text = "Запуск работ";
|
||||
startingWorkToolStripMenuItem.Name = "startingWorkToolStripMenuItem";
|
||||
startingWorkToolStripMenuItem.Size = new Size(92, 20);
|
||||
startingWorkToolStripMenuItem.Text = "Запуск работ";
|
||||
startingWorkToolStripMenuItem.Click += StartingWorkToolStripMenuItem_Click;
|
||||
//
|
||||
// createBackUpToolStripMenuItem
|
||||
//
|
||||
createBackUpToolStripMenuItem.Name = "createBackUpToolStripMenuItem";
|
||||
createBackUpToolStripMenuItem.Size = new Size(97, 20);
|
||||
createBackUpToolStripMenuItem.Text = "Создать бекап";
|
||||
createBackUpToolStripMenuItem.Click += CreateBackUpToolStripMenuItem_Click;
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1135, 338);
|
||||
this.Controls.Add(this.buttonRefresh);
|
||||
this.Controls.Add(this.buttonIssuedOrder);
|
||||
this.Controls.Add(this.buttonCreateOrder);
|
||||
this.Controls.Add(this.dataGridView);
|
||||
this.Controls.Add(this.menuStrip);
|
||||
this.MainMenuStrip = this.menuStrip;
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.Name = "FormMain";
|
||||
this.Text = "Сборка мебели";
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||
this.menuStrip.ResumeLayout(false);
|
||||
this.menuStrip.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1135, 338);
|
||||
Controls.Add(buttonRefresh);
|
||||
Controls.Add(buttonIssuedOrder);
|
||||
Controls.Add(buttonCreateOrder);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(menuStrip);
|
||||
MainMenuStrip = menuStrip;
|
||||
Margin = new Padding(3, 2, 3, 2);
|
||||
Name = "FormMain";
|
||||
Text = "Сборка мебели";
|
||||
Load += FormMain_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
menuStrip.ResumeLayout(false);
|
||||
menuStrip.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -240,5 +246,6 @@
|
||||
private ToolStripMenuItem implementerToolStripMenuItem;
|
||||
private ToolStripMenuItem startingWorkToolStripMenuItem;
|
||||
private ToolStripMenuItem mailsToolStripMenuItem;
|
||||
private ToolStripMenuItem createBackUpToolStripMenuItem;
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using FurnitureAssemblyContracts.BindingModels;
|
||||
using FurnitureAssemblyContracts.BusinessLogicsContracts;
|
||||
using FurnitureAssemblyContracts.DI;
|
||||
using FurnitureAssemblyDataModels.Enums;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
@ -24,7 +25,9 @@ namespace FurnitureAssemblyView
|
||||
|
||||
private readonly IWorkProcess _workProcess;
|
||||
|
||||
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess)
|
||||
private readonly IBackUpLogic _backUpLogic;
|
||||
|
||||
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess, IBackUpLogic backUpLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
@ -32,6 +35,7 @@ namespace FurnitureAssemblyView
|
||||
_orderLogic = orderLogic;
|
||||
_reportLogic = reportLogic;
|
||||
_workProcess = workProcess;
|
||||
_backUpLogic = backUpLogic;
|
||||
}
|
||||
|
||||
private void FormMain_Load(object sender, EventArgs e)
|
||||
@ -45,20 +49,9 @@ namespace FurnitureAssemblyView
|
||||
|
||||
try
|
||||
{
|
||||
var list = _orderLogic.ReadList(null);
|
||||
dataGridView.FillandConfigGrid(_orderLogic.ReadList(null));
|
||||
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["FurnitureId"].Visible = false;
|
||||
dataGridView.Columns["ClientId"].Visible = false;
|
||||
dataGridView.Columns["ImplementerId"].Visible = false;
|
||||
dataGridView.Columns["FurnitureName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridView.Columns["ClientFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridView.Columns["ImplementerFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
|
||||
_logger.LogInformation("Загрузка заказов");
|
||||
_logger.LogInformation("Успешная загрузка заказов");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -69,36 +62,26 @@ namespace FurnitureAssemblyView
|
||||
|
||||
private void WorkPieceToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormWorkPieces));
|
||||
var form = DependencyManager.Instance.Resolve<FormWorkPieces>();
|
||||
|
||||
if (service is FormWorkPieces form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void FurnitureToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormFurnitures));
|
||||
var form = DependencyManager.Instance.Resolve<FormFurnitures>();
|
||||
|
||||
if (service is FormFurnitures form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonCreateOrder_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
|
||||
var form = DependencyManager.Instance.Resolve<FormCreateOrder>();
|
||||
|
||||
if (service is FormCreateOrder form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
LoadData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ButtonIssuedOrder_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
@ -147,64 +130,74 @@ namespace FurnitureAssemblyView
|
||||
|
||||
private void WorkPieceFurnituresToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportFurnitureWorkPieces));
|
||||
var form = DependencyManager.Instance.Resolve<FormReportFurnitureWorkPieces>();
|
||||
|
||||
if (service is FormReportFurnitureWorkPieces form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
|
||||
var form = DependencyManager.Instance.Resolve<FormReportOrders>();
|
||||
|
||||
if (service is FormReportOrders form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonRef_Click(object sender, EventArgs e)
|
||||
private void ButtonRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void ClientsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormClients));
|
||||
var form = DependencyManager.Instance.Resolve<FormClients>();
|
||||
|
||||
if (service is FormClients form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void StartingWorkToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
_workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic);
|
||||
_workProcess.DoWork(DependencyManager.Instance.Resolve<IImplementerLogic>()!, _orderLogic);
|
||||
|
||||
MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
|
||||
private void ImplementerToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormImplementers));
|
||||
var form = DependencyManager.Instance.Resolve<FormImplementers>();
|
||||
|
||||
if (service is FormImplementers form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void MailsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormMails));
|
||||
var form = DependencyManager.Instance.Resolve<FormMails>();
|
||||
|
||||
if (service is FormMails form)
|
||||
{
|
||||
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 BackUpSaveBindingModel
|
||||
{
|
||||
FolderName = fbd.SelectedPath
|
||||
});
|
||||
|
||||
MessageBox.Show("Бекап создан", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,64 @@
|
||||
<root>
|
||||
<?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">
|
||||
|
@ -48,17 +48,15 @@
|
||||
this.panel.Controls.Add(this.dateTimePickerFrom);
|
||||
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(3, 2, 3, 2);
|
||||
this.panel.Name = "panel";
|
||||
this.panel.Size = new System.Drawing.Size(973, 38);
|
||||
this.panel.Size = new System.Drawing.Size(1112, 51);
|
||||
this.panel.TabIndex = 0;
|
||||
//
|
||||
// buttonToPdf
|
||||
//
|
||||
this.buttonToPdf.Location = new System.Drawing.Point(782, 8);
|
||||
this.buttonToPdf.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonToPdf.Location = new System.Drawing.Point(894, 10);
|
||||
this.buttonToPdf.Name = "buttonToPdf";
|
||||
this.buttonToPdf.Size = new System.Drawing.Size(137, 22);
|
||||
this.buttonToPdf.Size = new System.Drawing.Size(157, 29);
|
||||
this.buttonToPdf.TabIndex = 5;
|
||||
this.buttonToPdf.Text = "В Pdf";
|
||||
this.buttonToPdf.UseVisualStyleBackColor = true;
|
||||
@ -66,10 +64,9 @@
|
||||
//
|
||||
// buttonMake
|
||||
//
|
||||
this.buttonMake.Location = new System.Drawing.Point(630, 8);
|
||||
this.buttonMake.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonMake.Location = new System.Drawing.Point(612, 10);
|
||||
this.buttonMake.Name = "buttonMake";
|
||||
this.buttonMake.Size = new System.Drawing.Size(137, 22);
|
||||
this.buttonMake.Size = new System.Drawing.Size(157, 29);
|
||||
this.buttonMake.TabIndex = 4;
|
||||
this.buttonMake.Text = "Сформировать";
|
||||
this.buttonMake.UseVisualStyleBackColor = true;
|
||||
@ -78,44 +75,41 @@
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(230, 13);
|
||||
this.label2.Location = new System.Drawing.Point(263, 17);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(21, 15);
|
||||
this.label2.Size = new System.Drawing.Size(27, 20);
|
||||
this.label2.TabIndex = 3;
|
||||
this.label2.Text = "по";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(22, 13);
|
||||
this.label1.Location = new System.Drawing.Point(25, 17);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(15, 15);
|
||||
this.label1.Size = new System.Drawing.Size(18, 20);
|
||||
this.label1.TabIndex = 2;
|
||||
this.label1.Text = "С";
|
||||
//
|
||||
// dateTimePickerTo
|
||||
//
|
||||
this.dateTimePickerTo.Location = new System.Drawing.Point(274, 9);
|
||||
this.dateTimePickerTo.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.dateTimePickerTo.Location = new System.Drawing.Point(313, 12);
|
||||
this.dateTimePickerTo.Name = "dateTimePickerTo";
|
||||
this.dateTimePickerTo.Size = new System.Drawing.Size(148, 23);
|
||||
this.dateTimePickerTo.TabIndex = 5;
|
||||
this.dateTimePickerTo.Size = new System.Drawing.Size(169, 27);
|
||||
this.dateTimePickerTo.TabIndex = 1;
|
||||
//
|
||||
// dateTimePickerFrom
|
||||
//
|
||||
this.dateTimePickerFrom.Location = new System.Drawing.Point(57, 9);
|
||||
this.dateTimePickerFrom.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.dateTimePickerFrom.Location = new System.Drawing.Point(65, 12);
|
||||
this.dateTimePickerFrom.Name = "dateTimePickerFrom";
|
||||
this.dateTimePickerFrom.Size = new System.Drawing.Size(154, 23);
|
||||
this.dateTimePickerFrom.Size = new System.Drawing.Size(176, 27);
|
||||
this.dateTimePickerFrom.TabIndex = 0;
|
||||
//
|
||||
// FormReportOrders
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(973, 338);
|
||||
this.ClientSize = new System.Drawing.Size(1112, 450);
|
||||
this.Controls.Add(this.panel);
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.Name = "FormReportOrders";
|
||||
this.Text = "Заказы";
|
||||
this.panel.ResumeLayout(false);
|
||||
|
@ -1,5 +1,6 @@
|
||||
using FurnitureAssemblyContracts.BindingModels;
|
||||
using FurnitureAssemblyContracts.BusinessLogicsContracts;
|
||||
using FurnitureAssemblyContracts.DI;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -37,15 +38,7 @@ namespace FurnitureAssemblyView
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _logic.ReadList(null);
|
||||
|
||||
// Растягиваем колонку Название на всю ширину, колонку Id скрываем
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["Id"].Visible = false;
|
||||
dataGridView.Columns["WorkPieceName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
dataGridView.FillandConfigGrid(_logic.ReadList(null));
|
||||
|
||||
_logger.LogInformation("Загрузка заготовок");
|
||||
}
|
||||
@ -59,26 +52,21 @@ namespace FurnitureAssemblyView
|
||||
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormWorkPiece));
|
||||
var form = DependencyManager.Instance.Resolve<FormWorkPiece>();
|
||||
|
||||
if (service is FormWorkPiece form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Проверяем наличие выделенной строки
|
||||
private void ButtonUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormWorkPiece));
|
||||
var form = DependencyManager.Instance.Resolve<FormWorkPiece>();
|
||||
|
||||
if (service is FormWorkPiece form)
|
||||
{
|
||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
@ -86,7 +74,6 @@ namespace FurnitureAssemblyView
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
@ -4,6 +4,7 @@ using FurnitureAssemblyBusinessLogic.OfficePackage;
|
||||
using FurnitureAssemblyContracts.BusinessLogicsContracts;
|
||||
using FurnitureAssemblyContracts.StoragesContracts;
|
||||
using FurnitureAssemblyDatabaseImplement.Implements;
|
||||
using FurnitureAssemblyContracts.DI;
|
||||
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@ -15,10 +16,6 @@ namespace FurnitureAssemblyView
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
private static ServiceProvider? _serviceProvider;
|
||||
|
||||
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
@ -29,12 +26,11 @@ namespace FurnitureAssemblyView
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
var services = new ServiceCollection();
|
||||
ConfigureServices(services);
|
||||
_serviceProvider = services.BuildServiceProvider();
|
||||
InitDependency();
|
||||
|
||||
try
|
||||
{
|
||||
var mailSender = _serviceProvider.GetService<AbstractMailWorker>();
|
||||
var mailSender = DependencyManager.Instance.Resolve<AbstractMailWorker>();
|
||||
mailSender?.MailConfig(new MailConfigBindingModel
|
||||
{
|
||||
MailLogin = System.Configuration.ConfigurationManager.AppSettings["MailLogin"] ?? string.Empty,
|
||||
@ -50,59 +46,55 @@ namespace FurnitureAssemblyView
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var logger = _serviceProvider.GetService<ILogger>();
|
||||
var logger = DependencyManager.Instance.Resolve<ILogger>();
|
||||
|
||||
logger?.LogError(ex, "Îøèáêà ðàáîòû ñ ïî÷òîé");
|
||||
}
|
||||
|
||||
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
||||
Application.Run(DependencyManager.Instance.Resolve<FormMain>());
|
||||
}
|
||||
|
||||
private static void ConfigureServices(ServiceCollection services)
|
||||
private static void InitDependency()
|
||||
{
|
||||
services.AddLogging(option =>
|
||||
DependencyManager.InitDependency();
|
||||
|
||||
DependencyManager.Instance.AddLogging(option =>
|
||||
{
|
||||
option.SetMinimumLevel(LogLevel.Information);
|
||||
option.AddNLog("nlog.config");
|
||||
});
|
||||
|
||||
services.AddTransient<IWorkPieceStorage, WorkPieceStorage>();
|
||||
services.AddTransient<IOrderStorage, OrderStorage>();
|
||||
services.AddTransient<IFurnitureStorage, FurnitureStorage>();
|
||||
services.AddTransient<IClientStorage, ClientStorage>();
|
||||
services.AddTransient<IImplementerStorage, ImplementerStorage>();
|
||||
services.AddTransient<IMessageInfoStorage, MessageInfoStorage>();
|
||||
DependencyManager.Instance.RegisterType<IWorkPieceLogic, WorkPieceLogic>();
|
||||
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<IBackUpLogic, BackUpLogic>();
|
||||
|
||||
services.AddTransient<IWorkPieceLogic, WorkPieceLogic>();
|
||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||
services.AddTransient<IFurnitureLogic, FurnitureLogic>();
|
||||
services.AddTransient<IReportLogic, ReportLogic>();
|
||||
services.AddTransient<IClientLogic, ClientLogic>();
|
||||
services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
||||
services.AddTransient<IMessageInfoLogic, MessageInfoLogic>();
|
||||
DependencyManager.Instance.RegisterType<AbstractSaveToExcel, SaveToExcel>();
|
||||
DependencyManager.Instance.RegisterType<AbstractSaveToWord, SaveToWord>();
|
||||
DependencyManager.Instance.RegisterType<AbstractSaveToPdf, SaveToPdf>();
|
||||
|
||||
services.AddTransient<IWorkProcess, WorkModeling>();
|
||||
services.AddSingleton<AbstractMailWorker, MailKitWorker>();
|
||||
DependencyManager.Instance.RegisterType<IWorkProcess, WorkModeling>();
|
||||
DependencyManager.Instance.RegisterType<AbstractMailWorker, MailKitWorker>(true);
|
||||
|
||||
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
||||
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
||||
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
||||
|
||||
services.AddTransient<FormMain>();
|
||||
services.AddTransient<FormWorkPiece>();
|
||||
services.AddTransient<FormWorkPieces>();
|
||||
services.AddTransient<FormCreateOrder>();
|
||||
services.AddTransient<FormFurniture>();
|
||||
services.AddTransient<FormFurnitures>();
|
||||
services.AddTransient<FormFurnitureWorkPiece>();
|
||||
services.AddTransient<FormReportFurnitureWorkPieces>();
|
||||
services.AddTransient<FormReportOrders>();
|
||||
services.AddTransient<FormClients>();
|
||||
services.AddTransient<FormImplementers>();
|
||||
services.AddTransient<FormImplementer>();
|
||||
services.AddTransient<FormMails>();
|
||||
DependencyManager.Instance.RegisterType<FormMain>();
|
||||
DependencyManager.Instance.RegisterType<FormWorkPiece>();
|
||||
DependencyManager.Instance.RegisterType<FormWorkPieces>();
|
||||
DependencyManager.Instance.RegisterType<FormCreateOrder>();
|
||||
DependencyManager.Instance.RegisterType<FormFurniture>();
|
||||
DependencyManager.Instance.RegisterType<FormFurnitureWorkPiece>();
|
||||
DependencyManager.Instance.RegisterType<FormFurnitures>();
|
||||
DependencyManager.Instance.RegisterType<FormReportFurnitureWorkPieces>();
|
||||
DependencyManager.Instance.RegisterType<FormReportOrders>();
|
||||
DependencyManager.Instance.RegisterType<FormClients>();
|
||||
DependencyManager.Instance.RegisterType<FormImplementer>();
|
||||
DependencyManager.Instance.RegisterType<FormImplementers>();
|
||||
DependencyManager.Instance.RegisterType<FormMails>();
|
||||
}
|
||||
|
||||
private static void MailCheck(object obj) => ServiceProvider?.GetService<AbstractMailWorker>()?.MailCheck();
|
||||
private static void MailCheck(object obj) => DependencyManager.Instance.Resolve<AbstractMailWorker>()?.MailCheck();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user