Лабораторная работа 4 Усложнённая
This commit is contained in:
parent
80f7910057
commit
5a0e120e05
@ -20,11 +20,17 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
|||||||
|
|
||||||
private readonly IOrderStorage _orderStorage;
|
private readonly IOrderStorage _orderStorage;
|
||||||
|
|
||||||
|
private readonly IShopLogic _shopLogic;
|
||||||
|
|
||||||
|
private readonly IFurnitureStorage _furnitureStorage;
|
||||||
|
|
||||||
// Конструктор
|
// Конструктор
|
||||||
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage)
|
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, IShopLogic shopLogic, IFurnitureStorage furnitureStorage)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_orderStorage = orderStorage;
|
_orderStorage = orderStorage;
|
||||||
|
_shopLogic = shopLogic;
|
||||||
|
_furnitureStorage = furnitureStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Вывод отфильтрованного списка компонентов
|
// Вывод отфильтрованного списка компонентов
|
||||||
@ -35,7 +41,7 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
|||||||
// list хранит весь список в случае, если model пришло со значением null на вход метода
|
// list хранит весь список в случае, если model пришло со значением null на вход метода
|
||||||
var list = model == null ? _orderStorage.GetFullList() : _orderStorage.GetFilteredList(model);
|
var list = model == null ? _orderStorage.GetFullList() : _orderStorage.GetFilteredList(model);
|
||||||
|
|
||||||
if(list == null)
|
if (list == null)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("ReadList return null list");
|
_logger.LogWarning("ReadList return null list");
|
||||||
|
|
||||||
@ -52,7 +58,7 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
|||||||
{
|
{
|
||||||
CheckModel(model);
|
CheckModel(model);
|
||||||
|
|
||||||
if(model.Status != OrderStatus.Неизвестен)
|
if (model.Status != OrderStatus.Неизвестен)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Insert operation failed, incorrect order status");
|
_logger.LogWarning("Insert operation failed, incorrect order status");
|
||||||
return false;
|
return false;
|
||||||
@ -60,7 +66,7 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
|||||||
|
|
||||||
model.Status = OrderStatus.Принят;
|
model.Status = OrderStatus.Принят;
|
||||||
|
|
||||||
if(_orderStorage.Insert(model) == null)
|
if (_orderStorage.Insert(model) == null)
|
||||||
{
|
{
|
||||||
model.Status = OrderStatus.Неизвестен;
|
model.Status = OrderStatus.Неизвестен;
|
||||||
_logger.LogWarning("Insert operation failed");
|
_logger.LogWarning("Insert operation failed");
|
||||||
@ -100,30 +106,30 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Проверка на наличие товаров в заказе
|
// Проверка на наличие товаров в заказе
|
||||||
if(model.Count <= 0)
|
if (model.Count <= 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("В заказе не может быть 0 изделий", nameof(model.Count));
|
throw new ArgumentNullException("В заказе не может быть 0 изделий", nameof(model.Count));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Проверка на наличие нормальной суммарной стоимости чека
|
// Проверка на наличие нормальной суммарной стоимости чека
|
||||||
if(model.Sum <= 0)
|
if (model.Sum <= 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Суммарная стоимость заказа должна быть больше 0", nameof(model.Sum));
|
throw new ArgumentNullException("Суммарная стоимость заказа должна быть больше 0", nameof(model.Sum));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Проверка корректности id у изделий
|
// Проверка корректности id у изделий
|
||||||
if(model.FurnitureId < 0)
|
if (model.FurnitureId < 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Некорректный id у изделия", nameof(model.FurnitureId));
|
throw new ArgumentNullException("Некорректный id у изделия", nameof(model.FurnitureId));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Проверка корректности дат
|
// Проверка корректности дат
|
||||||
if(model.DateCreate > model.DateImplement)
|
if (model.DateCreate > model.DateImplement)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Дата создания должна быть более ранней, нежели дата завершения");
|
throw new InvalidOperationException("Дата создания должна быть более ранней, нежели дата завершения");
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogInformation("Order. OrderId:{Id}, Sum:{Sum}. FurnitureId:{Id}", model.Id, model.Sum, model.FurnitureId);
|
_logger.LogInformation("Order. OrderId:{Id}, Sum:{Sum}. FurnitureId:{Id}. Sum:{Sum}", model.Id, model.Sum, model.FurnitureId, model.Sum);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Обновление статуса заказа
|
// Обновление статуса заказа
|
||||||
@ -132,13 +138,13 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
|||||||
var viewModel = _orderStorage.GetElement(new OrderSearchModel { Id = model.Id });
|
var viewModel = _orderStorage.GetElement(new OrderSearchModel { Id = model.Id });
|
||||||
|
|
||||||
// Если не смогли найти указанный заказ по его Id
|
// Если не смогли найти указанный заказ по его Id
|
||||||
if(viewModel == null)
|
if (viewModel == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(model));
|
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");
|
_logger.LogWarning("Status update operation failed. New status " + newOrderStatus.ToString() + "incorrect");
|
||||||
return false;
|
return false;
|
||||||
@ -147,9 +153,21 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
|||||||
model.Status = newOrderStatus;
|
model.Status = newOrderStatus;
|
||||||
|
|
||||||
// Проверка на выдачу
|
// Проверка на выдачу
|
||||||
if(model.Status == OrderStatus.Выдан)
|
if (model.Status == OrderStatus.Готов)
|
||||||
{
|
{
|
||||||
model.DateImplement = DateTime.Now;
|
model.DateImplement = DateTime.Now;
|
||||||
|
|
||||||
|
var furniture = _furnitureStorage.GetElement(new() { Id = viewModel.FurnitureId });
|
||||||
|
|
||||||
|
if (furniture == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(furniture));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_shopLogic.AddFurnitures(furniture, viewModel.Count))
|
||||||
|
{
|
||||||
|
throw new Exception($"Невозможно выдать изделия, магазины переполнены. Operation failed. Shop is full.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -159,7 +177,7 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
|||||||
CheckModel(model, false);
|
CheckModel(model, false);
|
||||||
|
|
||||||
// Финальная проверка на возможность обновления
|
// Финальная проверка на возможность обновления
|
||||||
if(_orderStorage.Update(model) == null)
|
if (_orderStorage.Update(model) == null)
|
||||||
{
|
{
|
||||||
model.Status--;
|
model.Status--;
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
|||||||
|
|
||||||
private readonly IOrderStorage _orderStorage;
|
private readonly IOrderStorage _orderStorage;
|
||||||
|
|
||||||
|
private readonly IShopStorage _shopStorage;
|
||||||
|
|
||||||
private readonly AbstractSaveToExcel _saveToExcel;
|
private readonly AbstractSaveToExcel _saveToExcel;
|
||||||
|
|
||||||
private readonly AbstractSaveToWord _saveToWord;
|
private readonly AbstractSaveToWord _saveToWord;
|
||||||
@ -27,12 +29,12 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
|||||||
private readonly AbstractSaveToPdf _saveToPdf;
|
private readonly AbstractSaveToPdf _saveToPdf;
|
||||||
|
|
||||||
// Инициализируем поля класса через контейнер
|
// Инициализируем поля класса через контейнер
|
||||||
public ReportLogic(IFurnitureStorage furnitureStorage,
|
public ReportLogic(IFurnitureStorage furnitureStorage, IOrderStorage orderStorage, IShopStorage shopStorage,
|
||||||
IOrderStorage orderStorage, AbstractSaveToExcel saveToExcel,
|
AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
|
||||||
AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
|
|
||||||
{
|
{
|
||||||
_furnitureStorage = furnitureStorage;
|
_furnitureStorage = furnitureStorage;
|
||||||
_orderStorage = orderStorage;
|
_orderStorage = orderStorage;
|
||||||
|
_shopStorage = shopStorage;
|
||||||
|
|
||||||
_saveToExcel = saveToExcel;
|
_saveToExcel = saveToExcel;
|
||||||
_saveToWord = saveToWord;
|
_saveToWord = saveToWord;
|
||||||
@ -67,6 +69,30 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Получение списка изделий с указанием, в каких магазинах в наличии
|
||||||
|
public List<ReportShopFurnituresViewModel> GetShopFurnitures()
|
||||||
|
{
|
||||||
|
var shops = _shopStorage.GetFullList();
|
||||||
|
var list = new List<ReportShopFurnituresViewModel>();
|
||||||
|
|
||||||
|
foreach (var shop in shops)
|
||||||
|
{
|
||||||
|
var record = new ReportShopFurnituresViewModel
|
||||||
|
{
|
||||||
|
ShopName = shop.ShopName,
|
||||||
|
Furnitures = new List<Tuple<string, int>>(),
|
||||||
|
TotalCount = 0
|
||||||
|
};
|
||||||
|
foreach (var furniturecount in shop.ShopFurnitures.Values)
|
||||||
|
{
|
||||||
|
record.Furnitures.Add(new Tuple<string, int>(furniturecount.Item1.FurnitureName, furniturecount.Item2));
|
||||||
|
record.TotalCount += furniturecount.Item2;
|
||||||
|
}
|
||||||
|
list.Add(record);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
// Получение списка заказов за определённый период
|
// Получение списка заказов за определённый период
|
||||||
public List<ReportOrdersViewModel> GetOrders(ReportBindingModel model)
|
public List<ReportOrdersViewModel> GetOrders(ReportBindingModel model)
|
||||||
{
|
{
|
||||||
@ -81,6 +107,20 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
|||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Получение списка заказов за весь период
|
||||||
|
public List<ReportGroupedOrdersViewModel> GetGroupedOrders()
|
||||||
|
{
|
||||||
|
return _orderStorage.GetFullList()
|
||||||
|
.GroupBy(x => x.DateCreate.Date)
|
||||||
|
.Select(x => new ReportGroupedOrdersViewModel
|
||||||
|
{
|
||||||
|
DateCreate = x.Key,
|
||||||
|
Count = x.Count(),
|
||||||
|
Sum = x.Sum(x => x.Sum)
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
// Сохранение мебели в файл-Word
|
// Сохранение мебели в файл-Word
|
||||||
public void SaveFurnituresToWordFile(ReportBindingModel model)
|
public void SaveFurnituresToWordFile(ReportBindingModel model)
|
||||||
{
|
{
|
||||||
@ -92,6 +132,17 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Сохранение магазинов в файл-Word
|
||||||
|
public void SaveShopsToWordFile(ReportBindingModel model)
|
||||||
|
{
|
||||||
|
_saveToWord.CreateTableDoc(new WordInfo
|
||||||
|
{
|
||||||
|
FileName = model.FileName,
|
||||||
|
Title = "Таблица магазинов",
|
||||||
|
Shops = _shopStorage.GetFullList()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Сохранение заготовок с указанием изделий в файл_Excel
|
// Сохранение заготовок с указанием изделий в файл_Excel
|
||||||
public void SaveFurnitureWorkPieceToExcelFile(ReportBindingModel model)
|
public void SaveFurnitureWorkPieceToExcelFile(ReportBindingModel model)
|
||||||
{
|
{
|
||||||
@ -103,6 +154,17 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Сохранение магазинов с указанием изделий в файл-Excel
|
||||||
|
public void SaveShopFurnituresToExcelFile(ReportBindingModel model)
|
||||||
|
{
|
||||||
|
_saveToExcel.CreateShopReport(new ExcelInfo
|
||||||
|
{
|
||||||
|
FileName = model.FileName,
|
||||||
|
Title = "Список магазинов",
|
||||||
|
ShopFurnitures = GetShopFurnitures()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Сохранение заказов в файл-Pdf
|
// Сохранение заказов в файл-Pdf
|
||||||
public void SaveOrdersToPdfFile(ReportBindingModel model)
|
public void SaveOrdersToPdfFile(ReportBindingModel model)
|
||||||
{
|
{
|
||||||
@ -115,5 +177,16 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
|||||||
Orders = GetOrders(model)
|
Orders = GetOrders(model)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Сохранение заказов за весь период в файл-Pdf
|
||||||
|
public void SaveGroupedOrdersToPdfFile(ReportBindingModel model)
|
||||||
|
{
|
||||||
|
_saveToPdf.CreateGroupedDoc(new PdfInfo
|
||||||
|
{
|
||||||
|
FileName = model.FileName,
|
||||||
|
Title = "Список заказов",
|
||||||
|
GroupedOrders = GetGroupedOrders()
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,267 @@
|
|||||||
|
using FurnitureAssemblyContracts.BindingModels;
|
||||||
|
using FurnitureAssemblyContracts.BusinessLogicsContracts;
|
||||||
|
using FurnitureAssemblyContracts.SearchModels;
|
||||||
|
using FurnitureAssemblyContracts.StoragesContracts;
|
||||||
|
using FurnitureAssemblyContracts.ViewModels;
|
||||||
|
using FurnitureAssemblyDataModels.Models;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
||||||
|
{
|
||||||
|
// Класс, реализующий логику для магазинов
|
||||||
|
public class ShopLogic : IShopLogic
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
|
private readonly IShopStorage _shopStorage;
|
||||||
|
|
||||||
|
// Конструктор
|
||||||
|
public ShopLogic(ILogger<ShopLogic> logger, IShopStorage shopStorage)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_shopStorage = shopStorage;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Вывод конкретного магазина
|
||||||
|
public ShopViewModel? ReadElement(ShopSearchModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(model));
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("ReadElement. ShopName:{ShopName}. Id:{Id}", model.ShopName, model.Id);
|
||||||
|
var element = _shopStorage.GetElement(model);
|
||||||
|
|
||||||
|
if (element == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("ReadElement element not found");
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||||
|
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Вывод отфильтрованного списка компонентов
|
||||||
|
public List<ShopViewModel>? ReadList(ShopSearchModel? model)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("ReadList. ShopName:{ShopName}. Id: {Id}", model?.ShopName, model?.Id);
|
||||||
|
|
||||||
|
// list хранит весь список в случае, если model пришло со значением null на вход метода
|
||||||
|
var list = model == null ? _shopStorage.GetFullList() : _shopStorage.GetFilteredList(model);
|
||||||
|
|
||||||
|
if (list == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("ReadList return null list");
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Пополнение магазина
|
||||||
|
public bool AddFurniture(ShopSearchModel model, IFurnitureModel furniture, int count)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(model));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count <= 0)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Количество добавляемых изделий должно быть больше 0", nameof(count));
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("AddFurniture. ShopName:{ShopName}. Id: {Id}", model?.ShopName, model?.Id);
|
||||||
|
var shop = _shopStorage.GetElement(model);
|
||||||
|
|
||||||
|
if (shop == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Add Furniture operation failed");
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shop.MaxCountFurnitures - shop.ShopFurnitures.Select(x => x.Value.Item2).Sum() < count)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Слишком много изделий для одного магазина", nameof(count));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!shop.ShopFurnitures.ContainsKey(furniture.Id))
|
||||||
|
{
|
||||||
|
shop.ShopFurnitures[furniture.Id] = (furniture, count);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
shop.ShopFurnitures[furniture.Id] = (furniture, shop.ShopFurnitures[furniture.Id].Item2 + count);
|
||||||
|
}
|
||||||
|
|
||||||
|
_shopStorage.Update(new ShopBindingModel()
|
||||||
|
{
|
||||||
|
Id = shop.Id,
|
||||||
|
ShopName = shop.ShopName,
|
||||||
|
Address = shop.Address,
|
||||||
|
DateOpen = shop.DateOpen,
|
||||||
|
MaxCountFurnitures = shop.MaxCountFurnitures,
|
||||||
|
ShopFurnitures = shop.ShopFurnitures
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Создание магазина
|
||||||
|
public bool Create(ShopBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model);
|
||||||
|
|
||||||
|
if (_shopStorage.Insert(model) == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Insert operation failed");
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обновление магазина
|
||||||
|
public bool Update(ShopBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model);
|
||||||
|
|
||||||
|
if (_shopStorage.Update(model) == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Update operation failed");
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Удаление магазина
|
||||||
|
public bool Delete(ShopBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model, false);
|
||||||
|
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||||
|
|
||||||
|
if (_shopStorage.Delete(model) == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Delete operation failed");
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Проверка входного аргумента для методов Insert, Update и Delete
|
||||||
|
private void CheckModel(ShopBindingModel model, bool withParams = true)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(model));
|
||||||
|
}
|
||||||
|
|
||||||
|
// При удалении передаём как параметр false
|
||||||
|
if (!withParams)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Проверка на наличие названия магазина
|
||||||
|
if (string.IsNullOrEmpty(model.ShopName))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Отсутствует названия магазина", nameof(model.ShopName));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Проверка на наличие адреса у магазина
|
||||||
|
if (string.IsNullOrEmpty(model.Address))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Отсутствует адреса магазина", nameof(model.Address));
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Shop. ShopName:{ShopName}. Address:{Address}. Id: {Id}", model.ShopName, model.Address, model.Id);
|
||||||
|
|
||||||
|
// Проверка на наличие такого же магазина в списке
|
||||||
|
var element = _shopStorage.GetElement(new ShopSearchModel
|
||||||
|
{
|
||||||
|
ShopName = model.ShopName
|
||||||
|
});
|
||||||
|
|
||||||
|
// Если элемент найден и его Id не совпадает с Id переданного объекта
|
||||||
|
if (element != null && element.Id != model.Id)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("Магазин с таким названием уже есть");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public bool AddFurnitures(IFurnitureModel model, int count)
|
||||||
|
{
|
||||||
|
if (count <= 0)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Количество добавляемых изделий должно быть больше 0", nameof(count));
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("AddFurnitures. Furniture: {Furniture}. Count: {Count}", model?.FurnitureName, count);
|
||||||
|
|
||||||
|
var capacity = _shopStorage.GetFullList().Select(x => x.MaxCountFurnitures - x.ShopFurnitures.Select(x => x.Value.Item2).Sum()).Sum() - count;
|
||||||
|
|
||||||
|
if (capacity < 0)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("AddFurnitures operation failed. Sell {count} Furnitures ", -capacity);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var shop in _shopStorage.GetFullList())
|
||||||
|
{
|
||||||
|
if (shop.MaxCountFurnitures - shop.ShopFurnitures.Select(x => x.Value.Item2).Sum() < count)
|
||||||
|
{
|
||||||
|
if (!AddFurniture(new() { Id = shop.Id }, model, shop.MaxCountFurnitures - shop.ShopFurnitures.Select(x => x.Value.Item2).Sum()))
|
||||||
|
{
|
||||||
|
_logger.LogWarning("AddFurnitures operation failed.");
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
count -= shop.MaxCountFurnitures - shop.ShopFurnitures.Select(x => x.Value.Item2).Sum();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!AddFurniture(new() { Id = shop.Id }, model, count))
|
||||||
|
{
|
||||||
|
_logger.LogWarning("AddFurnitures operation failed.");
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
count -= count;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count == 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool SellFurnitures(IFurnitureModel model, int count)
|
||||||
|
{
|
||||||
|
return _shopStorage.SellFurnitures(model, count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,21 +1,21 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DocumentFormat.OpenXml" Version="2.20.0" />
|
<PackageReference Include="DocumentFormat.OpenXml" Version="3.0.2" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||||
<PackageReference Include="MigraDocCore.DocumentObjectModel" Version="1.3.63" />
|
<PackageReference Include="MigraDocCore.DocumentObjectModel" Version="1.3.63" />
|
||||||
<PackageReference Include="MigraDocCore.Rendering" Version="1.3.63" />
|
<PackageReference Include="MigraDocCore.Rendering" Version="1.3.63" />
|
||||||
<PackageReference Include="PDFsharp-MigraDoc-GDI" Version="1.50.5147" />
|
<PackageReference Include="PDFsharp-MigraDoc-GDI" Version="1.50.5147" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\FurnitureAssemblyContracts\FurnitureAssemblyContracts.csproj" />
|
<ProjectReference Include="..\FurnitureAssemblyContracts\FurnitureAssemblyContracts.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -31,19 +31,19 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage
|
|||||||
|
|
||||||
uint rowIndex = 2;
|
uint rowIndex = 2;
|
||||||
|
|
||||||
foreach (var fwp in info.FurnitureWorkPieces)
|
foreach (var mwp in info.FurnitureWorkPieces)
|
||||||
{
|
{
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
{
|
{
|
||||||
ColumnName = "A",
|
ColumnName = "A",
|
||||||
RowIndex = rowIndex,
|
RowIndex = rowIndex,
|
||||||
Text = fwp.FurnitureName,
|
Text = mwp.FurnitureName,
|
||||||
StyleInfo = ExcelStyleInfoType.Text
|
StyleInfo = ExcelStyleInfoType.Text
|
||||||
});
|
});
|
||||||
|
|
||||||
rowIndex++;
|
rowIndex++;
|
||||||
|
|
||||||
foreach (var (WorkPiece, Count) in fwp.WorkPieces)
|
foreach (var (WorkPiece, Count) in mwp.WorkPieces)
|
||||||
{
|
{
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
{
|
{
|
||||||
@ -76,7 +76,82 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage
|
|||||||
{
|
{
|
||||||
ColumnName = "C",
|
ColumnName = "C",
|
||||||
RowIndex = rowIndex,
|
RowIndex = rowIndex,
|
||||||
Text = fwp.TotalCount.ToString(),
|
Text = mwp.TotalCount.ToString(),
|
||||||
|
StyleInfo = ExcelStyleInfoType.Text
|
||||||
|
});
|
||||||
|
|
||||||
|
rowIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
SaveExcel(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateShopReport(ExcelInfo info)
|
||||||
|
{
|
||||||
|
CreateExcel(info);
|
||||||
|
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "A",
|
||||||
|
RowIndex = 1,
|
||||||
|
Text = info.Title,
|
||||||
|
StyleInfo = ExcelStyleInfoType.Title
|
||||||
|
});
|
||||||
|
|
||||||
|
MergeCells(new ExcelMergeParameters
|
||||||
|
{
|
||||||
|
CellFromName = "A1",
|
||||||
|
CellToName = "C1"
|
||||||
|
});
|
||||||
|
|
||||||
|
uint rowIndex = 2;
|
||||||
|
|
||||||
|
foreach (var sm in info.ShopFurnitures)
|
||||||
|
{
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "A",
|
||||||
|
RowIndex = rowIndex,
|
||||||
|
Text = sm.ShopName,
|
||||||
|
StyleInfo = ExcelStyleInfoType.Text
|
||||||
|
});
|
||||||
|
|
||||||
|
rowIndex++;
|
||||||
|
|
||||||
|
foreach (var (Furniture, Count) in sm.Furnitures)
|
||||||
|
{
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "B",
|
||||||
|
RowIndex = rowIndex,
|
||||||
|
Text = Furniture,
|
||||||
|
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
||||||
|
});
|
||||||
|
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "C",
|
||||||
|
RowIndex = rowIndex,
|
||||||
|
Text = Count.ToString(),
|
||||||
|
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
||||||
|
});
|
||||||
|
|
||||||
|
rowIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "A",
|
||||||
|
RowIndex = rowIndex,
|
||||||
|
Text = "Итого",
|
||||||
|
StyleInfo = ExcelStyleInfoType.Text
|
||||||
|
});
|
||||||
|
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "C",
|
||||||
|
RowIndex = rowIndex,
|
||||||
|
Text = sm.TotalCount.ToString(),
|
||||||
StyleInfo = ExcelStyleInfoType.Text
|
StyleInfo = ExcelStyleInfoType.Text
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -58,6 +58,36 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage
|
|||||||
SavePdf(info);
|
SavePdf(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void CreateGroupedDoc(PdfInfo info)
|
||||||
|
{
|
||||||
|
CreatePdf(info);
|
||||||
|
|
||||||
|
CreateParagraph(new PdfParagraph { Text = info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center });
|
||||||
|
|
||||||
|
CreateTable(new List<string> { "3cm", "3cm", "3cm" });
|
||||||
|
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string> { "Дата заказа", "Количество заказов", "Сумма" },
|
||||||
|
Style = "NormalTitle",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
|
||||||
|
foreach (var order in info.GroupedOrders)
|
||||||
|
{
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string> { order.DateCreate.ToShortDateString(), order.Count.ToString(), order.Sum.ToString() },
|
||||||
|
Style = "Normal",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
CreateParagraph(new PdfParagraph { Text = $"Итого: {info.GroupedOrders.Sum(x => x.Sum)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center });
|
||||||
|
|
||||||
|
SavePdf(info);
|
||||||
|
}
|
||||||
|
|
||||||
/// Создание Pdf-файла
|
/// Создание Pdf-файла
|
||||||
protected abstract void CreatePdf(PdfInfo info);
|
protected abstract void CreatePdf(PdfInfo info);
|
||||||
|
|
||||||
|
@ -44,12 +44,41 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage
|
|||||||
SaveWord(info);
|
SaveWord(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void CreateTableDoc(WordInfo wordInfo)
|
||||||
|
{
|
||||||
|
CreateWord(wordInfo);
|
||||||
|
|
||||||
|
var list = new List<string>();
|
||||||
|
|
||||||
|
foreach (var shop in wordInfo.Shops)
|
||||||
|
{
|
||||||
|
list.Add(shop.ShopName);
|
||||||
|
list.Add(shop.Address);
|
||||||
|
list.Add(shop.DateOpen.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
var wordTable = new WordTable
|
||||||
|
{
|
||||||
|
Headers = new List<string> {
|
||||||
|
"Название",
|
||||||
|
"Адрес",
|
||||||
|
"Дата открытия"},
|
||||||
|
Texts = list
|
||||||
|
};
|
||||||
|
|
||||||
|
CreateTable(wordTable);
|
||||||
|
SaveWord(wordInfo);
|
||||||
|
}
|
||||||
|
|
||||||
// Создание Doc-файла
|
// Создание Doc-файла
|
||||||
protected abstract void CreateWord(WordInfo info);
|
protected abstract void CreateWord(WordInfo info);
|
||||||
|
|
||||||
// Создание абзаца с текстом
|
// Создание абзаца с текстом
|
||||||
protected abstract void CreateParagraph(WordParagraph paragraph);
|
protected abstract void CreateParagraph(WordParagraph paragraph);
|
||||||
|
|
||||||
|
// Создание таблицы
|
||||||
|
protected abstract void CreateTable(WordTable info);
|
||||||
|
|
||||||
// Сохранение файла
|
// Сохранение файла
|
||||||
protected abstract void SaveWord(WordInfo info);
|
protected abstract void SaveWord(WordInfo info);
|
||||||
}
|
}
|
||||||
|
@ -18,5 +18,8 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels
|
|||||||
|
|
||||||
// Список заготовок по изделиям
|
// Список заготовок по изделиям
|
||||||
public List<ReportFurnitureWorkPieceViewModel> FurnitureWorkPieces { get; set; } = new();
|
public List<ReportFurnitureWorkPieceViewModel> FurnitureWorkPieces { get; set; } = new();
|
||||||
|
|
||||||
|
// Список магазинов с изделиями
|
||||||
|
public List<ReportShopFurnituresViewModel> ShopFurnitures { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,5 +20,8 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels
|
|||||||
|
|
||||||
// Перечень заказов за указанный период для вывода/сохранения
|
// Перечень заказов за указанный период для вывода/сохранения
|
||||||
public List<ReportOrdersViewModel> Orders { get; set; } = new();
|
public List<ReportOrdersViewModel> Orders { get; set; } = new();
|
||||||
|
|
||||||
|
// Перечень заказов за весь период для вывода и сохранения
|
||||||
|
public List<ReportGroupedOrdersViewModel> GroupedOrders { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,10 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels
|
|||||||
|
|
||||||
public string Title { get; set; } = string.Empty;
|
public string Title { get; set; } = string.Empty;
|
||||||
|
|
||||||
//список заготовок для вывода и сохранения
|
// Список заготовок для вывода и сохранения
|
||||||
public List<FurnitureViewModel> Furnitures { get; set; } = new();
|
public List<FurnitureViewModel> Furnitures { get; set; } = new();
|
||||||
|
|
||||||
|
// Список магазинов для вывода и сохранения
|
||||||
|
public List<ShopViewModel> Shops { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,12 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels
|
|||||||
// Модель параграфов, которые есть в тексте
|
// Модель параграфов, которые есть в тексте
|
||||||
public class WordParagraph
|
public class WordParagraph
|
||||||
{
|
{
|
||||||
// Набор текстов в абзаце (для случая, если в абзаце текст разных стилей)
|
//набор текстов в абзаце (для случая, если в абзаце текст разных стилей)
|
||||||
public List<(string, WordTextProperties)> Texts { get; set; } = new();
|
public List<(string, WordTextProperties)> Texts { get; set; } = new();
|
||||||
|
|
||||||
//свойства параграфа, если они есть
|
//свойства параграфа, если они есть
|
||||||
public WordTextProperties? TextProperties { get; set; }
|
public WordTextProperties? TextProperties { get; set; }
|
||||||
|
|
||||||
|
public List<List<(string, WordTextProperties)>> RowTexts { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels
|
||||||
|
{
|
||||||
|
public class WordTable
|
||||||
|
{
|
||||||
|
public List<string> Headers { get; set; } = new();
|
||||||
|
|
||||||
|
public List<string> Texts { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
@ -184,11 +184,8 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage.Implements
|
|||||||
};
|
};
|
||||||
|
|
||||||
var stylesheetExtensionList = new StylesheetExtensionList();
|
var stylesheetExtensionList = new StylesheetExtensionList();
|
||||||
var stylesheetExtension1 = new StylesheetExtension()
|
|
||||||
{
|
|
||||||
Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}"
|
|
||||||
};
|
|
||||||
|
|
||||||
|
var stylesheetExtension1 = new StylesheetExtension() { Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}" };
|
||||||
stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
|
stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
|
||||||
stylesheetExtension1.Append(new SlicerStyles()
|
stylesheetExtension1.Append(new SlicerStyles()
|
||||||
{
|
{
|
||||||
@ -313,7 +310,7 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage.Implements
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Все ячейки должны быть последовательно друг за другом расположены
|
// Все ячейки должны быть последовательно друг за другом расположены
|
||||||
// Нужно определить, после какой вставлять
|
// нужно определить, после какой вставлять
|
||||||
Cell? refCell = null;
|
Cell? refCell = null;
|
||||||
|
|
||||||
foreach (Cell rowCell in row.Elements<Cell>())
|
foreach (Cell rowCell in row.Elements<Cell>())
|
||||||
@ -331,6 +328,7 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage.Implements
|
|||||||
};
|
};
|
||||||
|
|
||||||
row.InsertBefore(newCell, refCell);
|
row.InsertBefore(newCell, refCell);
|
||||||
|
|
||||||
cell = newCell;
|
cell = newCell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,10 +73,7 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage.Implements
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(paragraphProperties.Size))
|
if (!string.IsNullOrEmpty(paragraphProperties.Size))
|
||||||
{
|
{
|
||||||
paragraphMarkRunProperties.AppendChild(new FontSize
|
paragraphMarkRunProperties.AppendChild(new FontSize { Val = paragraphProperties.Size });
|
||||||
{
|
|
||||||
Val = paragraphProperties.Size
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
properties.AppendChild(paragraphMarkRunProperties);
|
properties.AppendChild(paragraphMarkRunProperties);
|
||||||
@ -117,7 +114,6 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage.Implements
|
|||||||
var docRun = new Run();
|
var docRun = new Run();
|
||||||
var properties = new RunProperties();
|
var properties = new RunProperties();
|
||||||
|
|
||||||
// Задание свойств текста - размер и жирность
|
|
||||||
properties.AppendChild(new FontSize { Val = run.Item2.Size });
|
properties.AppendChild(new FontSize { Val = run.Item2.Size });
|
||||||
|
|
||||||
if (run.Item2.Bold)
|
if (run.Item2.Bold)
|
||||||
@ -127,11 +123,7 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage.Implements
|
|||||||
|
|
||||||
docRun.AppendChild(properties);
|
docRun.AppendChild(properties);
|
||||||
|
|
||||||
docRun.AppendChild(new Text
|
docRun.AppendChild(new Text { Text = run.Item1, Space = SpaceProcessingModeValues.Preserve });
|
||||||
{
|
|
||||||
Text = run.Item1,
|
|
||||||
Space = SpaceProcessingModeValues.Preserve
|
|
||||||
});
|
|
||||||
|
|
||||||
docParagraph.AppendChild(docRun);
|
docParagraph.AppendChild(docRun);
|
||||||
}
|
}
|
||||||
@ -155,5 +147,109 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage.Implements
|
|||||||
|
|
||||||
_wordDocument.Dispose();
|
_wordDocument.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void CreateTable(WordTable table)
|
||||||
|
{
|
||||||
|
if (_docBody == null || table == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Table tab = new Table();
|
||||||
|
|
||||||
|
TableProperties props = new TableProperties(
|
||||||
|
new TableBorders(
|
||||||
|
new TopBorder
|
||||||
|
{
|
||||||
|
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||||
|
Size = 12
|
||||||
|
},
|
||||||
|
|
||||||
|
new BottomBorder
|
||||||
|
{
|
||||||
|
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||||
|
Size = 12
|
||||||
|
},
|
||||||
|
|
||||||
|
new LeftBorder
|
||||||
|
{
|
||||||
|
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||||
|
Size = 12
|
||||||
|
},
|
||||||
|
|
||||||
|
new RightBorder
|
||||||
|
{
|
||||||
|
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||||
|
Size = 12
|
||||||
|
},
|
||||||
|
|
||||||
|
new InsideHorizontalBorder
|
||||||
|
{
|
||||||
|
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||||
|
Size = 12
|
||||||
|
},
|
||||||
|
|
||||||
|
new InsideVerticalBorder
|
||||||
|
{
|
||||||
|
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||||
|
Size = 12
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
tab.AppendChild<TableProperties>(props);
|
||||||
|
TableGrid tableGrid = new TableGrid();
|
||||||
|
|
||||||
|
for (int i = 0; i < table.Headers.Count; i++)
|
||||||
|
{
|
||||||
|
tableGrid.AppendChild(new GridColumn());
|
||||||
|
}
|
||||||
|
|
||||||
|
tab.AppendChild(tableGrid);
|
||||||
|
TableRow tableRow = new TableRow();
|
||||||
|
|
||||||
|
foreach (var text in table.Headers)
|
||||||
|
{
|
||||||
|
tableRow.AppendChild(CreateTableCell(text));
|
||||||
|
}
|
||||||
|
|
||||||
|
tab.AppendChild(tableRow);
|
||||||
|
|
||||||
|
int height = table.Texts.Count / table.Headers.Count;
|
||||||
|
int width = table.Headers.Count;
|
||||||
|
|
||||||
|
for (int i = 0; i < height; i++)
|
||||||
|
{
|
||||||
|
tableRow = new TableRow();
|
||||||
|
|
||||||
|
for (int j = 0; j < width; j++)
|
||||||
|
{
|
||||||
|
var element = table.Texts[i * table.Headers.Count + j];
|
||||||
|
tableRow.AppendChild(CreateTableCell(element));
|
||||||
|
}
|
||||||
|
|
||||||
|
tab.AppendChild(tableRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
_docBody.AppendChild(tab);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private TableCell CreateTableCell(string element)
|
||||||
|
{
|
||||||
|
var tableParagraph = new Paragraph();
|
||||||
|
|
||||||
|
var run = new Run();
|
||||||
|
|
||||||
|
run.AppendChild(new Text
|
||||||
|
{
|
||||||
|
Text = element
|
||||||
|
});
|
||||||
|
|
||||||
|
tableParagraph.AppendChild(run);
|
||||||
|
var tableCell = new TableCell();
|
||||||
|
tableCell.AppendChild(tableParagraph);
|
||||||
|
|
||||||
|
return tableCell;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace FurnitureAssemblyContracts.BindingModels
|
namespace FurnitureAssemblyContracts.BindingModels
|
||||||
{
|
{
|
||||||
// Реализация сущности "Отчёт"
|
|
||||||
public class ReportBindingModel
|
public class ReportBindingModel
|
||||||
{
|
{
|
||||||
public string FileName { get; set; } = string.Empty;
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
using FurnitureAssemblyDataModels.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FurnitureAssemblyContracts.BindingModels
|
||||||
|
{
|
||||||
|
// Реализация сущности "Магазин"
|
||||||
|
public class ShopBindingModel : IShopModel
|
||||||
|
{
|
||||||
|
public string ShopName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Address { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public DateTime DateOpen { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
|
public Dictionary<int, (IFurnitureModel, int)> ShopFurnitures { get; set; } = new();
|
||||||
|
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public int MaxCountFurnitures { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -13,16 +13,31 @@ namespace FurnitureAssemblyContracts.BusinessLogicsContracts
|
|||||||
// Получение списка заготовок с указанием, в каких изделиях используются
|
// Получение списка заготовок с указанием, в каких изделиях используются
|
||||||
List<ReportFurnitureWorkPieceViewModel> GetFurnitureWorkPiece();
|
List<ReportFurnitureWorkPieceViewModel> GetFurnitureWorkPiece();
|
||||||
|
|
||||||
|
//Получение списка мороженых с указанием, в каких магазинах в наличии
|
||||||
|
List<ReportShopFurnituresViewModel> GetShopFurnitures();
|
||||||
|
|
||||||
// Получение списка заказов за определённый период
|
// Получение списка заказов за определённый период
|
||||||
List<ReportOrdersViewModel> GetOrders(ReportBindingModel model);
|
List<ReportOrdersViewModel> GetOrders(ReportBindingModel model);
|
||||||
|
|
||||||
|
//Получение списка заказов за весь период
|
||||||
|
List<ReportGroupedOrdersViewModel> GetGroupedOrders();
|
||||||
|
|
||||||
// Сохранение изделий в файл-Word
|
// Сохранение изделий в файл-Word
|
||||||
void SaveFurnituresToWordFile(ReportBindingModel model);
|
void SaveFurnituresToWordFile(ReportBindingModel model);
|
||||||
|
|
||||||
|
//Сохранение магазинов в виде таблицы в файл-Word
|
||||||
|
void SaveShopsToWordFile(ReportBindingModel model);
|
||||||
|
|
||||||
// Сохранение заготовок с указанием изделий в файл-Excel
|
// Сохранение заготовок с указанием изделий в файл-Excel
|
||||||
void SaveFurnitureWorkPieceToExcelFile(ReportBindingModel model);
|
void SaveFurnitureWorkPieceToExcelFile(ReportBindingModel model);
|
||||||
|
|
||||||
|
//Сохранение магазинов с указанием мороженых в файл-Excel
|
||||||
|
void SaveShopFurnituresToExcelFile(ReportBindingModel model);
|
||||||
|
|
||||||
// Сохранение заказов в файл-Pdf
|
// Сохранение заказов в файл-Pdf
|
||||||
void SaveOrdersToPdfFile(ReportBindingModel model);
|
void SaveOrdersToPdfFile(ReportBindingModel model);
|
||||||
|
|
||||||
|
//Сохранение заказов за весь период в файл-Pdf
|
||||||
|
void SaveGroupedOrdersToPdfFile(ReportBindingModel model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
using FurnitureAssemblyContracts.BindingModels;
|
||||||
|
using FurnitureAssemblyContracts.SearchModels;
|
||||||
|
using FurnitureAssemblyContracts.ViewModels;
|
||||||
|
using FurnitureAssemblyDataModels.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FurnitureAssemblyContracts.BusinessLogicsContracts
|
||||||
|
{
|
||||||
|
// Бизнес-логика для магазина
|
||||||
|
public interface IShopLogic
|
||||||
|
{
|
||||||
|
List<ShopViewModel>? ReadList(ShopSearchModel? model);
|
||||||
|
|
||||||
|
ShopViewModel? ReadElement(ShopSearchModel model);
|
||||||
|
|
||||||
|
bool Create(ShopBindingModel model);
|
||||||
|
|
||||||
|
bool Update(ShopBindingModel model);
|
||||||
|
|
||||||
|
bool Delete(ShopBindingModel model);
|
||||||
|
|
||||||
|
bool AddFurniture(ShopSearchModel model, IFurnitureModel furniture, int count);
|
||||||
|
|
||||||
|
bool SellFurnitures(IFurnitureModel model, int count);
|
||||||
|
|
||||||
|
bool AddFurnitures(IFurnitureModel model, int count);
|
||||||
|
}
|
||||||
|
}
|
@ -12,9 +12,8 @@ namespace FurnitureAssemblyContracts.SearchModels
|
|||||||
// для поиска по идентификатору
|
// для поиска по идентификатору
|
||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
|
|
||||||
// Два поля для возможности производить выборку
|
|
||||||
public DateTime? DateFrom { get; set; }
|
public DateTime? DateFrom { get; set; }
|
||||||
|
|
||||||
public DateTime? DateTo { get; set;}
|
public DateTime? DateTo { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FurnitureAssemblyContracts.SearchModels
|
||||||
|
{
|
||||||
|
// Для поиска сущности "Магазин"
|
||||||
|
public class ShopSearchModel
|
||||||
|
{
|
||||||
|
// Для поиска по идентификатору
|
||||||
|
public int? Id { get; set; }
|
||||||
|
|
||||||
|
// Для поиска по названию
|
||||||
|
public string? ShopName { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
using FurnitureAssemblyContracts.BindingModels;
|
||||||
|
using FurnitureAssemblyContracts.SearchModels;
|
||||||
|
using FurnitureAssemblyContracts.ViewModels;
|
||||||
|
using FurnitureAssemblyDataModels.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FurnitureAssemblyContracts.StoragesContracts
|
||||||
|
{
|
||||||
|
// Класс для хранилища магазинов
|
||||||
|
public interface IShopStorage
|
||||||
|
{
|
||||||
|
List<ShopViewModel> GetFullList();
|
||||||
|
|
||||||
|
List<ShopViewModel> GetFilteredList(ShopSearchModel model);
|
||||||
|
|
||||||
|
ShopViewModel? GetElement(ShopSearchModel model);
|
||||||
|
|
||||||
|
ShopViewModel? Insert(ShopBindingModel model);
|
||||||
|
|
||||||
|
ShopViewModel? Update(ShopBindingModel model);
|
||||||
|
|
||||||
|
ShopViewModel? Delete(ShopBindingModel model);
|
||||||
|
|
||||||
|
bool SellFurnitures(IFurnitureModel model, int count);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FurnitureAssemblyContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class ReportGroupedOrdersViewModel
|
||||||
|
{
|
||||||
|
public DateTime DateCreate { get; set; }
|
||||||
|
|
||||||
|
public int Count { get; set; }
|
||||||
|
|
||||||
|
public double Sum { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -10,7 +10,7 @@ namespace FurnitureAssemblyContracts.ViewModels
|
|||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
public DateTime DateCreate { get; set; }
|
public DateTime DateCreate { get; set; }
|
||||||
|
|
||||||
public string FurnitureName { get; set; } = string.Empty;
|
public string FurnitureName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FurnitureAssemblyContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class ReportShopFurnituresViewModel
|
||||||
|
{
|
||||||
|
public string ShopName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int TotalCount { get; set; }
|
||||||
|
|
||||||
|
public List<Tuple<string, int>> Furnitures { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
using FurnitureAssemblyDataModels.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FurnitureAssemblyContracts.ViewModels
|
||||||
|
{
|
||||||
|
// Класс для отображения пользователю информации о магазинах
|
||||||
|
public class ShopViewModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Название магазина")]
|
||||||
|
public string ShopName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Адрес магазина")]
|
||||||
|
public string Address { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Дата открытия")]
|
||||||
|
public DateTime DateOpen { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
|
public Dictionary<int, (IFurnitureModel, int)> ShopFurnitures { get; set; } = new();
|
||||||
|
|
||||||
|
[DisplayName("Вместимость магазина")]
|
||||||
|
public int MaxCountFurnitures { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FurnitureAssemblyDataModels.Models
|
||||||
|
{
|
||||||
|
// Интерфейс сущности "Магазин"
|
||||||
|
public interface IShopModel : IId
|
||||||
|
{
|
||||||
|
// Название магазина
|
||||||
|
string ShopName { get; }
|
||||||
|
|
||||||
|
// Адрес магазина
|
||||||
|
string Address { get; }
|
||||||
|
|
||||||
|
// Дата открытия магазина
|
||||||
|
DateTime DateOpen { get; }
|
||||||
|
|
||||||
|
//максимальное кол-во изделий в магазине
|
||||||
|
int MaxCountFurnitures { get; }
|
||||||
|
|
||||||
|
// Изделия в магазине
|
||||||
|
Dictionary<int, (IFurnitureModel, int)> ShopFurnitures { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
using FurnitureAssemblyDatabaseImplement.Models;
|
using BlacksmithWorkshopDatabaseImplement.Models;
|
||||||
|
using FurnitureAssemblyDatabaseImplement.Models;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -14,7 +15,7 @@ namespace FurnitureAssemblyDatabaseImplement
|
|||||||
{
|
{
|
||||||
if (optionsBuilder.IsConfigured == false)
|
if (optionsBuilder.IsConfigured == false)
|
||||||
{
|
{
|
||||||
optionsBuilder.UseSqlServer(@"Data Source=KatanaNik\SQLEXPRESS;Initial Catalog=FurnitureAssemblyDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
optionsBuilder.UseSqlServer(@"Data Source=KatanaNik\SQLEXPRESS;Initial Catalog=FurnitureAssemblyDatabaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||||
}
|
}
|
||||||
|
|
||||||
base.OnConfiguring(optionsBuilder);
|
base.OnConfiguring(optionsBuilder);
|
||||||
@ -27,5 +28,9 @@ namespace FurnitureAssemblyDatabaseImplement
|
|||||||
public virtual DbSet<FurnitureWorkPiece> FurnitureWorkPieces { set; get; }
|
public virtual DbSet<FurnitureWorkPiece> FurnitureWorkPieces { set; get; }
|
||||||
|
|
||||||
public virtual DbSet<Order> Orders { set; get; }
|
public virtual DbSet<Order> Orders { set; get; }
|
||||||
|
|
||||||
|
public virtual DbSet<Shop> Shops { set; get; }
|
||||||
|
|
||||||
|
public virtual DbSet<ShopFurniture> ShopFurnitures { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,13 +97,15 @@ namespace FurnitureAssemblyDatabaseImplement.Implements
|
|||||||
public OrderViewModel? Delete(OrderBindingModel model)
|
public OrderViewModel? Delete(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new FurnitureAssemblyDatabase();
|
using var context = new FurnitureAssemblyDatabase();
|
||||||
var element = context.Orders.FirstOrDefault(rec => rec.Id == model.Id);
|
var element = context.Orders.Include(x => x.Furniture).FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
|
|
||||||
if (element != null)
|
if (element != null)
|
||||||
{
|
{
|
||||||
// для более корректного отображения модели
|
// для отображения корректной ViewModel-и
|
||||||
var deletedElement = context.Orders.Include(x => x.Furniture)
|
var deletedElement = context.Orders
|
||||||
.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
.Include(x => x.Furniture)
|
||||||
|
.FirstOrDefault(x => x.Id == model.Id)
|
||||||
|
?.GetViewModel;
|
||||||
|
|
||||||
context.Orders.Remove(element);
|
context.Orders.Remove(element);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
|
@ -0,0 +1,179 @@
|
|||||||
|
using BlacksmithWorkshopDatabaseImplement.Models;
|
||||||
|
using FurnitureAssemblyContracts.BindingModels;
|
||||||
|
using FurnitureAssemblyContracts.SearchModels;
|
||||||
|
using FurnitureAssemblyContracts.StoragesContracts;
|
||||||
|
using FurnitureAssemblyContracts.ViewModels;
|
||||||
|
using FurnitureAssemblyDataModels.Models;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FurnitureAssemblyDatabaseImplement.Implements
|
||||||
|
{
|
||||||
|
public class ShopStorage : IShopStorage
|
||||||
|
{
|
||||||
|
public List<ShopViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
using var context = new FurnitureAssemblyDatabase();
|
||||||
|
|
||||||
|
return context.Shops
|
||||||
|
.Include(x => x.Furnitures)
|
||||||
|
.ThenInclude(x => x.Furniture)
|
||||||
|
.ToList()
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ShopViewModel> GetFilteredList(ShopSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.ShopName))
|
||||||
|
{
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
|
||||||
|
using var context = new FurnitureAssemblyDatabase();
|
||||||
|
|
||||||
|
return context.Shops
|
||||||
|
.Include(x => x.Furnitures)
|
||||||
|
.ThenInclude(x => x.Furniture)
|
||||||
|
.Where(x => x.ShopName.Contains(model.ShopName))
|
||||||
|
.ToList()
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShopViewModel? GetElement(ShopSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.ShopName) && !model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
using var context = new FurnitureAssemblyDatabase();
|
||||||
|
|
||||||
|
return context.Shops
|
||||||
|
.Include(x => x.Furnitures)
|
||||||
|
.ThenInclude(x => x.Furniture)
|
||||||
|
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.ShopName) && x.ShopName == model.ShopName) ||
|
||||||
|
(model.Id.HasValue && x.Id == model.Id))
|
||||||
|
?.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShopViewModel? Insert(ShopBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new FurnitureAssemblyDatabase();
|
||||||
|
var newShop = Shop.Create(context, model);
|
||||||
|
|
||||||
|
if (newShop == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
context.Shops.Add(newShop);
|
||||||
|
context.SaveChanges();
|
||||||
|
|
||||||
|
return newShop.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShopViewModel? Update(ShopBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new FurnitureAssemblyDatabase();
|
||||||
|
using var transaction = context.Database.BeginTransaction();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var shop = context.Shops.FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
|
|
||||||
|
if (shop == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
shop.Update(model);
|
||||||
|
context.SaveChanges();
|
||||||
|
shop.UpdateFurnitures(context, model);
|
||||||
|
transaction.Commit();
|
||||||
|
|
||||||
|
return shop.GetViewModel;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
transaction.Rollback();
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShopViewModel? Delete(ShopBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new FurnitureAssemblyDatabase();
|
||||||
|
|
||||||
|
var element = context.Shops
|
||||||
|
.Include(x => x.Furnitures)
|
||||||
|
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
|
|
||||||
|
if (element != null)
|
||||||
|
{
|
||||||
|
context.Shops.Remove(element);
|
||||||
|
context.SaveChanges();
|
||||||
|
|
||||||
|
return element.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool SellFurnitures(IFurnitureModel model, int count)
|
||||||
|
{
|
||||||
|
using var context = new FurnitureAssemblyDatabase();
|
||||||
|
using var transaction = context.Database.BeginTransaction();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var shops = context.ShopFurnitures
|
||||||
|
.Include(x => x.Shop)
|
||||||
|
.ToList()
|
||||||
|
.Where(rec => rec.FurnitureId == model.Id);
|
||||||
|
|
||||||
|
if (shops == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var shop in shops)
|
||||||
|
{
|
||||||
|
if (shop.Count < count)
|
||||||
|
{
|
||||||
|
count -= shop.Count;
|
||||||
|
shop.Count = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
shop.Count = shop.Count - count;
|
||||||
|
count -= count;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count == 0)
|
||||||
|
{
|
||||||
|
context.SaveChanges();
|
||||||
|
transaction.Commit();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
transaction.Rollback();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
transaction.Rollback();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|||||||
namespace FurnitureAssemblyDatabaseImplement.Migrations
|
namespace FurnitureAssemblyDatabaseImplement.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(FurnitureAssemblyDatabase))]
|
[DbContext(typeof(FurnitureAssemblyDatabase))]
|
||||||
[Migration("20240325045814_InitCreate")]
|
[Migration("20240408073851_InitialCreate")]
|
||||||
partial class InitCreate
|
partial class InitialCreate
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@ -25,6 +25,33 @@ namespace FurnitureAssemblyDatabaseImplement.Migrations
|
|||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Shop", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Address")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateOpen")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int>("MaxCountFurnitures")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("ShopName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Shops");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Furniture", b =>
|
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Furniture", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@ -104,6 +131,32 @@ namespace FurnitureAssemblyDatabaseImplement.Migrations
|
|||||||
b.ToTable("Orders");
|
b.ToTable("Orders");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.ShopFurniture", 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>("ShopId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("FurnitureId");
|
||||||
|
|
||||||
|
b.HasIndex("ShopId");
|
||||||
|
|
||||||
|
b.ToTable("ShopFurnitures");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.WorkPiece", b =>
|
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.WorkPiece", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@ -154,10 +207,36 @@ namespace FurnitureAssemblyDatabaseImplement.Migrations
|
|||||||
b.Navigation("Furniture");
|
b.Navigation("Furniture");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.ShopFurniture", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("FurnitureAssemblyDatabaseImplement.Models.Furniture", "Furniture")
|
||||||
|
.WithMany("Shops")
|
||||||
|
.HasForeignKey("FurnitureId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Shop", "Shop")
|
||||||
|
.WithMany("Furnitures")
|
||||||
|
.HasForeignKey("ShopId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Furniture");
|
||||||
|
|
||||||
|
b.Navigation("Shop");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Shop", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Furnitures");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Furniture", b =>
|
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Furniture", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Orders");
|
b.Navigation("Orders");
|
||||||
|
|
||||||
|
b.Navigation("Shops");
|
||||||
|
|
||||||
b.Navigation("WorkPieces");
|
b.Navigation("WorkPieces");
|
||||||
});
|
});
|
||||||
|
|
@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
namespace FurnitureAssemblyDatabaseImplement.Migrations
|
namespace FurnitureAssemblyDatabaseImplement.Migrations
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class InitCreate : Migration
|
public partial class InitialCreate : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
@ -25,6 +25,22 @@ namespace FurnitureAssemblyDatabaseImplement.Migrations
|
|||||||
table.PrimaryKey("PK_Furnitures", x => x.Id);
|
table.PrimaryKey("PK_Furnitures", x => x.Id);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Shops",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ShopName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Address = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
DateOpen = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
MaxCountFurnitures = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Shops", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "WorkPieces",
|
name: "WorkPieces",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@ -63,6 +79,33 @@ namespace FurnitureAssemblyDatabaseImplement.Migrations
|
|||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "ShopFurnitures",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ShopId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
FurnitureId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Count = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_ShopFurnitures", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ShopFurnitures_Furnitures_FurnitureId",
|
||||||
|
column: x => x.FurnitureId,
|
||||||
|
principalTable: "Furnitures",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ShopFurnitures_Shops_ShopId",
|
||||||
|
column: x => x.ShopId,
|
||||||
|
principalTable: "Shops",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "FurnitureWorkPieces",
|
name: "FurnitureWorkPieces",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@ -104,6 +147,16 @@ namespace FurnitureAssemblyDatabaseImplement.Migrations
|
|||||||
name: "IX_Orders_FurnitureId",
|
name: "IX_Orders_FurnitureId",
|
||||||
table: "Orders",
|
table: "Orders",
|
||||||
column: "FurnitureId");
|
column: "FurnitureId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ShopFurnitures_FurnitureId",
|
||||||
|
table: "ShopFurnitures",
|
||||||
|
column: "FurnitureId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ShopFurnitures_ShopId",
|
||||||
|
table: "ShopFurnitures",
|
||||||
|
column: "ShopId");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -115,11 +168,17 @@ namespace FurnitureAssemblyDatabaseImplement.Migrations
|
|||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Orders");
|
name: "Orders");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ShopFurnitures");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "WorkPieces");
|
name: "WorkPieces");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Furnitures");
|
name: "Furnitures");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Shops");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -22,6 +22,33 @@ namespace FurnitureAssemblyDatabaseImplement.Migrations
|
|||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Shop", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Address")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateOpen")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int>("MaxCountFurnitures")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("ShopName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Shops");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Furniture", b =>
|
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Furniture", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@ -101,6 +128,32 @@ namespace FurnitureAssemblyDatabaseImplement.Migrations
|
|||||||
b.ToTable("Orders");
|
b.ToTable("Orders");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.ShopFurniture", 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>("ShopId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("FurnitureId");
|
||||||
|
|
||||||
|
b.HasIndex("ShopId");
|
||||||
|
|
||||||
|
b.ToTable("ShopFurnitures");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.WorkPiece", b =>
|
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.WorkPiece", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@ -151,10 +204,36 @@ namespace FurnitureAssemblyDatabaseImplement.Migrations
|
|||||||
b.Navigation("Furniture");
|
b.Navigation("Furniture");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.ShopFurniture", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("FurnitureAssemblyDatabaseImplement.Models.Furniture", "Furniture")
|
||||||
|
.WithMany("Shops")
|
||||||
|
.HasForeignKey("FurnitureId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Shop", "Shop")
|
||||||
|
.WithMany("Furnitures")
|
||||||
|
.HasForeignKey("ShopId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Furniture");
|
||||||
|
|
||||||
|
b.Navigation("Shop");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Shop", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Furnitures");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Furniture", b =>
|
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Furniture", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Orders");
|
b.Navigation("Orders");
|
||||||
|
|
||||||
|
b.Navigation("Shops");
|
||||||
|
|
||||||
b.Navigation("WorkPieces");
|
b.Navigation("WorkPieces");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -47,6 +47,9 @@ namespace FurnitureAssemblyDatabaseImplement.Models
|
|||||||
[ForeignKey("FurnitureId")]
|
[ForeignKey("FurnitureId")]
|
||||||
public virtual List<Order> Orders { get; set; } = new();
|
public virtual List<Order> Orders { get; set; } = new();
|
||||||
|
|
||||||
|
[ForeignKey("FurnitureId")]
|
||||||
|
public virtual List<ShopFurniture> Shops { get; set; } = new();
|
||||||
|
|
||||||
public static Furniture Create(FurnitureAssemblyDatabase context, FurnitureBindingModel model)
|
public static Furniture Create(FurnitureAssemblyDatabase context, FurnitureBindingModel model)
|
||||||
{
|
{
|
||||||
return new Furniture()
|
return new Furniture()
|
||||||
@ -76,9 +79,6 @@ namespace FurnitureAssemblyDatabaseImplement.Models
|
|||||||
FurnitureWorkPieces = FurnitureWorkPieces
|
FurnitureWorkPieces = FurnitureWorkPieces
|
||||||
};
|
};
|
||||||
|
|
||||||
Dictionary<int, (IWorkPieceModel, int)> IFurnitureModel.FurnitureWorkPieces => throw new NotImplementedException();
|
|
||||||
|
|
||||||
|
|
||||||
public void UpdateWorkPieces(FurnitureAssemblyDatabase context, FurnitureBindingModel model)
|
public void UpdateWorkPieces(FurnitureAssemblyDatabase context, FurnitureBindingModel model)
|
||||||
{
|
{
|
||||||
var furnitureWorkPieces = context.FurnitureWorkPieces.Where(rec => rec.FurnitureId == model.Id).ToList();
|
var furnitureWorkPieces = context.FurnitureWorkPieces.Where(rec => rec.FurnitureId == model.Id).ToList();
|
||||||
@ -101,13 +101,13 @@ namespace FurnitureAssemblyDatabaseImplement.Models
|
|||||||
|
|
||||||
var furniture = context.Furnitures.First(x => x.Id == Id);
|
var furniture = context.Furnitures.First(x => x.Id == Id);
|
||||||
|
|
||||||
foreach(var pc in model.FurnitureWorkPieces)
|
foreach(var mwp in model.FurnitureWorkPieces)
|
||||||
{
|
{
|
||||||
context.FurnitureWorkPieces.Add(new FurnitureWorkPiece
|
context.FurnitureWorkPieces.Add(new FurnitureWorkPiece
|
||||||
{
|
{
|
||||||
Furniture = furniture,
|
Furniture = furniture,
|
||||||
WorkPiece = context.WorkPieces.First(x => x.Id == pc.Key),
|
WorkPiece = context.WorkPieces.First(x => x.Id == mwp.Key),
|
||||||
Count = pc.Value.Item2
|
Count = mwp.Value.Item2
|
||||||
});
|
});
|
||||||
|
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
|
@ -0,0 +1,121 @@
|
|||||||
|
using FurnitureAssemblyContracts.BindingModels;
|
||||||
|
using FurnitureAssemblyContracts.ViewModels;
|
||||||
|
using FurnitureAssemblyDatabaseImplement;
|
||||||
|
using FurnitureAssemblyDatabaseImplement.Models;
|
||||||
|
using FurnitureAssemblyDataModels.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BlacksmithWorkshopDatabaseImplement.Models
|
||||||
|
{
|
||||||
|
public class Shop : IShopModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public string ShopName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public string Address { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public DateTime DateOpen { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public int MaxCountFurnitures { get; set; }
|
||||||
|
|
||||||
|
private Dictionary<int, (IFurnitureModel, int)>? _shopFurnitures = null;
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public Dictionary<int, (IFurnitureModel, int)> ShopFurnitures
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_shopFurnitures == null)
|
||||||
|
{
|
||||||
|
_shopFurnitures = Furnitures.ToDictionary(recSI => recSI.FurnitureId, recSI => (recSI.Furniture as IFurnitureModel, recSI.Count));
|
||||||
|
}
|
||||||
|
return _shopFurnitures;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ForeignKey("ShopId")]
|
||||||
|
public virtual List<ShopFurniture> Furnitures { get; set; } = new();
|
||||||
|
|
||||||
|
public static Shop? Create(FurnitureAssemblyDatabase context, ShopBindingModel model)
|
||||||
|
{
|
||||||
|
return new Shop()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
ShopName = model.ShopName,
|
||||||
|
Address = model.Address,
|
||||||
|
DateOpen = model.DateOpen,
|
||||||
|
Furnitures = model.ShopFurnitures.Select(x => new ShopFurniture
|
||||||
|
{
|
||||||
|
Furniture = context.Furnitures.First(y => y.Id == x.Key),
|
||||||
|
Count = x.Value.Item2
|
||||||
|
}).ToList(),
|
||||||
|
MaxCountFurnitures = model.MaxCountFurnitures
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(ShopBindingModel model)
|
||||||
|
{
|
||||||
|
ShopName = model.ShopName;
|
||||||
|
Address = model.Address;
|
||||||
|
DateOpen = model.DateOpen;
|
||||||
|
MaxCountFurnitures = model.MaxCountFurnitures;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShopViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
ShopName = ShopName,
|
||||||
|
Address = Address,
|
||||||
|
DateOpen = DateOpen,
|
||||||
|
MaxCountFurnitures = MaxCountFurnitures,
|
||||||
|
ShopFurnitures = ShopFurnitures
|
||||||
|
};
|
||||||
|
|
||||||
|
public void UpdateFurnitures(FurnitureAssemblyDatabase context, ShopBindingModel model)
|
||||||
|
{
|
||||||
|
var shopFurnitures = context.ShopFurnitures.Where(rec => rec.ShopId == model.Id).ToList();
|
||||||
|
|
||||||
|
if (shopFurnitures != null && shopFurnitures.Count > 0)
|
||||||
|
{ // удалили те, которых нет в модели
|
||||||
|
context.ShopFurnitures.RemoveRange(shopFurnitures.Where(rec => !model.ShopFurnitures.ContainsKey(rec.FurnitureId)));
|
||||||
|
context.SaveChanges();
|
||||||
|
|
||||||
|
// обновили количество у существующих записей
|
||||||
|
foreach (var _shopFurnitures in shopFurnitures)
|
||||||
|
{
|
||||||
|
_shopFurnitures.Count = model.ShopFurnitures[_shopFurnitures.FurnitureId].Item2;
|
||||||
|
model.ShopFurnitures.Remove(_shopFurnitures.FurnitureId);
|
||||||
|
}
|
||||||
|
|
||||||
|
context.SaveChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
var shop = context.Shops.First(x => x.Id == Id);
|
||||||
|
|
||||||
|
foreach (var sm in model.ShopFurnitures)
|
||||||
|
{
|
||||||
|
context.ShopFurnitures.Add(new ShopFurniture
|
||||||
|
{
|
||||||
|
Shop = shop,
|
||||||
|
Furniture = context.Furnitures.First(x => x.Id == sm.Key),
|
||||||
|
Count = sm.Value.Item2
|
||||||
|
});
|
||||||
|
|
||||||
|
context.SaveChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
_shopFurnitures = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
using BlacksmithWorkshopDatabaseImplement.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FurnitureAssemblyDatabaseImplement.Models
|
||||||
|
{
|
||||||
|
public class ShopFurniture
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public int ShopId { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public int FurnitureId { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public int Count { get; set; }
|
||||||
|
|
||||||
|
public virtual Shop Shop { get; set; } = new();
|
||||||
|
|
||||||
|
public virtual Furniture Furniture { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
@ -18,12 +18,16 @@ namespace FurnitureAssemblyFileImplement
|
|||||||
|
|
||||||
private readonly string FurnitureFileName = "Furniture.xml";
|
private readonly string FurnitureFileName = "Furniture.xml";
|
||||||
|
|
||||||
|
private readonly string ShopFileName = "Shop.xml";
|
||||||
|
|
||||||
public List<WorkPiece> WorkPieces { get; private set; }
|
public List<WorkPiece> WorkPieces { get; private set; }
|
||||||
|
|
||||||
public List<Order> Orders { get; private set; }
|
public List<Order> Orders { get; private set; }
|
||||||
|
|
||||||
public List<Furniture> Furnitures { get; private set; }
|
public List<Furniture> Furnitures { get; private set; }
|
||||||
|
|
||||||
|
public List<Shop> Shops { get; private set; }
|
||||||
|
|
||||||
public static DataFileSingleton GetInstance()
|
public static DataFileSingleton GetInstance()
|
||||||
{
|
{
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
@ -40,12 +44,14 @@ namespace FurnitureAssemblyFileImplement
|
|||||||
|
|
||||||
public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement);
|
public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement);
|
||||||
|
|
||||||
|
public void SaveShops() => SaveData(Shops, ShopFileName, "Shops", x => x.GetXElement);
|
||||||
|
|
||||||
private DataFileSingleton()
|
private DataFileSingleton()
|
||||||
{
|
{
|
||||||
WorkPieces = LoadData(WorkPieceFileName, "WorkPiece", x => WorkPiece.Create(x)!)!;
|
WorkPieces = LoadData(WorkPieceFileName, "WorkPiece", x => WorkPiece.Create(x)!)!;
|
||||||
Furnitures = LoadData(FurnitureFileName, "Furniture", x => Furniture.Create(x)!)!;
|
Furnitures = LoadData(FurnitureFileName, "Furniture", x => Furniture.Create(x)!)!;
|
||||||
Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!;
|
Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!;
|
||||||
|
Shops = LoadData(ShopFileName, "Shop", x => Shop.Create(x)!)!;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<T>? LoadData<T>(string filename, string xmlNodeName, Func<XElement, T> selectFunction)
|
private static List<T>? LoadData<T>(string filename, string xmlNodeName, Func<XElement, T> selectFunction)
|
||||||
|
@ -31,7 +31,8 @@ namespace FurnitureAssemblyFileImplement.Implements
|
|||||||
if (!model.Id.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue)
|
if (!model.Id.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||||
{
|
{
|
||||||
return source.Orders.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
|
return source.Orders.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
|
||||||
.Select(x => GetViewModel(x)).ToList();
|
.Select(x => GetViewModel(x))
|
||||||
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return source.Orders.Where(x => x.Id == model.Id).Select(x => GetViewModel(x)).ToList();
|
return source.Orders.Where(x => x.Id == model.Id).Select(x => GetViewModel(x)).ToList();
|
||||||
|
@ -0,0 +1,139 @@
|
|||||||
|
using FurnitureAssemblyContracts.BindingModels;
|
||||||
|
using FurnitureAssemblyContracts.SearchModels;
|
||||||
|
using FurnitureAssemblyContracts.StoragesContracts;
|
||||||
|
using FurnitureAssemblyContracts.ViewModels;
|
||||||
|
using FurnitureAssemblyDataModels.Models;
|
||||||
|
using FurnitureAssemblyFileImplement.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FurnitureAssemblyFileImplement.Implements
|
||||||
|
{
|
||||||
|
// Реализация интерфейса хранилища магазинов
|
||||||
|
public class ShopStorage : IShopStorage
|
||||||
|
{
|
||||||
|
private readonly DataFileSingleton _source;
|
||||||
|
|
||||||
|
public ShopStorage()
|
||||||
|
{
|
||||||
|
_source = DataFileSingleton.GetInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ShopViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
return _source.Shops.Select(x => x.GetViewModel).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ShopViewModel> GetFilteredList(ShopSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.ShopName))
|
||||||
|
{
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
|
||||||
|
return _source.Shops.Where(x => x.ShopName.Contains(model.ShopName))
|
||||||
|
.Select(x => x.GetViewModel).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShopViewModel? GetElement(ShopSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.ShopName) && !model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _source.Shops.FirstOrDefault(x => (!string.IsNullOrEmpty(model.ShopName) && x.ShopName == model.ShopName)
|
||||||
|
|| (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShopViewModel? Insert(ShopBindingModel model)
|
||||||
|
{
|
||||||
|
model.Id = _source.Shops.Count > 0 ? _source.Shops.Max(x => x.Id) + 1 : 1;
|
||||||
|
|
||||||
|
var newShop = Shop.Create(model);
|
||||||
|
|
||||||
|
if (newShop == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
_source.Shops.Add(newShop);
|
||||||
|
_source.SaveShops();
|
||||||
|
|
||||||
|
return newShop.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShopViewModel? Update(ShopBindingModel model)
|
||||||
|
{
|
||||||
|
var shop = _source.Shops.FirstOrDefault(x => x.ShopName.Contains(model.ShopName) || x.Id == model.Id);
|
||||||
|
|
||||||
|
if (shop == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
shop.Update(model);
|
||||||
|
_source.SaveShops();
|
||||||
|
|
||||||
|
return shop.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShopViewModel? Delete(ShopBindingModel model)
|
||||||
|
{
|
||||||
|
var element = _source.Shops.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
|
||||||
|
if (element != null)
|
||||||
|
{
|
||||||
|
_source.Shops.Remove(element);
|
||||||
|
_source.SaveShops();
|
||||||
|
|
||||||
|
return element.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool SellFurnitures(IFurnitureModel model, int count)
|
||||||
|
{
|
||||||
|
if (_source.Shops.Select(x => x.ShopFurnitures.FirstOrDefault(x => x.Key == model.Id).Value.Item2).Sum() < count)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var list = _source.Shops.Where(x => x.ShopFurnitures.ContainsKey(model.Id));
|
||||||
|
|
||||||
|
foreach (var shop in list)
|
||||||
|
{
|
||||||
|
if (shop.ShopFurnitures[model.Id].Item2 < count)
|
||||||
|
{
|
||||||
|
count -= shop.ShopFurnitures[model.Id].Item2;
|
||||||
|
shop.ShopFurnitures[model.Id] = (shop.ShopFurnitures[model.Id].Item1, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
shop.ShopFurnitures[model.Id] = (shop.ShopFurnitures[model.Id].Item1, shop.ShopFurnitures[model.Id].Item2 - count);
|
||||||
|
count -= count;
|
||||||
|
}
|
||||||
|
|
||||||
|
Update(new()
|
||||||
|
{
|
||||||
|
ShopName = shop.ShopName,
|
||||||
|
Address = shop.Address,
|
||||||
|
DateOpen = shop.DateOpen,
|
||||||
|
MaxCountFurnitures = shop.MaxCountFurnitures,
|
||||||
|
ShopFurnitures = shop.ShopFurnitures
|
||||||
|
});
|
||||||
|
|
||||||
|
if (count == 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
111
FurnitureAssembly/FurnitureAssemblyFileImplement/Models/Shop.cs
Normal file
111
FurnitureAssembly/FurnitureAssemblyFileImplement/Models/Shop.cs
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
using FurnitureAssemblyContracts.BindingModels;
|
||||||
|
using FurnitureAssemblyContracts.ViewModels;
|
||||||
|
using FurnitureAssemblyDataModels.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
namespace FurnitureAssemblyFileImplement.Models
|
||||||
|
{
|
||||||
|
// Класс, реализующий интерфейс модели магазина
|
||||||
|
public class Shop : IShopModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string ShopName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Address { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public DateTime DateOpen { get; set; }
|
||||||
|
|
||||||
|
public int MaxCountFurnitures { get; set; }
|
||||||
|
|
||||||
|
public Dictionary<int, int> countFurniture { get; private set; } = new();
|
||||||
|
|
||||||
|
public Dictionary<int, (IFurnitureModel, int)> _furnitures = null;
|
||||||
|
|
||||||
|
public Dictionary<int, (IFurnitureModel, int)> ShopFurnitures
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_furnitures == null)
|
||||||
|
{
|
||||||
|
var source = DataFileSingleton.GetInstance();
|
||||||
|
_furnitures = countFurniture.ToDictionary(x => x.Key, y => ((source.Furnitures.FirstOrDefault(z => z.Id == y.Key) as IFurnitureModel)!, y.Value));
|
||||||
|
}
|
||||||
|
|
||||||
|
return _furnitures;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Shop? Create(ShopBindingModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Shop()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
ShopName = model.ShopName,
|
||||||
|
Address = model.Address,
|
||||||
|
DateOpen = model.DateOpen,
|
||||||
|
MaxCountFurnitures = model.MaxCountFurnitures,
|
||||||
|
countFurniture = model.ShopFurnitures.ToDictionary(x => x.Key, x => x.Value.Item2)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public static Shop? Create(XElement element)
|
||||||
|
|
||||||
|
{
|
||||||
|
if (element == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Shop()
|
||||||
|
{
|
||||||
|
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
||||||
|
ShopName = element.Element("ShopName")!.Value,
|
||||||
|
Address = element.Element("Address")!.Value,
|
||||||
|
DateOpen = Convert.ToDateTime(element.Element("DateOpen")!.Value),
|
||||||
|
MaxCountFurnitures = Convert.ToInt32(element.Element("MaxCountFurnitures")!.Value),
|
||||||
|
countFurniture = element.Element("Furnitures")!.Elements("Furnitures").ToDictionary(x => Convert.ToInt32(x.Element("Key")?.Value), x => Convert.ToInt32(x.Element("Value")?.Value))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(ShopBindingModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ShopName = model.ShopName;
|
||||||
|
Address = model.Address;
|
||||||
|
DateOpen = model.DateOpen;
|
||||||
|
MaxCountFurnitures = model.MaxCountFurnitures;
|
||||||
|
countFurniture = model.ShopFurnitures.ToDictionary(x => x.Key, x => x.Value.Item2);
|
||||||
|
_furnitures = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShopViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
ShopName = ShopName,
|
||||||
|
Address = Address,
|
||||||
|
DateOpen = DateOpen,
|
||||||
|
MaxCountFurnitures = MaxCountFurnitures,
|
||||||
|
ShopFurnitures = ShopFurnitures
|
||||||
|
};
|
||||||
|
public XElement GetXElement => new("Shop",
|
||||||
|
new XAttribute("Id", Id),
|
||||||
|
new XElement("ShopName", ShopName),
|
||||||
|
new XElement("Address", Address),
|
||||||
|
new XElement("DateOpen", DateOpen.ToString()),
|
||||||
|
new XElement("MaxCountFurnitures", MaxCountFurnitures.ToString()),
|
||||||
|
new XElement("Furnitures", countFurniture.Select(x => new XElement("Furnitures",
|
||||||
|
new XElement("Key", x.Key),
|
||||||
|
new XElement("Value", x.Value))).ToArray()));
|
||||||
|
}
|
||||||
|
}
|
@ -21,11 +21,15 @@ namespace FurnitureAssemblyListImplement
|
|||||||
// Список для хранения заказов
|
// Список для хранения заказов
|
||||||
public List<Order> Orders { get; set; }
|
public List<Order> Orders { get; set; }
|
||||||
|
|
||||||
|
//список для хранения Магазинов
|
||||||
|
public List<Shop> Shops { get; set; }
|
||||||
|
|
||||||
public DataListSingleton()
|
public DataListSingleton()
|
||||||
{
|
{
|
||||||
WorkPiece = new List<WorkPiece>();
|
WorkPiece = new List<WorkPiece>();
|
||||||
Furnitures = new List<Furniture>();
|
Furnitures = new List<Furniture>();
|
||||||
Orders = new List<Order>();
|
Orders = new List<Order>();
|
||||||
|
Shops = new List<Shop>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DataListSingleton GetInstance()
|
public static DataListSingleton GetInstance()
|
||||||
|
@ -0,0 +1,143 @@
|
|||||||
|
using FurnitureAssemblyContracts.BindingModels;
|
||||||
|
using FurnitureAssemblyContracts.SearchModels;
|
||||||
|
using FurnitureAssemblyContracts.StoragesContracts;
|
||||||
|
using FurnitureAssemblyContracts.ViewModels;
|
||||||
|
using FurnitureAssemblyDataModels.Models;
|
||||||
|
using FurnitureAssemblyListImplement.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FurnitureAssemblyListImplement.Implements
|
||||||
|
{
|
||||||
|
// Класс, реализующий интерфейс хранилища магазинов
|
||||||
|
public class ShopStorage : IShopStorage
|
||||||
|
{
|
||||||
|
// Поле для работы со списком магазинов
|
||||||
|
private readonly DataListSingleton _source;
|
||||||
|
|
||||||
|
// Получение в конструкторе объекта DataListSingleton
|
||||||
|
public ShopStorage()
|
||||||
|
{
|
||||||
|
_source = DataListSingleton.GetInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Получение элемента из списка заготовок
|
||||||
|
public ShopViewModel? GetElement(ShopSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.ShopName) && !model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var shop in _source.Shops)
|
||||||
|
{
|
||||||
|
if ((!string.IsNullOrEmpty(model.ShopName) && shop.ShopName == model.ShopName) || (model.Id.HasValue && shop.Id == model.Id))
|
||||||
|
{
|
||||||
|
return shop.GetViewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Получение отфильтрованного списка заказов
|
||||||
|
public List<ShopViewModel> GetFilteredList(ShopSearchModel model)
|
||||||
|
{
|
||||||
|
var result = new List<ShopViewModel>();
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(model.ShopName))
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var shop in _source.Shops)
|
||||||
|
{
|
||||||
|
if (shop.ShopName.Contains(model.ShopName))
|
||||||
|
{
|
||||||
|
result.Add(shop.GetViewModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Получение полного списка заготовок
|
||||||
|
public List<ShopViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
var result = new List<ShopViewModel>();
|
||||||
|
|
||||||
|
foreach (var shop in _source.Shops)
|
||||||
|
{
|
||||||
|
result.Add(shop.GetViewModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// При создании магазина определяем для него новый id: ищем max id и прибавляем к нему 1
|
||||||
|
public ShopViewModel? Insert(ShopBindingModel model)
|
||||||
|
{
|
||||||
|
model.Id = 1;
|
||||||
|
|
||||||
|
foreach (var shop in _source.Shops)
|
||||||
|
{
|
||||||
|
if (model.Id <= shop.Id)
|
||||||
|
{
|
||||||
|
model.Id = shop.Id + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var newShop = Shop.Create(model);
|
||||||
|
|
||||||
|
if (newShop == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
_source.Shops.Add(newShop);
|
||||||
|
|
||||||
|
return newShop.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обновление магазина
|
||||||
|
public ShopViewModel? Update(ShopBindingModel model)
|
||||||
|
{
|
||||||
|
foreach (var shop in _source.Shops)
|
||||||
|
{
|
||||||
|
if (shop.Id == model.Id)
|
||||||
|
{
|
||||||
|
shop.Update(model);
|
||||||
|
|
||||||
|
return shop.GetViewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Удаление магазина
|
||||||
|
public ShopViewModel? Delete(ShopBindingModel model)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _source.Shops.Count; ++i)
|
||||||
|
{
|
||||||
|
if (_source.Shops[i].Id == model.Id)
|
||||||
|
{
|
||||||
|
var element = _source.Shops[i];
|
||||||
|
_source.Shops.RemoveAt(i);
|
||||||
|
|
||||||
|
return element.GetViewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool SellFurnitures(IFurnitureModel model, int count)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -28,6 +28,7 @@ namespace FurnitureAssemblyListImplement.Models
|
|||||||
|
|
||||||
public DateTime? DateImplement { get; private set; }
|
public DateTime? DateImplement { get; private set; }
|
||||||
|
|
||||||
|
// Метод для создания объекта от класса-компонента на основе класса-BindingModel
|
||||||
public static Order? Create(OrderBindingModel? model)
|
public static Order? Create(OrderBindingModel? model)
|
||||||
{
|
{
|
||||||
if(model == null)
|
if(model == null)
|
||||||
|
@ -0,0 +1,71 @@
|
|||||||
|
using FurnitureAssemblyContracts.BindingModels;
|
||||||
|
using FurnitureAssemblyContracts.ViewModels;
|
||||||
|
using FurnitureAssemblyDataModels.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FurnitureAssemblyListImplement.Models
|
||||||
|
{
|
||||||
|
// Класс, реализующий интерфейс модели магазина
|
||||||
|
public class Shop : IShopModel
|
||||||
|
{
|
||||||
|
// Методы set сделали приватными, чтобы исключить неразрешённые манипуляции
|
||||||
|
public string ShopName { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Address { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
public DateTime DateOpen { get; private set; }
|
||||||
|
|
||||||
|
public int Id { get; private set; }
|
||||||
|
|
||||||
|
public int MaxCountFurnitures { get; set; }
|
||||||
|
|
||||||
|
public Dictionary<int, (IFurnitureModel, int)> ShopFurnitures { get; private set; } =
|
||||||
|
new Dictionary<int, (IFurnitureModel, int)>();
|
||||||
|
|
||||||
|
// Метод для создания объекта от класса-компонента на основе класса-BindingModel
|
||||||
|
public static Shop? Create(ShopBindingModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Shop()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
ShopName = model.ShopName,
|
||||||
|
Address = model.Address,
|
||||||
|
DateOpen = model.DateOpen,
|
||||||
|
ShopFurnitures = model.ShopFurnitures
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Метод изменения существующего объекта
|
||||||
|
public void Update(ShopBindingModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ShopName = model.ShopName;
|
||||||
|
Address = model.Address;
|
||||||
|
DateOpen = model.DateOpen;
|
||||||
|
ShopFurnitures = model.ShopFurnitures;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Метод для создания объекта класса ViewModel на основе данных объекта класса-компонента
|
||||||
|
public ShopViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
ShopName = ShopName,
|
||||||
|
Address = Address,
|
||||||
|
DateOpen = DateOpen,
|
||||||
|
ShopFurnitures = ShopFurnitures
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
151
FurnitureAssembly/FurnitureAssemblyView/FormAddFurniture.Designer.cs
generated
Normal file
151
FurnitureAssembly/FurnitureAssemblyView/FormAddFurniture.Designer.cs
generated
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
namespace FurnitureAssemblyView
|
||||||
|
{
|
||||||
|
partial class FormAddFurniture
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.labelFurniture = new System.Windows.Forms.Label();
|
||||||
|
this.labelCount = new System.Windows.Forms.Label();
|
||||||
|
this.labelShop = new System.Windows.Forms.Label();
|
||||||
|
this.comboBoxFurniture = new System.Windows.Forms.ComboBox();
|
||||||
|
this.textBoxCount = new System.Windows.Forms.TextBox();
|
||||||
|
this.buttonSave = new System.Windows.Forms.Button();
|
||||||
|
this.buttonCancel = new System.Windows.Forms.Button();
|
||||||
|
this.comboBoxShop = new System.Windows.Forms.ComboBox();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// labelFurniture
|
||||||
|
//
|
||||||
|
this.labelFurniture.AutoSize = true;
|
||||||
|
this.labelFurniture.Location = new System.Drawing.Point(28, 58);
|
||||||
|
this.labelFurniture.Name = "labelFurniture";
|
||||||
|
this.labelFurniture.Size = new System.Drawing.Size(56, 15);
|
||||||
|
this.labelFurniture.TabIndex = 0;
|
||||||
|
this.labelFurniture.Text = "Изделие:";
|
||||||
|
//
|
||||||
|
// labelCount
|
||||||
|
//
|
||||||
|
this.labelCount.AutoSize = true;
|
||||||
|
this.labelCount.Location = new System.Drawing.Point(28, 91);
|
||||||
|
this.labelCount.Name = "labelCount";
|
||||||
|
this.labelCount.Size = new System.Drawing.Size(75, 15);
|
||||||
|
this.labelCount.TabIndex = 1;
|
||||||
|
this.labelCount.Text = "Количество:";
|
||||||
|
//
|
||||||
|
// labelShop
|
||||||
|
//
|
||||||
|
this.labelShop.AutoSize = true;
|
||||||
|
this.labelShop.Location = new System.Drawing.Point(28, 23);
|
||||||
|
this.labelShop.Name = "labelShop";
|
||||||
|
this.labelShop.Size = new System.Drawing.Size(57, 15);
|
||||||
|
this.labelShop.TabIndex = 2;
|
||||||
|
this.labelShop.Text = "Магазин:";
|
||||||
|
//
|
||||||
|
// comboBoxFurniture
|
||||||
|
//
|
||||||
|
this.comboBoxFurniture.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.comboBoxFurniture.FormattingEnabled = true;
|
||||||
|
this.comboBoxFurniture.Location = new System.Drawing.Point(149, 55);
|
||||||
|
this.comboBoxFurniture.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||||
|
this.comboBoxFurniture.Name = "comboBoxFurniture";
|
||||||
|
this.comboBoxFurniture.Size = new System.Drawing.Size(230, 23);
|
||||||
|
this.comboBoxFurniture.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// textBoxCount
|
||||||
|
//
|
||||||
|
this.textBoxCount.Location = new System.Drawing.Point(149, 88);
|
||||||
|
this.textBoxCount.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||||
|
this.textBoxCount.Name = "textBoxCount";
|
||||||
|
this.textBoxCount.Size = new System.Drawing.Size(230, 23);
|
||||||
|
this.textBoxCount.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
this.buttonSave.Location = new System.Drawing.Point(209, 123);
|
||||||
|
this.buttonSave.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||||
|
this.buttonSave.Name = "buttonSave";
|
||||||
|
this.buttonSave.Size = new System.Drawing.Size(82, 22);
|
||||||
|
this.buttonSave.TabIndex = 6;
|
||||||
|
this.buttonSave.Text = "Сохранить";
|
||||||
|
this.buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
this.buttonCancel.Location = new System.Drawing.Point(297, 123);
|
||||||
|
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 = 7;
|
||||||
|
this.buttonCancel.Text = "Отмена";
|
||||||
|
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||||
|
//
|
||||||
|
// comboBoxShop
|
||||||
|
//
|
||||||
|
this.comboBoxShop.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.comboBoxShop.FormattingEnabled = true;
|
||||||
|
this.comboBoxShop.Location = new System.Drawing.Point(149, 23);
|
||||||
|
this.comboBoxShop.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||||
|
this.comboBoxShop.Name = "comboBoxShop";
|
||||||
|
this.comboBoxShop.Size = new System.Drawing.Size(230, 23);
|
||||||
|
this.comboBoxShop.TabIndex = 8;
|
||||||
|
//
|
||||||
|
// FormAddFurniture
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(394, 159);
|
||||||
|
this.Controls.Add(this.comboBoxShop);
|
||||||
|
this.Controls.Add(this.buttonCancel);
|
||||||
|
this.Controls.Add(this.buttonSave);
|
||||||
|
this.Controls.Add(this.textBoxCount);
|
||||||
|
this.Controls.Add(this.comboBoxFurniture);
|
||||||
|
this.Controls.Add(this.labelShop);
|
||||||
|
this.Controls.Add(this.labelCount);
|
||||||
|
this.Controls.Add(this.labelFurniture);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||||
|
this.Name = "FormAddFurniture";
|
||||||
|
this.Text = "Пополнение магазина";
|
||||||
|
this.Load += new System.EventHandler(this.FormAddFurniture_Load);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label labelFurniture;
|
||||||
|
private Label labelCount;
|
||||||
|
private Label labelShop;
|
||||||
|
private ComboBox comboBoxFurniture;
|
||||||
|
private TextBox textBoxCount;
|
||||||
|
private Button buttonSave;
|
||||||
|
private Button buttonCancel;
|
||||||
|
private ComboBox comboBoxShop;
|
||||||
|
}
|
||||||
|
}
|
128
FurnitureAssembly/FurnitureAssemblyView/FormAddFurniture.cs
Normal file
128
FurnitureAssembly/FurnitureAssemblyView/FormAddFurniture.cs
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
using FurnitureAssemblyContracts.BusinessLogicsContracts;
|
||||||
|
using FurnitureAssemblyContracts.SearchModels;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace FurnitureAssemblyView
|
||||||
|
{
|
||||||
|
public partial class FormAddFurniture : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IFurnitureLogic _logicI;
|
||||||
|
private readonly IShopLogic _logicS;
|
||||||
|
|
||||||
|
public FormAddFurniture(ILogger<FormAddFurniture> logger, IFurnitureLogic logicI, IShopLogic logicS)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logicI = logicI;
|
||||||
|
_logicS = logicS;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormAddFurniture_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Загрузка списка изделий для пополнения");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var list = _logicI.ReadList(null);
|
||||||
|
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
comboBoxFurniture.DisplayMember = "FurnitureName";
|
||||||
|
comboBoxFurniture.ValueMember = "Id";
|
||||||
|
comboBoxFurniture.DataSource = list;
|
||||||
|
comboBoxFurniture.SelectedItem = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки списка изделий");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Загрузка списка магазинов для пополнения");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var list = _logicS.ReadList(null);
|
||||||
|
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
comboBoxShop.DisplayMember = "ShopName";
|
||||||
|
comboBoxShop.ValueMember = "Id";
|
||||||
|
comboBoxShop.DataSource = list;
|
||||||
|
comboBoxShop.SelectedItem = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки списка магазинов");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(textBoxCount.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните поле Количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (comboBoxFurniture.SelectedValue == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (comboBoxShop.SelectedValue == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Выберите магазин", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Пополнение магазина");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var operationResult = _logicS.AddFurniture(new ShopSearchModel
|
||||||
|
{
|
||||||
|
Id = Convert.ToInt32(comboBoxShop.SelectedValue)
|
||||||
|
},
|
||||||
|
|
||||||
|
_logicI.ReadElement(new FurnitureSearchModel()
|
||||||
|
{
|
||||||
|
Id = Convert.ToInt32(comboBoxFurniture.SelectedValue)
|
||||||
|
})!, Convert.ToInt32(textBoxCount.Text));
|
||||||
|
|
||||||
|
if (!operationResult)
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при пополнении магазина. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка создания заказа");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = DialogResult.Cancel;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
@ -28,82 +28,83 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
labelWorkPiece = new Label();
|
this.labelWorkPiece = new System.Windows.Forms.Label();
|
||||||
labelCount = new Label();
|
this.labelCount = new System.Windows.Forms.Label();
|
||||||
comboBoxWorkPiece = new ComboBox();
|
this.comboBoxWorkPiece = new System.Windows.Forms.ComboBox();
|
||||||
textBoxCount = new TextBox();
|
this.textBoxCount = new System.Windows.Forms.TextBox();
|
||||||
buttonSave = new Button();
|
this.buttonSave = new System.Windows.Forms.Button();
|
||||||
buttonCancel = new Button();
|
this.buttonCancel = new System.Windows.Forms.Button();
|
||||||
SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// labelWorkPiece
|
// labelWorkPiece
|
||||||
//
|
//
|
||||||
labelWorkPiece.AutoSize = true;
|
this.labelWorkPiece.AutoSize = true;
|
||||||
labelWorkPiece.Location = new Point(31, 33);
|
this.labelWorkPiece.Location = new System.Drawing.Point(31, 33);
|
||||||
labelWorkPiece.Name = "labelWorkPiece";
|
this.labelWorkPiece.Name = "labelWorkPiece";
|
||||||
labelWorkPiece.Size = new Size(81, 20);
|
this.labelWorkPiece.Size = new System.Drawing.Size(81, 20);
|
||||||
labelWorkPiece.TabIndex = 0;
|
this.labelWorkPiece.TabIndex = 0;
|
||||||
labelWorkPiece.Text = "Заготовка:";
|
this.labelWorkPiece.Text = "Заготовка:";
|
||||||
//
|
//
|
||||||
// labelCount
|
// labelCount
|
||||||
//
|
//
|
||||||
labelCount.AutoSize = true;
|
this.labelCount.AutoSize = true;
|
||||||
labelCount.Location = new Point(31, 79);
|
this.labelCount.Location = new System.Drawing.Point(31, 79);
|
||||||
labelCount.Name = "labelCount";
|
this.labelCount.Name = "labelCount";
|
||||||
labelCount.Size = new Size(93, 20);
|
this.labelCount.Size = new System.Drawing.Size(93, 20);
|
||||||
labelCount.TabIndex = 1;
|
this.labelCount.TabIndex = 1;
|
||||||
labelCount.Text = "Количество:";
|
this.labelCount.Text = "Количество:";
|
||||||
//
|
//
|
||||||
// comboBoxWorkPiece
|
// comboBoxWorkPiece
|
||||||
//
|
//
|
||||||
comboBoxWorkPiece.FormattingEnabled = true;
|
this.comboBoxWorkPiece.FormattingEnabled = true;
|
||||||
comboBoxWorkPiece.Location = new Point(156, 30);
|
this.comboBoxWorkPiece.Location = new System.Drawing.Point(156, 30);
|
||||||
comboBoxWorkPiece.Name = "comboBoxWorkPiece";
|
this.comboBoxWorkPiece.Name = "comboBoxWorkPiece";
|
||||||
comboBoxWorkPiece.Size = new Size(320, 28);
|
this.comboBoxWorkPiece.Size = new System.Drawing.Size(320, 28);
|
||||||
comboBoxWorkPiece.TabIndex = 2;
|
this.comboBoxWorkPiece.TabIndex = 2;
|
||||||
//
|
//
|
||||||
// textBoxCount
|
// textBoxCount
|
||||||
//
|
//
|
||||||
textBoxCount.Location = new Point(156, 76);
|
this.textBoxCount.Location = new System.Drawing.Point(156, 76);
|
||||||
textBoxCount.Name = "textBoxCount";
|
this.textBoxCount.Name = "textBoxCount";
|
||||||
textBoxCount.Size = new Size(320, 27);
|
this.textBoxCount.Size = new System.Drawing.Size(320, 27);
|
||||||
textBoxCount.TabIndex = 3;
|
this.textBoxCount.TabIndex = 3;
|
||||||
//
|
//
|
||||||
// buttonSave
|
// buttonSave
|
||||||
//
|
//
|
||||||
buttonSave.Location = new Point(236, 118);
|
this.buttonSave.Location = new System.Drawing.Point(235, 118);
|
||||||
buttonSave.Name = "buttonSave";
|
this.buttonSave.Name = "buttonSave";
|
||||||
buttonSave.Size = new Size(110, 38);
|
this.buttonSave.Size = new System.Drawing.Size(94, 29);
|
||||||
buttonSave.TabIndex = 4;
|
this.buttonSave.TabIndex = 4;
|
||||||
buttonSave.Text = "Сохранить";
|
this.buttonSave.Text = "Сохранить";
|
||||||
buttonSave.UseVisualStyleBackColor = true;
|
this.buttonSave.UseVisualStyleBackColor = true;
|
||||||
buttonSave.Click += ButtonSave_Click;
|
this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
||||||
//
|
//
|
||||||
// buttonCancel
|
// buttonCancel
|
||||||
//
|
//
|
||||||
buttonCancel.Location = new Point(363, 118);
|
this.buttonCancel.Location = new System.Drawing.Point(353, 118);
|
||||||
buttonCancel.Name = "buttonCancel";
|
this.buttonCancel.Name = "buttonCancel";
|
||||||
buttonCancel.Size = new Size(113, 38);
|
this.buttonCancel.Size = new System.Drawing.Size(94, 29);
|
||||||
buttonCancel.TabIndex = 5;
|
this.buttonCancel.TabIndex = 5;
|
||||||
buttonCancel.Text = "Отмена";
|
this.buttonCancel.Text = "Отмена";
|
||||||
buttonCancel.UseVisualStyleBackColor = true;
|
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||||
buttonCancel.Click += ButtonCancel_Click;
|
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||||
//
|
//
|
||||||
// FormFurnitureWorkPiece
|
// FormFurnitureWorkPiece
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
ClientSize = new Size(526, 168);
|
this.ClientSize = new System.Drawing.Size(526, 168);
|
||||||
Controls.Add(buttonCancel);
|
this.Controls.Add(this.buttonCancel);
|
||||||
Controls.Add(buttonSave);
|
this.Controls.Add(this.buttonSave);
|
||||||
Controls.Add(textBoxCount);
|
this.Controls.Add(this.textBoxCount);
|
||||||
Controls.Add(comboBoxWorkPiece);
|
this.Controls.Add(this.comboBoxWorkPiece);
|
||||||
Controls.Add(labelCount);
|
this.Controls.Add(this.labelCount);
|
||||||
Controls.Add(labelWorkPiece);
|
this.Controls.Add(this.labelWorkPiece);
|
||||||
Name = "FormFurnitureWorkPiece";
|
this.Name = "FormFurnitureWorkPiece";
|
||||||
Text = "Заготовки для изделия";
|
this.Text = "Заготовки для изделия";
|
||||||
ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -18,24 +18,21 @@ namespace FurnitureAssemblyView
|
|||||||
{
|
{
|
||||||
private readonly List<WorkPieceViewModel>? _list;
|
private readonly List<WorkPieceViewModel>? _list;
|
||||||
|
|
||||||
public int Id
|
public int Id { get { return Convert.ToInt32(comboBoxWorkPiece.SelectedValue); }
|
||||||
{
|
set { comboBoxWorkPiece.SelectedValue = value; } }
|
||||||
get { return Convert.ToInt32(comboBoxWorkPiece.SelectedValue); }
|
|
||||||
set { comboBoxWorkPiece.SelectedValue = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public IWorkPieceModel? WorkPieceModel
|
public IWorkPieceModel? WorkPieceModel
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_list == null)
|
if(_list == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var elem in _list)
|
foreach(var elem in _list)
|
||||||
{
|
{
|
||||||
if (elem.Id == Id)
|
if(elem.Id == Id)
|
||||||
{
|
{
|
||||||
return elem;
|
return elem;
|
||||||
}
|
}
|
||||||
@ -45,14 +42,8 @@ namespace FurnitureAssemblyView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Count
|
public int Count { get { return Convert.ToInt32(textBoxCount.Text); } set {
|
||||||
{
|
textBoxCount.Text = value.ToString(); } }
|
||||||
get { return Convert.ToInt32(textBoxCount.Text); }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
textBoxCount.Text = value.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public FormFurnitureWorkPiece(IWorkPieceLogic logic)
|
public FormFurnitureWorkPiece(IWorkPieceLogic logic)
|
||||||
{
|
{
|
||||||
@ -60,7 +51,7 @@ namespace FurnitureAssemblyView
|
|||||||
|
|
||||||
_list = logic.ReadList(null);
|
_list = logic.ReadList(null);
|
||||||
|
|
||||||
if (_list != null)
|
if(_list != null)
|
||||||
{
|
{
|
||||||
comboBoxWorkPiece.DisplayMember = "WorkPieceName";
|
comboBoxWorkPiece.DisplayMember = "WorkPieceName";
|
||||||
comboBoxWorkPiece.ValueMember = "Id";
|
comboBoxWorkPiece.ValueMember = "Id";
|
||||||
|
@ -1,64 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<root>
|
||||||
<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: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:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
buttonAdd = new Button();
|
buttonAdd = new Button();
|
||||||
buttonUpdate = new Button();
|
buttonUpdate = new Button();
|
||||||
buttonDelete = new Button();
|
buttonDelete = new Button();
|
||||||
buttonRefresh = new Button();
|
buttonRef = new Button();
|
||||||
dataGridView = new DataGridView();
|
dataGridView = new DataGridView();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
@ -68,13 +68,13 @@
|
|||||||
//
|
//
|
||||||
// buttonRef
|
// buttonRef
|
||||||
//
|
//
|
||||||
buttonRefresh.Location = new Point(640, 245);
|
buttonRef.Location = new Point(640, 245);
|
||||||
buttonRefresh.Name = "buttonRef";
|
buttonRef.Name = "buttonRef";
|
||||||
buttonRefresh.Size = new Size(116, 50);
|
buttonRef.Size = new Size(116, 50);
|
||||||
buttonRefresh.TabIndex = 3;
|
buttonRef.TabIndex = 3;
|
||||||
buttonRefresh.Text = "Обновить";
|
buttonRef.Text = "Обновить";
|
||||||
buttonRefresh.UseVisualStyleBackColor = true;
|
buttonRef.UseVisualStyleBackColor = true;
|
||||||
buttonRefresh.Click += ButtonRefresh_Click;
|
buttonRef.Click += ButtonRef_Click;
|
||||||
//
|
//
|
||||||
// dataGridView
|
// dataGridView
|
||||||
//
|
//
|
||||||
@ -92,7 +92,7 @@
|
|||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(781, 450);
|
ClientSize = new Size(781, 450);
|
||||||
Controls.Add(dataGridView);
|
Controls.Add(dataGridView);
|
||||||
Controls.Add(buttonRefresh);
|
Controls.Add(buttonRef);
|
||||||
Controls.Add(buttonDelete);
|
Controls.Add(buttonDelete);
|
||||||
Controls.Add(buttonUpdate);
|
Controls.Add(buttonUpdate);
|
||||||
Controls.Add(buttonAdd);
|
Controls.Add(buttonAdd);
|
||||||
@ -108,7 +108,7 @@
|
|||||||
private Button buttonAdd;
|
private Button buttonAdd;
|
||||||
private Button buttonUpdate;
|
private Button buttonUpdate;
|
||||||
private Button buttonDelete;
|
private Button buttonDelete;
|
||||||
private Button buttonRefresh;
|
private Button buttonRef;
|
||||||
private DataGridView dataGridView;
|
private DataGridView dataGridView;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -118,7 +118,7 @@ namespace FurnitureAssemblyView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonRefresh_Click(object sender, EventArgs e)
|
private void ButtonRef_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
|
@ -38,10 +38,16 @@
|
|||||||
toolStripMenuItem = new ToolStripMenuItem();
|
toolStripMenuItem = new ToolStripMenuItem();
|
||||||
workPieceToolStripMenuItem = new ToolStripMenuItem();
|
workPieceToolStripMenuItem = new ToolStripMenuItem();
|
||||||
furnitureToolStripMenuItem = new ToolStripMenuItem();
|
furnitureToolStripMenuItem = new ToolStripMenuItem();
|
||||||
reportsToolStripMenuItem = new ToolStripMenuItem();
|
shopToolStripMenuItem = new ToolStripMenuItem();
|
||||||
workPiecesToolStripMenuItem = new ToolStripMenuItem();
|
addFurnitureToolStripMenuItem = new ToolStripMenuItem();
|
||||||
workPieceFurnituresToolStripMenuItem = new ToolStripMenuItem();
|
reportToolStripMenuItem = new ToolStripMenuItem();
|
||||||
ordersToolStripMenuItem = new ToolStripMenuItem();
|
groupedOrdersReportToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
ordersReportToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
workloadStoresReportToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
shopsReportToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
reportManufactureToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
workPieceManufacturesToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
buttonSellFurniture = new Button();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
menuStrip.SuspendLayout();
|
menuStrip.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
@ -59,10 +65,10 @@
|
|||||||
//
|
//
|
||||||
// buttonCreateOrder
|
// buttonCreateOrder
|
||||||
//
|
//
|
||||||
buttonCreateOrder.Location = new Point(887, 50);
|
buttonCreateOrder.Location = new Point(887, 38);
|
||||||
buttonCreateOrder.Margin = new Padding(3, 2, 3, 2);
|
buttonCreateOrder.Margin = new Padding(3, 2, 3, 2);
|
||||||
buttonCreateOrder.Name = "buttonCreateOrder";
|
buttonCreateOrder.Name = "buttonCreateOrder";
|
||||||
buttonCreateOrder.Size = new Size(206, 34);
|
buttonCreateOrder.Size = new Size(216, 36);
|
||||||
buttonCreateOrder.TabIndex = 1;
|
buttonCreateOrder.TabIndex = 1;
|
||||||
buttonCreateOrder.Text = "Создать заказ";
|
buttonCreateOrder.Text = "Создать заказ";
|
||||||
buttonCreateOrder.UseVisualStyleBackColor = true;
|
buttonCreateOrder.UseVisualStyleBackColor = true;
|
||||||
@ -70,10 +76,10 @@
|
|||||||
//
|
//
|
||||||
// buttonTakeOrderInWork
|
// buttonTakeOrderInWork
|
||||||
//
|
//
|
||||||
buttonTakeOrderInWork.Location = new Point(887, 107);
|
buttonTakeOrderInWork.Location = new Point(887, 96);
|
||||||
buttonTakeOrderInWork.Margin = new Padding(3, 2, 3, 2);
|
buttonTakeOrderInWork.Margin = new Padding(3, 2, 3, 2);
|
||||||
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
||||||
buttonTakeOrderInWork.Size = new Size(206, 36);
|
buttonTakeOrderInWork.Size = new Size(216, 34);
|
||||||
buttonTakeOrderInWork.TabIndex = 2;
|
buttonTakeOrderInWork.TabIndex = 2;
|
||||||
buttonTakeOrderInWork.Text = "Отдать на выполнение";
|
buttonTakeOrderInWork.Text = "Отдать на выполнение";
|
||||||
buttonTakeOrderInWork.UseVisualStyleBackColor = true;
|
buttonTakeOrderInWork.UseVisualStyleBackColor = true;
|
||||||
@ -81,10 +87,10 @@
|
|||||||
//
|
//
|
||||||
// buttonOrderReady
|
// buttonOrderReady
|
||||||
//
|
//
|
||||||
buttonOrderReady.Location = new Point(887, 165);
|
buttonOrderReady.Location = new Point(887, 148);
|
||||||
buttonOrderReady.Margin = new Padding(3, 2, 3, 2);
|
buttonOrderReady.Margin = new Padding(3, 2, 3, 2);
|
||||||
buttonOrderReady.Name = "buttonOrderReady";
|
buttonOrderReady.Name = "buttonOrderReady";
|
||||||
buttonOrderReady.Size = new Size(206, 31);
|
buttonOrderReady.Size = new Size(216, 33);
|
||||||
buttonOrderReady.TabIndex = 3;
|
buttonOrderReady.TabIndex = 3;
|
||||||
buttonOrderReady.Text = "Заказ готов";
|
buttonOrderReady.Text = "Заказ готов";
|
||||||
buttonOrderReady.UseVisualStyleBackColor = true;
|
buttonOrderReady.UseVisualStyleBackColor = true;
|
||||||
@ -92,10 +98,10 @@
|
|||||||
//
|
//
|
||||||
// buttonIssuedOrder
|
// buttonIssuedOrder
|
||||||
//
|
//
|
||||||
buttonIssuedOrder.Location = new Point(887, 217);
|
buttonIssuedOrder.Location = new Point(887, 201);
|
||||||
buttonIssuedOrder.Margin = new Padding(3, 2, 3, 2);
|
buttonIssuedOrder.Margin = new Padding(3, 2, 3, 2);
|
||||||
buttonIssuedOrder.Name = "buttonIssuedOrder";
|
buttonIssuedOrder.Name = "buttonIssuedOrder";
|
||||||
buttonIssuedOrder.Size = new Size(206, 33);
|
buttonIssuedOrder.Size = new Size(216, 32);
|
||||||
buttonIssuedOrder.TabIndex = 4;
|
buttonIssuedOrder.TabIndex = 4;
|
||||||
buttonIssuedOrder.Text = "Заказ выдан";
|
buttonIssuedOrder.Text = "Заказ выдан";
|
||||||
buttonIssuedOrder.UseVisualStyleBackColor = true;
|
buttonIssuedOrder.UseVisualStyleBackColor = true;
|
||||||
@ -103,19 +109,19 @@
|
|||||||
//
|
//
|
||||||
// buttonRefresh
|
// buttonRefresh
|
||||||
//
|
//
|
||||||
buttonRefresh.Location = new Point(887, 269);
|
buttonRefresh.Location = new Point(887, 250);
|
||||||
buttonRefresh.Margin = new Padding(3, 2, 3, 2);
|
buttonRefresh.Margin = new Padding(3, 2, 3, 2);
|
||||||
buttonRefresh.Name = "buttonRefresh";
|
buttonRefresh.Name = "buttonRefresh";
|
||||||
buttonRefresh.Size = new Size(206, 29);
|
buttonRefresh.Size = new Size(216, 31);
|
||||||
buttonRefresh.TabIndex = 5;
|
buttonRefresh.TabIndex = 5;
|
||||||
buttonRefresh.Text = "Обновить";
|
buttonRefresh.Text = "Обновить";
|
||||||
buttonRefresh.UseVisualStyleBackColor = true;
|
buttonRefresh.UseVisualStyleBackColor = true;
|
||||||
buttonRefresh.Click += ButtonRef_Click;
|
buttonRefresh.Click += ButtonRefresh_Click;
|
||||||
//
|
//
|
||||||
// menuStrip
|
// menuStrip
|
||||||
//
|
//
|
||||||
menuStrip.ImageScalingSize = new Size(20, 20);
|
menuStrip.ImageScalingSize = new Size(20, 20);
|
||||||
menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, reportsToolStripMenuItem });
|
menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, reportToolStripMenuItem });
|
||||||
menuStrip.Location = new Point(0, 0);
|
menuStrip.Location = new Point(0, 0);
|
||||||
menuStrip.Name = "menuStrip";
|
menuStrip.Name = "menuStrip";
|
||||||
menuStrip.Padding = new Padding(5, 2, 0, 2);
|
menuStrip.Padding = new Padding(5, 2, 0, 2);
|
||||||
@ -125,7 +131,7 @@
|
|||||||
//
|
//
|
||||||
// toolStripMenuItem
|
// toolStripMenuItem
|
||||||
//
|
//
|
||||||
toolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { workPieceToolStripMenuItem, furnitureToolStripMenuItem });
|
toolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { workPieceToolStripMenuItem, furnitureToolStripMenuItem, shopToolStripMenuItem, addFurnitureToolStripMenuItem });
|
||||||
toolStripMenuItem.Name = "toolStripMenuItem";
|
toolStripMenuItem.Name = "toolStripMenuItem";
|
||||||
toolStripMenuItem.Size = new Size(94, 20);
|
toolStripMenuItem.Size = new Size(94, 20);
|
||||||
toolStripMenuItem.Text = "Справочники";
|
toolStripMenuItem.Text = "Справочники";
|
||||||
@ -133,50 +139,97 @@
|
|||||||
// workPieceToolStripMenuItem
|
// workPieceToolStripMenuItem
|
||||||
//
|
//
|
||||||
workPieceToolStripMenuItem.Name = "workPieceToolStripMenuItem";
|
workPieceToolStripMenuItem.Name = "workPieceToolStripMenuItem";
|
||||||
workPieceToolStripMenuItem.Size = new Size(130, 22);
|
workPieceToolStripMenuItem.Size = new Size(198, 22);
|
||||||
workPieceToolStripMenuItem.Text = "Заготовки";
|
workPieceToolStripMenuItem.Text = "Заготовки";
|
||||||
workPieceToolStripMenuItem.Click += WorkPieceToolStripMenuItem_Click;
|
workPieceToolStripMenuItem.Click += WorkPieceToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// furnitureToolStripMenuItem
|
// furnitureToolStripMenuItem
|
||||||
//
|
//
|
||||||
furnitureToolStripMenuItem.Name = "furnitureToolStripMenuItem";
|
furnitureToolStripMenuItem.Name = "furnitureToolStripMenuItem";
|
||||||
furnitureToolStripMenuItem.Size = new Size(130, 22);
|
furnitureToolStripMenuItem.Size = new Size(198, 22);
|
||||||
furnitureToolStripMenuItem.Text = "Изделия";
|
furnitureToolStripMenuItem.Text = "Изделия";
|
||||||
furnitureToolStripMenuItem.Click += FurnitureToolStripMenuItem_Click;
|
furnitureToolStripMenuItem.Click += FurnitureToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// reportsToolStripMenuItem
|
// shopToolStripMenuItem
|
||||||
//
|
//
|
||||||
reportsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { workPiecesToolStripMenuItem, workPieceFurnituresToolStripMenuItem, ordersToolStripMenuItem });
|
shopToolStripMenuItem.Name = "shopToolStripMenuItem";
|
||||||
reportsToolStripMenuItem.Name = "reportsToolStripMenuItem";
|
shopToolStripMenuItem.Size = new Size(198, 22);
|
||||||
reportsToolStripMenuItem.Size = new Size(60, 20);
|
shopToolStripMenuItem.Text = "Магазины";
|
||||||
reportsToolStripMenuItem.Text = "Отчёты";
|
shopToolStripMenuItem.Click += ShopToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// workPiecesToolStripMenuItem
|
// addFurnitureToolStripMenuItem
|
||||||
//
|
//
|
||||||
workPiecesToolStripMenuItem.Name = "workPiecesToolStripMenuItem";
|
addFurnitureToolStripMenuItem.Name = "addFurnitureToolStripMenuItem";
|
||||||
workPiecesToolStripMenuItem.Size = new Size(203, 22);
|
addFurnitureToolStripMenuItem.Size = new Size(198, 22);
|
||||||
workPiecesToolStripMenuItem.Text = "Список заготовок";
|
addFurnitureToolStripMenuItem.Text = "Пополнение магазина";
|
||||||
workPiecesToolStripMenuItem.Click += WorkPiecesToolStripMenuItem_Click;
|
addFurnitureToolStripMenuItem.Click += AddFurnitureToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// workPieceFurnituresToolStripMenuItem
|
// reportToolStripMenuItem
|
||||||
//
|
//
|
||||||
workPieceFurnituresToolStripMenuItem.Name = "workPieceFurnituresToolStripMenuItem";
|
reportToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { groupedOrdersReportToolStripMenuItem, ordersReportToolStripMenuItem, workloadStoresReportToolStripMenuItem, shopsReportToolStripMenuItem, reportManufactureToolStripMenuItem, workPieceManufacturesToolStripMenuItem });
|
||||||
workPieceFurnituresToolStripMenuItem.Size = new Size(203, 22);
|
reportToolStripMenuItem.Name = "reportToolStripMenuItem";
|
||||||
workPieceFurnituresToolStripMenuItem.Text = "Заготовки по изделиям";
|
reportToolStripMenuItem.Size = new Size(60, 20);
|
||||||
workPieceFurnituresToolStripMenuItem.Click += WorkPieceFurnituresToolStripMenuItem_Click;
|
reportToolStripMenuItem.Text = "Отчёты";
|
||||||
//
|
//
|
||||||
// ordersToolStripMenuItem
|
// groupedOrdersReportToolStripMenuItem
|
||||||
//
|
//
|
||||||
ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
|
groupedOrdersReportToolStripMenuItem.Name = "groupedOrdersReportToolStripMenuItem";
|
||||||
ordersToolStripMenuItem.Size = new Size(203, 22);
|
groupedOrdersReportToolStripMenuItem.Size = new Size(243, 22);
|
||||||
ordersToolStripMenuItem.Text = "Список заказов";
|
groupedOrdersReportToolStripMenuItem.Text = "Список заказов за весь период";
|
||||||
ordersToolStripMenuItem.Click += OrdersToolStripMenuItem_Click;
|
groupedOrdersReportToolStripMenuItem.Click += GroupedOrdersReportToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// ordersReportToolStripMenuItem
|
||||||
|
//
|
||||||
|
ordersReportToolStripMenuItem.Name = "ordersReportToolStripMenuItem";
|
||||||
|
ordersReportToolStripMenuItem.Size = new Size(243, 22);
|
||||||
|
ordersReportToolStripMenuItem.Text = "Список заказов";
|
||||||
|
ordersReportToolStripMenuItem.Click += OrdersReportToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// workloadStoresReportToolStripMenuItem
|
||||||
|
//
|
||||||
|
workloadStoresReportToolStripMenuItem.Name = "workloadStoresReportToolStripMenuItem";
|
||||||
|
workloadStoresReportToolStripMenuItem.Size = new Size(243, 22);
|
||||||
|
workloadStoresReportToolStripMenuItem.Text = "Загруженность магазинов";
|
||||||
|
workloadStoresReportToolStripMenuItem.Click += WorkloadStoresReportToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// shopsReportToolStripMenuItem
|
||||||
|
//
|
||||||
|
shopsReportToolStripMenuItem.Name = "shopsReportToolStripMenuItem";
|
||||||
|
shopsReportToolStripMenuItem.Size = new Size(243, 22);
|
||||||
|
shopsReportToolStripMenuItem.Text = "Таблица магазинов";
|
||||||
|
shopsReportToolStripMenuItem.Click += ShopsReportToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// reportManufactureToolStripMenuItem
|
||||||
|
//
|
||||||
|
reportManufactureToolStripMenuItem.Name = "reportManufactureToolStripMenuItem";
|
||||||
|
reportManufactureToolStripMenuItem.Size = new Size(243, 22);
|
||||||
|
reportManufactureToolStripMenuItem.Text = "Список изделий";
|
||||||
|
reportManufactureToolStripMenuItem.Click += ReportFurnitureToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// workPieceManufacturesToolStripMenuItem
|
||||||
|
//
|
||||||
|
workPieceManufacturesToolStripMenuItem.Name = "workPieceManufacturesToolStripMenuItem";
|
||||||
|
workPieceManufacturesToolStripMenuItem.Size = new Size(243, 22);
|
||||||
|
workPieceManufacturesToolStripMenuItem.Text = "Заготовки по изделиям";
|
||||||
|
workPieceManufacturesToolStripMenuItem.Click += WorkPieceFurnituresToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// buttonSellFurniture
|
||||||
|
//
|
||||||
|
buttonSellFurniture.Location = new Point(887, 297);
|
||||||
|
buttonSellFurniture.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonSellFurniture.Name = "buttonSellFurniture";
|
||||||
|
buttonSellFurniture.Size = new Size(216, 30);
|
||||||
|
buttonSellFurniture.TabIndex = 8;
|
||||||
|
buttonSellFurniture.Text = "Продажа изделий";
|
||||||
|
buttonSellFurniture.UseVisualStyleBackColor = true;
|
||||||
|
buttonSellFurniture.Click += ButtonSellFurniture_Click;
|
||||||
//
|
//
|
||||||
// FormMain
|
// FormMain
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(1135, 338);
|
ClientSize = new Size(1135, 338);
|
||||||
|
Controls.Add(buttonSellFurniture);
|
||||||
Controls.Add(buttonRefresh);
|
Controls.Add(buttonRefresh);
|
||||||
Controls.Add(buttonIssuedOrder);
|
Controls.Add(buttonIssuedOrder);
|
||||||
Controls.Add(buttonOrderReady);
|
Controls.Add(buttonOrderReady);
|
||||||
@ -208,9 +261,15 @@
|
|||||||
private ToolStripMenuItem toolStripMenuItem;
|
private ToolStripMenuItem toolStripMenuItem;
|
||||||
private ToolStripMenuItem workPieceToolStripMenuItem;
|
private ToolStripMenuItem workPieceToolStripMenuItem;
|
||||||
private ToolStripMenuItem furnitureToolStripMenuItem;
|
private ToolStripMenuItem furnitureToolStripMenuItem;
|
||||||
private ToolStripMenuItem reportsToolStripMenuItem;
|
private ToolStripMenuItem shopToolStripMenuItem;
|
||||||
private ToolStripMenuItem workPiecesToolStripMenuItem;
|
private ToolStripMenuItem addFurnitureToolStripMenuItem;
|
||||||
private ToolStripMenuItem workPieceFurnituresToolStripMenuItem;
|
private Button buttonSellFurniture;
|
||||||
private ToolStripMenuItem ordersToolStripMenuItem;
|
private ToolStripMenuItem reportToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem groupedOrdersReportToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem ordersReportToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem workloadStoresReportToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem shopsReportToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem reportManufactureToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem workPieceManufacturesToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -48,7 +48,6 @@ namespace FurnitureAssemblyView
|
|||||||
{
|
{
|
||||||
dataGridView.DataSource = list;
|
dataGridView.DataSource = list;
|
||||||
dataGridView.Columns["FurnitureId"].Visible = false;
|
dataGridView.Columns["FurnitureId"].Visible = false;
|
||||||
dataGridView.Columns["FurnitureName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogInformation("Загрузка заказов");
|
_logger.LogInformation("Загрузка заказов");
|
||||||
@ -181,7 +180,85 @@ namespace FurnitureAssemblyView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WorkPiecesToolStripMenuItem_Click(object sender, EventArgs e)
|
private void ButtonRefresh_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShopToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormShops));
|
||||||
|
|
||||||
|
if (service is FormShops form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void AddFurnitureToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormAddFurniture));
|
||||||
|
|
||||||
|
if (service is FormAddFurniture form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonSellFurniture_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormSellFurniture));
|
||||||
|
if (service is FormSellFurniture form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GroupedOrdersReportToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormReportGroupedOrders));
|
||||||
|
|
||||||
|
if (service is FormReportGroupedOrders form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OrdersReportToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
|
||||||
|
|
||||||
|
if (service is FormReportOrders form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WorkloadStoresReportToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormReportShopFurnitures));
|
||||||
|
|
||||||
|
if (service is FormReportShopFurnitures form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShopsReportToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||||
|
|
||||||
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
_reportLogic.SaveShopsToWordFile(new ReportBindingModel { FileName = dialog.FileName });
|
||||||
|
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ReportFurnitureToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||||
|
|
||||||
@ -205,20 +282,5 @@ namespace FurnitureAssemblyView
|
|||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
|
|
||||||
|
|
||||||
if (service is FormReportOrders form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonRef_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,81 +28,92 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.buttonSaveToExcel = new System.Windows.Forms.Button();
|
dataGridView = new DataGridView();
|
||||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
buttonSaveToExcel = new Button();
|
||||||
this.ColumWorkPiece = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
ColumnFurniture = new DataGridViewTextBoxColumn();
|
||||||
this.ColumnFurniture = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
ColumnWorkPiece = new DataGridViewTextBoxColumn();
|
||||||
this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
ColumnCount = new DataGridViewTextBoxColumn();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
this.SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// buttonSaveToExcel
|
// dataGridView
|
||||||
//
|
//
|
||||||
this.buttonSaveToExcel.Location = new System.Drawing.Point(33, 25);
|
dataGridView.AllowUserToAddRows = false;
|
||||||
this.buttonSaveToExcel.Name = "buttonSaveToExcel";
|
dataGridView.AllowUserToDeleteRows = false;
|
||||||
this.buttonSaveToExcel.Size = new System.Drawing.Size(256, 29);
|
dataGridView.AllowUserToOrderColumns = true;
|
||||||
this.buttonSaveToExcel.TabIndex = 0;
|
dataGridView.AllowUserToResizeColumns = false;
|
||||||
this.buttonSaveToExcel.Text = "Сохранить в Excel";
|
dataGridView.AllowUserToResizeRows = false;
|
||||||
this.buttonSaveToExcel.UseVisualStyleBackColor = true;
|
dataGridView.BackgroundColor = SystemColors.ControlLightLight;
|
||||||
this.buttonSaveToExcel.Click += new System.EventHandler(this.ButtonSaveToExcel_Click);
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnFurniture, ColumnWorkPiece, ColumnCount });
|
||||||
|
dataGridView.Dock = DockStyle.Bottom;
|
||||||
|
dataGridView.Location = new Point(0, 63);
|
||||||
|
dataGridView.Margin = new Padding(4, 5, 4, 5);
|
||||||
|
dataGridView.MultiSelect = false;
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.ReadOnly = true;
|
||||||
|
dataGridView.RowHeadersVisible = false;
|
||||||
|
dataGridView.RowHeadersWidth = 51;
|
||||||
|
dataGridView.Size = new Size(704, 680);
|
||||||
|
dataGridView.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// dataGridView
|
// buttonSaveToExcel
|
||||||
//
|
//
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
buttonSaveToExcel.Location = new Point(16, 18);
|
||||||
this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
buttonSaveToExcel.Margin = new Padding(4, 5, 4, 5);
|
||||||
this.ColumWorkPiece,
|
buttonSaveToExcel.Name = "buttonSaveToExcel";
|
||||||
this.ColumnFurniture,
|
buttonSaveToExcel.Size = new Size(212, 35);
|
||||||
this.ColumnCount});
|
buttonSaveToExcel.TabIndex = 1;
|
||||||
this.dataGridView.Dock = System.Windows.Forms.DockStyle.Bottom;
|
buttonSaveToExcel.Text = "Сохранить в Excel";
|
||||||
this.dataGridView.Location = new System.Drawing.Point(0, 73);
|
buttonSaveToExcel.UseVisualStyleBackColor = true;
|
||||||
this.dataGridView.Name = "dataGridView";
|
buttonSaveToExcel.Click += ButtonSaveToExcel_Click;
|
||||||
this.dataGridView.RowHeadersWidth = 51;
|
|
||||||
this.dataGridView.RowTemplate.Height = 29;
|
|
||||||
this.dataGridView.Size = new System.Drawing.Size(800, 395);
|
|
||||||
this.dataGridView.TabIndex = 1;
|
|
||||||
//
|
//
|
||||||
// ColumWorkPiece
|
// ColumnFurniture
|
||||||
//
|
//
|
||||||
this.ColumWorkPiece.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
ColumnFurniture.HeaderText = "Изделие";
|
||||||
this.ColumWorkPiece.HeaderText = "Заготовка";
|
ColumnFurniture.MinimumWidth = 6;
|
||||||
this.ColumWorkPiece.MinimumWidth = 6;
|
ColumnFurniture.Name = "ColumnFurniture";
|
||||||
this.ColumWorkPiece.Name = "ColumWorkPiece";
|
ColumnFurniture.ReadOnly = true;
|
||||||
|
ColumnFurniture.Width = 200;
|
||||||
//
|
//
|
||||||
// ColumnFurniture
|
// ColumnWorkPiece
|
||||||
//
|
//
|
||||||
this.ColumnFurniture.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
ColumnWorkPiece.HeaderText = "Заготовка";
|
||||||
this.ColumnFurniture.HeaderText = "Изделие";
|
ColumnWorkPiece.MinimumWidth = 6;
|
||||||
this.ColumnFurniture.MinimumWidth = 6;
|
ColumnWorkPiece.Name = "ColumnWorkPiece";
|
||||||
this.ColumnFurniture.Name = "ColumnFurniture";
|
ColumnWorkPiece.ReadOnly = true;
|
||||||
|
ColumnWorkPiece.Width = 200;
|
||||||
//
|
//
|
||||||
// ColumnCount
|
// ColumnCount
|
||||||
//
|
//
|
||||||
this.ColumnCount.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
ColumnCount.HeaderText = "Количество";
|
||||||
this.ColumnCount.HeaderText = "Количество";
|
ColumnCount.MinimumWidth = 6;
|
||||||
this.ColumnCount.MinimumWidth = 6;
|
ColumnCount.Name = "ColumnCount";
|
||||||
this.ColumnCount.Name = "ColumnCount";
|
ColumnCount.ReadOnly = true;
|
||||||
|
ColumnCount.Width = 125;
|
||||||
//
|
//
|
||||||
// FormReportFurnitureWorkPieces
|
// FormReportFurnitureWorkPieces
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(800, 468);
|
ClientSize = new Size(704, 743);
|
||||||
this.Controls.Add(this.dataGridView);
|
Controls.Add(buttonSaveToExcel);
|
||||||
this.Controls.Add(this.buttonSaveToExcel);
|
Controls.Add(dataGridView);
|
||||||
this.Name = "FormReportFurnitureWorkPieces";
|
Margin = new Padding(4, 5, 4, 5);
|
||||||
this.Text = "Заготовки по изделиям";
|
Name = "FormReportFurnitureWorkPieces";
|
||||||
this.Load += new System.EventHandler(this.FormReportFurnitureWorkPieces_Load);
|
Text = "Заготовки по изделиям";
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
Load += FormReportFurnitureWorkPieces_Load;
|
||||||
this.ResumeLayout(false);
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView dataGridView;
|
||||||
private Button buttonSaveToExcel;
|
private Button buttonSaveToExcel;
|
||||||
private DataGridView dataGridView;
|
|
||||||
private DataGridViewTextBoxColumn ColumWorkPiece;
|
private DataGridViewTextBoxColumn ColumWorkPiece;
|
||||||
private DataGridViewTextBoxColumn ColumnFurniture;
|
private DataGridViewTextBoxColumn ColumnFurniture;
|
||||||
|
private DataGridViewTextBoxColumn ColumnWorkPiece;
|
||||||
private DataGridViewTextBoxColumn ColumnCount;
|
private DataGridViewTextBoxColumn ColumnCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,64 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<root>
|
||||||
<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: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:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
@ -117,14 +57,22 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
<metadata name="ColumWorkPiece.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<data name="ColumWorkPiece.UserAddedColumn" type="System.Boolean, mscorlib">
|
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</data>
|
</metadata>
|
||||||
<data name="ColumnFurniture.UserAddedColumn" type="System.Boolean, mscorlib">
|
<metadata name="ColumnManufacture.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</data>
|
</metadata>
|
||||||
<data name="ColumnCount.UserAddedColumn" type="System.Boolean, mscorlib">
|
<metadata name="ColumnCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</data>
|
</metadata>
|
||||||
|
<metadata name="ColumWorkPiece.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="ColumnManufacture.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="ColumnCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
</root>
|
</root>
|
92
FurnitureAssembly/FurnitureAssemblyView/FormReportGroupedOrders.Designer.cs
generated
Normal file
92
FurnitureAssembly/FurnitureAssemblyView/FormReportGroupedOrders.Designer.cs
generated
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
namespace FurnitureAssemblyView
|
||||||
|
{
|
||||||
|
partial class FormReportGroupedOrders
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
panel = new Panel();
|
||||||
|
buttonToPdf = new Button();
|
||||||
|
buttonMake = new Button();
|
||||||
|
panel.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel
|
||||||
|
//
|
||||||
|
panel.Controls.Add(buttonToPdf);
|
||||||
|
panel.Controls.Add(buttonMake);
|
||||||
|
panel.Dock = DockStyle.Top;
|
||||||
|
panel.Location = new Point(0, 0);
|
||||||
|
panel.Margin = new Padding(4, 3, 4, 3);
|
||||||
|
panel.Name = "panel";
|
||||||
|
panel.Size = new Size(1031, 40);
|
||||||
|
panel.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// buttonToPdf
|
||||||
|
//
|
||||||
|
buttonToPdf.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
|
buttonToPdf.Location = new Point(878, 8);
|
||||||
|
buttonToPdf.Margin = new Padding(4, 3, 4, 3);
|
||||||
|
buttonToPdf.Name = "buttonToPdf";
|
||||||
|
buttonToPdf.Size = new Size(139, 27);
|
||||||
|
buttonToPdf.TabIndex = 5;
|
||||||
|
buttonToPdf.Text = "В Pdf";
|
||||||
|
buttonToPdf.UseVisualStyleBackColor = true;
|
||||||
|
buttonToPdf.Click += ButtonToPdf_Click;
|
||||||
|
//
|
||||||
|
// buttonMake
|
||||||
|
//
|
||||||
|
buttonMake.Location = new Point(476, 8);
|
||||||
|
buttonMake.Margin = new Padding(4, 3, 4, 3);
|
||||||
|
buttonMake.Name = "buttonMake";
|
||||||
|
buttonMake.Size = new Size(139, 27);
|
||||||
|
buttonMake.TabIndex = 4;
|
||||||
|
buttonMake.Text = "Сформировать";
|
||||||
|
buttonMake.UseVisualStyleBackColor = true;
|
||||||
|
buttonMake.Click += ButtonMake_Click;
|
||||||
|
//
|
||||||
|
// FormReportOrders
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(1031, 647);
|
||||||
|
Controls.Add(panel);
|
||||||
|
Margin = new Padding(4, 3, 4, 3);
|
||||||
|
Name = "FormReportOrders";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
|
Text = "Заказы";
|
||||||
|
panel.ResumeLayout(false);
|
||||||
|
panel.PerformLayout();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel panel;
|
||||||
|
private Button buttonToPdf;
|
||||||
|
private Button buttonMake;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,87 @@
|
|||||||
|
using FurnitureAssemblyContracts.BindingModels;
|
||||||
|
using FurnitureAssemblyContracts.BusinessLogicsContracts;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.Reporting.WinForms;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace FurnitureAssemblyView
|
||||||
|
{
|
||||||
|
public partial class FormReportGroupedOrders : Form
|
||||||
|
{
|
||||||
|
private readonly ReportViewer reportViewer;
|
||||||
|
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
|
private readonly IReportLogic _logic;
|
||||||
|
|
||||||
|
public FormReportGroupedOrders(ILogger<FormReportGroupedOrders> logger, IReportLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
|
||||||
|
reportViewer = new ReportViewer
|
||||||
|
{
|
||||||
|
Dock = DockStyle.Fill
|
||||||
|
};
|
||||||
|
|
||||||
|
reportViewer.LocalReport.LoadReportDefinition(new FileStream("E:\\TP\\Hard\\Lab4\\FurnitureAssembly\\FurnitureAssemblyView\\ReportGroupedOrders.rdlc", FileMode.Open));
|
||||||
|
Controls.Clear();
|
||||||
|
Controls.Add(reportViewer);
|
||||||
|
Controls.Add(panel);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonMake_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var dataSource = _logic.GetGroupedOrders();
|
||||||
|
var source = new ReportDataSource("DataSetGroupedOrders", dataSource);
|
||||||
|
|
||||||
|
reportViewer.LocalReport.DataSources.Clear();
|
||||||
|
reportViewer.LocalReport.DataSources.Add(source);
|
||||||
|
|
||||||
|
reportViewer.RefreshReport();
|
||||||
|
_logger.LogInformation("Загрузка списка заказов");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки списка заказов");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonToPdf_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" };
|
||||||
|
|
||||||
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_logic.SaveGroupedOrdersToPdfFile(new ReportBindingModel
|
||||||
|
{
|
||||||
|
FileName = dialog.FileName
|
||||||
|
});
|
||||||
|
|
||||||
|
_logger.LogInformation("Загрузка списка заказов");
|
||||||
|
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка сохранения списка заказов");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
@ -31,10 +31,10 @@
|
|||||||
panel = new Panel();
|
panel = new Panel();
|
||||||
buttonToPdf = new Button();
|
buttonToPdf = new Button();
|
||||||
buttonMake = new Button();
|
buttonMake = new Button();
|
||||||
label2 = new Label();
|
|
||||||
label1 = new Label();
|
|
||||||
dateTimePickerTo = new DateTimePicker();
|
dateTimePickerTo = new DateTimePicker();
|
||||||
|
labelTo = new Label();
|
||||||
dateTimePickerFrom = new DateTimePicker();
|
dateTimePickerFrom = new DateTimePicker();
|
||||||
|
labelFrom = new Label();
|
||||||
panel.SuspendLayout();
|
panel.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
@ -42,21 +42,24 @@
|
|||||||
//
|
//
|
||||||
panel.Controls.Add(buttonToPdf);
|
panel.Controls.Add(buttonToPdf);
|
||||||
panel.Controls.Add(buttonMake);
|
panel.Controls.Add(buttonMake);
|
||||||
panel.Controls.Add(label2);
|
|
||||||
panel.Controls.Add(label1);
|
|
||||||
panel.Controls.Add(dateTimePickerTo);
|
panel.Controls.Add(dateTimePickerTo);
|
||||||
|
panel.Controls.Add(labelTo);
|
||||||
panel.Controls.Add(dateTimePickerFrom);
|
panel.Controls.Add(dateTimePickerFrom);
|
||||||
|
panel.Controls.Add(labelFrom);
|
||||||
panel.Dock = DockStyle.Top;
|
panel.Dock = DockStyle.Top;
|
||||||
panel.Location = new Point(0, 0);
|
panel.Location = new Point(0, 0);
|
||||||
|
panel.Margin = new Padding(4, 3, 4, 3);
|
||||||
panel.Name = "panel";
|
panel.Name = "panel";
|
||||||
panel.Size = new Size(1112, 51);
|
panel.Size = new Size(1031, 40);
|
||||||
panel.TabIndex = 0;
|
panel.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// buttonToPdf
|
// buttonToPdf
|
||||||
//
|
//
|
||||||
buttonToPdf.Location = new Point(894, 10);
|
buttonToPdf.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
|
buttonToPdf.Location = new Point(878, 8);
|
||||||
|
buttonToPdf.Margin = new Padding(4, 3, 4, 3);
|
||||||
buttonToPdf.Name = "buttonToPdf";
|
buttonToPdf.Name = "buttonToPdf";
|
||||||
buttonToPdf.Size = new Size(157, 29);
|
buttonToPdf.Size = new Size(139, 27);
|
||||||
buttonToPdf.TabIndex = 5;
|
buttonToPdf.TabIndex = 5;
|
||||||
buttonToPdf.Text = "В Pdf";
|
buttonToPdf.Text = "В Pdf";
|
||||||
buttonToPdf.UseVisualStyleBackColor = true;
|
buttonToPdf.UseVisualStyleBackColor = true;
|
||||||
@ -64,55 +67,61 @@
|
|||||||
//
|
//
|
||||||
// buttonMake
|
// buttonMake
|
||||||
//
|
//
|
||||||
buttonMake.Location = new Point(612, 10);
|
buttonMake.Location = new Point(476, 8);
|
||||||
|
buttonMake.Margin = new Padding(4, 3, 4, 3);
|
||||||
buttonMake.Name = "buttonMake";
|
buttonMake.Name = "buttonMake";
|
||||||
buttonMake.Size = new Size(157, 29);
|
buttonMake.Size = new Size(139, 27);
|
||||||
buttonMake.TabIndex = 4;
|
buttonMake.TabIndex = 4;
|
||||||
buttonMake.Text = "Сформировать";
|
buttonMake.Text = "Сформировать";
|
||||||
buttonMake.UseVisualStyleBackColor = true;
|
buttonMake.UseVisualStyleBackColor = true;
|
||||||
buttonMake.Click += ButtonMake_Click;
|
buttonMake.Click += ButtonMake_Click;
|
||||||
//
|
//
|
||||||
// label2
|
|
||||||
//
|
|
||||||
label2.AutoSize = true;
|
|
||||||
label2.Location = new Point(263, 17);
|
|
||||||
label2.Name = "label2";
|
|
||||||
label2.Size = new Size(27, 20);
|
|
||||||
label2.TabIndex = 3;
|
|
||||||
label2.Text = "по";
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
label1.AutoSize = true;
|
|
||||||
label1.Location = new Point(25, 17);
|
|
||||||
label1.Name = "label1";
|
|
||||||
label1.Size = new Size(18, 20);
|
|
||||||
label1.TabIndex = 2;
|
|
||||||
label1.Text = "С";
|
|
||||||
//
|
|
||||||
// dateTimePickerTo
|
// dateTimePickerTo
|
||||||
//
|
//
|
||||||
dateTimePickerTo.Location = new Point(313, 12);
|
dateTimePickerTo.Location = new Point(237, 7);
|
||||||
|
dateTimePickerTo.Margin = new Padding(4, 3, 4, 3);
|
||||||
dateTimePickerTo.Name = "dateTimePickerTo";
|
dateTimePickerTo.Name = "dateTimePickerTo";
|
||||||
dateTimePickerTo.Size = new Size(169, 27);
|
dateTimePickerTo.Size = new Size(163, 23);
|
||||||
dateTimePickerTo.TabIndex = 1;
|
dateTimePickerTo.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// labelTo
|
||||||
|
//
|
||||||
|
labelTo.AutoSize = true;
|
||||||
|
labelTo.Location = new Point(208, 10);
|
||||||
|
labelTo.Margin = new Padding(4, 0, 4, 0);
|
||||||
|
labelTo.Name = "labelTo";
|
||||||
|
labelTo.Size = new Size(21, 15);
|
||||||
|
labelTo.TabIndex = 2;
|
||||||
|
labelTo.Text = "по";
|
||||||
//
|
//
|
||||||
// dateTimePickerFrom
|
// dateTimePickerFrom
|
||||||
//
|
//
|
||||||
dateTimePickerFrom.Location = new Point(65, 12);
|
dateTimePickerFrom.Location = new Point(37, 7);
|
||||||
|
dateTimePickerFrom.Margin = new Padding(4, 3, 4, 3);
|
||||||
dateTimePickerFrom.Name = "dateTimePickerFrom";
|
dateTimePickerFrom.Name = "dateTimePickerFrom";
|
||||||
dateTimePickerFrom.Size = new Size(176, 27);
|
dateTimePickerFrom.Size = new Size(163, 23);
|
||||||
dateTimePickerFrom.TabIndex = 0;
|
dateTimePickerFrom.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// labelFrom
|
||||||
|
//
|
||||||
|
labelFrom.AutoSize = true;
|
||||||
|
labelFrom.Location = new Point(14, 10);
|
||||||
|
labelFrom.Margin = new Padding(4, 0, 4, 0);
|
||||||
|
labelFrom.Name = "labelFrom";
|
||||||
|
labelFrom.Size = new Size(15, 15);
|
||||||
|
labelFrom.TabIndex = 0;
|
||||||
|
labelFrom.Text = "С";
|
||||||
//
|
//
|
||||||
// FormReportOrders
|
// FormReportOrders
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(1112, 450);
|
ClientSize = new Size(1031, 647);
|
||||||
Controls.Add(panel);
|
Controls.Add(panel);
|
||||||
|
Margin = new Padding(4, 3, 4, 3);
|
||||||
Name = "FormReportOrders";
|
Name = "FormReportOrders";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
Text = "Заказы";
|
Text = "Заказы";
|
||||||
Load += FormReportOrders_Load;
|
|
||||||
panel.ResumeLayout(false);
|
panel.ResumeLayout(false);
|
||||||
panel.PerformLayout();
|
panel.PerformLayout();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
@ -121,11 +130,11 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private Panel panel;
|
private Panel panel;
|
||||||
|
private Button buttonToPdf;
|
||||||
private Button buttonMake;
|
private Button buttonMake;
|
||||||
private Label label2;
|
|
||||||
private Label label1;
|
|
||||||
private DateTimePicker dateTimePickerTo;
|
private DateTimePicker dateTimePickerTo;
|
||||||
|
private Label labelTo;
|
||||||
private DateTimePicker dateTimePickerFrom;
|
private DateTimePicker dateTimePickerFrom;
|
||||||
private Button buttonToPdf;
|
private Label labelFrom;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -35,7 +35,7 @@ namespace FurnitureAssemblyView
|
|||||||
Dock = DockStyle.Fill
|
Dock = DockStyle.Fill
|
||||||
};
|
};
|
||||||
|
|
||||||
reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrders.rdlc", FileMode.Open));
|
reportViewer.LocalReport.LoadReportDefinition(new FileStream("E:\\TP\\Hard\\Lab4\\FurnitureAssembly\\FurnitureAssemblyView\\ReportOrders.rdlc", FileMode.Open));
|
||||||
|
|
||||||
Controls.Clear();
|
Controls.Clear();
|
||||||
Controls.Add(reportViewer);
|
Controls.Add(reportViewer);
|
||||||
@ -46,9 +46,7 @@ namespace FurnitureAssemblyView
|
|||||||
{
|
{
|
||||||
if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date)
|
if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка",
|
MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
@ -64,14 +62,14 @@ namespace FurnitureAssemblyView
|
|||||||
reportViewer.LocalReport.DataSources.Clear();
|
reportViewer.LocalReport.DataSources.Clear();
|
||||||
reportViewer.LocalReport.DataSources.Add(source);
|
reportViewer.LocalReport.DataSources.Add(source);
|
||||||
|
|
||||||
var parameters = new[] { new ReportParameter("ReportParameterPeriod",
|
var parameters = new[] { new ReportParameter("ReportParameterPeriod",
|
||||||
$"c {dateTimePickerFrom.Value.ToShortDateString()} по {dateTimePickerTo.Value.ToShortDateString()}") };
|
$"c {dateTimePickerFrom.Value.ToShortDateString()} по {dateTimePickerTo.Value.ToShortDateString()}") };
|
||||||
|
|
||||||
reportViewer.LocalReport.SetParameters(parameters);
|
reportViewer.LocalReport.SetParameters(parameters);
|
||||||
|
|
||||||
reportViewer.RefreshReport();
|
reportViewer.RefreshReport();
|
||||||
|
|
||||||
_logger.LogInformation("Загрузка списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(),
|
_logger.LogInformation("Загрузка списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
|
||||||
dateTimePickerTo.Value.ToShortDateString());
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -89,10 +87,7 @@ namespace FurnitureAssemblyView
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using var dialog = new SaveFileDialog
|
using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" };
|
||||||
{
|
|
||||||
Filter = "pdf|*.pdf"
|
|
||||||
};
|
|
||||||
|
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
@ -105,9 +100,7 @@ namespace FurnitureAssemblyView
|
|||||||
DateTo = dateTimePickerTo.Value
|
DateTo = dateTimePickerTo.Value
|
||||||
});
|
});
|
||||||
|
|
||||||
_logger.LogInformation("Сохранение списка заказов на период {From}-{To}",
|
_logger.LogInformation("Сохранение списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
|
||||||
dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
|
|
||||||
|
|
||||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -118,10 +111,5 @@ namespace FurnitureAssemblyView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormReportOrders_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
118
FurnitureAssembly/FurnitureAssemblyView/FormReportShopFurnitures.Designer.cs
generated
Normal file
118
FurnitureAssembly/FurnitureAssemblyView/FormReportShopFurnitures.Designer.cs
generated
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
namespace FurnitureAssemblyView
|
||||||
|
{
|
||||||
|
partial class FormReportShopFurnitures
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
buttonSaveToExcel = new Button();
|
||||||
|
ColumnShop = new DataGridViewTextBoxColumn();
|
||||||
|
ColumnFurniture = new DataGridViewTextBoxColumn();
|
||||||
|
ColumnCount = new DataGridViewTextBoxColumn();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.AllowUserToAddRows = false;
|
||||||
|
dataGridView.AllowUserToDeleteRows = false;
|
||||||
|
dataGridView.AllowUserToOrderColumns = true;
|
||||||
|
dataGridView.AllowUserToResizeColumns = false;
|
||||||
|
dataGridView.AllowUserToResizeRows = false;
|
||||||
|
dataGridView.BackgroundColor = SystemColors.ControlLightLight;
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnShop, ColumnFurniture, ColumnCount });
|
||||||
|
dataGridView.Dock = DockStyle.Bottom;
|
||||||
|
dataGridView.Location = new Point(0, 63);
|
||||||
|
dataGridView.Margin = new Padding(4, 5, 4, 5);
|
||||||
|
dataGridView.MultiSelect = false;
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.ReadOnly = true;
|
||||||
|
dataGridView.RowHeadersVisible = false;
|
||||||
|
dataGridView.RowHeadersWidth = 51;
|
||||||
|
dataGridView.Size = new Size(704, 680);
|
||||||
|
dataGridView.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// buttonSaveToExcel
|
||||||
|
//
|
||||||
|
buttonSaveToExcel.Location = new Point(16, 18);
|
||||||
|
buttonSaveToExcel.Margin = new Padding(4, 5, 4, 5);
|
||||||
|
buttonSaveToExcel.Name = "buttonSaveToExcel";
|
||||||
|
buttonSaveToExcel.Size = new Size(212, 35);
|
||||||
|
buttonSaveToExcel.TabIndex = 1;
|
||||||
|
buttonSaveToExcel.Text = "Сохранить в Excel";
|
||||||
|
buttonSaveToExcel.UseVisualStyleBackColor = true;
|
||||||
|
buttonSaveToExcel.Click += ButtonSaveToExcel_Click;
|
||||||
|
//
|
||||||
|
// ColumnShop
|
||||||
|
//
|
||||||
|
ColumnShop.HeaderText = "Магазин";
|
||||||
|
ColumnShop.MinimumWidth = 6;
|
||||||
|
ColumnShop.Name = "ColumnShop";
|
||||||
|
ColumnShop.ReadOnly = true;
|
||||||
|
ColumnShop.Width = 200;
|
||||||
|
//
|
||||||
|
// ColumnFurniture
|
||||||
|
//
|
||||||
|
ColumnFurniture.HeaderText = "Изделие";
|
||||||
|
ColumnFurniture.MinimumWidth = 6;
|
||||||
|
ColumnFurniture.Name = "ColumnFurniture";
|
||||||
|
ColumnFurniture.ReadOnly = true;
|
||||||
|
ColumnFurniture.Width = 200;
|
||||||
|
//
|
||||||
|
// ColumnCount
|
||||||
|
//
|
||||||
|
ColumnCount.HeaderText = "Количество";
|
||||||
|
ColumnCount.MinimumWidth = 6;
|
||||||
|
ColumnCount.Name = "ColumnCount";
|
||||||
|
ColumnCount.ReadOnly = true;
|
||||||
|
ColumnCount.Width = 125;
|
||||||
|
//
|
||||||
|
// FormReportShopFurnitures
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(704, 743);
|
||||||
|
Controls.Add(buttonSaveToExcel);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Margin = new Padding(4, 5, 4, 5);
|
||||||
|
Name = "FormReportShopFurnitures";
|
||||||
|
Text = "Загруженность магазинов";
|
||||||
|
Load += FormReportShopFurnitures_Load;
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
private Button buttonSaveToExcel;
|
||||||
|
private DataGridViewTextBoxColumn ColumnShop;
|
||||||
|
private DataGridViewTextBoxColumn ColumnFurniture;
|
||||||
|
private DataGridViewTextBoxColumn ColumnCount;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,86 @@
|
|||||||
|
using FurnitureAssemblyContracts.BindingModels;
|
||||||
|
using FurnitureAssemblyContracts.BusinessLogicsContracts;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace FurnitureAssemblyView
|
||||||
|
{
|
||||||
|
public partial class FormReportShopFurnitures : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
|
private readonly IReportLogic _logic;
|
||||||
|
|
||||||
|
public FormReportShopFurnitures(ILogger<FormReportShopFurnitures> logger, IReportLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormReportShopFurnitures_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var dict = _logic.GetShopFurnitures();
|
||||||
|
|
||||||
|
if (dict != null)
|
||||||
|
{
|
||||||
|
dataGridView.Rows.Clear();
|
||||||
|
|
||||||
|
foreach (var elem in dict)
|
||||||
|
{
|
||||||
|
dataGridView.Rows.Add(new object[] { elem.ShopName, "", "" });
|
||||||
|
|
||||||
|
foreach (var listElem in elem.Furnitures)
|
||||||
|
{
|
||||||
|
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
|
||||||
|
}
|
||||||
|
|
||||||
|
dataGridView.Rows.Add(new object[] { "Итого", "", elem.TotalCount });
|
||||||
|
dataGridView.Rows.Add(Array.Empty<object>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Загрузка списка магазинов по изделиям");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки списка магазинов по изделиям");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonSaveToExcel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
using var dialog = new SaveFileDialog { Filter = "xlsx|*.xlsx" };
|
||||||
|
|
||||||
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_logic.SaveShopFurnituresToExcelFile(new ReportBindingModel
|
||||||
|
{
|
||||||
|
FileName = dialog.FileName
|
||||||
|
});
|
||||||
|
|
||||||
|
_logger.LogInformation("Сохранение списка магазинов по изделиям");
|
||||||
|
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка сохранения списка магазинов по изделиям");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
125
FurnitureAssembly/FurnitureAssemblyView/FormSellFurniture.Designer.cs
generated
Normal file
125
FurnitureAssembly/FurnitureAssemblyView/FormSellFurniture.Designer.cs
generated
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
namespace FurnitureAssemblyView
|
||||||
|
{
|
||||||
|
partial class FormSellFurniture
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
labelFurniture = new Label();
|
||||||
|
labelCount = new Label();
|
||||||
|
comboBoxFurniture = new ComboBox();
|
||||||
|
textBoxCount = new TextBox();
|
||||||
|
buttonSave = new Button();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// labelFurniture
|
||||||
|
//
|
||||||
|
labelFurniture.AutoSize = true;
|
||||||
|
labelFurniture.Location = new Point(28, 24);
|
||||||
|
labelFurniture.Name = "labelFurniture";
|
||||||
|
labelFurniture.Size = new Size(56, 15);
|
||||||
|
labelFurniture.TabIndex = 0;
|
||||||
|
labelFurniture.Text = "Изделие:";
|
||||||
|
//
|
||||||
|
// labelCount
|
||||||
|
//
|
||||||
|
labelCount.AutoSize = true;
|
||||||
|
labelCount.Location = new Point(30, 64);
|
||||||
|
labelCount.Name = "labelCount";
|
||||||
|
labelCount.Size = new Size(75, 15);
|
||||||
|
labelCount.TabIndex = 1;
|
||||||
|
labelCount.Text = "Количество:";
|
||||||
|
//
|
||||||
|
// comboBoxFurniture
|
||||||
|
//
|
||||||
|
comboBoxFurniture.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxFurniture.FormattingEnabled = true;
|
||||||
|
comboBoxFurniture.Location = new Point(149, 24);
|
||||||
|
comboBoxFurniture.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
comboBoxFurniture.Name = "comboBoxFurniture";
|
||||||
|
comboBoxFurniture.Size = new Size(230, 23);
|
||||||
|
comboBoxFurniture.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// textBoxCount
|
||||||
|
//
|
||||||
|
textBoxCount.Location = new Point(149, 64);
|
||||||
|
textBoxCount.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
textBoxCount.Name = "textBoxCount";
|
||||||
|
textBoxCount.Size = new Size(230, 23);
|
||||||
|
textBoxCount.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(169, 102);
|
||||||
|
buttonSave.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(101, 26);
|
||||||
|
buttonSave.TabIndex = 6;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += ButtonSave_Click;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(282, 102);
|
||||||
|
buttonCancel.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(97, 26);
|
||||||
|
buttonCancel.TabIndex = 7;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += ButtonCancel_Click;
|
||||||
|
//
|
||||||
|
// FormSellFurniture
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(385, 135);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(textBoxCount);
|
||||||
|
Controls.Add(comboBoxFurniture);
|
||||||
|
Controls.Add(labelCount);
|
||||||
|
Controls.Add(labelFurniture);
|
||||||
|
Margin = new Padding(3, 2, 3, 2);
|
||||||
|
Name = "FormSellFurniture";
|
||||||
|
Text = "Продажа изделий";
|
||||||
|
Load += FormSellFurniture_Load;
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label labelFurniture;
|
||||||
|
private Label labelCount;
|
||||||
|
private ComboBox comboBoxFurniture;
|
||||||
|
private TextBox textBoxCount;
|
||||||
|
private Button buttonSave;
|
||||||
|
private Button buttonCancel;
|
||||||
|
}
|
||||||
|
}
|
100
FurnitureAssembly/FurnitureAssemblyView/FormSellFurniture.cs
Normal file
100
FurnitureAssembly/FurnitureAssemblyView/FormSellFurniture.cs
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
using FurnitureAssemblyContracts.BusinessLogicsContracts;
|
||||||
|
using FurnitureAssemblyContracts.SearchModels;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace FurnitureAssemblyView
|
||||||
|
{
|
||||||
|
public partial class FormSellFurniture : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
|
private readonly IFurnitureLogic _logicI;
|
||||||
|
|
||||||
|
private readonly IShopLogic _logicS;
|
||||||
|
|
||||||
|
public FormSellFurniture(ILogger<FormAddFurniture> logger, IFurnitureLogic logicI, IShopLogic logicS)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
_logger = logger;
|
||||||
|
_logicI = logicI;
|
||||||
|
_logicS = logicS;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormSellFurniture_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Загрузка списка изделий для продажи");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var list = _logicI.ReadList(null);
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
comboBoxFurniture.DisplayMember = "FurnitureName";
|
||||||
|
comboBoxFurniture.ValueMember = "Id";
|
||||||
|
comboBoxFurniture.DataSource = list;
|
||||||
|
comboBoxFurniture.SelectedItem = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки списка изделий");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(textBoxCount.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните поле Количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (comboBoxFurniture.SelectedValue == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Продажа изделия");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var operationResult = _logicS.SellFurnitures(_logicI.ReadElement(new FurnitureSearchModel()
|
||||||
|
{
|
||||||
|
Id = Convert.ToInt32(comboBoxFurniture.SelectedValue)
|
||||||
|
})!, Convert.ToInt32(textBoxCount.Text));
|
||||||
|
|
||||||
|
if (!operationResult)
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при продаже изделия. Дополнительная информация в логах. Недостаточно изделий");
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка продажи изделия");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = DialogResult.Cancel;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
FurnitureAssembly/FurnitureAssemblyView/FormSellFurniture.resx
Normal file
120
FurnitureAssembly/FurnitureAssemblyView/FormSellFurniture.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
231
FurnitureAssembly/FurnitureAssemblyView/FormShop.Designer.cs
generated
Normal file
231
FurnitureAssembly/FurnitureAssemblyView/FormShop.Designer.cs
generated
Normal file
@ -0,0 +1,231 @@
|
|||||||
|
namespace FurnitureAssemblyView
|
||||||
|
{
|
||||||
|
partial class FormShop
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
labelName = new Label();
|
||||||
|
labelAddress = new Label();
|
||||||
|
textBoxName = new TextBox();
|
||||||
|
textBoxAddress = new TextBox();
|
||||||
|
groupBoxFurniture = new GroupBox();
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
ID = new DataGridViewTextBoxColumn();
|
||||||
|
ColumnFurnitureName = new DataGridViewTextBoxColumn();
|
||||||
|
ColumnCount = new DataGridViewTextBoxColumn();
|
||||||
|
buttonSave = new Button();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
labelDate = new Label();
|
||||||
|
dateTimePickerDate = new DateTimePicker();
|
||||||
|
labelCount = new Label();
|
||||||
|
numericUpDownCount = new NumericUpDown();
|
||||||
|
groupBoxFurniture.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownCount).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// labelName
|
||||||
|
//
|
||||||
|
labelName.AutoSize = true;
|
||||||
|
labelName.Location = new Point(18, 10);
|
||||||
|
labelName.Name = "labelName";
|
||||||
|
labelName.Size = new Size(62, 15);
|
||||||
|
labelName.TabIndex = 0;
|
||||||
|
labelName.Text = "Название:";
|
||||||
|
//
|
||||||
|
// labelAddress
|
||||||
|
//
|
||||||
|
labelAddress.AutoSize = true;
|
||||||
|
labelAddress.Location = new Point(266, 9);
|
||||||
|
labelAddress.Name = "labelAddress";
|
||||||
|
labelAddress.Size = new Size(43, 15);
|
||||||
|
labelAddress.TabIndex = 1;
|
||||||
|
labelAddress.Text = "Адрес:";
|
||||||
|
//
|
||||||
|
// textBoxName
|
||||||
|
//
|
||||||
|
textBoxName.Location = new Point(94, 8);
|
||||||
|
textBoxName.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
textBoxName.Name = "textBoxName";
|
||||||
|
textBoxName.Size = new Size(138, 23);
|
||||||
|
textBoxName.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// textBoxAddress
|
||||||
|
//
|
||||||
|
textBoxAddress.Location = new Point(318, 7);
|
||||||
|
textBoxAddress.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
textBoxAddress.Name = "textBoxAddress";
|
||||||
|
textBoxAddress.Size = new Size(138, 23);
|
||||||
|
textBoxAddress.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// groupBoxFurniture
|
||||||
|
//
|
||||||
|
groupBoxFurniture.Controls.Add(dataGridView);
|
||||||
|
groupBoxFurniture.Location = new Point(12, 70);
|
||||||
|
groupBoxFurniture.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
groupBoxFurniture.Name = "groupBoxFurniture";
|
||||||
|
groupBoxFurniture.Padding = new Padding(3, 2, 3, 2);
|
||||||
|
groupBoxFurniture.Size = new Size(720, 206);
|
||||||
|
groupBoxFurniture.TabIndex = 4;
|
||||||
|
groupBoxFurniture.TabStop = false;
|
||||||
|
groupBoxFurniture.Text = "Изделия";
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ID, ColumnFurnitureName, ColumnCount });
|
||||||
|
dataGridView.Location = new Point(5, 20);
|
||||||
|
dataGridView.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.RowHeadersWidth = 51;
|
||||||
|
dataGridView.RowTemplate.Height = 29;
|
||||||
|
dataGridView.Size = new Size(709, 182);
|
||||||
|
dataGridView.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// ID
|
||||||
|
//
|
||||||
|
ID.HeaderText = "ID";
|
||||||
|
ID.MinimumWidth = 6;
|
||||||
|
ID.Name = "ID";
|
||||||
|
ID.Visible = false;
|
||||||
|
ID.Width = 125;
|
||||||
|
//
|
||||||
|
// ColumnFurnitureName
|
||||||
|
//
|
||||||
|
ColumnFurnitureName.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
ColumnFurnitureName.HeaderText = "Изделие";
|
||||||
|
ColumnFurnitureName.MinimumWidth = 6;
|
||||||
|
ColumnFurnitureName.Name = "ColumnFurnitureName";
|
||||||
|
ColumnFurnitureName.Resizable = DataGridViewTriState.True;
|
||||||
|
//
|
||||||
|
// ColumnCount
|
||||||
|
//
|
||||||
|
ColumnCount.HeaderText = "Количество";
|
||||||
|
ColumnCount.MinimumWidth = 6;
|
||||||
|
ColumnCount.Name = "ColumnCount";
|
||||||
|
ColumnCount.Width = 125;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(396, 286);
|
||||||
|
buttonSave.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(151, 33);
|
||||||
|
buttonSave.TabIndex = 5;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += ButtonSave_Click;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(569, 286);
|
||||||
|
buttonCancel.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(146, 33);
|
||||||
|
buttonCancel.TabIndex = 6;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += ButtonCancel_Click;
|
||||||
|
//
|
||||||
|
// labelDate
|
||||||
|
//
|
||||||
|
labelDate.AutoSize = true;
|
||||||
|
labelDate.Location = new Point(492, 9);
|
||||||
|
labelDate.Name = "labelDate";
|
||||||
|
labelDate.Size = new Size(90, 15);
|
||||||
|
labelDate.TabIndex = 7;
|
||||||
|
labelDate.Text = "Дата открытия:";
|
||||||
|
//
|
||||||
|
// dateTimePickerDate
|
||||||
|
//
|
||||||
|
dateTimePickerDate.Location = new Point(596, 7);
|
||||||
|
dateTimePickerDate.Name = "dateTimePickerDate";
|
||||||
|
dateTimePickerDate.Size = new Size(127, 23);
|
||||||
|
dateTimePickerDate.TabIndex = 9;
|
||||||
|
//
|
||||||
|
// labelCount
|
||||||
|
//
|
||||||
|
labelCount.AutoSize = true;
|
||||||
|
labelCount.Location = new Point(18, 41);
|
||||||
|
labelCount.Name = "labelCount";
|
||||||
|
labelCount.Size = new Size(137, 15);
|
||||||
|
labelCount.TabIndex = 10;
|
||||||
|
labelCount.Text = "Вместимость магазина:";
|
||||||
|
//
|
||||||
|
// numericUpDownCount
|
||||||
|
//
|
||||||
|
numericUpDownCount.Location = new Point(175, 40);
|
||||||
|
numericUpDownCount.Name = "numericUpDownCount";
|
||||||
|
numericUpDownCount.Size = new Size(127, 23);
|
||||||
|
numericUpDownCount.TabIndex = 11;
|
||||||
|
//
|
||||||
|
// FormShop
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(744, 330);
|
||||||
|
Controls.Add(numericUpDownCount);
|
||||||
|
Controls.Add(labelCount);
|
||||||
|
Controls.Add(dateTimePickerDate);
|
||||||
|
Controls.Add(labelDate);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(groupBoxFurniture);
|
||||||
|
Controls.Add(textBoxAddress);
|
||||||
|
Controls.Add(textBoxName);
|
||||||
|
Controls.Add(labelAddress);
|
||||||
|
Controls.Add(labelName);
|
||||||
|
Margin = new Padding(3, 2, 3, 2);
|
||||||
|
Name = "FormShop";
|
||||||
|
Text = "Магазин";
|
||||||
|
Load += FormShop_Load;
|
||||||
|
groupBoxFurniture.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownCount).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label labelName;
|
||||||
|
private Label labelAddress;
|
||||||
|
private TextBox textBoxName;
|
||||||
|
private TextBox textBoxAddress;
|
||||||
|
private GroupBox groupBoxFurniture;
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
private Button buttonSave;
|
||||||
|
private Button buttonCancel;
|
||||||
|
private Label labelDate;
|
||||||
|
private DateTimePicker dateTimePickerDate;
|
||||||
|
private DataGridViewTextBoxColumn ID;
|
||||||
|
private DataGridViewTextBoxColumn ColumnFurnitureName;
|
||||||
|
private DataGridViewTextBoxColumn ColumnCount;
|
||||||
|
private Label labelCount;
|
||||||
|
private NumericUpDown numericUpDownCount;
|
||||||
|
}
|
||||||
|
}
|
139
FurnitureAssembly/FurnitureAssemblyView/FormShop.cs
Normal file
139
FurnitureAssembly/FurnitureAssemblyView/FormShop.cs
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
using FurnitureAssemblyContracts.BindingModels;
|
||||||
|
using FurnitureAssemblyContracts.BusinessLogicsContracts;
|
||||||
|
using FurnitureAssemblyContracts.SearchModels;
|
||||||
|
using FurnitureAssemblyDataModels.Models;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace FurnitureAssemblyView
|
||||||
|
{
|
||||||
|
public partial class FormShop : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
|
private readonly IShopLogic _logic;
|
||||||
|
|
||||||
|
private int? _id;
|
||||||
|
|
||||||
|
private Dictionary<int, (IFurnitureModel, int)> _shopFurnitures;
|
||||||
|
|
||||||
|
public int Id { set { _id = value; } }
|
||||||
|
|
||||||
|
public FormShop(ILogger<FormShop> logger, IShopLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
_shopFurnitures = new Dictionary<int, (IFurnitureModel, int)>();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormShop_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_id.HasValue)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Загрузка магазина");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var view = _logic.ReadElement(new ShopSearchModel
|
||||||
|
{
|
||||||
|
Id = _id.Value
|
||||||
|
});
|
||||||
|
|
||||||
|
if (view != null)
|
||||||
|
{
|
||||||
|
textBoxName.Text = view.ShopName;
|
||||||
|
textBoxAddress.Text = view.Address.ToString();
|
||||||
|
dateTimePickerDate.Value = view.DateOpen;
|
||||||
|
numericUpDownCount.Value = view.MaxCountFurnitures;
|
||||||
|
_shopFurnitures = view.ShopFurnitures ?? new Dictionary<int, (IFurnitureModel, int)>();
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки магазина");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Загрузка изделий в магазине");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_shopFurnitures != null)
|
||||||
|
{
|
||||||
|
dataGridView.Rows.Clear();
|
||||||
|
foreach (var element in _shopFurnitures)
|
||||||
|
{
|
||||||
|
dataGridView.Rows.Add(new object[] { element.Key, element.Value.Item1.FurnitureName, element.Value.Item2 });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки изделий в магазине");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(textBoxName.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(textBoxAddress.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните адрес", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Сохранение магазина");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var model = new ShopBindingModel
|
||||||
|
{
|
||||||
|
Id = _id ?? 0,
|
||||||
|
ShopName = textBoxName.Text,
|
||||||
|
Address = textBoxAddress.Text,
|
||||||
|
DateOpen = dateTimePickerDate.Value.Date,
|
||||||
|
ShopFurnitures = _shopFurnitures,
|
||||||
|
MaxCountFurnitures = (int)numericUpDownCount.Value
|
||||||
|
};
|
||||||
|
|
||||||
|
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||||
|
|
||||||
|
if (!operationResult)
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка сохранения магазина");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = DialogResult.Cancel;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
FurnitureAssembly/FurnitureAssemblyView/FormShop.resx
Normal file
120
FurnitureAssembly/FurnitureAssemblyView/FormShop.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
120
FurnitureAssembly/FurnitureAssemblyView/FormShops.Designer.cs
generated
Normal file
120
FurnitureAssembly/FurnitureAssemblyView/FormShops.Designer.cs
generated
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
namespace FurnitureAssemblyView
|
||||||
|
{
|
||||||
|
partial class FormShops
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
buttonUpdate = new Button();
|
||||||
|
buttonDelete = new Button();
|
||||||
|
buttonRefresh = new Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Location = new Point(10, 9);
|
||||||
|
dataGridView.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.RowHeadersWidth = 51;
|
||||||
|
dataGridView.RowTemplate.Height = 29;
|
||||||
|
dataGridView.Size = new Size(444, 320);
|
||||||
|
dataGridView.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.Location = new Point(465, 24);
|
||||||
|
buttonAdd.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(133, 35);
|
||||||
|
buttonAdd.TabIndex = 2;
|
||||||
|
buttonAdd.Text = "Добавить";
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += ButtonAdd_Click;
|
||||||
|
//
|
||||||
|
// buttonUpdate
|
||||||
|
//
|
||||||
|
buttonUpdate.Location = new Point(465, 108);
|
||||||
|
buttonUpdate.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonUpdate.Name = "buttonUpdate";
|
||||||
|
buttonUpdate.Size = new Size(133, 33);
|
||||||
|
buttonUpdate.TabIndex = 3;
|
||||||
|
buttonUpdate.Text = "Изменить";
|
||||||
|
buttonUpdate.UseVisualStyleBackColor = true;
|
||||||
|
buttonUpdate.Click += ButtonUpdate_Click;
|
||||||
|
//
|
||||||
|
// buttonDelete
|
||||||
|
//
|
||||||
|
buttonDelete.Location = new Point(465, 183);
|
||||||
|
buttonDelete.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonDelete.Name = "buttonDelete";
|
||||||
|
buttonDelete.Size = new Size(133, 36);
|
||||||
|
buttonDelete.TabIndex = 4;
|
||||||
|
buttonDelete.Text = "Удалить";
|
||||||
|
buttonDelete.UseVisualStyleBackColor = true;
|
||||||
|
buttonDelete.Click += ButtonDelete_Click;
|
||||||
|
//
|
||||||
|
// buttonRefresh
|
||||||
|
//
|
||||||
|
buttonRefresh.Location = new Point(465, 261);
|
||||||
|
buttonRefresh.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonRefresh.Name = "buttonRefresh";
|
||||||
|
buttonRefresh.Size = new Size(133, 35);
|
||||||
|
buttonRefresh.TabIndex = 5;
|
||||||
|
buttonRefresh.Text = "Обновить";
|
||||||
|
buttonRefresh.UseVisualStyleBackColor = true;
|
||||||
|
buttonRefresh.Click += ButtonRefresh_Click;
|
||||||
|
//
|
||||||
|
// FormShops
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(610, 338);
|
||||||
|
Controls.Add(buttonRefresh);
|
||||||
|
Controls.Add(buttonDelete);
|
||||||
|
Controls.Add(buttonUpdate);
|
||||||
|
Controls.Add(buttonAdd);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Margin = new Padding(3, 2, 3, 2);
|
||||||
|
Name = "FormShops";
|
||||||
|
Text = "Магазины";
|
||||||
|
Load += FormShops_Load;
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private Button buttonUpdate;
|
||||||
|
private Button buttonDelete;
|
||||||
|
private Button buttonRefresh;
|
||||||
|
}
|
||||||
|
}
|
117
FurnitureAssembly/FurnitureAssemblyView/FormShops.cs
Normal file
117
FurnitureAssembly/FurnitureAssemblyView/FormShops.cs
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
using FurnitureAssemblyContracts.BindingModels;
|
||||||
|
using FurnitureAssemblyContracts.BusinessLogicsContracts;
|
||||||
|
using FurnitureAssemblyContracts.SearchModels;
|
||||||
|
using FurnitureAssemblyDataModels.Models;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace FurnitureAssemblyView
|
||||||
|
{
|
||||||
|
public partial class FormShops : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IShopLogic _logic;
|
||||||
|
|
||||||
|
public FormShops(ILogger<FormShops> logger, IShopLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormShops_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var list = _logic.ReadList(null);
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
dataGridView.DataSource = list;
|
||||||
|
dataGridView.Columns["Id"].Visible = false;
|
||||||
|
dataGridView.Columns["ShopFurnitures"].Visible = false;
|
||||||
|
dataGridView.Columns["ShopName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Загрузка магазинов");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки магазинов");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormShop));
|
||||||
|
if (service is FormShop 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(FormShop));
|
||||||
|
if (service is FormShop form)
|
||||||
|
{
|
||||||
|
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonDelete_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
_logger.LogInformation("Удаление магазина");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!_logic.Delete(new ShopBindingModel
|
||||||
|
{
|
||||||
|
Id = id
|
||||||
|
}))
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка удаления изделия");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonRefresh_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
FurnitureAssembly/FurnitureAssemblyView/FormShops.resx
Normal file
120
FurnitureAssembly/FurnitureAssemblyView/FormShops.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
@ -28,83 +28,87 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.labelName = new System.Windows.Forms.Label();
|
labelName = new Label();
|
||||||
this.labelPrice = new System.Windows.Forms.Label();
|
labelPrice = new Label();
|
||||||
this.textBoxName = new System.Windows.Forms.TextBox();
|
textBoxName = new TextBox();
|
||||||
this.textBoxCost = new System.Windows.Forms.TextBox();
|
textBoxCost = new TextBox();
|
||||||
this.buttonCancel = new System.Windows.Forms.Button();
|
buttonCancel = new Button();
|
||||||
this.buttonSave = new System.Windows.Forms.Button();
|
buttonSave = new Button();
|
||||||
this.SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// labelName
|
// labelName
|
||||||
//
|
//
|
||||||
this.labelName.AutoSize = true;
|
labelName.AutoSize = true;
|
||||||
this.labelName.Location = new System.Drawing.Point(30, 24);
|
labelName.Location = new Point(26, 18);
|
||||||
this.labelName.Name = "labelName";
|
labelName.Name = "labelName";
|
||||||
this.labelName.Size = new System.Drawing.Size(80, 20);
|
labelName.Size = new Size(62, 15);
|
||||||
this.labelName.TabIndex = 0;
|
labelName.TabIndex = 0;
|
||||||
this.labelName.Text = "Название:";
|
labelName.Text = "Название:";
|
||||||
//
|
//
|
||||||
// labelPrice
|
// labelPrice
|
||||||
//
|
//
|
||||||
this.labelPrice.AutoSize = true;
|
labelPrice.AutoSize = true;
|
||||||
this.labelPrice.Location = new System.Drawing.Point(30, 65);
|
labelPrice.Location = new Point(26, 49);
|
||||||
this.labelPrice.Name = "labelPrice";
|
labelPrice.Name = "labelPrice";
|
||||||
this.labelPrice.Size = new System.Drawing.Size(48, 20);
|
labelPrice.Size = new Size(38, 15);
|
||||||
this.labelPrice.TabIndex = 1;
|
labelPrice.TabIndex = 1;
|
||||||
this.labelPrice.Text = "Цена:";
|
labelPrice.Text = "Цена:";
|
||||||
//
|
//
|
||||||
// textBoxName
|
// textBoxName
|
||||||
//
|
//
|
||||||
this.textBoxName.Location = new System.Drawing.Point(127, 21);
|
textBoxName.Location = new Point(111, 16);
|
||||||
this.textBoxName.Name = "textBoxName";
|
textBoxName.Margin = new Padding(3, 2, 3, 2);
|
||||||
this.textBoxName.Size = new System.Drawing.Size(293, 27);
|
textBoxName.Name = "textBoxName";
|
||||||
this.textBoxName.TabIndex = 2;
|
textBoxName.Size = new Size(257, 23);
|
||||||
|
textBoxName.TabIndex = 2;
|
||||||
//
|
//
|
||||||
// textBoxCost
|
// textBoxCost
|
||||||
//
|
//
|
||||||
this.textBoxCost.Location = new System.Drawing.Point(127, 62);
|
textBoxCost.Location = new Point(111, 46);
|
||||||
this.textBoxCost.Name = "textBoxCost";
|
textBoxCost.Margin = new Padding(3, 2, 3, 2);
|
||||||
this.textBoxCost.Size = new System.Drawing.Size(179, 27);
|
textBoxCost.Name = "textBoxCost";
|
||||||
this.textBoxCost.TabIndex = 3;
|
textBoxCost.Size = new Size(157, 23);
|
||||||
|
textBoxCost.TabIndex = 3;
|
||||||
//
|
//
|
||||||
// buttonCancel
|
// buttonCancel
|
||||||
//
|
//
|
||||||
this.buttonCancel.Location = new System.Drawing.Point(326, 104);
|
buttonCancel.Location = new Point(289, 78);
|
||||||
this.buttonCancel.Name = "buttonCancel";
|
buttonCancel.Margin = new Padding(3, 2, 3, 2);
|
||||||
this.buttonCancel.Size = new System.Drawing.Size(94, 29);
|
buttonCancel.Name = "buttonCancel";
|
||||||
this.buttonCancel.TabIndex = 4;
|
buttonCancel.Size = new Size(105, 26);
|
||||||
this.buttonCancel.Text = "Отмена";
|
buttonCancel.TabIndex = 4;
|
||||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
buttonCancel.Text = "Отмена";
|
||||||
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += ButtonCancel_Click;
|
||||||
//
|
//
|
||||||
// buttonSave
|
// buttonSave
|
||||||
//
|
//
|
||||||
this.buttonSave.Location = new System.Drawing.Point(212, 104);
|
buttonSave.Location = new Point(171, 78);
|
||||||
this.buttonSave.Name = "buttonSave";
|
buttonSave.Margin = new Padding(3, 2, 3, 2);
|
||||||
this.buttonSave.Size = new System.Drawing.Size(94, 29);
|
buttonSave.Name = "buttonSave";
|
||||||
this.buttonSave.TabIndex = 5;
|
buttonSave.Size = new Size(97, 26);
|
||||||
this.buttonSave.Text = "Сохранить";
|
buttonSave.TabIndex = 5;
|
||||||
this.buttonSave.UseVisualStyleBackColor = true;
|
buttonSave.Text = "Сохранить";
|
||||||
this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += ButtonSave_Click;
|
||||||
//
|
//
|
||||||
// FormWorkPiece
|
// FormWorkPiece
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(464, 153);
|
ClientSize = new Size(406, 115);
|
||||||
this.Controls.Add(this.buttonSave);
|
Controls.Add(buttonSave);
|
||||||
this.Controls.Add(this.buttonCancel);
|
Controls.Add(buttonCancel);
|
||||||
this.Controls.Add(this.textBoxCost);
|
Controls.Add(textBoxCost);
|
||||||
this.Controls.Add(this.textBoxName);
|
Controls.Add(textBoxName);
|
||||||
this.Controls.Add(this.labelPrice);
|
Controls.Add(labelPrice);
|
||||||
this.Controls.Add(this.labelName);
|
Controls.Add(labelName);
|
||||||
this.Name = "FormWorkPiece";
|
Margin = new Padding(3, 2, 3, 2);
|
||||||
this.Text = "Заготовка";
|
Name = "FormWorkPiece";
|
||||||
this.Load += new System.EventHandler(this.FormWorkPiece_Load);
|
Text = "Заготовка";
|
||||||
this.ResumeLayout(false);
|
Load += FormWorkPiece_Load;
|
||||||
this.PerformLayout();
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -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: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:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
@ -31,16 +31,17 @@
|
|||||||
buttonAdd = new Button();
|
buttonAdd = new Button();
|
||||||
buttonUpdate = new Button();
|
buttonUpdate = new Button();
|
||||||
buttonDelete = new Button();
|
buttonDelete = new Button();
|
||||||
buttonRefresh = new Button();
|
buttonRef = new Button();
|
||||||
dataGridView = new DataGridView();
|
dataGridView = new DataGridView();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// buttonAdd
|
// buttonAdd
|
||||||
//
|
//
|
||||||
buttonAdd.Location = new Point(641, 36);
|
buttonAdd.Location = new Point(561, 27);
|
||||||
|
buttonAdd.Margin = new Padding(3, 2, 3, 2);
|
||||||
buttonAdd.Name = "buttonAdd";
|
buttonAdd.Name = "buttonAdd";
|
||||||
buttonAdd.Size = new Size(116, 47);
|
buttonAdd.Size = new Size(100, 38);
|
||||||
buttonAdd.TabIndex = 0;
|
buttonAdd.TabIndex = 0;
|
||||||
buttonAdd.Text = "Добавить";
|
buttonAdd.Text = "Добавить";
|
||||||
buttonAdd.UseVisualStyleBackColor = true;
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
@ -48,9 +49,10 @@
|
|||||||
//
|
//
|
||||||
// buttonUpdate
|
// buttonUpdate
|
||||||
//
|
//
|
||||||
buttonUpdate.Location = new Point(641, 102);
|
buttonUpdate.Location = new Point(561, 85);
|
||||||
|
buttonUpdate.Margin = new Padding(3, 2, 3, 2);
|
||||||
buttonUpdate.Name = "buttonUpdate";
|
buttonUpdate.Name = "buttonUpdate";
|
||||||
buttonUpdate.Size = new Size(116, 47);
|
buttonUpdate.Size = new Size(100, 36);
|
||||||
buttonUpdate.TabIndex = 1;
|
buttonUpdate.TabIndex = 1;
|
||||||
buttonUpdate.Text = "Изменить";
|
buttonUpdate.Text = "Изменить";
|
||||||
buttonUpdate.UseVisualStyleBackColor = true;
|
buttonUpdate.UseVisualStyleBackColor = true;
|
||||||
@ -58,44 +60,48 @@
|
|||||||
//
|
//
|
||||||
// buttonDelete
|
// buttonDelete
|
||||||
//
|
//
|
||||||
buttonDelete.Location = new Point(641, 168);
|
buttonDelete.Location = new Point(561, 143);
|
||||||
|
buttonDelete.Margin = new Padding(3, 2, 3, 2);
|
||||||
buttonDelete.Name = "buttonDelete";
|
buttonDelete.Name = "buttonDelete";
|
||||||
buttonDelete.Size = new Size(116, 47);
|
buttonDelete.Size = new Size(100, 34);
|
||||||
buttonDelete.TabIndex = 2;
|
buttonDelete.TabIndex = 2;
|
||||||
buttonDelete.Text = "Удалить";
|
buttonDelete.Text = "Удалить";
|
||||||
buttonDelete.UseVisualStyleBackColor = true;
|
buttonDelete.UseVisualStyleBackColor = true;
|
||||||
buttonDelete.Click += ButtonDelete_Click;
|
buttonDelete.Click += ButtonDelete_Click;
|
||||||
//
|
//
|
||||||
// buttonRefresh
|
// buttonRef
|
||||||
//
|
//
|
||||||
buttonRefresh.Location = new Point(641, 239);
|
buttonRef.Location = new Point(561, 197);
|
||||||
buttonRefresh.Name = "buttonRefresh";
|
buttonRef.Margin = new Padding(3, 2, 3, 2);
|
||||||
buttonRefresh.Size = new Size(116, 47);
|
buttonRef.Name = "buttonRef";
|
||||||
buttonRefresh.TabIndex = 3;
|
buttonRef.Size = new Size(100, 34);
|
||||||
buttonRefresh.Text = "Обновить";
|
buttonRef.TabIndex = 3;
|
||||||
buttonRefresh.UseVisualStyleBackColor = true;
|
buttonRef.Text = "Обновить";
|
||||||
buttonRefresh.Click += ButtonRefresh_Click;
|
buttonRef.UseVisualStyleBackColor = true;
|
||||||
|
buttonRef.Click += ButtonRef_Click;
|
||||||
//
|
//
|
||||||
// dataGridView
|
// dataGridView
|
||||||
//
|
//
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
dataGridView.Location = new Point(12, 12);
|
dataGridView.Location = new Point(10, 9);
|
||||||
|
dataGridView.Margin = new Padding(3, 2, 3, 2);
|
||||||
dataGridView.Name = "dataGridView";
|
dataGridView.Name = "dataGridView";
|
||||||
dataGridView.RowHeadersWidth = 51;
|
dataGridView.RowHeadersWidth = 51;
|
||||||
dataGridView.RowTemplate.Height = 29;
|
dataGridView.RowTemplate.Height = 29;
|
||||||
dataGridView.Size = new Size(604, 426);
|
dataGridView.Size = new Size(528, 320);
|
||||||
dataGridView.TabIndex = 4;
|
dataGridView.TabIndex = 4;
|
||||||
//
|
//
|
||||||
// FormWorkPieces
|
// FormWorkPieces
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(781, 450);
|
ClientSize = new Size(683, 338);
|
||||||
Controls.Add(dataGridView);
|
Controls.Add(dataGridView);
|
||||||
Controls.Add(buttonRefresh);
|
Controls.Add(buttonRef);
|
||||||
Controls.Add(buttonDelete);
|
Controls.Add(buttonDelete);
|
||||||
Controls.Add(buttonUpdate);
|
Controls.Add(buttonUpdate);
|
||||||
Controls.Add(buttonAdd);
|
Controls.Add(buttonAdd);
|
||||||
|
Margin = new Padding(3, 2, 3, 2);
|
||||||
Name = "FormWorkPieces";
|
Name = "FormWorkPieces";
|
||||||
Text = "Заготовки";
|
Text = "Заготовки";
|
||||||
Load += FormWorkPiece_Load;
|
Load += FormWorkPiece_Load;
|
||||||
@ -108,7 +114,7 @@
|
|||||||
private Button buttonAdd;
|
private Button buttonAdd;
|
||||||
private Button buttonUpdate;
|
private Button buttonUpdate;
|
||||||
private Button buttonDelete;
|
private Button buttonDelete;
|
||||||
private Button buttonRefresh;
|
private Button buttonRef;
|
||||||
private DataGridView dataGridView;
|
private DataGridView dataGridView;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -40,7 +40,7 @@ namespace FurnitureAssemblyView
|
|||||||
var list = _logic.ReadList(null);
|
var list = _logic.ReadList(null);
|
||||||
|
|
||||||
// Растягиваем колонку Название на всю ширину, колонку Id скрываем
|
// Растягиваем колонку Название на всю ширину, колонку Id скрываем
|
||||||
if (list != null)
|
if(list != null)
|
||||||
{
|
{
|
||||||
dataGridView.DataSource = list;
|
dataGridView.DataSource = list;
|
||||||
dataGridView.Columns["Id"].Visible = false;
|
dataGridView.Columns["Id"].Visible = false;
|
||||||
@ -49,7 +49,7 @@ namespace FurnitureAssemblyView
|
|||||||
|
|
||||||
_logger.LogInformation("Загрузка заготовок");
|
_logger.LogInformation("Загрузка заготовок");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка загрузки заготовок");
|
_logger.LogError(ex, "Ошибка загрузки заготовок");
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ namespace FurnitureAssemblyView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonRefresh_Click(object sender, EventArgs e)
|
private void ButtonRef_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
|
@ -9,15 +9,14 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.0" />
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.16">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.16">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
|
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
|
||||||
<PackageReference Include="ReportViewerCore.WinForms" Version="15.1.17" />
|
<PackageReference Include="ReportViewerCore.WinForms" Version="15.1.17" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -28,10 +27,4 @@
|
|||||||
<ProjectReference Include="..\FurnitureAssemblyListImplement\FurnitureAssemblyListImplement.csproj" />
|
<ProjectReference Include="..\FurnitureAssemblyListImplement\FurnitureAssemblyListImplement.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Update="ReportOrders.rdlc">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
@ -31,7 +31,6 @@ namespace FurnitureAssemblyView
|
|||||||
_serviceProvider = services.BuildServiceProvider();
|
_serviceProvider = services.BuildServiceProvider();
|
||||||
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ConfigureServices(ServiceCollection services)
|
private static void ConfigureServices(ServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddLogging(option =>
|
services.AddLogging(option =>
|
||||||
@ -43,10 +42,12 @@ namespace FurnitureAssemblyView
|
|||||||
services.AddTransient<IWorkPieceStorage, WorkPieceStorage>();
|
services.AddTransient<IWorkPieceStorage, WorkPieceStorage>();
|
||||||
services.AddTransient<IOrderStorage, OrderStorage>();
|
services.AddTransient<IOrderStorage, OrderStorage>();
|
||||||
services.AddTransient<IFurnitureStorage, FurnitureStorage>();
|
services.AddTransient<IFurnitureStorage, FurnitureStorage>();
|
||||||
|
services.AddTransient<IShopStorage, ShopStorage>();
|
||||||
|
|
||||||
services.AddTransient<IWorkPieceLogic, WorkPieceLogic>();
|
services.AddTransient<IWorkPieceLogic, WorkPieceLogic>();
|
||||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||||
services.AddTransient<IFurnitureLogic, FurnitureLogic>();
|
services.AddTransient<IFurnitureLogic, FurnitureLogic>();
|
||||||
|
services.AddTransient<IShopLogic, ShopLogic>();
|
||||||
services.AddTransient<IReportLogic, ReportLogic>();
|
services.AddTransient<IReportLogic, ReportLogic>();
|
||||||
|
|
||||||
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
||||||
@ -60,8 +61,15 @@ namespace FurnitureAssemblyView
|
|||||||
services.AddTransient<FormFurniture>();
|
services.AddTransient<FormFurniture>();
|
||||||
services.AddTransient<FormFurnitures>();
|
services.AddTransient<FormFurnitures>();
|
||||||
services.AddTransient<FormFurnitureWorkPiece>();
|
services.AddTransient<FormFurnitureWorkPiece>();
|
||||||
|
services.AddTransient<FormShop>();
|
||||||
|
services.AddTransient<FormShops>();
|
||||||
|
services.AddTransient<FormAddFurniture>();
|
||||||
|
services.AddTransient<FormSellFurniture>();
|
||||||
|
|
||||||
services.AddTransient<FormReportFurnitureWorkPieces>();
|
services.AddTransient<FormReportFurnitureWorkPieces>();
|
||||||
|
services.AddTransient<FormReportShopFurnitures>();
|
||||||
services.AddTransient<FormReportOrders>();
|
services.AddTransient<FormReportOrders>();
|
||||||
|
services.AddTransient<FormReportGroupedOrders>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
410
FurnitureAssembly/FurnitureAssemblyView/ReportGroupedOrders.rdlc
Normal file
410
FurnitureAssembly/FurnitureAssemblyView/ReportGroupedOrders.rdlc
Normal file
@ -0,0 +1,410 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
|
||||||
|
<AutoRefresh>0</AutoRefresh>
|
||||||
|
<DataSources>
|
||||||
|
<DataSource Name="FurnitureAssemblyContractsViewModels">
|
||||||
|
<ConnectionProperties>
|
||||||
|
<DataProvider>System.Data.DataSet</DataProvider>
|
||||||
|
<ConnectString>/* Local Connection */</ConnectString>
|
||||||
|
</ConnectionProperties>
|
||||||
|
<rd:DataSourceID>10791c83-cee8-4a38-bbd0-245fc17cefb3</rd:DataSourceID>
|
||||||
|
</DataSource>
|
||||||
|
</DataSources>
|
||||||
|
<DataSets>
|
||||||
|
<DataSet Name="DataSetGroupedOrders">
|
||||||
|
<Query>
|
||||||
|
<DataSourceName>FurnitureAssemblyContractsViewModels</DataSourceName>
|
||||||
|
<CommandText>/* Local Query */</CommandText>
|
||||||
|
</Query>
|
||||||
|
<Fields>
|
||||||
|
<Field Name="DateCreate">
|
||||||
|
<DataField>DateCreate</DataField>
|
||||||
|
<rd:TypeName>System.DateTime</rd:TypeName>
|
||||||
|
</Field>
|
||||||
|
<Field Name="Count">
|
||||||
|
<DataField>Count</DataField>
|
||||||
|
<rd:TypeName>System.Int32</rd:TypeName>
|
||||||
|
</Field>
|
||||||
|
<Field Name="Sum">
|
||||||
|
<DataField>Sum</DataField>
|
||||||
|
<rd:TypeName>System.Decimal</rd:TypeName>
|
||||||
|
</Field>
|
||||||
|
</Fields>
|
||||||
|
<rd:DataSetInfo>
|
||||||
|
<rd:DataSetName>FurnitureAssemblyContracts.ViewModels</rd:DataSetName>
|
||||||
|
<rd:TableName>ReportGroupedOrdersViewModel</rd:TableName>
|
||||||
|
<rd:ObjectDataSourceType>FurnitureAssemblyContracts.ViewModels.ReportGroupedOrdersViewModel, FurnitureAssemblyContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
|
||||||
|
</rd:DataSetInfo>
|
||||||
|
</DataSet>
|
||||||
|
</DataSets>
|
||||||
|
<ReportSections>
|
||||||
|
<ReportSection>
|
||||||
|
<Body>
|
||||||
|
<ReportItems>
|
||||||
|
<Textbox Name="TextboxTitle">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>Заказы</Value>
|
||||||
|
<Style>
|
||||||
|
<FontSize>16pt</FontSize>
|
||||||
|
<FontWeight>Bold</FontWeight>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style>
|
||||||
|
<TextAlign>Center</TextAlign>
|
||||||
|
</Style>
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<Height>1cm</Height>
|
||||||
|
<Width>10.19559cm</Width>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Style>None</Style>
|
||||||
|
</Border>
|
||||||
|
<VerticalAlign>Middle</VerticalAlign>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
<Tablix Name="Tablix1">
|
||||||
|
<TablixBody>
|
||||||
|
<TablixColumns>
|
||||||
|
<TablixColumn>
|
||||||
|
<Width>3.21438cm</Width>
|
||||||
|
</TablixColumn>
|
||||||
|
<TablixColumn>
|
||||||
|
<Width>3.21438cm</Width>
|
||||||
|
</TablixColumn>
|
||||||
|
<TablixColumn>
|
||||||
|
<Width>3.21438cm</Width>
|
||||||
|
</TablixColumn>
|
||||||
|
</TablixColumns>
|
||||||
|
<TablixRows>
|
||||||
|
<TablixRow>
|
||||||
|
<Height>0.6cm</Height>
|
||||||
|
<TablixCells>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="Textbox1">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>Дата создания</Value>
|
||||||
|
<Style>
|
||||||
|
<FontWeight>Bold</FontWeight>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Textbox1</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="Textbox3">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>Количество заказов</Value>
|
||||||
|
<Style>
|
||||||
|
<FontWeight>Bold</FontWeight>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Textbox3</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="Textbox2">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>Сумма по заказам</Value>
|
||||||
|
<Style>
|
||||||
|
<FontWeight>Bold</FontWeight>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Textbox2</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
</TablixCells>
|
||||||
|
</TablixRow>
|
||||||
|
<TablixRow>
|
||||||
|
<Height>0.6cm</Height>
|
||||||
|
<TablixCells>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="DateCreate">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>=Fields!DateCreate.Value</Value>
|
||||||
|
<Style>
|
||||||
|
<Format>d</Format>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>DateCreate</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="Count">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>=Fields!Count.Value</Value>
|
||||||
|
<Style />
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Count</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
<TablixCell>
|
||||||
|
<CellContents>
|
||||||
|
<Textbox Name="Sum">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>=Fields!Sum.Value</Value>
|
||||||
|
<Style />
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style />
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<rd:DefaultName>Sum</rd:DefaultName>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Color>LightGrey</Color>
|
||||||
|
<Style>Solid</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</CellContents>
|
||||||
|
</TablixCell>
|
||||||
|
</TablixCells>
|
||||||
|
</TablixRow>
|
||||||
|
</TablixRows>
|
||||||
|
</TablixBody>
|
||||||
|
<TablixColumnHierarchy>
|
||||||
|
<TablixMembers>
|
||||||
|
<TablixMember />
|
||||||
|
<TablixMember />
|
||||||
|
<TablixMember />
|
||||||
|
</TablixMembers>
|
||||||
|
</TablixColumnHierarchy>
|
||||||
|
<TablixRowHierarchy>
|
||||||
|
<TablixMembers>
|
||||||
|
<TablixMember>
|
||||||
|
<KeepWithGroup>After</KeepWithGroup>
|
||||||
|
</TablixMember>
|
||||||
|
<TablixMember>
|
||||||
|
<Group Name="Подробности" />
|
||||||
|
</TablixMember>
|
||||||
|
</TablixMembers>
|
||||||
|
</TablixRowHierarchy>
|
||||||
|
<DataSetName>DataSetGroupedOrders</DataSetName>
|
||||||
|
<Top>2.48391cm</Top>
|
||||||
|
<Left>0.55245cm</Left>
|
||||||
|
<Height>1.2cm</Height>
|
||||||
|
<Width>9.64314cm</Width>
|
||||||
|
<ZIndex>1</ZIndex>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Style>Double</Style>
|
||||||
|
</Border>
|
||||||
|
</Style>
|
||||||
|
</Tablix>
|
||||||
|
<Textbox Name="TextboxTotalSum">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>Итого:</Value>
|
||||||
|
<Style>
|
||||||
|
<FontWeight>Bold</FontWeight>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style>
|
||||||
|
<TextAlign>Right</TextAlign>
|
||||||
|
</Style>
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<Top>4cm</Top>
|
||||||
|
<Left>5.19559cm</Left>
|
||||||
|
<Height>0.6cm</Height>
|
||||||
|
<Width>2.5cm</Width>
|
||||||
|
<ZIndex>2</ZIndex>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Style>None</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
<Textbox Name="SumTotal">
|
||||||
|
<CanGrow>true</CanGrow>
|
||||||
|
<KeepTogether>true</KeepTogether>
|
||||||
|
<Paragraphs>
|
||||||
|
<Paragraph>
|
||||||
|
<TextRuns>
|
||||||
|
<TextRun>
|
||||||
|
<Value>=Sum(Fields!Sum.Value, "DataSetGroupedOrders")</Value>
|
||||||
|
<Style>
|
||||||
|
<FontWeight>Bold</FontWeight>
|
||||||
|
</Style>
|
||||||
|
</TextRun>
|
||||||
|
</TextRuns>
|
||||||
|
<Style>
|
||||||
|
<TextAlign>Right</TextAlign>
|
||||||
|
</Style>
|
||||||
|
</Paragraph>
|
||||||
|
</Paragraphs>
|
||||||
|
<Top>4cm</Top>
|
||||||
|
<Left>7.69559cm</Left>
|
||||||
|
<Height>0.6cm</Height>
|
||||||
|
<Width>2.5cm</Width>
|
||||||
|
<ZIndex>3</ZIndex>
|
||||||
|
<Style>
|
||||||
|
<Border>
|
||||||
|
<Style>None</Style>
|
||||||
|
</Border>
|
||||||
|
<PaddingLeft>2pt</PaddingLeft>
|
||||||
|
<PaddingRight>2pt</PaddingRight>
|
||||||
|
<PaddingTop>2pt</PaddingTop>
|
||||||
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
|
</Style>
|
||||||
|
</Textbox>
|
||||||
|
</ReportItems>
|
||||||
|
<Height>5.62292cm</Height>
|
||||||
|
<Style />
|
||||||
|
</Body>
|
||||||
|
<Width>10.25792cm</Width>
|
||||||
|
<Page>
|
||||||
|
<PageHeight>29.7cm</PageHeight>
|
||||||
|
<PageWidth>21cm</PageWidth>
|
||||||
|
<LeftMargin>2cm</LeftMargin>
|
||||||
|
<RightMargin>2cm</RightMargin>
|
||||||
|
<TopMargin>2cm</TopMargin>
|
||||||
|
<BottomMargin>2cm</BottomMargin>
|
||||||
|
<ColumnSpacing>0.13cm</ColumnSpacing>
|
||||||
|
<Style />
|
||||||
|
</Page>
|
||||||
|
</ReportSection>
|
||||||
|
</ReportSections>
|
||||||
|
<ReportParametersLayout>
|
||||||
|
<GridLayoutDefinition>
|
||||||
|
<NumberOfColumns>4</NumberOfColumns>
|
||||||
|
<NumberOfRows>2</NumberOfRows>
|
||||||
|
</GridLayoutDefinition>
|
||||||
|
</ReportParametersLayout>
|
||||||
|
<rd:ReportUnitType>Cm</rd:ReportUnitType>
|
||||||
|
<rd:ReportID>2de0031a-4d17-449d-922d-d9fc54572312</rd:ReportID>
|
||||||
|
</Report>
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user