слияние
This commit is contained in:
commit
a0b164c20a
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -19,10 +19,16 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogics
|
||||
|
||||
private readonly IOrderStorage _orderStorage;
|
||||
|
||||
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage)
|
||||
private readonly IReinforcedStorage _reinforcedStorage;
|
||||
|
||||
private readonly IShopLogic _shopLogic;
|
||||
|
||||
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, IReinforcedStorage reinforcedStorage, IShopLogic shopLogic)
|
||||
{
|
||||
_logger = logger;
|
||||
_orderStorage = orderStorage;
|
||||
_reinforcedStorage = reinforcedStorage;
|
||||
_shopLogic = shopLogic;
|
||||
}
|
||||
|
||||
public bool CreateOrder(OrderBindingModel model)
|
||||
|
@ -19,17 +19,20 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogics
|
||||
|
||||
private readonly IOrderStorage _orderStorage;
|
||||
|
||||
private readonly IShopStorage _shopStorage;
|
||||
|
||||
private readonly AbstractSaveToExcel _saveToExcel;
|
||||
|
||||
private readonly AbstractSaveToWord _saveToWord;
|
||||
|
||||
private readonly AbstractSaveToPdf _saveToPdf;
|
||||
|
||||
public ReportLogic(IReinforcedStorage reinforcedStorage, IComponentStorage componentStorage, IOrderStorage orderStorage,
|
||||
public ReportLogic(IReinforcedStorage reinforcedStorage, IComponentStorage componentStorage, IShopStorage shopStorage, IOrderStorage orderStorage,
|
||||
AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
|
||||
{
|
||||
_reinforcedStorage = reinforcedStorage;
|
||||
_orderStorage = orderStorage;
|
||||
_shopStorage = shopStorage;
|
||||
|
||||
_saveToExcel = saveToExcel;
|
||||
_saveToWord = saveToWord;
|
||||
@ -63,6 +66,32 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogics
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<ReportShopReinforcedViewModel> GetShopReinforceds()
|
||||
{
|
||||
var shops = _shopStorage.GetFullList();
|
||||
|
||||
var list = new List<ReportShopReinforcedViewModel>();
|
||||
|
||||
foreach (var shop in shops)
|
||||
{
|
||||
var record = new ReportShopReinforcedViewModel
|
||||
{
|
||||
ShopName = shop.ShopName,
|
||||
Reinforceds = new List<(string Reinforced, int Count)>(),
|
||||
TotalCount = 0,
|
||||
};
|
||||
foreach (var reinforced in shop.ShopReinforceds)
|
||||
{
|
||||
record.Reinforceds.Add(new(reinforced.Value.Item1.ReinforcedName, reinforced.Value.Item2));
|
||||
record.TotalCount += reinforced.Value.Item2;
|
||||
}
|
||||
|
||||
list.Add(record);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<ReportOrdersViewModel> GetOrders(ReportBindingModel model)
|
||||
{
|
||||
return _orderStorage.GetFilteredList(new OrderSearchModel { DateFrom = model.DateFrom, DateTo = model.DateTo })
|
||||
@ -77,6 +106,18 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogics
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<ReportOrdersByDateViewModel> GetGroupedByDateOrders()
|
||||
{
|
||||
return _orderStorage.GetFullList().GroupBy(x => x.DateCreate.Date)
|
||||
.Select(x => new ReportOrdersByDateViewModel
|
||||
{
|
||||
Date = x.Key,
|
||||
Count = x.Count(),
|
||||
Sum = x.Sum(y => y.Sum)
|
||||
})
|
||||
.ToList();
|
||||
|
||||
}
|
||||
public void SaveReinforcedsToWordFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToWord.CreateDoc(new WordInfo
|
||||
@ -87,6 +128,16 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogics
|
||||
});
|
||||
}
|
||||
|
||||
public void SaveShopsToWordFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToWord.CreateShopsTable(new WordInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список магазинов",
|
||||
Shops = _shopStorage.GetFullList()
|
||||
});
|
||||
}
|
||||
|
||||
public void SaveReinforcedComponentToExcelFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToExcel.CreateReport(new ExcelInfo
|
||||
@ -97,6 +148,16 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogics
|
||||
});
|
||||
}
|
||||
|
||||
public void SaveShopReinforcedToExcelFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToExcel.CreateShopReport(new ExcelInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Загруженность магазинов",
|
||||
ShopReinforceds = GetShopReinforceds()
|
||||
});
|
||||
}
|
||||
|
||||
public void SaveOrdersToPdfFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToPdf.CreateDoc(new PdfInfo
|
||||
@ -108,5 +169,15 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogics
|
||||
Orders = GetOrders(model)
|
||||
});
|
||||
}
|
||||
|
||||
public void SaveGroupedOrdersToPdfFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToPdf.CreateDocWithGroupedOrders(new PdfInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Заказы по датам",
|
||||
GroupedOrders = GetGroupedByDateOrders()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,239 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PrecastConcretePlantContracts.BindingModels;
|
||||
using PrecastConcretePlantContracts.BusinessLogicsContracts;
|
||||
using PrecastConcretePlantContracts.SearchModels;
|
||||
using PrecastConcretePlantContracts.StoragesContracts;
|
||||
using PrecastConcretePlantContracts.ViewModels;
|
||||
using PrecastConcretePlantDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PrecastConcretePlantBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class ShopLogic : IShopLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly IShopStorage _shopStorage;
|
||||
|
||||
public ShopLogic(ILogger<ShopLogic> logger, IShopStorage shopStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_shopStorage = shopStorage;
|
||||
}
|
||||
|
||||
public List<ShopViewModel>? ReadList(ShopSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. ShopName: {ShopName}. Id: {Id}", model?.ShopName, model?.Id);
|
||||
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 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 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;
|
||||
}
|
||||
|
||||
public bool ReplenishShop(ShopSearchModel shopModel, IReinforcedModel reinforced, int count)
|
||||
{
|
||||
if (shopModel == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(shopModel));
|
||||
}
|
||||
if (reinforced == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(reinforced));
|
||||
}
|
||||
if (count <= 0)
|
||||
{
|
||||
throw new ArgumentException("В магазине должен быть хотя бы один товар", nameof(count));
|
||||
}
|
||||
_logger.LogInformation("ReplenishShop(GetElement). ShopName: {ShopName}. Id: {Id}", shopModel.ShopName, shopModel.Id);
|
||||
var shop = _shopStorage.GetElement(shopModel);
|
||||
if (shop == null)
|
||||
{
|
||||
_logger.LogWarning("ReplenishShop(GetElement). Element not found");
|
||||
return false;
|
||||
}
|
||||
if (shop.ReinforcedsMax - shop.ShopReinforceds.Sum(x => x.Value.Item2) < count)
|
||||
{
|
||||
_logger.LogWarning("ReplenishShop error. No space for new reinforceds");
|
||||
return false;
|
||||
}
|
||||
if (shop.ShopReinforceds.ContainsKey(reinforced.Id))
|
||||
{
|
||||
var shopR = shop.ShopReinforceds[reinforced.Id];
|
||||
shopR.Item2 += count;
|
||||
shop.ShopReinforceds[reinforced.Id] = shopR;
|
||||
_logger.LogInformation("ReplenishShop. Added {count} '{reinforced}' to '{ShopName}' shop", count, reinforced.ReinforcedName,
|
||||
shop.ShopName);
|
||||
}
|
||||
else
|
||||
{
|
||||
shop.ShopReinforceds.Add(reinforced.Id, (reinforced, count));
|
||||
_logger.LogInformation("ReplenishShop. Added {count} new '{reinforced}' to '{ShopName}' shop", count, reinforced.ReinforcedName,
|
||||
shop.ShopName);
|
||||
}
|
||||
if (_shopStorage.Update(new ShopBindingModel()
|
||||
{
|
||||
Id = shop.Id,
|
||||
ShopName = shop.ShopName,
|
||||
Address = shop.Address,
|
||||
DateOpening = shop.DateOpening,
|
||||
ReinforcedsMax = shop.ReinforcedsMax,
|
||||
ShopReinforceds = shop.ShopReinforceds,
|
||||
}) == null)
|
||||
{
|
||||
_logger.LogWarning("ReplenishShop. Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool MakeSale(IReinforcedModel model, int count)
|
||||
{
|
||||
return _shopStorage.MakeSale(model, count);
|
||||
}
|
||||
|
||||
public bool DeliverReinforceds(IReinforcedModel reinforced, int count)
|
||||
{
|
||||
if (count <= 0)
|
||||
{
|
||||
_logger.LogWarning("Reinforceds delivery operation failed. Reinforced count <= 0");
|
||||
return false;
|
||||
}
|
||||
|
||||
var shopList = _shopStorage.GetFullList();
|
||||
int shopsCapacity = shopList.Sum(x => x.ReinforcedsMax);
|
||||
int currentReinforceds = shopList.Select(x => x.ShopReinforceds.Sum(y => y.Value.Item2)).Sum();
|
||||
int freePlaces = shopsCapacity - currentReinforceds;
|
||||
|
||||
if (freePlaces < count)
|
||||
{
|
||||
_logger.LogWarning("Reinforceds delivery operation failed. No space for new кeinforceds");
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (var shop in shopList)
|
||||
{
|
||||
freePlaces = shop.ReinforcedsMax - shop.ShopReinforceds.Sum(x => x.Value.Item2);
|
||||
if (freePlaces == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (freePlaces >= count)
|
||||
{
|
||||
if (ReplenishShop(new() { Id = shop.Id }, reinforced, count))
|
||||
{
|
||||
count = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogWarning("Reinforceds delivery operation failed");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ReplenishShop(new() { Id = shop.Id }, reinforced, freePlaces))
|
||||
{
|
||||
count -= freePlaces;
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogWarning("Reinforceds delivery operation failed");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (count == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private void CheckModel(ShopBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
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
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Магазин с таким названием уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -81,6 +81,76 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage
|
||||
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 si in info.ShopReinforceds)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = si.ShopName,
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
rowIndex++;
|
||||
|
||||
foreach (var (Reinforced, Count) in si.Reinforceds)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = Reinforced,
|
||||
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 = si.TotalCount.ToString(),
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
SaveExcel(info);
|
||||
}
|
||||
|
||||
// Создание excel-файла
|
||||
protected abstract void CreateExcel(ExcelInfo info);
|
||||
|
@ -36,8 +36,36 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage
|
||||
SavePdf(info);
|
||||
}
|
||||
|
||||
public void CreateDocWithGroupedOrders(PdfInfo info)
|
||||
{
|
||||
CreatePdf(info);
|
||||
CreateParagraph(new PdfParagraph { Text = info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center });
|
||||
|
||||
// Создание pdf-файла
|
||||
CreateTable(new List<string> { "5cm", "6cm", "5cm" });
|
||||
|
||||
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.Date.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.Right });
|
||||
|
||||
SavePdf(info);
|
||||
}
|
||||
|
||||
|
||||
// Создание pdf-файла
|
||||
protected abstract void CreatePdf(PdfInfo info);
|
||||
|
||||
|
||||
|
@ -41,15 +41,67 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage
|
||||
SaveWord(info);
|
||||
}
|
||||
|
||||
public void CreateShopsTable(WordInfo info)
|
||||
{
|
||||
CreateWord(info);
|
||||
|
||||
// Создание doc-файла
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
|
||||
CreateTable(new List<string> { "3000", "3000", "3000" });
|
||||
|
||||
CreateRow(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { ("Название магазина", new WordTextProperties { Size = "24" }),
|
||||
("Адрес", new WordTextProperties { Size = "24" }), ("Дата открытия", new WordTextProperties { Size = "24" }) },
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
Bold = true,
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
|
||||
foreach (var shop in info.Shops)
|
||||
{
|
||||
CreateRow(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { (shop.ShopName, new WordTextProperties { Size = "22" }),
|
||||
(shop.Address, new WordTextProperties { Size = "22" }), (shop.DateOpening.ToString(), new WordTextProperties { Size = "22" })},
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "22",
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
SaveWord(info);
|
||||
}
|
||||
|
||||
|
||||
// Создание doc-файла
|
||||
protected abstract void CreateWord(WordInfo info);
|
||||
|
||||
|
||||
// Создание абзаца с текстом
|
||||
protected abstract void CreateParagraph(WordParagraph paragraph);
|
||||
|
||||
//Сохранение файла
|
||||
// Создание таблицы
|
||||
protected abstract void CreateTable(List<string> columns);
|
||||
|
||||
// Создание строки таблицы
|
||||
protected abstract void CreateRow(WordParagraph paragraph);
|
||||
|
||||
//Сохранение файла
|
||||
protected abstract void SaveWord(WordInfo info);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -14,5 +14,7 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage.HelperModels
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
public List<ReportReinforcedComponentViewModel> ReinforcedComponents { get; set; } = new();
|
||||
|
||||
public List<ReportShopReinforcedViewModel> ShopReinforceds { get; set; } = new();
|
||||
}
|
||||
}
|
@ -18,5 +18,7 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage.HelperModels
|
||||
public DateTime DateTo { get; set; }
|
||||
|
||||
public List<ReportOrdersViewModel> Orders { get; set; } = new();
|
||||
|
||||
public List<ReportOrdersByDateViewModel> GroupedOrders { get; set; } = new();
|
||||
}
|
||||
}
|
@ -14,5 +14,7 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage.HelperModels
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
public List<ReinforcedViewModel> Reinforceds { get; set; } = new();
|
||||
|
||||
public List<ShopViewModel> Shops { get; set; } = new();
|
||||
}
|
||||
}
|
@ -18,7 +18,9 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage.Implements
|
||||
|
||||
private Body? _docBody;
|
||||
|
||||
|
||||
private Table? table;
|
||||
|
||||
|
||||
// Получение типа выравнивания
|
||||
private static JustificationValues GetJustificationValues(WordJustificationType type)
|
||||
{
|
||||
@ -117,6 +119,67 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage.Implements
|
||||
_docBody.AppendChild(docParagraph);
|
||||
}
|
||||
|
||||
protected override void CreateTable(List<string> columns)
|
||||
{
|
||||
if (_docBody == null || columns == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
table = new();
|
||||
TableProperties properties = new();
|
||||
properties.AppendChild(new TableLayout { Type = TableLayoutValues.Fixed });
|
||||
properties.AppendChild(new TableBorders(
|
||||
new TopBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
|
||||
new LeftBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
|
||||
new RightBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
|
||||
new BottomBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
|
||||
new InsideHorizontalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
|
||||
new InsideVerticalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 }
|
||||
));
|
||||
properties.AppendChild(new TableWidth { Type = TableWidthUnitValues.Auto });
|
||||
table.AppendChild(properties);
|
||||
|
||||
TableGrid tableGrid = new();
|
||||
foreach (var column in columns)
|
||||
{
|
||||
tableGrid.AppendChild(new GridColumn() { Width = column });
|
||||
}
|
||||
table.AppendChild(tableGrid);
|
||||
|
||||
_docBody.AppendChild(table);
|
||||
}
|
||||
|
||||
protected override void CreateRow(WordParagraph paragraph)
|
||||
{
|
||||
if (_docBody == null || table == null || paragraph == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
TableRow tableRow = new();
|
||||
foreach (var column in paragraph.Texts)
|
||||
{
|
||||
var tableParagraph = new Paragraph();
|
||||
tableParagraph.AppendChild(CreateParagraphProperties(paragraph.TextProperties));
|
||||
|
||||
var tableRun = new Run();
|
||||
var runProperties = new RunProperties();
|
||||
runProperties.AppendChild(new FontSize { Val = column.Item2.Size });
|
||||
if (column.Item2.Bold)
|
||||
{
|
||||
runProperties.AppendChild(new Bold());
|
||||
}
|
||||
tableRun.AppendChild(runProperties);
|
||||
tableRun.AppendChild(new Text { Text = column.Item1, Space = SpaceProcessingModeValues.Preserve });
|
||||
tableParagraph.AppendChild(tableRun);
|
||||
|
||||
TableCell cell = new();
|
||||
cell.AppendChild(tableParagraph);
|
||||
tableRow.AppendChild(cell);
|
||||
}
|
||||
table.AppendChild(tableRow);
|
||||
}
|
||||
|
||||
protected override void SaveWord(WordInfo info)
|
||||
{
|
||||
if (_docBody == null || _wordDocument == null)
|
||||
|
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using PrecastConcretePlantDataModels.Models;
|
||||
|
||||
namespace PrecastConcretePlantContracts.BindingModels
|
||||
{
|
||||
public class ShopBindingModel : IShopModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string ShopName { get; set; } = string.Empty;
|
||||
|
||||
public string Address { get; set; } = string.Empty;
|
||||
|
||||
public DateTime DateOpening { get; set; } = DateTime.Now;
|
||||
|
||||
public Dictionary<int, (IReinforcedModel, int)> ShopReinforceds
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = new();
|
||||
public int ReinforcedsMax { get; set; }
|
||||
}
|
||||
}
|
@ -12,12 +12,22 @@ namespace PrecastConcretePlantContracts.BusinessLogicsContracts
|
||||
{
|
||||
List<ReportReinforcedComponentViewModel> GetReinforcedComponents();
|
||||
|
||||
List<ReportShopReinforcedViewModel> GetShopReinforceds();
|
||||
|
||||
List<ReportOrdersViewModel> GetOrders(ReportBindingModel model);
|
||||
|
||||
List<ReportOrdersByDateViewModel> GetGroupedByDateOrders();
|
||||
|
||||
void SaveReinforcedsToWordFile(ReportBindingModel model);
|
||||
|
||||
void SaveShopsToWordFile(ReportBindingModel model);
|
||||
|
||||
void SaveReinforcedComponentToExcelFile(ReportBindingModel model);
|
||||
|
||||
void SaveShopReinforcedToExcelFile(ReportBindingModel model);
|
||||
|
||||
void SaveOrdersToPdfFile(ReportBindingModel model);
|
||||
|
||||
void SaveGroupedOrdersToPdfFile(ReportBindingModel model);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,31 @@
|
||||
using PrecastConcretePlantContracts.BindingModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using PrecastConcretePlantContracts.SearchModels;
|
||||
using PrecastConcretePlantContracts.ViewModels;
|
||||
using PrecastConcretePlantDataModels.Models;
|
||||
|
||||
namespace PrecastConcretePlantContracts.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 ReplenishShop(ShopSearchModel shopModel, IReinforcedModel reinforced, int count);
|
||||
|
||||
bool MakeSale(IReinforcedModel model, int count);
|
||||
|
||||
bool DeliverReinforceds(IReinforcedModel model, int count);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PrecastConcretePlantContracts.SearchModels
|
||||
{
|
||||
public class ShopSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
|
||||
public string? ShopName { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
using PrecastConcretePlantContracts.BindingModels;
|
||||
using PrecastConcretePlantContracts.SearchModels;
|
||||
using PrecastConcretePlantContracts.ViewModels;
|
||||
using PrecastConcretePlantDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PrecastConcretePlantContracts.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 MakeSale(IReinforcedModel model, int count);
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PrecastConcretePlantContracts.ViewModels
|
||||
{
|
||||
public class ReportOrdersByDateViewModel
|
||||
{
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
public int Count { get; set; }
|
||||
|
||||
public double Sum { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PrecastConcretePlantContracts.ViewModels
|
||||
{
|
||||
public class ReportShopReinforcedViewModel
|
||||
{
|
||||
public string ShopName { get; set; } = string.Empty;
|
||||
|
||||
public int TotalCount { get; set; }
|
||||
|
||||
public List<(string Reinforced, int Count)> Reinforceds { get; set; } = new();
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
using PrecastConcretePlantDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PrecastConcretePlantContracts.ViewModels
|
||||
{
|
||||
public class ShopViewModel : IShopModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Название магазина")]
|
||||
public string ShopName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Адрес")]
|
||||
public string Address { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Дата открытия")]
|
||||
public DateTime DateOpening { get; set; } = DateTime.Now;
|
||||
|
||||
public Dictionary<int, (IReinforcedModel, int)> ShopReinforceds
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = new();
|
||||
|
||||
[DisplayName("Максимальное количество изделий")]
|
||||
public int ReinforcedsMax { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PrecastConcretePlantDataModels.Models
|
||||
{
|
||||
public interface IShopModel : IId
|
||||
{
|
||||
string ShopName { get; }
|
||||
|
||||
string Address { get; }
|
||||
|
||||
DateTime DateOpening { get; }
|
||||
|
||||
Dictionary<int, (IReinforcedModel, int)> ShopReinforceds { get; }
|
||||
int ReinforcedsMax { get; }
|
||||
}
|
||||
}
|
@ -0,0 +1,146 @@
|
||||
using PrecastConcretePlantContracts.BindingModels;
|
||||
using PrecastConcretePlantContracts.SearchModels;
|
||||
using PrecastConcretePlantContracts.StoragesContracts;
|
||||
using PrecastConcretePlantContracts.ViewModels;
|
||||
using PrecastConcretePlantDatabaseImplement.Models;
|
||||
using PrecastConcretePlantDataModels.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace PrecastConcretePlantDatabaseImplement.Implements
|
||||
{
|
||||
public class ShopStorage : IShopStorage
|
||||
{
|
||||
public List<ShopViewModel> GetFullList()
|
||||
{
|
||||
using var context = new PrecastConcretePlantDatabase();
|
||||
return context.Shops
|
||||
.Include(x => x.Reinforceds)
|
||||
.ThenInclude(x => x.Reinforced)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<ShopViewModel> GetFilteredList(ShopSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.ShopName))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new PrecastConcretePlantDatabase();
|
||||
return context.Shops
|
||||
.Include(x => x.Reinforceds)
|
||||
.ThenInclude(x => x.Reinforced)
|
||||
.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 PrecastConcretePlantDatabase();
|
||||
return context.Shops
|
||||
.Include(x => x.Reinforceds)
|
||||
.ThenInclude(x => x.Reinforced)
|
||||
.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 PrecastConcretePlantDatabase();
|
||||
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 PrecastConcretePlantDatabase();
|
||||
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.UpdateReinforceds(context, model);
|
||||
transaction.Commit();
|
||||
return shop.GetViewModel;
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public ShopViewModel? Delete(ShopBindingModel model)
|
||||
{
|
||||
using var context = new PrecastConcretePlantDatabase();
|
||||
var element = context.Shops
|
||||
.Include(x => x.Reinforceds)
|
||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Shops.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool MakeSale(IReinforcedModel model, int count)
|
||||
{
|
||||
using var context = new PrecastConcretePlantDatabase();
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
foreach (var shop in context.Shops.Include(x => x.Reinforceds).ThenInclude(x => x.Reinforced)
|
||||
.Where(x => x.Reinforceds.Any(x => x.ReinforcedId == model.Id))
|
||||
.ToList())
|
||||
{
|
||||
var reinforced = shop.ShopReinforceds[model.Id];
|
||||
int min = Math.Min(reinforced.Item2, count);
|
||||
if (min == reinforced.Item2)
|
||||
{
|
||||
shop.ShopReinforceds.Remove(model.Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
shop.ShopReinforceds[model.Id] = (reinforced.Item1, reinforced.Item2 - min);
|
||||
}
|
||||
shop.UpdateReinforceds(context, new() { Id = shop.Id, ShopReinforceds = shop.ShopReinforceds });
|
||||
count -= min;
|
||||
if (count == 0)
|
||||
{
|
||||
context.SaveChanges();
|
||||
transaction.Commit();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
transaction.Rollback();
|
||||
return false;
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -12,8 +12,8 @@ using PrecastConcretePlantDatabaseImplement;
|
||||
namespace PrecastConcretePlantDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(PrecastConcretePlantDatabase))]
|
||||
[Migration("20240319190111_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
[Migration("20240417054900_Init")]
|
||||
partial class Init
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@ -124,6 +124,59 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations
|
||||
b.ToTable("ReinforcedComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.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>("DateOpening")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("ReinforcedsMax")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ShopName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Shops");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.ShopReinforced", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ReinforcedId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ShopId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ReinforcedId");
|
||||
|
||||
b.HasIndex("ShopId");
|
||||
|
||||
b.ToTable("ShopReinforceds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("PrecastConcretePlantDatabaseImplement.Models.Reinforced", "Reinforced")
|
||||
@ -154,6 +207,25 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations
|
||||
b.Navigation("Reinforced");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.ShopReinforced", b =>
|
||||
{
|
||||
b.HasOne("PrecastConcretePlantDatabaseImplement.Models.Reinforced", "Reinforced")
|
||||
.WithMany("ShopReinforceds")
|
||||
.HasForeignKey("ReinforcedId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PrecastConcretePlantDatabaseImplement.Models.Shop", "Shop")
|
||||
.WithMany("Reinforceds")
|
||||
.HasForeignKey("ShopId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reinforced");
|
||||
|
||||
b.Navigation("Shop");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Navigation("ReinforcedComponents");
|
||||
@ -164,6 +236,13 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations
|
||||
b.Navigation("Components");
|
||||
|
||||
b.Navigation("Orders");
|
||||
|
||||
b.Navigation("ShopReinforceds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.Shop", b =>
|
||||
{
|
||||
b.Navigation("Reinforceds");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
||||
namespace PrecastConcretePlantDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialCreate : Migration
|
||||
public partial class Init : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
@ -39,6 +39,22 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations
|
||||
table.PrimaryKey("PK_Reinforceds", 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),
|
||||
DateOpening = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
ReinforcedsMax = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Shops", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Orders",
|
||||
columns: table => new
|
||||
@ -90,6 +106,33 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ShopReinforceds",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ShopId = table.Column<int>(type: "int", nullable: false),
|
||||
ReinforcedId = table.Column<int>(type: "int", nullable: false),
|
||||
Count = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ShopReinforceds", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ShopReinforceds_Reinforceds_ReinforcedId",
|
||||
column: x => x.ReinforcedId,
|
||||
principalTable: "Reinforceds",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ShopReinforceds_Shops_ShopId",
|
||||
column: x => x.ShopId,
|
||||
principalTable: "Shops",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Orders_ReinforcedId",
|
||||
table: "Orders",
|
||||
@ -104,6 +147,16 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations
|
||||
name: "IX_ReinforcedComponents_ReinforcedId",
|
||||
table: "ReinforcedComponents",
|
||||
column: "ReinforcedId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ShopReinforceds_ReinforcedId",
|
||||
table: "ShopReinforceds",
|
||||
column: "ReinforcedId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ShopReinforceds_ShopId",
|
||||
table: "ShopReinforceds",
|
||||
column: "ShopId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -115,11 +168,17 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations
|
||||
migrationBuilder.DropTable(
|
||||
name: "ReinforcedComponents");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ShopReinforceds");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Components");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Reinforceds");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Shops");
|
||||
}
|
||||
}
|
||||
}
|
@ -151,6 +151,59 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations
|
||||
b.ToTable("ReinforcedComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.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>("DateOpening")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("ReinforcedsMax")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ShopName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Shops");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.ShopReinforced", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ReinforcedId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ShopId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ReinforcedId");
|
||||
|
||||
b.HasIndex("ShopId");
|
||||
|
||||
b.ToTable("ShopReinforceds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("PrecastConcretePlantDatabaseImplement.Models.Client", "Client")
|
||||
@ -189,6 +242,25 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations
|
||||
b.Navigation("Reinforced");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.ShopReinforced", b =>
|
||||
{
|
||||
b.HasOne("PrecastConcretePlantDatabaseImplement.Models.Reinforced", "Reinforced")
|
||||
.WithMany("ShopReinforceds")
|
||||
.HasForeignKey("ReinforcedId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PrecastConcretePlantDatabaseImplement.Models.Shop", "Shop")
|
||||
.WithMany("Reinforceds")
|
||||
.HasForeignKey("ShopId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Reinforced");
|
||||
|
||||
b.Navigation("Shop");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("Orders");
|
||||
@ -204,6 +276,13 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations
|
||||
b.Navigation("Components");
|
||||
|
||||
b.Navigation("Orders");
|
||||
|
||||
b.Navigation("ShopReinforceds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.Shop", b =>
|
||||
{
|
||||
b.Navigation("Reinforceds");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
|
@ -40,6 +40,9 @@ namespace PrecastConcretePlantDatabaseImplement.Models
|
||||
|
||||
public virtual List<Order> Orders { get; set; } = new();
|
||||
|
||||
[ForeignKey("ReinforcedId")]
|
||||
public virtual List<ShopReinforced> ShopReinforceds { get; set; } = new();
|
||||
|
||||
public static Reinforced Create(PrecastConcretePlantDatabase context, ReinforcedBindingModel model)
|
||||
{
|
||||
return new Reinforced()
|
||||
|
@ -0,0 +1,115 @@
|
||||
using PrecastConcretePlantContracts.BindingModels;
|
||||
using PrecastConcretePlantContracts.ViewModels;
|
||||
using PrecastConcretePlantDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PrecastConcretePlantDatabaseImplement.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 DateOpening { get; set; }
|
||||
|
||||
[Required]
|
||||
public int ReinforcedsMax { get; set; }
|
||||
|
||||
private Dictionary<int, (IReinforcedModel, int)>? _shopReinforceds = null;
|
||||
|
||||
[NotMapped]
|
||||
public Dictionary<int, (IReinforcedModel, int)> ShopReinforceds
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_shopReinforceds == null)
|
||||
{
|
||||
_shopReinforceds = Reinforceds
|
||||
.ToDictionary(x => x.ReinforcedId, x => (x.Reinforced as IReinforcedModel, x.Count));
|
||||
}
|
||||
return _shopReinforceds;
|
||||
}
|
||||
}
|
||||
|
||||
[ForeignKey("ShopId")]
|
||||
public virtual List<ShopReinforced> Reinforceds { get; set; } = new();
|
||||
|
||||
public static Shop Create(PrecastConcretePlantDatabase context, ShopBindingModel model)
|
||||
{
|
||||
return new Shop()
|
||||
{
|
||||
Id = model.Id,
|
||||
ShopName = model.ShopName,
|
||||
Address = model.Address,
|
||||
DateOpening = model.DateOpening,
|
||||
ReinforcedsMax = model.ReinforcedsMax,
|
||||
Reinforceds = model.ShopReinforceds.Select(x => new ShopReinforced
|
||||
{
|
||||
Reinforced = context.Reinforceds.First(y => y.Id == x.Key),
|
||||
Count = x.Value.Item2
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(ShopBindingModel model)
|
||||
{
|
||||
ShopName = model.ShopName;
|
||||
Address = model.Address;
|
||||
DateOpening = model.DateOpening;
|
||||
ReinforcedsMax = model.ReinforcedsMax;
|
||||
}
|
||||
|
||||
public ShopViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
ShopName = ShopName,
|
||||
Address = Address,
|
||||
DateOpening = DateOpening,
|
||||
ReinforcedsMax = ReinforcedsMax,
|
||||
ShopReinforceds = ShopReinforceds
|
||||
};
|
||||
|
||||
public void UpdateReinforceds(PrecastConcretePlantDatabase context, ShopBindingModel model)
|
||||
{
|
||||
var shopReinforceds = context.ShopReinforceds.Where(rec => rec.ShopId == model.Id).ToList();
|
||||
if (shopReinforceds != null && shopReinforceds.Count > 0)
|
||||
{
|
||||
context.ShopReinforceds.RemoveRange(shopReinforceds.Where(rec => !model.ShopReinforceds.ContainsKey(rec.ReinforcedId)));
|
||||
context.SaveChanges();
|
||||
foreach (var updateReinforced in shopReinforceds)
|
||||
{
|
||||
if (model.ShopReinforceds.ContainsKey(updateReinforced.ReinforcedId))
|
||||
{
|
||||
updateReinforced.Count = model.ShopReinforceds[updateReinforced.ReinforcedId].Item2;
|
||||
model.ShopReinforceds.Remove(updateReinforced.ReinforcedId);
|
||||
}
|
||||
}
|
||||
context.SaveChanges();
|
||||
}
|
||||
var shop = context.Shops.First(x => x.Id == Id);
|
||||
foreach (var ic in model.ShopReinforceds)
|
||||
{
|
||||
context.ShopReinforceds.Add(new ShopReinforced
|
||||
{
|
||||
Shop = shop,
|
||||
Reinforced = context.Reinforceds.First(x => x.Id == ic.Key),
|
||||
Count = ic.Value.Item2
|
||||
});
|
||||
context.SaveChanges();
|
||||
}
|
||||
_shopReinforceds = null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PrecastConcretePlantDatabaseImplement.Models
|
||||
{
|
||||
public class ShopReinforced
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public int ShopId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int ReinforcedId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int Count { get; set; }
|
||||
|
||||
public virtual Reinforced Reinforced { get; set; } = new();
|
||||
|
||||
public virtual Shop Shop { get; set; } = new();
|
||||
}
|
||||
}
|
@ -24,6 +24,8 @@ namespace PrecastConcretePlantDatabaseImplement
|
||||
public virtual DbSet<ReinforcedComponent> ReinforcedComponents { set; get; }
|
||||
public virtual DbSet<Order> Orders { set; get; }
|
||||
public virtual DbSet<Client> Clients { set; get; }
|
||||
public virtual DbSet<Shop> Shops { set; get; }
|
||||
public virtual DbSet<ShopReinforced> ShopReinforceds { set; get; }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,11 +9,13 @@ namespace PrecastConcretePlantFileImplement
|
||||
private readonly string ComponentFileName = "Component.xml";
|
||||
private readonly string OrderFileName = "Order.xml";
|
||||
private readonly string ReinforcedFileName = "Reinforced.xml";
|
||||
private readonly string ShopFileName = "Shop.xml";
|
||||
private readonly string ClientFileName = "Client.xml";
|
||||
public List<Component> Components { get; private set; }
|
||||
public List<Order> Orders { get; private set; }
|
||||
public List<Reinforced> Reinforceds { get; private set; }
|
||||
public List<Client> Clients { get; private set; }
|
||||
public List<Shop> Shops { get; private set; }
|
||||
public static DataFileSingleton GetInstance()
|
||||
{
|
||||
if (instance == null)
|
||||
@ -26,11 +28,13 @@ namespace PrecastConcretePlantFileImplement
|
||||
public void SaveReinforceds() => SaveData(Reinforceds, ReinforcedFileName, "Reinforceds", x => x.GetXElement);
|
||||
public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement);
|
||||
public void SaveClients() => SaveData(Clients, ClientFileName, "Clients", x => x.GetXElement);
|
||||
public void SaveShops() => SaveData(Shops, ShopFileName, "Shops", x => x.GetXElement);
|
||||
private DataFileSingleton()
|
||||
{
|
||||
Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!;
|
||||
Reinforceds = LoadData(ReinforcedFileName, "Reinforced", x => Reinforced.Create(x)!)!;
|
||||
Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!;
|
||||
Shops = LoadData(ShopFileName, "Shop", x => Shop.Create(x)!)!;
|
||||
Clients = LoadData(ClientFileName, "Client", x => Client.Create(x)!)!;
|
||||
}
|
||||
private static List<T>? LoadData<T>(string filename, string xmlNodeName, Func<XElement, T> selectFunction)
|
||||
|
@ -0,0 +1,137 @@
|
||||
using PrecastConcretePlantContracts.BindingModels;
|
||||
using PrecastConcretePlantContracts.SearchModels;
|
||||
using PrecastConcretePlantContracts.StoragesContracts;
|
||||
using PrecastConcretePlantContracts.ViewModels;
|
||||
using PrecastConcretePlantDataModels.Models;
|
||||
using PrecastConcretePlantFileImplement.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PrecastConcretePlantFileImplement.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.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 MakeSale(IReinforcedModel model, int count)
|
||||
{
|
||||
var reinforced = source.Reinforceds.FirstOrDefault(x => x.Id == model.Id);
|
||||
int countInShops = source.Shops.SelectMany(x => x.ShopReinforceds).Sum(y => y.Key == model.Id ? y.Value.Item2 : 0);
|
||||
|
||||
if (reinforced == null || countInShops < count)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (var shop in source.Shops)
|
||||
{
|
||||
var shopReinforceds = shop.ShopReinforceds.Where(x => x.Key == model.Id);
|
||||
if (shopReinforceds.Any())
|
||||
{
|
||||
var shopReinforced = shopReinforceds.First();
|
||||
int min = Math.Min(shopReinforced.Value.Item2, count);
|
||||
if (min == shopReinforced.Value.Item2)
|
||||
{
|
||||
shop.ShopReinforceds.Remove(shopReinforced.Key);
|
||||
}
|
||||
else
|
||||
{
|
||||
shop.ShopReinforceds[shopReinforced.Key] = (shopReinforced.Value.Item1, shopReinforced.Value.Item2 - min);
|
||||
}
|
||||
shop.Update(new ShopBindingModel
|
||||
{
|
||||
Id = shop.Id,
|
||||
ShopName = shop.ShopName,
|
||||
Address = shop.Address,
|
||||
DateOpening = shop.DateOpening,
|
||||
ShopReinforceds = shop.ShopReinforceds,
|
||||
ReinforcedsMax = shop.ReinforcedsMax
|
||||
});
|
||||
count -= min;
|
||||
if (count <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
source.SaveShops();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,113 @@
|
||||
using PrecastConcretePlantContracts.BindingModels;
|
||||
using PrecastConcretePlantContracts.ViewModels;
|
||||
using PrecastConcretePlantDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace PrecastConcretePlantFileImplement.Models
|
||||
{
|
||||
public class Shop : IShopModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
|
||||
public string ShopName { get; private set; } = string.Empty;
|
||||
|
||||
public string Address { get; private set; } = string.Empty;
|
||||
|
||||
public DateTime DateOpening { get; private set; }
|
||||
|
||||
public Dictionary<int, int> Reinforceds { get; private set; } = new();
|
||||
|
||||
private Dictionary<int, (IReinforcedModel, int)>? _shopReinforceds = null;
|
||||
|
||||
public Dictionary<int, (IReinforcedModel, int)> ShopReinforceds
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_shopReinforceds == null)
|
||||
{
|
||||
var source = DataFileSingleton.GetInstance();
|
||||
_shopReinforceds = Reinforceds.ToDictionary(x => x.Key,
|
||||
y => ((source.Reinforceds.FirstOrDefault(z => z.Id == y.Key) as IReinforcedModel)!, y.Value));
|
||||
}
|
||||
return _shopReinforceds;
|
||||
}
|
||||
}
|
||||
|
||||
public int ReinforcedsMax { get; private set; }
|
||||
|
||||
public static Shop? Create(ShopBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Shop()
|
||||
{
|
||||
Id = model.Id,
|
||||
ShopName = model.ShopName,
|
||||
Address = model.Address,
|
||||
DateOpening = model.DateOpening,
|
||||
Reinforceds = model.ShopReinforceds.ToDictionary(x => x.Key, x => x.Value.Item2),
|
||||
ReinforcedsMax = model.ReinforcedsMax
|
||||
};
|
||||
}
|
||||
|
||||
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,
|
||||
DateOpening = Convert.ToDateTime(element.Element("DateOpening")!.Value),
|
||||
ReinforcedsMax = Convert.ToInt32(element.Element("ReinforcedsMax")!.Value),
|
||||
Reinforceds = element.Element("ShopReinforceds")!.Elements("ShopReinforced")
|
||||
.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;
|
||||
DateOpening = model.DateOpening;
|
||||
ReinforcedsMax = model.ReinforcedsMax;
|
||||
Reinforceds = model.ShopReinforceds.ToDictionary(x => x.Key, x => x.Value.Item2);
|
||||
_shopReinforceds = null;
|
||||
}
|
||||
|
||||
public ShopViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
ShopName = ShopName,
|
||||
Address = Address,
|
||||
DateOpening = DateOpening,
|
||||
ShopReinforceds = ShopReinforceds,
|
||||
ReinforcedsMax = ReinforcedsMax
|
||||
};
|
||||
|
||||
public XElement GetXElement => new("Shop",
|
||||
new XAttribute("Id", Id),
|
||||
new XElement("ShopName", ShopName),
|
||||
new XElement("Address", Address),
|
||||
new XElement("DateOpening", DateOpening.ToString()),
|
||||
new XElement("ReinforcedsMax", ReinforcedsMax.ToString()),
|
||||
new XElement("ShopReinforceds",
|
||||
Reinforceds.Select(x => new XElement("ShopReinforced",
|
||||
new XElement("Key", x.Key),
|
||||
new XElement("Value", x.Value))).ToArray()));
|
||||
}
|
||||
}
|
@ -8,6 +8,7 @@ namespace PrecastConcretePlantListImplement
|
||||
public List<Component> Components { get; set; }
|
||||
public List<Order> Orders { get; set; }
|
||||
public List<Reinforced> Reinforceds { get; set; }
|
||||
public List<Shop> Shops { get; set; }
|
||||
|
||||
public List<Client> Clients { get; set; }
|
||||
private DataListSingleton()
|
||||
@ -17,6 +18,7 @@ namespace PrecastConcretePlantListImplement
|
||||
Reinforceds = new List<Reinforced>();
|
||||
Clients = new List<Client>();
|
||||
|
||||
Shops = new List<Shop>();
|
||||
}
|
||||
public static DataListSingleton GetInstance()
|
||||
{
|
||||
|
@ -0,0 +1,119 @@
|
||||
using PrecastConcretePlantContracts.BindingModels;
|
||||
using PrecastConcretePlantContracts.SearchModels;
|
||||
using PrecastConcretePlantContracts.StoragesContracts;
|
||||
using PrecastConcretePlantContracts.ViewModels;
|
||||
using PrecastConcretePlantDataModels.Models;
|
||||
using PrecastConcretePlantListImplement.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PrecastConcretePlantListImplement.Implements
|
||||
{
|
||||
public class ShopStorage : IShopStorage
|
||||
{
|
||||
private readonly DataListSingleton _source;
|
||||
|
||||
public ShopStorage()
|
||||
{
|
||||
_source = DataListSingleton.GetInstance();
|
||||
}
|
||||
|
||||
public List<ShopViewModel> GetFullList()
|
||||
{
|
||||
var result = new List<ShopViewModel>();
|
||||
foreach (var shop in _source.Shops)
|
||||
{
|
||||
result.Add(shop.GetViewModel);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
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 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 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 MakeSale(IReinforcedModel model, int count)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
using PrecastConcretePlantContracts.BindingModels;
|
||||
using PrecastConcretePlantContracts.ViewModels;
|
||||
using PrecastConcretePlantDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PrecastConcretePlantListImplement.Models
|
||||
{
|
||||
public class Shop : IShopModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
|
||||
public string ShopName { get; private set; } = string.Empty;
|
||||
|
||||
public string Address { get; private set; } = string.Empty;
|
||||
|
||||
public DateTime DateOpening { get; private set; }
|
||||
|
||||
public int ReinforcedsMax { get; set; }
|
||||
|
||||
public Dictionary<int, (IReinforcedModel, int)> ShopReinforceds
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = new Dictionary<int, (IReinforcedModel, int)>();
|
||||
|
||||
public static Shop? Create(ShopBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Shop()
|
||||
{
|
||||
Id = model.Id,
|
||||
ShopName = model.ShopName,
|
||||
Address = model.Address,
|
||||
DateOpening = model.DateOpening,
|
||||
ShopReinforceds = model.ShopReinforceds
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(ShopBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ShopName = model.ShopName;
|
||||
Address = model.Address;
|
||||
DateOpening = model.DateOpening;
|
||||
ShopReinforceds = model.ShopReinforceds;
|
||||
}
|
||||
|
||||
public ShopViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
ShopName = ShopName,
|
||||
Address = Address,
|
||||
DateOpening = DateOpening,
|
||||
ShopReinforceds = ShopReinforceds
|
||||
};
|
||||
}
|
||||
}
|
@ -3,14 +3,14 @@
|
||||
partial class FormMain
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// Обязательная переменная конструктора.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// Освободить все используемые ресурсы.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
@ -20,11 +20,11 @@
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
#region Код, автоматически созданный конструктором форм Windows
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||
/// содержимое этого метода с помощью редактора кода.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
@ -32,16 +32,22 @@
|
||||
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||
компонентыToolStripMenuItem = new ToolStripMenuItem();
|
||||
изделияToolStripMenuItem = new ToolStripMenuItem();
|
||||
магазиныToolStripMenuItem = new ToolStripMenuItem();
|
||||
клиентыToolStripMenuItem = new ToolStripMenuItem();
|
||||
отчетыToolStripMenuItem = new ToolStripMenuItem();
|
||||
списокИзделийToolStripMenuItem = new ToolStripMenuItem();
|
||||
компонентыПоИзделиямToolStripMenuItem = new ToolStripMenuItem();
|
||||
списокЗаказовToolStripMenuItem = new ToolStripMenuItem();
|
||||
dataGridView = new DataGridView();
|
||||
buttonCreateOrder = new Button();
|
||||
buttonTakeOrderInWork = new Button();
|
||||
buttonOrderReady = new Button();
|
||||
списокМагазиновToolStripMenuItem = new ToolStripMenuItem();
|
||||
заказыПоДатамToolStripMenuItem = new ToolStripMenuItem();
|
||||
загруженностьПоМагазинамToolStripMenuItem = new ToolStripMenuItem();
|
||||
пополнениеМагазинаToolStripMenuItem = new ToolStripMenuItem();
|
||||
продажаИзделийToolStripMenuItem = new ToolStripMenuItem();
|
||||
buttonIssuedOrder = new Button();
|
||||
buttonOrderReady = new Button();
|
||||
buttonTakeOrderInWork = new Button();
|
||||
buttonCreateOrder = new Button();
|
||||
dataGridView = new DataGridView();
|
||||
buttonUpd = new Button();
|
||||
menuStrip.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
@ -50,10 +56,11 @@
|
||||
// menuStrip
|
||||
//
|
||||
menuStrip.ImageScalingSize = new Size(20, 20);
|
||||
menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, отчетыToolStripMenuItem });
|
||||
menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, отчетыToolStripMenuItem, пополнениеМагазинаToolStripMenuItem, продажаИзделийToolStripMenuItem });
|
||||
menuStrip.Location = new Point(0, 0);
|
||||
menuStrip.Name = "menuStrip";
|
||||
menuStrip.Size = new Size(1257, 28);
|
||||
menuStrip.Padding = new Padding(8, 3, 0, 3);
|
||||
menuStrip.Size = new Size(1178, 30);
|
||||
menuStrip.TabIndex = 0;
|
||||
menuStrip.Text = "menuStrip1";
|
||||
//
|
||||
@ -78,6 +85,13 @@
|
||||
изделияToolStripMenuItem.Text = "Изделия";
|
||||
изделияToolStripMenuItem.Click += ИзделияToolStripMenuItem_Click;
|
||||
//
|
||||
// магазиныToolStripMenuItem
|
||||
//
|
||||
магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem";
|
||||
магазиныToolStripMenuItem.Size = new Size(182, 26);
|
||||
магазиныToolStripMenuItem.Text = "Магазины";
|
||||
магазиныToolStripMenuItem.Click += МагазиныToolStripMenuItem_Click;
|
||||
//
|
||||
// клиентыToolStripMenuItem
|
||||
//
|
||||
клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
|
||||
@ -87,7 +101,7 @@
|
||||
//
|
||||
// отчетыToolStripMenuItem
|
||||
//
|
||||
отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокИзделийToolStripMenuItem, компонентыПоИзделиямToolStripMenuItem, списокЗаказовToolStripMenuItem });
|
||||
отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокИзделийToolStripMenuItem, компонентыПоИзделиямToolStripMenuItem, списокЗаказовToolStripMenuItem, списокМагазиновToolStripMenuItem, загруженностьПоМагазинамToolStripMenuItem, заказыПоДатамToolStripMenuItem });
|
||||
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
||||
отчетыToolStripMenuItem.Size = new Size(73, 24);
|
||||
отчетыToolStripMenuItem.Text = "Отчеты";
|
||||
@ -113,6 +127,89 @@
|
||||
списокЗаказовToolStripMenuItem.Text = "Список заказов";
|
||||
списокЗаказовToolStripMenuItem.Click += СписокЗаказовToolStripMenuItem_Click;
|
||||
//
|
||||
// списокМагазиновToolStripMenuItem
|
||||
//
|
||||
списокМагазиновToolStripMenuItem.Name = "списокМагазиновToolStripMenuItem";
|
||||
списокМагазиновToolStripMenuItem.Size = new Size(276, 26);
|
||||
списокМагазиновToolStripMenuItem.Text = "Список магазинов";
|
||||
списокМагазиновToolStripMenuItem.Click += СписокМагазиновToolStripMenuItem_Click;
|
||||
//
|
||||
// заказыПоДатамToolStripMenuItem
|
||||
//
|
||||
заказыПоДатамToolStripMenuItem.Name = "заказыПоДатамToolStripMenuItem";
|
||||
заказыПоДатамToolStripMenuItem.Size = new Size(276, 26);
|
||||
заказыПоДатамToolStripMenuItem.Text = "Заказы по датам";
|
||||
заказыПоДатамToolStripMenuItem.Click += ЗаказыПоДатамToolStripMenuItem_Click;
|
||||
//
|
||||
// загруженностьПоМагазинамToolStripMenuItem
|
||||
//
|
||||
загруженностьПоМагазинамToolStripMenuItem.Name = "загруженностьПоМагазинамToolStripMenuItem";
|
||||
загруженностьПоМагазинамToolStripMenuItem.Size = new Size(276, 26);
|
||||
загруженностьПоМагазинамToolStripMenuItem.Text = "Загруженность магазинов";
|
||||
загруженностьПоМагазинамToolStripMenuItem.Click += ЗагруженностьМагазиновToolStripMenuItem_Click;
|
||||
//
|
||||
// пополнениеМагазинаToolStripMenuItem
|
||||
//
|
||||
пополнениеМагазинаToolStripMenuItem.Name = "пополнениеМагазинаToolStripMenuItem";
|
||||
пополнениеМагазинаToolStripMenuItem.Size = new Size(182, 24);
|
||||
пополнениеМагазинаToolStripMenuItem.Text = "Пополнение магазина";
|
||||
пополнениеМагазинаToolStripMenuItem.Click += ПополнениеМагазинаToolStripMenuItem_Click;
|
||||
//
|
||||
// продажаИзделийToolStripMenuItem
|
||||
//
|
||||
продажаИзделийToolStripMenuItem.Name = "продажаИзделийToolStripMenuItem";
|
||||
продажаИзделийToolStripMenuItem.Size = new Size(147, 24);
|
||||
продажаИзделийToolStripMenuItem.Text = "продажа изделий";
|
||||
продажаИзделийToolStripMenuItem.Click += ПродажаИзделийToolStripMenuItem_Click;
|
||||
//
|
||||
// buttonIssuedOrder
|
||||
//
|
||||
buttonIssuedOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
buttonIssuedOrder.Location = new Point(965, 308);
|
||||
buttonIssuedOrder.Margin = new Padding(5, 4, 5, 4);
|
||||
buttonIssuedOrder.Name = "buttonIssuedOrder";
|
||||
buttonIssuedOrder.Size = new Size(199, 36);
|
||||
buttonIssuedOrder.TabIndex = 4;
|
||||
buttonIssuedOrder.Text = "Заказ выдан";
|
||||
buttonIssuedOrder.UseVisualStyleBackColor = true;
|
||||
buttonIssuedOrder.Click += ButtonIssuedOrder_Click;
|
||||
//
|
||||
// buttonOrderReady
|
||||
//
|
||||
buttonOrderReady.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
buttonOrderReady.Location = new Point(965, 228);
|
||||
buttonOrderReady.Margin = new Padding(5, 4, 5, 4);
|
||||
buttonOrderReady.Name = "buttonOrderReady";
|
||||
buttonOrderReady.Size = new Size(199, 36);
|
||||
buttonOrderReady.TabIndex = 3;
|
||||
buttonOrderReady.Text = "Заказ готов";
|
||||
buttonOrderReady.UseVisualStyleBackColor = true;
|
||||
buttonOrderReady.Click += ButtonOrderReady_Click;
|
||||
//
|
||||
// buttonTakeOrderInWork
|
||||
//
|
||||
buttonTakeOrderInWork.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
buttonTakeOrderInWork.Location = new Point(965, 156);
|
||||
buttonTakeOrderInWork.Margin = new Padding(5, 4, 5, 4);
|
||||
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
||||
buttonTakeOrderInWork.Size = new Size(199, 36);
|
||||
buttonTakeOrderInWork.TabIndex = 2;
|
||||
buttonTakeOrderInWork.Text = "Отдать на выполнение";
|
||||
buttonTakeOrderInWork.UseVisualStyleBackColor = true;
|
||||
buttonTakeOrderInWork.Click += ButtonTakeOrderInWork_Click;
|
||||
//
|
||||
// buttonCreateOrder
|
||||
//
|
||||
buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
buttonCreateOrder.Location = new Point(965, 77);
|
||||
buttonCreateOrder.Margin = new Padding(5, 4, 5, 4);
|
||||
buttonCreateOrder.Name = "buttonCreateOrder";
|
||||
buttonCreateOrder.Size = new Size(199, 36);
|
||||
buttonCreateOrder.TabIndex = 1;
|
||||
buttonCreateOrder.Text = "Создать заказ";
|
||||
buttonCreateOrder.UseVisualStyleBackColor = true;
|
||||
buttonCreateOrder.Click += ButtonCreateOrder_Click;
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
@ -120,62 +217,24 @@
|
||||
dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
dataGridView.BackgroundColor = SystemColors.ControlLightLight;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Location = new Point(12, 45);
|
||||
dataGridView.Location = new Point(0, 37);
|
||||
dataGridView.Margin = new Padding(5, 4, 5, 4);
|
||||
dataGridView.MultiSelect = false;
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersVisible = false;
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.RowTemplate.Height = 29;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.Size = new Size(1031, 412);
|
||||
dataGridView.Size = new Size(944, 427);
|
||||
dataGridView.TabIndex = 0;
|
||||
//
|
||||
// buttonCreateOrder
|
||||
//
|
||||
buttonCreateOrder.Location = new Point(1068, 85);
|
||||
buttonCreateOrder.Name = "buttonCreateOrder";
|
||||
buttonCreateOrder.Size = new Size(177, 40);
|
||||
buttonCreateOrder.TabIndex = 1;
|
||||
buttonCreateOrder.Text = "Создать заказ";
|
||||
buttonCreateOrder.UseVisualStyleBackColor = true;
|
||||
buttonCreateOrder.Click += ButtonCreateOrder_Click;
|
||||
//
|
||||
// buttonTakeOrderInWork
|
||||
//
|
||||
buttonTakeOrderInWork.Location = new Point(1068, 143);
|
||||
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
||||
buttonTakeOrderInWork.Size = new Size(177, 40);
|
||||
buttonTakeOrderInWork.TabIndex = 2;
|
||||
buttonTakeOrderInWork.Text = "Отдать на выполнение";
|
||||
buttonTakeOrderInWork.UseVisualStyleBackColor = true;
|
||||
buttonTakeOrderInWork.Click += ButtonTakeOrderInWork_Click;
|
||||
//
|
||||
// buttonOrderReady
|
||||
//
|
||||
buttonOrderReady.Location = new Point(1068, 206);
|
||||
buttonOrderReady.Name = "buttonOrderReady";
|
||||
buttonOrderReady.Size = new Size(177, 40);
|
||||
buttonOrderReady.TabIndex = 3;
|
||||
buttonOrderReady.Text = "Заказ готов";
|
||||
buttonOrderReady.UseVisualStyleBackColor = true;
|
||||
buttonOrderReady.Click += ButtonOrderReady_Click;
|
||||
//
|
||||
// buttonIssuedOrder
|
||||
//
|
||||
buttonIssuedOrder.Location = new Point(1068, 265);
|
||||
buttonIssuedOrder.Name = "buttonIssuedOrder";
|
||||
buttonIssuedOrder.Size = new Size(177, 40);
|
||||
buttonIssuedOrder.TabIndex = 4;
|
||||
buttonIssuedOrder.Text = "Заказ выдан";
|
||||
buttonIssuedOrder.UseVisualStyleBackColor = true;
|
||||
buttonIssuedOrder.Click += ButtonIssuedOrder_Click;
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
buttonUpd.Location = new Point(1068, 324);
|
||||
buttonUpd.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
buttonUpd.Location = new Point(965, 387);
|
||||
buttonUpd.Margin = new Padding(5, 4, 5, 4);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new Size(177, 40);
|
||||
buttonUpd.Size = new Size(199, 36);
|
||||
buttonUpd.TabIndex = 5;
|
||||
buttonUpd.Text = "Обновить список";
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
@ -185,7 +244,7 @@
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1257, 469);
|
||||
ClientSize = new Size(1178, 463);
|
||||
Controls.Add(buttonUpd);
|
||||
Controls.Add(buttonIssuedOrder);
|
||||
Controls.Add(buttonOrderReady);
|
||||
@ -194,6 +253,7 @@
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(menuStrip);
|
||||
MainMenuStrip = menuStrip;
|
||||
Margin = new Padding(5, 4, 5, 4);
|
||||
Name = "FormMain";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Завод";
|
||||
@ -207,20 +267,26 @@
|
||||
|
||||
#endregion
|
||||
|
||||
private MenuStrip menuStrip;
|
||||
private ToolStripMenuItem справочникиToolStripMenuItem;
|
||||
private ToolStripMenuItem компонентыToolStripMenuItem;
|
||||
private ToolStripMenuItem изделияToolStripMenuItem;
|
||||
private DataGridView dataGridView;
|
||||
private Button buttonCreateOrder;
|
||||
private Button buttonTakeOrderInWork;
|
||||
private Button buttonOrderReady;
|
||||
private Button buttonIssuedOrder;
|
||||
private Button buttonUpd;
|
||||
private System.Windows.Forms.MenuStrip menuStrip;
|
||||
private System.Windows.Forms.ToolStripMenuItem справочникиToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem компонентыToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem изделияToolStripMenuItem;
|
||||
private System.Windows.Forms.Button buttonIssuedOrder;
|
||||
private System.Windows.Forms.Button buttonOrderReady;
|
||||
private System.Windows.Forms.Button buttonTakeOrderInWork;
|
||||
private System.Windows.Forms.Button buttonCreateOrder;
|
||||
private System.Windows.Forms.DataGridView dataGridView;
|
||||
private System.Windows.Forms.Button buttonUpd;
|
||||
private ToolStripMenuItem магазиныToolStripMenuItem;
|
||||
private ToolStripMenuItem пополнениеМагазинаToolStripMenuItem;
|
||||
private ToolStripMenuItem продажаИзделийToolStripMenuItem;
|
||||
private ToolStripMenuItem отчетыToolStripMenuItem;
|
||||
private ToolStripMenuItem списокИзделийToolStripMenuItem;
|
||||
private ToolStripMenuItem компонентыПоИзделиямToolStripMenuItem;
|
||||
private ToolStripMenuItem списокЗаказовToolStripMenuItem;
|
||||
private ToolStripMenuItem клиентыToolStripMenuItem;
|
||||
private ToolStripMenuItem списокМагазиновToolStripMenuItem;
|
||||
private ToolStripMenuItem заказыПоДатамToolStripMenuItem;
|
||||
private ToolStripMenuItem загруженностьПоМагазинамToolStripMenuItem;
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
using PrecastConcretePlantBusinessLogic.BusinessLogics;
|
||||
using PrecastConcretePlantContracts.BindingModels;
|
||||
using PrecastConcretePlantContracts.BusinessLogicsContracts;
|
||||
using PrecastConcretePlantView;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@ -17,8 +18,11 @@ namespace PrecastConcretePlantView
|
||||
public partial class FormMain : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly IOrderLogic _orderLogic;
|
||||
|
||||
private readonly IReportLogic _reportLogic;
|
||||
|
||||
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -26,10 +30,12 @@ namespace PrecastConcretePlantView
|
||||
_orderLogic = orderLogic;
|
||||
_reportLogic = reportLogic;
|
||||
}
|
||||
|
||||
private void FormMain_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
try
|
||||
@ -51,15 +57,16 @@ namespace PrecastConcretePlantView
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void КомпонентыToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service =
|
||||
Program.ServiceProvider?.GetService(typeof(FormComponents));
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormComponents));
|
||||
if (service is FormComponents form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void ИзделияToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormReinforceds));
|
||||
@ -68,6 +75,34 @@ namespace PrecastConcretePlantView
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void МагазиныToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormShops));
|
||||
if (service is FormShops form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void ПополнениеМагазинаToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormShopReplenishment));
|
||||
if (service is FormShopReplenishment form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void ПродажаИзделийToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormReinforcedSale));
|
||||
if (service is FormReinforcedSale form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void КлиентыToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormClients));
|
||||
@ -103,54 +138,55 @@ namespace PrecastConcretePlantView
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void СписокМагазиновToolStripMenuItem_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 ЗагруженностьМагазиновToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportShopReinforceds));
|
||||
if (service is FormReportShopReinforceds form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void ЗаказыПоДатамToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportGroupedOrders));
|
||||
if (service is FormReportGroupedOrders form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonCreateOrder_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service =
|
||||
Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
|
||||
if (service is FormCreateOrder form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonTakeOrderInWork_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
int id =
|
||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id);
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Order №{id}. Status changes to 'В работе'", id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id });
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении.Дополнительная информация в логах.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка передачи заказа в работу");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonOrderReady_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
int id =
|
||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'",
|
||||
id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.FinishOrder(new
|
||||
OrderBindingModel
|
||||
{ Id = id });
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
@ -158,18 +194,41 @@ namespace PrecastConcretePlantView
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка отметки о готовности заказа");
|
||||
_logger.LogError(ex, "Error taking an order to work");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonOrderReady_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Order №{id}. Status changes to 'Готов'", id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel { Id = id });
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Order readiness marking error");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonIssuedOrder_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
int id =
|
||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'", id);
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Order №{id}. Status changes to 'Выдан'", id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel { Id = id });
|
||||
@ -177,20 +236,21 @@ namespace PrecastConcretePlantView
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
_logger.LogInformation("Заказ №{id} выдан", id);
|
||||
_logger.LogInformation("Order №{id} issued", id);
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка отметки о выдачи заказа");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
_logger.LogError(ex, "Order issue marking error");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -120,7 +120,4 @@
|
||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>25</value>
|
||||
</metadata>
|
||||
</root>
|
128
PrecastConcretePlant/PrecastConcretePlantView/FormReinforcedSale.Designer.cs
generated
Normal file
128
PrecastConcretePlant/PrecastConcretePlantView/FormReinforcedSale.Designer.cs
generated
Normal file
@ -0,0 +1,128 @@
|
||||
namespace PrecastConcretePlantView
|
||||
{
|
||||
partial class FormReinforcedSale
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
buttonCancel = new Button();
|
||||
buttonSale = new Button();
|
||||
textBoxCount = new TextBox();
|
||||
labelCount = new Label();
|
||||
comboBoxReinforced = new ComboBox();
|
||||
labelReinforced = new Label();
|
||||
SuspendLayout();
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(289, 111);
|
||||
buttonCancel.Margin = new Padding(5, 4, 5, 4);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(101, 36);
|
||||
buttonCancel.TabIndex = 17;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// buttonSale
|
||||
//
|
||||
buttonSale.Location = new Point(182, 111);
|
||||
buttonSale.Margin = new Padding(5, 4, 5, 4);
|
||||
buttonSale.Name = "buttonSale";
|
||||
buttonSale.Size = new Size(101, 36);
|
||||
buttonSale.TabIndex = 16;
|
||||
buttonSale.Text = "Продать";
|
||||
buttonSale.UseVisualStyleBackColor = true;
|
||||
buttonSale.Click += ButtonSale_Click;
|
||||
//
|
||||
// textBoxCount
|
||||
//
|
||||
textBoxCount.Location = new Point(115, 68);
|
||||
textBoxCount.Margin = new Padding(5, 4, 5, 4);
|
||||
textBoxCount.Name = "textBoxCount";
|
||||
textBoxCount.Size = new Size(287, 27);
|
||||
textBoxCount.TabIndex = 15;
|
||||
//
|
||||
// labelCount
|
||||
//
|
||||
labelCount.AutoSize = true;
|
||||
labelCount.Location = new Point(15, 72);
|
||||
labelCount.Margin = new Padding(5, 0, 5, 0);
|
||||
labelCount.Name = "labelCount";
|
||||
labelCount.Size = new Size(93, 20);
|
||||
labelCount.TabIndex = 14;
|
||||
labelCount.Text = "Количество:";
|
||||
//
|
||||
// comboBoxReinforced
|
||||
//
|
||||
comboBoxReinforced.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxReinforced.FormattingEnabled = true;
|
||||
comboBoxReinforced.Location = new Point(115, 20);
|
||||
comboBoxReinforced.Margin = new Padding(5, 4, 5, 4);
|
||||
comboBoxReinforced.Name = "comboBoxReinforced";
|
||||
comboBoxReinforced.Size = new Size(287, 28);
|
||||
comboBoxReinforced.TabIndex = 13;
|
||||
//
|
||||
// labelReinforced
|
||||
//
|
||||
labelReinforced.AutoSize = true;
|
||||
labelReinforced.Location = new Point(15, 25);
|
||||
labelReinforced.Margin = new Padding(5, 0, 5, 0);
|
||||
labelReinforced.Name = "labelReinforced";
|
||||
labelReinforced.Size = new Size(71, 20);
|
||||
labelReinforced.TabIndex = 12;
|
||||
labelReinforced.Text = "Изделие:";
|
||||
//
|
||||
// FormReinforcedSale
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(426, 164);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSale);
|
||||
Controls.Add(textBoxCount);
|
||||
Controls.Add(labelCount);
|
||||
Controls.Add(comboBoxReinforced);
|
||||
Controls.Add(labelReinforced);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "FormReinforcedSale";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Продажа изделий";
|
||||
Load += FormReinforcedSale_Load;
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Button buttonCancel;
|
||||
private Button buttonSale;
|
||||
private TextBox textBoxCount;
|
||||
private Label labelCount;
|
||||
private ComboBox comboBoxReinforced;
|
||||
private Label labelReinforced;
|
||||
}
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
using PrecastConcretePlantContracts.BusinessLogicsContracts;
|
||||
using PrecastConcretePlantContracts.BindingModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace PrecastConcretePlantView
|
||||
{
|
||||
public partial class FormReinforcedSale : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly IReinforcedLogic _logicReinforced;
|
||||
|
||||
private readonly IShopLogic _logicShop;
|
||||
|
||||
public FormReinforcedSale(ILogger<FormShopReplenishment> logger, IReinforcedLogic logicReinforced, IShopLogic logicShop)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logicReinforced = logicReinforced;
|
||||
_logicShop = logicShop;
|
||||
}
|
||||
|
||||
private void FormReinforcedSale_Load(object sender, EventArgs e)
|
||||
{
|
||||
_logger.LogInformation("Reinforceds loading");
|
||||
try
|
||||
{
|
||||
var list = _logicReinforced.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
comboBoxReinforced.DisplayMember = "ReinforcedName";
|
||||
comboBoxReinforced.ValueMember = "Id";
|
||||
comboBoxReinforced.DataSource = list;
|
||||
comboBoxReinforced.SelectedItem = null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Reinforceds loading error");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonSale_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (comboBoxReinforced.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(textBoxCount.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните поле Количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Reinforced sale");
|
||||
try
|
||||
{
|
||||
var operationResult = _logicShop.MakeSale(
|
||||
new ReinforcedBindingModel
|
||||
{
|
||||
Id = Convert.ToInt32(comboBoxReinforced.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, "Reinforced sale error");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
@ -0,0 +1,72 @@
|
||||
using PrecastConcretePlantContracts.BindingModels;
|
||||
using PrecastConcretePlantContracts.BusinessLogicsContracts;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Reporting.WinForms;
|
||||
|
||||
namespace PrecastConcretePlantView
|
||||
{
|
||||
public partial class FormReportGroupedOrders : Form
|
||||
{
|
||||
private readonly ReportViewer reportViewer;
|
||||
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly IReportLogic _logic;
|
||||
|
||||
public FormReportGroupedOrders(ILogger<FormReportOrders> logger, IReportLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
reportViewer = new ReportViewer
|
||||
{
|
||||
Dock = DockStyle.Fill
|
||||
};
|
||||
reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportGroupedOrders.rdlc", FileMode.Open));
|
||||
Controls.Clear();
|
||||
Controls.Add(reportViewer);
|
||||
Controls.Add(panel);
|
||||
}
|
||||
|
||||
private void ButtonCreateReport_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var dataSource = _logic.GetGroupedByDateOrders();
|
||||
var source = new ReportDataSource("DataSetOrders", dataSource);
|
||||
reportViewer.LocalReport.DataSources.Clear();
|
||||
reportViewer.LocalReport.DataSources.Add(source);
|
||||
|
||||
reportViewer.RefreshReport();
|
||||
_logger.LogInformation("Loading list of grouped orders");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Loading list of grouped orders error");
|
||||
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("Saving list of grouped orders");
|
||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Saving list of grouped orders error");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
91
PrecastConcretePlant/PrecastConcretePlantView/FormReportGroupedOrders.designer.cs
generated
Normal file
91
PrecastConcretePlant/PrecastConcretePlantView/FormReportGroupedOrders.designer.cs
generated
Normal file
@ -0,0 +1,91 @@
|
||||
namespace PrecastConcretePlantView
|
||||
{
|
||||
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();
|
||||
buttonCreateReport = new Button();
|
||||
panel.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel
|
||||
//
|
||||
panel.Controls.Add(buttonToPdf);
|
||||
panel.Controls.Add(buttonCreateReport);
|
||||
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(188, 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;
|
||||
//
|
||||
// buttonCreateReport
|
||||
//
|
||||
buttonCreateReport.Location = new Point(11, 8);
|
||||
buttonCreateReport.Margin = new Padding(4, 3, 4, 3);
|
||||
buttonCreateReport.Name = "buttonCreateReport";
|
||||
buttonCreateReport.Size = new Size(139, 27);
|
||||
buttonCreateReport.TabIndex = 4;
|
||||
buttonCreateReport.Text = "Сформировать";
|
||||
buttonCreateReport.UseVisualStyleBackColor = true;
|
||||
buttonCreateReport.Click += ButtonCreateReport_Click;
|
||||
//
|
||||
// FormReportGroupedOrders
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1031, 647);
|
||||
Controls.Add(panel);
|
||||
Margin = new Padding(4, 3, 4, 3);
|
||||
Name = "FormReportGroupedOrders";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Заказы по датам";
|
||||
panel.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel panel;
|
||||
private System.Windows.Forms.Button buttonToPdf;
|
||||
private System.Windows.Forms.Button buttonCreateReport;
|
||||
}
|
||||
}
|
@ -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>
|
@ -0,0 +1,70 @@
|
||||
using PrecastConcretePlantContracts.BindingModels;
|
||||
using PrecastConcretePlantContracts.BusinessLogicsContracts;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace PrecastConcretePlantView
|
||||
{
|
||||
public partial class FormReportShopReinforceds : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly IReportLogic _logic;
|
||||
|
||||
public FormReportShopReinforceds(ILogger<FormReportReinforcedComponents> logger, IReportLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
|
||||
private void FormReportShopReinforceds_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var dict = _logic.GetShopReinforceds();
|
||||
if (dict != null)
|
||||
{
|
||||
dataGridView.Rows.Clear();
|
||||
foreach (var elem in dict)
|
||||
{
|
||||
dataGridView.Rows.Add(new object[] { elem.ShopName, "", "" });
|
||||
foreach (var listElem in elem.Reinforceds)
|
||||
{
|
||||
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
|
||||
}
|
||||
dataGridView.Rows.Add(new object[] { "Итого", "", elem.TotalCount });
|
||||
dataGridView.Rows.Add(Array.Empty<object>());
|
||||
}
|
||||
}
|
||||
_logger.LogInformation("Loading information on store workload");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Loading information on store workload error");
|
||||
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.SaveShopReinforcedToExcelFile(new ReportBindingModel
|
||||
{
|
||||
FileName = dialog.FileName
|
||||
});
|
||||
_logger.LogInformation("Saving information on store workload");
|
||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Saving information on store workload error");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
114
PrecastConcretePlant/PrecastConcretePlantView/FormReportShopReinforceds.designer.cs
generated
Normal file
114
PrecastConcretePlant/PrecastConcretePlantView/FormReportShopReinforceds.designer.cs
generated
Normal file
@ -0,0 +1,114 @@
|
||||
namespace PrecastConcretePlantView
|
||||
{
|
||||
partial class FormReportShopReinforceds
|
||||
{
|
||||
/// <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();
|
||||
ColumnReinforced = 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, ColumnReinforced, ColumnCount });
|
||||
dataGridView.Dock = DockStyle.Bottom;
|
||||
dataGridView.Location = new Point(0, 47);
|
||||
dataGridView.Margin = new Padding(4, 3, 4, 3);
|
||||
dataGridView.MultiSelect = false;
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersVisible = false;
|
||||
dataGridView.Size = new Size(616, 510);
|
||||
dataGridView.TabIndex = 0;
|
||||
//
|
||||
// buttonSaveToExcel
|
||||
//
|
||||
buttonSaveToExcel.Location = new Point(13, 10);
|
||||
buttonSaveToExcel.Margin = new Padding(4, 3, 4, 3);
|
||||
buttonSaveToExcel.Name = "buttonSaveToExcel";
|
||||
buttonSaveToExcel.Size = new Size(186, 27);
|
||||
buttonSaveToExcel.TabIndex = 1;
|
||||
buttonSaveToExcel.Text = "Сохранить в Excel";
|
||||
buttonSaveToExcel.UseVisualStyleBackColor = true;
|
||||
buttonSaveToExcel.Click += ButtonSaveToExcel_Click;
|
||||
//
|
||||
// ColumnShop
|
||||
//
|
||||
ColumnShop.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
ColumnShop.HeaderText = "Магазин";
|
||||
ColumnShop.Name = "ColumnShop";
|
||||
ColumnShop.ReadOnly = true;
|
||||
//
|
||||
// ColumnIceCream
|
||||
//
|
||||
ColumnReinforced.HeaderText = "Изделия";
|
||||
ColumnReinforced.Name = "ColumnReinforced";
|
||||
ColumnReinforced.ReadOnly = true;
|
||||
ColumnReinforced.Width = 200;
|
||||
//
|
||||
// ColumnCount
|
||||
//
|
||||
ColumnCount.HeaderText = "Количество";
|
||||
ColumnCount.Name = "ColumnCount";
|
||||
ColumnCount.ReadOnly = true;
|
||||
//
|
||||
// FormReportShopReinforceds
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(616, 557);
|
||||
Controls.Add(buttonSaveToExcel);
|
||||
Controls.Add(dataGridView);
|
||||
Margin = new Padding(4, 3, 4, 3);
|
||||
Name = "FormReportShopReinforceds";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Загруженность магазинов";
|
||||
Load += FormReportShopReinforceds_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.DataGridView dataGridView;
|
||||
private System.Windows.Forms.Button buttonSaveToExcel;
|
||||
private DataGridViewTextBoxColumn ColumnShop;
|
||||
private DataGridViewTextBoxColumn ColumnReinforced;
|
||||
private DataGridViewTextBoxColumn ColumnCount;
|
||||
}
|
||||
}
|
@ -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>
|
243
PrecastConcretePlant/PrecastConcretePlantView/FormShop.Designer.cs
generated
Normal file
243
PrecastConcretePlant/PrecastConcretePlantView/FormShop.Designer.cs
generated
Normal file
@ -0,0 +1,243 @@
|
||||
namespace PrecastConcretePlantView
|
||||
{
|
||||
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();
|
||||
textBoxName = new TextBox();
|
||||
labelAddress = new Label();
|
||||
textBoxAddress = new TextBox();
|
||||
dateTimePicker = new DateTimePicker();
|
||||
labelOpeningDate = new Label();
|
||||
groupBoxReinforceds = new GroupBox();
|
||||
dataGridView = new DataGridView();
|
||||
ColumnId = new DataGridViewTextBoxColumn();
|
||||
ColumnName = new DataGridViewTextBoxColumn();
|
||||
ColumnCount = new DataGridViewTextBoxColumn();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
textBoxMax = new Label();
|
||||
textBoxMaximum = new TextBox();
|
||||
groupBoxReinforceds.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelName
|
||||
//
|
||||
labelName.AutoSize = true;
|
||||
labelName.Location = new Point(16, 13);
|
||||
labelName.Margin = new Padding(5, 0, 5, 0);
|
||||
labelName.Name = "labelName";
|
||||
labelName.Size = new Size(84, 20);
|
||||
labelName.TabIndex = 1;
|
||||
labelName.Text = "Название :";
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Location = new Point(105, 9);
|
||||
textBoxName.Margin = new Padding(5, 4, 5, 4);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(302, 27);
|
||||
textBoxName.TabIndex = 2;
|
||||
//
|
||||
// labelAddress
|
||||
//
|
||||
labelAddress.AutoSize = true;
|
||||
labelAddress.Location = new Point(16, 53);
|
||||
labelAddress.Margin = new Padding(5, 0, 5, 0);
|
||||
labelAddress.Name = "labelAddress";
|
||||
labelAddress.Size = new Size(58, 20);
|
||||
labelAddress.TabIndex = 3;
|
||||
labelAddress.Text = "Адрес :";
|
||||
//
|
||||
// textBoxAddress
|
||||
//
|
||||
textBoxAddress.Location = new Point(105, 49);
|
||||
textBoxAddress.Margin = new Padding(5, 4, 5, 4);
|
||||
textBoxAddress.Name = "textBoxAddress";
|
||||
textBoxAddress.Size = new Size(302, 27);
|
||||
textBoxAddress.TabIndex = 4;
|
||||
//
|
||||
// dateTimePicker
|
||||
//
|
||||
dateTimePicker.Location = new Point(144, 88);
|
||||
dateTimePicker.Margin = new Padding(3, 4, 3, 4);
|
||||
dateTimePicker.Name = "dateTimePicker";
|
||||
dateTimePicker.Size = new Size(263, 27);
|
||||
dateTimePicker.TabIndex = 5;
|
||||
//
|
||||
// labelOpeningDate
|
||||
//
|
||||
labelOpeningDate.AutoSize = true;
|
||||
labelOpeningDate.Location = new Point(16, 92);
|
||||
labelOpeningDate.Margin = new Padding(5, 0, 5, 0);
|
||||
labelOpeningDate.Name = "labelOpeningDate";
|
||||
labelOpeningDate.Size = new Size(117, 20);
|
||||
labelOpeningDate.TabIndex = 6;
|
||||
labelOpeningDate.Text = "Дата открытия :";
|
||||
//
|
||||
// groupBoxReinforceds
|
||||
//
|
||||
groupBoxReinforceds.Controls.Add(dataGridView);
|
||||
groupBoxReinforceds.Location = new Point(5, 183);
|
||||
groupBoxReinforceds.Margin = new Padding(5, 4, 5, 4);
|
||||
groupBoxReinforceds.Name = "groupBoxReinforceds";
|
||||
groupBoxReinforceds.Padding = new Padding(5, 4, 5, 4);
|
||||
groupBoxReinforceds.Size = new Size(536, 395);
|
||||
groupBoxReinforceds.TabIndex = 7;
|
||||
groupBoxReinforceds.TabStop = false;
|
||||
groupBoxReinforceds.Text = "Изделие";
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.BackgroundColor = SystemColors.ControlLightLight;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnId, ColumnName, ColumnCount });
|
||||
dataGridView.Dock = DockStyle.Left;
|
||||
dataGridView.Location = new Point(5, 24);
|
||||
dataGridView.Margin = new Padding(5, 4, 5, 4);
|
||||
dataGridView.MultiSelect = false;
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersVisible = false;
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.Size = new Size(522, 367);
|
||||
dataGridView.TabIndex = 0;
|
||||
//
|
||||
// ColumnId
|
||||
//
|
||||
ColumnId.HeaderText = "Id";
|
||||
ColumnId.MinimumWidth = 6;
|
||||
ColumnId.Name = "ColumnId";
|
||||
ColumnId.ReadOnly = true;
|
||||
ColumnId.Visible = false;
|
||||
ColumnId.Width = 125;
|
||||
//
|
||||
// ColumnName
|
||||
//
|
||||
ColumnName.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
ColumnName.HeaderText = "Название изделия";
|
||||
ColumnName.MinimumWidth = 6;
|
||||
ColumnName.Name = "ColumnName";
|
||||
ColumnName.ReadOnly = true;
|
||||
//
|
||||
// ColumnCount
|
||||
//
|
||||
ColumnCount.HeaderText = "Количество";
|
||||
ColumnCount.MinimumWidth = 6;
|
||||
ColumnCount.Name = "ColumnCount";
|
||||
ColumnCount.ReadOnly = true;
|
||||
ColumnCount.Width = 125;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(306, 586);
|
||||
buttonSave.Margin = new Padding(5, 4, 5, 4);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(101, 36);
|
||||
buttonSave.TabIndex = 8;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(417, 586);
|
||||
buttonCancel.Margin = new Padding(5, 4, 5, 4);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(101, 36);
|
||||
buttonCancel.TabIndex = 9;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// textBoxMax
|
||||
//
|
||||
textBoxMax.AutoSize = true;
|
||||
textBoxMax.Location = new Point(16, 141);
|
||||
textBoxMax.Name = "textBoxMax";
|
||||
textBoxMax.Size = new Size(270, 20);
|
||||
textBoxMax.TabIndex = 10;
|
||||
textBoxMax.Text = "Максимальное колличество изделий:";
|
||||
//
|
||||
// textBoxMaximum
|
||||
//
|
||||
textBoxMaximum.Location = new Point(306, 138);
|
||||
textBoxMaximum.Name = "textBoxMaximum";
|
||||
textBoxMaximum.Size = new Size(101, 27);
|
||||
textBoxMaximum.TabIndex = 11;
|
||||
//
|
||||
// FormShop
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(546, 635);
|
||||
Controls.Add(textBoxMaximum);
|
||||
Controls.Add(textBoxMax);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(groupBoxReinforceds);
|
||||
Controls.Add(labelOpeningDate);
|
||||
Controls.Add(dateTimePicker);
|
||||
Controls.Add(textBoxAddress);
|
||||
Controls.Add(labelAddress);
|
||||
Controls.Add(textBoxName);
|
||||
Controls.Add(labelName);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "FormShop";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Магазин";
|
||||
Load += FormShop_Load;
|
||||
groupBoxReinforceds.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelName;
|
||||
private TextBox textBoxName;
|
||||
private Label labelAddress;
|
||||
private TextBox textBoxAddress;
|
||||
private DateTimePicker dateTimePicker;
|
||||
private Label labelOpeningDate;
|
||||
private GroupBox groupBoxReinforceds;
|
||||
private DataGridView dataGridView;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
private DataGridViewTextBoxColumn ColumnId;
|
||||
private DataGridViewTextBoxColumn ColumnName;
|
||||
private DataGridViewTextBoxColumn ColumnCount;
|
||||
private Label textBoxMax;
|
||||
private TextBox textBoxMaximum;
|
||||
}
|
||||
}
|
133
PrecastConcretePlant/PrecastConcretePlantView/FormShop.cs
Normal file
133
PrecastConcretePlant/PrecastConcretePlantView/FormShop.cs
Normal file
@ -0,0 +1,133 @@
|
||||
using PrecastConcretePlantContracts.BindingModels;
|
||||
using PrecastConcretePlantContracts.BusinessLogicsContracts;
|
||||
using PrecastConcretePlantContracts.SearchModels;
|
||||
using PrecastConcretePlantDataModels.Models;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PrecastConcretePlantListImplement.Models;
|
||||
|
||||
namespace PrecastConcretePlantView
|
||||
{
|
||||
public partial class FormShop : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly IShopLogic _logic;
|
||||
|
||||
private int? _id;
|
||||
|
||||
private Dictionary<int, (IReinforcedModel, int)> _shopReinforceds;
|
||||
|
||||
public int Id { set { _id = value; } }
|
||||
|
||||
public FormShop(ILogger<FormShop> logger, IShopLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
_shopReinforceds = new Dictionary<int, (IReinforcedModel, int)>();
|
||||
}
|
||||
|
||||
private void FormShop_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (_id.HasValue)
|
||||
{
|
||||
_logger.LogInformation("Shop loading");
|
||||
try
|
||||
{
|
||||
var view = _logic.ReadElement(new ShopSearchModel { Id = _id.Value });
|
||||
if (view != null)
|
||||
{
|
||||
textBoxName.Text = view.ShopName;
|
||||
textBoxAddress.Text = view.Address;
|
||||
dateTimePicker.Value = view.DateOpening;
|
||||
textBoxMaximum.Text = view.ReinforcedsMax.ToString();
|
||||
_shopReinforceds = view.ShopReinforceds ?? new Dictionary<int, (IReinforcedModel, int)>();
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Shop loading error");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
_logger.LogInformation("Shop reinforceds loading");
|
||||
try
|
||||
{
|
||||
if (_shopReinforceds != null)
|
||||
{
|
||||
dataGridView.Rows.Clear();
|
||||
foreach (var reinforced in _shopReinforceds)
|
||||
{
|
||||
dataGridView.Rows.Add(new object[] { reinforced.Key, reinforced.Value.Item1.ReinforcedName, reinforced.Value.Item2 });
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Shop reinforceds loading error");
|
||||
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;
|
||||
}
|
||||
if (string.IsNullOrEmpty(dateTimePicker.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните дату", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(textBoxMaximum.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните максимальное количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Shop saving");
|
||||
try
|
||||
{
|
||||
var model = new ShopBindingModel
|
||||
{
|
||||
Id = _id ?? 0,
|
||||
ShopName = textBoxName.Text,
|
||||
Address = textBoxAddress.Text,
|
||||
DateOpening = dateTimePicker.Value,
|
||||
ReinforcedsMax = Convert.ToInt32(textBoxMaximum.Text),
|
||||
ShopReinforceds = _shopReinforceds
|
||||
};
|
||||
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, "Shop saving error");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
120
PrecastConcretePlant/PrecastConcretePlantView/FormShop.resx
Normal file
120
PrecastConcretePlant/PrecastConcretePlantView/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>
|
145
PrecastConcretePlant/PrecastConcretePlantView/FormShopReplenishment.Designer.cs
generated
Normal file
145
PrecastConcretePlant/PrecastConcretePlantView/FormShopReplenishment.Designer.cs
generated
Normal file
@ -0,0 +1,145 @@
|
||||
namespace PrecastConcretePlantView
|
||||
{
|
||||
partial class FormShopReplenishment
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
labelShop = new Label();
|
||||
labelReinforced = new Label();
|
||||
labelCount = new Label();
|
||||
comboBoxShop = new ComboBox();
|
||||
comboBoxReinforced = new ComboBox();
|
||||
textBoxCount = new TextBox();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelShop
|
||||
//
|
||||
labelShop.AutoSize = true;
|
||||
labelShop.Location = new Point(27, 29);
|
||||
labelShop.Name = "labelShop";
|
||||
labelShop.Size = new Size(72, 20);
|
||||
labelShop.TabIndex = 0;
|
||||
labelShop.Text = "Магазин:";
|
||||
//
|
||||
// labelReinforced
|
||||
//
|
||||
labelReinforced.AutoSize = true;
|
||||
labelReinforced.Location = new Point(27, 73);
|
||||
labelReinforced.Name = "labelReinforced";
|
||||
labelReinforced.Size = new Size(71, 20);
|
||||
labelReinforced.TabIndex = 1;
|
||||
labelReinforced.Text = "Изделие:";
|
||||
//
|
||||
// labelCount
|
||||
//
|
||||
labelCount.AutoSize = true;
|
||||
labelCount.Location = new Point(27, 118);
|
||||
labelCount.Name = "labelCount";
|
||||
labelCount.Size = new Size(93, 20);
|
||||
labelCount.TabIndex = 2;
|
||||
labelCount.Text = "Количество:";
|
||||
//
|
||||
// comboBoxShop
|
||||
//
|
||||
comboBoxShop.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxShop.FormattingEnabled = true;
|
||||
comboBoxShop.Location = new Point(136, 29);
|
||||
comboBoxShop.Name = "comboBoxShop";
|
||||
comboBoxShop.Size = new Size(239, 28);
|
||||
comboBoxShop.TabIndex = 3;
|
||||
//
|
||||
// comboBoxReinforced
|
||||
//
|
||||
comboBoxReinforced.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxReinforced.FormattingEnabled = true;
|
||||
comboBoxReinforced.Location = new Point(136, 73);
|
||||
comboBoxReinforced.Name = "comboBoxReinforced";
|
||||
comboBoxReinforced.Size = new Size(239, 28);
|
||||
comboBoxReinforced.TabIndex = 4;
|
||||
//
|
||||
// textBoxCount
|
||||
//
|
||||
textBoxCount.Location = new Point(136, 118);
|
||||
textBoxCount.Name = "textBoxCount";
|
||||
textBoxCount.Size = new Size(239, 27);
|
||||
textBoxCount.TabIndex = 5;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(282, 162);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(93, 29);
|
||||
buttonCancel.TabIndex = 6;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(182, 162);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(94, 29);
|
||||
buttonSave.TabIndex = 7;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// FormShopReplenishment
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(422, 203);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(textBoxCount);
|
||||
Controls.Add(comboBoxReinforced);
|
||||
Controls.Add(comboBoxShop);
|
||||
Controls.Add(labelCount);
|
||||
Controls.Add(labelReinforced);
|
||||
Controls.Add(labelShop);
|
||||
Name = "FormShopReplenishment";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Пополнение магазина";
|
||||
Load += FormShopReplenishment_Load;
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelShop;
|
||||
private Label labelReinforced;
|
||||
private Label labelCount;
|
||||
private ComboBox comboBoxShop;
|
||||
private ComboBox comboBoxReinforced;
|
||||
private TextBox textBoxCount;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
}
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
using PrecastConcretePlantContracts.BusinessLogicsContracts;
|
||||
using PrecastConcretePlantContracts.SearchModels;
|
||||
using PrecastConcretePlantListImplement.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PrecastConcretePlantView
|
||||
{
|
||||
public partial class FormShopReplenishment : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly IReinforcedLogic _logicReinforced;
|
||||
|
||||
private readonly IShopLogic _logicShop;
|
||||
|
||||
public FormShopReplenishment(ILogger<FormShopReplenishment> logger, IReinforcedLogic logicReinforced, IShopLogic logicShop)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logicReinforced = logicReinforced;
|
||||
_logicShop = logicShop;
|
||||
}
|
||||
|
||||
private void FormShopReplenishment_Load(object sender, EventArgs e)
|
||||
{
|
||||
_logger.LogInformation("Reinforceds loading");
|
||||
try
|
||||
{
|
||||
var list = _logicReinforced.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
comboBoxReinforced.DisplayMember = "ReinforcedName";
|
||||
comboBoxReinforced.ValueMember = "Id";
|
||||
comboBoxReinforced.DataSource = list;
|
||||
comboBoxReinforced.SelectedItem = null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Reinforceds loading error");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
_logger.LogInformation("Shops loading");
|
||||
try
|
||||
{
|
||||
var list = _logicShop.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
comboBoxShop.DisplayMember = "ShopName";
|
||||
comboBoxShop.ValueMember = "Id";
|
||||
comboBoxShop.DataSource = list;
|
||||
comboBoxShop.SelectedItem = null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Shops loading error");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (comboBoxShop.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите магазин", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (comboBoxReinforced.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(textBoxCount.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните поле Количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Shop replenishment");
|
||||
try
|
||||
{
|
||||
var reinforced = _logicReinforced.ReadElement(new ReinforcedSearchModel
|
||||
{ Id = Convert.ToInt32(comboBoxReinforced.SelectedValue) });
|
||||
if (reinforced == null)
|
||||
{
|
||||
throw new Exception("Изделие не найдено.");
|
||||
}
|
||||
var operationResult = _logicShop.ReplenishShop(new ShopSearchModel
|
||||
{
|
||||
Id = Convert.ToInt32(comboBoxShop.SelectedValue)
|
||||
},
|
||||
reinforced, 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, "Shop replenishment error");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
126
PrecastConcretePlant/PrecastConcretePlantView/FormShops.Designer.cs
generated
Normal file
126
PrecastConcretePlant/PrecastConcretePlantView/FormShops.Designer.cs
generated
Normal file
@ -0,0 +1,126 @@
|
||||
namespace PrecastConcretePlantView
|
||||
{
|
||||
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();
|
||||
buttonUpd = new Button();
|
||||
buttonDel = new Button();
|
||||
buttonEdit = new Button();
|
||||
buttonAdd = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.BackgroundColor = SystemColors.ControlLightLight;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Dock = DockStyle.Left;
|
||||
dataGridView.Location = new Point(0, 0);
|
||||
dataGridView.Margin = new Padding(4, 3, 4, 3);
|
||||
dataGridView.MultiSelect = false;
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersVisible = false;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.Size = new Size(408, 360);
|
||||
dataGridView.TabIndex = 2;
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
buttonUpd.Location = new Point(432, 152);
|
||||
buttonUpd.Margin = new Padding(4, 3, 4, 3);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new Size(88, 27);
|
||||
buttonUpd.TabIndex = 12;
|
||||
buttonUpd.Text = "Обновить";
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
buttonUpd.Click += ButtonUpd_Click;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.Location = new Point(432, 105);
|
||||
buttonDel.Margin = new Padding(4, 3, 4, 3);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(88, 27);
|
||||
buttonDel.TabIndex = 11;
|
||||
buttonDel.Text = "Удалить";
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// buttonEdit
|
||||
//
|
||||
buttonEdit.Location = new Point(432, 58);
|
||||
buttonEdit.Margin = new Padding(4, 3, 4, 3);
|
||||
buttonEdit.Name = "buttonEdit";
|
||||
buttonEdit.Size = new Size(88, 27);
|
||||
buttonEdit.TabIndex = 10;
|
||||
buttonEdit.Text = "Изменить";
|
||||
buttonEdit.UseVisualStyleBackColor = true;
|
||||
buttonEdit.Click += ButtonEdit_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(432, 14);
|
||||
buttonAdd.Margin = new Padding(4, 3, 4, 3);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(88, 27);
|
||||
buttonAdd.TabIndex = 9;
|
||||
buttonAdd.Text = "Добавить";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// FormShops
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(541, 360);
|
||||
Controls.Add(buttonUpd);
|
||||
Controls.Add(buttonDel);
|
||||
Controls.Add(buttonEdit);
|
||||
Controls.Add(buttonAdd);
|
||||
Controls.Add(dataGridView);
|
||||
Name = "FormShops";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Магазины";
|
||||
Load += FormShops_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridView;
|
||||
private Button buttonUpd;
|
||||
private Button buttonDel;
|
||||
private Button buttonEdit;
|
||||
private Button buttonAdd;
|
||||
}
|
||||
}
|
104
PrecastConcretePlant/PrecastConcretePlantView/FormShops.cs
Normal file
104
PrecastConcretePlant/PrecastConcretePlantView/FormShops.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using PrecastConcretePlantContracts.BindingModels;
|
||||
using PrecastConcretePlantContracts.BusinessLogicsContracts;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace PrecastConcretePlantView
|
||||
{
|
||||
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["ShopName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridView.Columns["ShopReinforceds"].Visible = false;
|
||||
}
|
||||
_logger.LogInformation("Shops loading");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Shops loading error");
|
||||
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 ButtonEdit_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 ButtonDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Deletion of shop");
|
||||
try
|
||||
{
|
||||
if (!_logic.Delete(new ShopBindingModel { Id = id }))
|
||||
{
|
||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Shop deletion error");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
120
PrecastConcretePlant/PrecastConcretePlantView/FormShops.resx
Normal file
120
PrecastConcretePlant/PrecastConcretePlantView/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,6 +28,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="ReportGroupedOrders.rdlc">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="ReportOrders.rdlc">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
@ -39,11 +39,13 @@ namespace PrecastConcretePlantView
|
||||
services.AddTransient<IComponentStorage, ComponentStorage>();
|
||||
services.AddTransient<IOrderStorage, OrderStorage>();
|
||||
services.AddTransient<IReinforcedStorage, ReinforcedStorage>();
|
||||
services.AddTransient<IShopStorage, ShopStorage>();
|
||||
services.AddTransient<IClientStorage, ClientStorage>();
|
||||
|
||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||
services.AddTransient<IReinforcedLogic, ReinforcedLogic>();
|
||||
services.AddTransient<IShopLogic, ShopLogic>();
|
||||
services.AddTransient<IReportLogic, ReportLogic>();
|
||||
services.AddTransient<IClientLogic, ClientLogic>();
|
||||
|
||||
@ -58,9 +60,19 @@ namespace PrecastConcretePlantView
|
||||
services.AddTransient<FormReinforced>();
|
||||
services.AddTransient<FormReinforcedComponent>();
|
||||
services.AddTransient<FormReinforceds>();
|
||||
|
||||
services.AddTransient<FormShop>();
|
||||
services.AddTransient<FormShops>();
|
||||
|
||||
services.AddTransient<FormShopReplenishment>();
|
||||
services.AddTransient<FormReinforcedSale>();
|
||||
|
||||
services.AddTransient<FormClients>();
|
||||
services.AddTransient<FormReportReinforcedComponents>();
|
||||
services.AddTransient<FormReportOrders>();
|
||||
|
||||
services.AddTransient<FormReportShopReinforceds>();
|
||||
services.AddTransient<FormReportGroupedOrders>();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,424 @@
|
||||
<?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="PrecastConcretePlantContractsViewModels">
|
||||
<ConnectionProperties>
|
||||
<DataProvider>System.Data.DataSet</DataProvider>
|
||||
<ConnectString>/* Local Connection */</ConnectString>
|
||||
</ConnectionProperties>
|
||||
<rd:DataSourceID>10791c83-cee8-4a38-bbd0-245fc17cefb3</rd:DataSourceID>
|
||||
</DataSource>
|
||||
</DataSources>
|
||||
<DataSets>
|
||||
<DataSet Name="DataSetOrders">
|
||||
<Query>
|
||||
<DataSourceName>PrecastConcretePlantContractsViewModels</DataSourceName>
|
||||
<CommandText>/* Local Query */</CommandText>
|
||||
</Query>
|
||||
<Fields>
|
||||
<Field Name="Date">
|
||||
<DataField>Date</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>PrecastConcretePlantContracts.ViewModels</rd:DataSetName>
|
||||
<rd:TableName>ReportOrdersByDateViewModel</rd:TableName>
|
||||
<rd:ObjectDataSourceType>PrecastConcretePlantContracts.ViewModels.ReportOrdersByDateViewModel, PrecastConcretePlantContracts, 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>21cm</Width>
|
||||
<Style>
|
||||
<Border>
|
||||
<Style>None</Style>
|
||||
</Border>
|
||||
<VerticalAlign>Middle</VerticalAlign>
|
||||
<PaddingLeft>2pt</PaddingLeft>
|
||||
<PaddingRight>2pt</PaddingRight>
|
||||
<PaddingTop>2pt</PaddingTop>
|
||||
<PaddingBottom>2pt</PaddingBottom>
|
||||
</Style>
|
||||
</Textbox>
|
||||
<Tablix Name="Tablix">
|
||||
<TablixBody>
|
||||
<TablixColumns>
|
||||
<TablixColumn>
|
||||
<Width>6.01401cm</Width>
|
||||
</TablixColumn>
|
||||
<TablixColumn>
|
||||
<Width>6.56042cm</Width>
|
||||
</TablixColumn>
|
||||
<TablixColumn>
|
||||
<Width>6.12687cm</Width>
|
||||
</TablixColumn>
|
||||
</TablixColumns>
|
||||
<TablixRows>
|
||||
<TablixRow>
|
||||
<Height>0.6cm</Height>
|
||||
<TablixCells>
|
||||
<TablixCell>
|
||||
<CellContents>
|
||||
<Textbox Name="TextboxDate">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>Дата</Value>
|
||||
<Style>
|
||||
<FontWeight>Bold</FontWeight>
|
||||
</Style>
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style />
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<rd:DefaultName>TextboxDate</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="TextboxCount">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>Количество заказов</Value>
|
||||
<Style>
|
||||
<FontWeight>Bold</FontWeight>
|
||||
</Style>
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style />
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<rd:DefaultName>TextboxCount</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="TextboxSum">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>Сумма</Value>
|
||||
<Style>
|
||||
<FontWeight>Bold</FontWeight>
|
||||
</Style>
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style />
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<rd:DefaultName>TextboxSum</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="Date">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>=Fields!Date.Value</Value>
|
||||
<Style>
|
||||
<Format>dd.MM.yyyy</Format>
|
||||
</Style>
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style />
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<rd:DefaultName>Date</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>DataSetOrders</DataSetName>
|
||||
<Top>1.95474cm</Top>
|
||||
<Left>1.16099cm</Left>
|
||||
<Height>1.2cm</Height>
|
||||
<Width>18.7013cm</Width>
|
||||
<ZIndex>1</ZIndex>
|
||||
<Style>
|
||||
<Border>
|
||||
<Style>Double</Style>
|
||||
</Border>
|
||||
</Style>
|
||||
</Tablix>
|
||||
<Textbox Name="TextboxTotal">
|
||||
<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>11.23542cm</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="TextboxTotalSum">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>=Sum(Fields!Sum.Value, "DataSetOrders")</Value>
|
||||
<Style>
|
||||
<FontWeight>Bold</FontWeight>
|
||||
</Style>
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style>
|
||||
<TextAlign>Right</TextAlign>
|
||||
</Style>
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<Top>4cm</Top>
|
||||
<Left>13.73542cm</Left>
|
||||
<Height>0.6cm</Height>
|
||||
<Width>6.12687cm</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.72875cm</Height>
|
||||
<Style />
|
||||
</Body>
|
||||
<Width>21cm</Width>
|
||||
<Page>
|
||||
<PageHeight>29.7cm</PageHeight>
|
||||
<PageWidth>21cm</PageWidth>
|
||||
<LeftMargin>2cm</LeftMargin>
|
||||
<RightMargin>2cm</RightMargin>
|
||||
<TopMargin>2cm</TopMargin>
|
||||
<BottomMargin>2cm</BottomMargin>
|
||||
<ColumnSpacing>0.13cm</ColumnSpacing>
|
||||
<Style />
|
||||
</Page>
|
||||
</ReportSection>
|
||||
</ReportSections>
|
||||
<ReportParameters>
|
||||
<ReportParameter Name="ReportParameterPeriod">
|
||||
<DataType>String</DataType>
|
||||
<Nullable>true</Nullable>
|
||||
<Prompt>ReportParameter1</Prompt>
|
||||
</ReportParameter>
|
||||
</ReportParameters>
|
||||
<ReportParametersLayout>
|
||||
<GridLayoutDefinition>
|
||||
<NumberOfColumns>4</NumberOfColumns>
|
||||
<NumberOfRows>2</NumberOfRows>
|
||||
<CellDefinitions>
|
||||
<CellDefinition>
|
||||
<ColumnIndex>0</ColumnIndex>
|
||||
<RowIndex>0</RowIndex>
|
||||
<ParameterName>ReportParameterPeriod</ParameterName>
|
||||
</CellDefinition>
|
||||
</CellDefinitions>
|
||||
</GridLayoutDefinition>
|
||||
</ReportParametersLayout>
|
||||
<rd:ReportUnitType>Cm</rd:ReportUnitType>
|
||||
<rd:ReportID>2de0031a-4d17-449d-922d-d9fc54572312</rd:ReportID>
|
||||
</Report>
|
Loading…
Reference in New Issue
Block a user