diff --git a/ConfectionaryBusinessLogic/OfficePackage/AbstractSaveToExcel.cs b/ConfectionaryBusinessLogic/OfficePackage/AbstractSaveToExcel.cs
index 0ad8d41..6936437 100644
--- a/ConfectionaryBusinessLogic/OfficePackage/AbstractSaveToExcel.cs
+++ b/ConfectionaryBusinessLogic/OfficePackage/AbstractSaveToExcel.cs
@@ -14,7 +14,7 @@ namespace ConfectioneryBusinessLogic.OfficePackage
/// Создание отчета
///
///
- public void CreateReport(ExcelInfo info)
+ public void CreateReportShop(ExcelInfo info)
{
CreateExcel(info);
@@ -100,6 +100,77 @@ namespace ConfectioneryBusinessLogic.OfficePackage
SaveExcel(info);
}
+ public void CreateReportPastry(ExcelInfoPastry info)
+ {
+ CreateExcel(new() { FileName = info.FileName });
+
+ InsertCellInWorksheet(new ExcelCellParameters
+ {
+ ColumnName = "A",
+ RowIndex = 1,
+ Text = info.Title,
+ StyleInfo = ExcelStyleInfoType.Title
+ });
+
+ MergeCells(new ExcelMergeParameters
+ {
+ CellFromName = "A1",
+ CellToName = "C1"
+ });
+
+ uint rowIndex = 2;
+ foreach (var pc in info.PastryComponents)
+ {
+ InsertCellInWorksheet(new ExcelCellParameters
+ {
+ ColumnName = "A",
+ RowIndex = rowIndex,
+ Text = pc.PastryName,
+ StyleInfo = ExcelStyleInfoType.Text
+ });
+ rowIndex++;
+
+ foreach (var (Pastry, Count) in pc.Components)
+ {
+ InsertCellInWorksheet(new ExcelCellParameters
+ {
+ ColumnName = "B",
+ RowIndex = rowIndex,
+ Text = Pastry,
+ StyleInfo = ExcelStyleInfoType.TextWithBroder
+ });
+
+ InsertCellInWorksheet(new ExcelCellParameters
+ {
+ ColumnName = "C",
+ RowIndex = rowIndex,
+ Text = Count.ToString(),
+ StyleInfo = ExcelStyleInfoType.TextWithBroder
+ });
+
+ rowIndex++;
+ }
+
+ InsertCellInWorksheet(new ExcelCellParameters
+ {
+ ColumnName = "A",
+ RowIndex = rowIndex,
+ Text = "Итого",
+ StyleInfo = ExcelStyleInfoType.Text
+ });
+ InsertCellInWorksheet(new ExcelCellParameters
+ {
+ ColumnName = "C",
+ RowIndex = rowIndex,
+ Text = pc.TotalCount.ToString(),
+ StyleInfo = ExcelStyleInfoType.Text
+ });
+ rowIndex++;
+ }
+
+ SaveExcel(new());
+ }
+
///
/// Создание excel-файла
///
diff --git a/ConfectionaryBusinessLogic/OfficePackage/AbstractSaveToPdf.cs b/ConfectionaryBusinessLogic/OfficePackage/AbstractSaveToPdf.cs
index 3086250..61699c5 100644
--- a/ConfectionaryBusinessLogic/OfficePackage/AbstractSaveToPdf.cs
+++ b/ConfectionaryBusinessLogic/OfficePackage/AbstractSaveToPdf.cs
@@ -41,6 +41,40 @@ namespace ConfectioneryBusinessLogic.OfficePackage
SavePdf(info);
}
+ public void CreateDocOrders(PdfInfoOrders info)
+ {
+ CreatePdf(info);
+ CreateParagraph(new PdfParagraph { Text = info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center });
+ CreateParagraph(new PdfParagraph
+ {
+ Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}",
+ Style = "Normal",
+ ParagraphAlignment = PdfParagraphAlignmentType.Center
+ });
+
+ CreateTable(new List { "2cm", "3cm", "6cm", "4cm", "3cm" });
+
+ CreateRow(new PdfRowParameters
+ {
+ Texts = new List { "Номер", "Дата заказа", "Изделие", "Статус заказа", "Сумма" },
+ Style = "NormalTitle",
+ ParagraphAlignment = PdfParagraphAlignmentType.Center
+ });
+
+ foreach (var order in info.Orders)
+ {
+ CreateRow(new PdfRowParameters
+ {
+ Texts = new List { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.PastryName, Convert.ToString(order.OrderStatus), order.Sum.ToString() },
+ Style = "Normal",
+ ParagraphAlignment = PdfParagraphAlignmentType.Left
+ });
+ }
+ CreateParagraph(new PdfParagraph { Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Rigth });
+
+ SavePdf(info);
+ }
+
///
/// Создание doc-файла
///
diff --git a/ConfectionaryBusinessLogic/OfficePackage/AbstractSaveToWord.cs b/ConfectionaryBusinessLogic/OfficePackage/AbstractSaveToWord.cs
index 1e72c44..605f9b7 100644
--- a/ConfectionaryBusinessLogic/OfficePackage/AbstractSaveToWord.cs
+++ b/ConfectionaryBusinessLogic/OfficePackage/AbstractSaveToWord.cs
@@ -10,7 +10,7 @@ namespace ConfectioneryBusinessLogic.OfficePackage
{
public abstract class AbstractSaveToWord
{
- public void CreateDoc(WordInfo info)
+ public void CreateDocTable(WordInfoTable info)
{
CreateWord(info);
@@ -42,11 +42,45 @@ namespace ConfectioneryBusinessLogic.OfficePackage
SaveWord(info);
}
+ public void CreateDoc(WordInfo info)
+ {
+ CreateWord(new() { FileName = info.FileName });
+
+ CreateParagraph(new WordParagraph
+ {
+ Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
+ TextProperties = new WordTextProperties
+ {
+ Size = "24",
+ JustificationType = WordJustificationType.Center
+ }
+ });
+
+ foreach (var pastry in info.Pastries)
+ {
+ CreateParagraph(new WordParagraph
+ {
+ Texts = new List<(string, WordTextProperties)>
+ {
+ (pastry.PastryName , new WordTextProperties { Size = "24", Bold = true}),
+ (" - цена: " + pastry.Price.ToString(), new WordTextProperties { Size = "24" })
+ },
+ TextProperties = new WordTextProperties
+ {
+ Size = "24",
+ JustificationType = WordJustificationType.Both
+ }
+ });
+ }
+
+ SaveWord(new());
+ }
+
///
/// Создание doc-файла
///
///
- protected abstract void CreateWord(WordInfo info);
+ protected abstract void CreateWord(WordInfoTable info);
///
/// Создание абзаца с текстом
@@ -66,6 +100,6 @@ namespace ConfectioneryBusinessLogic.OfficePackage
/// Сохранение файла
///
///
- protected abstract void SaveWord(WordInfo info);
+ protected abstract void SaveWord(WordInfoTable info);
}
}
diff --git a/ConfectionaryBusinessLogic/OfficePackage/HelperModels/ExcelInfoPastry.cs b/ConfectionaryBusinessLogic/OfficePackage/HelperModels/ExcelInfoPastry.cs
new file mode 100644
index 0000000..0ff7fa4
--- /dev/null
+++ b/ConfectionaryBusinessLogic/OfficePackage/HelperModels/ExcelInfoPastry.cs
@@ -0,0 +1,20 @@
+using ConfectioneryContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ConfectioneryBusinessLogic.OfficePackage.HelperModels
+{
+ public class ExcelInfoPastry
+ {
+ public string FileName { get; set; } = string.Empty;
+ public string Title { get; set; } = string.Empty;
+ public List PastryComponents
+ {
+ get;
+ set;
+ } = new();
+ }
+}
diff --git a/ConfectionaryBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs b/ConfectionaryBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs
index 8808b04..5e1ca7d 100644
--- a/ConfectionaryBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs
+++ b/ConfectionaryBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs
@@ -13,6 +13,6 @@ namespace ConfectioneryBusinessLogic.OfficePackage.HelperModels
public string Title { get; set; } = string.Empty;
public DateTime DateFrom { get; set; }
public DateTime DateTo { get; set; }
- public List Orders { get; set; } = new();
+ public List Orders { get; set; } = new();
}
}
diff --git a/ConfectionaryBusinessLogic/OfficePackage/HelperModels/PdfInfoOrders.cs b/ConfectionaryBusinessLogic/OfficePackage/HelperModels/PdfInfoOrders.cs
new file mode 100644
index 0000000..373da43
--- /dev/null
+++ b/ConfectionaryBusinessLogic/OfficePackage/HelperModels/PdfInfoOrders.cs
@@ -0,0 +1,29 @@
+using ConfectioneryContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ConfectioneryBusinessLogic.OfficePackage.HelperModels
+{
+ public class PdfInfoOrders
+ {
+ public string FileName { get; set; } = string.Empty;
+ public string Title { get; set; } = string.Empty;
+ public DateTime DateFrom { get; set; }
+ public DateTime DateTo { get; set; }
+ public List Orders { get; set; } = new();
+
+ public static implicit operator PdfInfo(PdfInfoOrders orders)
+ {
+ return new PdfInfo()
+ {
+ DateFrom = orders.DateFrom,
+ DateTo = orders.DateTo,
+ FileName = orders.FileName,
+ Title = orders.Title
+ };
+ }
+ }
+}
diff --git a/ConfectionaryBusinessLogic/OfficePackage/HelperModels/WordInfo.cs b/ConfectionaryBusinessLogic/OfficePackage/HelperModels/WordInfo.cs
index b3846a7..9ed9df6 100644
--- a/ConfectionaryBusinessLogic/OfficePackage/HelperModels/WordInfo.cs
+++ b/ConfectionaryBusinessLogic/OfficePackage/HelperModels/WordInfo.cs
@@ -1,9 +1,4 @@
using ConfectioneryContracts.ViewModels;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace ConfectioneryBusinessLogic.OfficePackage.HelperModels
{
@@ -11,6 +6,7 @@ namespace ConfectioneryBusinessLogic.OfficePackage.HelperModels
{
public string FileName { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;
+ public List Pastries { get; set; } = new();
public List Shops { get; set; } = new();
}
}
diff --git a/ConfectionaryBusinessLogic/OfficePackage/HelperModels/WordInfoTable.cs b/ConfectionaryBusinessLogic/OfficePackage/HelperModels/WordInfoTable.cs
new file mode 100644
index 0000000..32f9502
--- /dev/null
+++ b/ConfectionaryBusinessLogic/OfficePackage/HelperModels/WordInfoTable.cs
@@ -0,0 +1,16 @@
+using ConfectioneryContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ConfectioneryBusinessLogic.OfficePackage.HelperModels
+{
+ public class WordInfoTable
+ {
+ public string FileName { get; set; } = string.Empty;
+ public string Title { get; set; } = string.Empty;
+ public List Shops { get; set; } = new();
+ }
+}
diff --git a/ConfectionaryBusinessLogic/OfficePackage/Implements/SaveToWord.cs b/ConfectionaryBusinessLogic/OfficePackage/Implements/SaveToWord.cs
index af6a547..f733b5c 100644
--- a/ConfectionaryBusinessLogic/OfficePackage/Implements/SaveToWord.cs
+++ b/ConfectionaryBusinessLogic/OfficePackage/Implements/SaveToWord.cs
@@ -81,7 +81,7 @@ namespace ConfectioneryBusinessLogic.OfficePackage.Implements
return properties;
}
- protected override void CreateWord(WordInfo info)
+ protected override void CreateWord(WordInfoTable info)
{
_wordDocument = WordprocessingDocument.Create(info.FileName, WordprocessingDocumentType.Document);
MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart();
@@ -119,7 +119,7 @@ namespace ConfectioneryBusinessLogic.OfficePackage.Implements
_docBody.AppendChild(docParagraph);
}
- protected override void SaveWord(WordInfo info)
+ protected override void SaveWord(WordInfoTable info)
{
if (_docBody == null || _wordDocument == null)
{
diff --git a/ConfectionaryBusinessLogic/ReportLogic.cs b/ConfectionaryBusinessLogic/ReportLogic.cs
index e21732c..35427e3 100644
--- a/ConfectionaryBusinessLogic/ReportLogic.cs
+++ b/ConfectionaryBusinessLogic/ReportLogic.cs
@@ -15,6 +15,7 @@ namespace ConfectioneryBusinessLogic
private readonly IOrderStorage _orderStorage;
private readonly IShopStorage _shopStorage;
+ private readonly IComponentStorage _componentStorage;
private readonly AbstractSaveToExcel _saveToExcel;
@@ -22,9 +23,10 @@ namespace ConfectioneryBusinessLogic
private readonly AbstractSaveToPdf _saveToPdf;
- public ReportLogic(IPastryStorage PastryStorage, IOrderStorage orderStorage, IShopStorage shopStorage,
+ public ReportLogic(IPastryStorage PastryStorage, IOrderStorage orderStorage, IShopStorage shopStorage, IComponentStorage componentStorage,
AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
{
+ _componentStorage = componentStorage;
_pastryStorage = PastryStorage;
_orderStorage = orderStorage;
_shopStorage = shopStorage;
@@ -69,16 +71,70 @@ namespace ConfectioneryBusinessLogic
return list;
}
+ ///
+ /// Получение списка компонент с указанием, в каких изделиях используются
+ ///
+ ///
+ public List GetPastryComponent()
+ {
+ var components = _componentStorage.GetFullList();
+
+ var pastries = _pastryStorage.GetFullList();
+
+ var list = new List();
+
+ foreach (var pastry in pastries)
+ {
+ var record = new ReportPastryComponentViewModel
+ {
+ PastryName = pastry.PastryName,
+ Components = new List>(),
+ TotalCount = 0
+ };
+ foreach (var component in components)
+ {
+ if (pastry.PastryComponents.ContainsKey(component.Id))
+ {
+ record.Components.Add(new(component.ComponentName, pastry.PastryComponents[component.Id].Item2));
+ record.TotalCount += pastry.PastryComponents[component.Id].Item2;
+ }
+ }
+
+ list.Add(record);
+ }
+
+ return list;
+ }
+
///
/// Получение списка заказов за определенный период
///
///
///
public List GetOrders(ReportBindingModel model)
+ {
+ return _orderStorage.GetFilteredList(new OrderSearchModel { DateFrom = model.DateFrom, DateTo = model.DateTo })
+ .Select(x => new ReportOrdersViewModel
+ {
+ Id = x.Id,
+ DateCreate = x.DateCreate,
+ PastryName = x.PastryName,
+ OrderStatus = Convert.ToString(x.Status) ?? string.Empty,
+ Sum = x.Sum
+ })
+ .ToList();
+ }
+
+ ///
+ /// Получение списка заказов за определенный период
+ ///
+ ///
+ ///
+ public List GetGroupOrders(ReportBindingModel model)
{
return _orderStorage.GetFullList()
.GroupBy(x => x.DateCreate.Date)
- .Select(x => new ReportOrdersViewModel
+ .Select(x => new ReportGroupOrdersViewModel
{
Date = x.Key,
Count = x.Count(),
@@ -91,9 +147,9 @@ namespace ConfectioneryBusinessLogic
/// Сохранение магазинов в файл-Word
///
///
- public void SaveShopsToWordFile(ReportBindingModel model)
+ public void SaveShopsTableToWordFile(ReportBindingModel model)
{
- _saveToWord.CreateDoc(new WordInfo
+ _saveToWord.CreateDocTable(new WordInfoTable
{
FileName = model.FileName,
Title = "Список магазинов",
@@ -101,13 +157,25 @@ namespace ConfectioneryBusinessLogic
});
}
+ public void SavePastriesToWordFile(ReportBindingModel model)
+ {
+ _saveToWord.CreateDoc(new WordInfo
+ {
+ FileName = model.FileName,
+ Title = "Список изделий",
+ Pastries = _pastryStorage.GetFullList()
+ });
+ }
+
+
+
///
/// Сохранение магазинов с указаеним продуктов в файл-Excel
///
///
public void SaveShopPastryToExcelFile(ReportBindingModel model)
{
- _saveToExcel.CreateReport(new ExcelInfo
+ _saveToExcel.CreateReportShop(new ExcelInfo
{
FileName = model.FileName,
Title = "Список магазинов",
@@ -115,20 +183,46 @@ namespace ConfectioneryBusinessLogic
});
}
+ public void SavePastryComponentToExcelFile(ReportBindingModel model)
+ {
+ _saveToExcel.CreateReportPastry(new ExcelInfoPastry
+ {
+ FileName = model.FileName,
+ Title = "Список изделий по компонентам",
+ PastryComponents = GetPastryComponent(),
+ });
+ }
+
+ ///
+ /// Сохранение заказов в файл-Pdf
+ ///
+ ///
+ public void SaveGroupOrdersToPdfFile(ReportBindingModel model)
+ {
+ _saveToPdf.CreateDoc(new PdfInfo
+ {
+ FileName = model.FileName,
+ Title = "Список сгруппированных заказов по датам",
+ DateFrom = model.DateFrom!.Value,
+ DateTo = model.DateTo!.Value,
+ Orders = GetGroupOrders(model)
+ });
+ }
///
/// Сохранение заказов в файл-Pdf
///
///
public void SaveOrdersToPdfFile(ReportBindingModel model)
{
- _saveToPdf.CreateDoc(new PdfInfo
+ _saveToPdf.CreateDocOrders(new PdfInfoOrders
{
FileName = model.FileName,
Title = "Список заказов",
DateFrom = model.DateFrom!.Value,
DateTo = model.DateTo!.Value,
- Orders = GetOrders(model)
+ Orders = GetOrders(model),
});
}
+
}
}
diff --git a/Confectionery/ConfectioneryView.csproj b/Confectionery/ConfectioneryView.csproj
index 463a255..4b33b8e 100644
--- a/Confectionery/ConfectioneryView.csproj
+++ b/Confectionery/ConfectioneryView.csproj
@@ -27,9 +27,12 @@
-
+
PreserveNewest
+
+ Always
+
\ No newline at end of file
diff --git a/Confectionery/FormMain.Designer.cs b/Confectionery/FormMain.Designer.cs
index be4ea31..df667a4 100644
--- a/Confectionery/FormMain.Designer.cs
+++ b/Confectionery/FormMain.Designer.cs
@@ -1,249 +1,276 @@
namespace ConfectioneryView
{
- partial class FormMain
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
+ partial class FormMain
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
- #region Windows Form Designer generated code
+ #region Windows Form Designer generated code
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- menuStrip1 = new MenuStrip();
- справочникиToolStripMenuItem = new ToolStripMenuItem();
- pastryToolStripMenuItem = new ToolStripMenuItem();
- componentToolStripMenuItem = new ToolStripMenuItem();
- ShopsToolStripMenuItem = new ToolStripMenuItem();
- reportsToolStripMenuItem = new ToolStripMenuItem();
- reportShopsToolStripMenuItem = new ToolStripMenuItem();
- ShopPastriesToolStripMenuItem = new ToolStripMenuItem();
- ordersToolStripMenuItem = new ToolStripMenuItem();
- dataGridView = new DataGridView();
- buttonCreateOrder = new Button();
- buttonTakeOrderInWork = new Button();
- button2 = new Button();
- button3 = new Button();
- button4 = new Button();
- buttonAddPastryInShop = new Button();
- buttonSellPastry = new Button();
- menuStrip1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
- SuspendLayout();
- //
- // menuStrip1
- //
- menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, reportsToolStripMenuItem });
- menuStrip1.Location = new Point(0, 0);
- menuStrip1.Name = "menuStrip1";
- menuStrip1.Size = new Size(783, 24);
- menuStrip1.TabIndex = 0;
- menuStrip1.Text = "menuStrip1";
- //
- // справочникиToolStripMenuItem
- //
- справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { pastryToolStripMenuItem, componentToolStripMenuItem, ShopsToolStripMenuItem });
- справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
- справочникиToolStripMenuItem.Size = new Size(94, 20);
- справочникиToolStripMenuItem.Text = "Справочники";
- //
- // pastryToolStripMenuItem
- //
- pastryToolStripMenuItem.Name = "pastryToolStripMenuItem";
- pastryToolStripMenuItem.Size = new Size(145, 22);
- pastryToolStripMenuItem.Text = "Изделия";
- pastryToolStripMenuItem.Click += PastryToolStripMenuItem_Click;
- //
- // componentToolStripMenuItem
- //
- componentToolStripMenuItem.Name = "componentToolStripMenuItem";
- componentToolStripMenuItem.Size = new Size(145, 22);
- componentToolStripMenuItem.Text = "Компоненты";
- componentToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click;
- //
- // ShopsToolStripMenuItem
- //
- ShopsToolStripMenuItem.Name = "ShopsToolStripMenuItem";
- ShopsToolStripMenuItem.Size = new Size(145, 22);
- ShopsToolStripMenuItem.Text = "Магазины";
- ShopsToolStripMenuItem.Click += ShopsToolStripMenuItem_Click;
- //
- // reportsToolStripMenuItem
- //
- reportsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { reportShopsToolStripMenuItem, ShopPastriesToolStripMenuItem, ordersToolStripMenuItem });
- reportsToolStripMenuItem.Name = "reportsToolStripMenuItem";
- reportsToolStripMenuItem.Size = new Size(60, 20);
- reportsToolStripMenuItem.Text = "Отчеты";
- //
- // reportShopsToolStripMenuItem
- //
- reportShopsToolStripMenuItem.Name = "reportShopsToolStripMenuItem";
- reportShopsToolStripMenuItem.Size = new Size(202, 22);
- reportShopsToolStripMenuItem.Text = "Список магазинов";
- reportShopsToolStripMenuItem.Click += ReportShopsToolStripMenuItem_Click;
- //
- // ShopPastriesToolStripMenuItem
- //
- ShopPastriesToolStripMenuItem.Name = "ShopPastriesToolStripMenuItem";
- ShopPastriesToolStripMenuItem.Size = new Size(202, 22);
- ShopPastriesToolStripMenuItem.Text = "Магазины с изделиями";
- ShopPastriesToolStripMenuItem.Click += ShopPastriesToolStripMenuItem_Click;
- //
- // ordersToolStripMenuItem
- //
- ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
- ordersToolStripMenuItem.Size = new Size(202, 22);
- ordersToolStripMenuItem.Text = "Список заказов";
- ordersToolStripMenuItem.Click += OrdersToolStripMenuItem_Click;
- //
- // dataGridView
- //
- dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
- dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- dataGridView.Location = new Point(12, 27);
- dataGridView.Name = "dataGridView";
- dataGridView.RowTemplate.Height = 25;
- dataGridView.Size = new Size(606, 399);
- dataGridView.TabIndex = 1;
- //
- // buttonCreateOrder
- //
- buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
- buttonCreateOrder.Location = new Point(624, 39);
- buttonCreateOrder.Name = "buttonCreateOrder";
- buttonCreateOrder.Size = new Size(147, 32);
- buttonCreateOrder.TabIndex = 2;
- buttonCreateOrder.Text = "Создать заказ";
- buttonCreateOrder.UseVisualStyleBackColor = true;
- buttonCreateOrder.Click += ButtonCreateOrder_Click;
- //
- // buttonTakeOrderInWork
- //
- buttonTakeOrderInWork.Anchor = AnchorStyles.Top | AnchorStyles.Right;
- buttonTakeOrderInWork.Location = new Point(624, 98);
- buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
- buttonTakeOrderInWork.Size = new Size(147, 32);
- buttonTakeOrderInWork.TabIndex = 3;
- buttonTakeOrderInWork.Text = "Отдать на выполнение";
- buttonTakeOrderInWork.UseVisualStyleBackColor = true;
- buttonTakeOrderInWork.Click += ButtonTakeOrderInWork_Click;
- //
- // button2
- //
- button2.Anchor = AnchorStyles.Top | AnchorStyles.Right;
- button2.Location = new Point(624, 157);
- button2.Name = "button2";
- button2.Size = new Size(147, 32);
- button2.TabIndex = 4;
- button2.Text = "Заказ готов";
- button2.UseVisualStyleBackColor = true;
- button2.Click += ButtonOrderReady_Click;
- //
- // button3
- //
- button3.Anchor = AnchorStyles.Top | AnchorStyles.Right;
- button3.Location = new Point(624, 215);
- button3.Name = "button3";
- button3.Size = new Size(147, 32);
- button3.TabIndex = 5;
- button3.Text = "Заказ выдан";
- button3.UseVisualStyleBackColor = true;
- button3.Click += ButtonIssuedOrder_Click;
- //
- // button4
- //
- button4.Anchor = AnchorStyles.Top | AnchorStyles.Right;
- button4.Location = new Point(624, 274);
- button4.Name = "button4";
- button4.Size = new Size(147, 32);
- button4.TabIndex = 6;
- button4.Text = "Обновить список";
- button4.UseVisualStyleBackColor = true;
- button4.Click += ButtonRef_Click;
- //
- // buttonAddPastryInShop
- //
- buttonAddPastryInShop.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
- buttonAddPastryInShop.Location = new Point(624, 384);
- buttonAddPastryInShop.Name = "buttonAddPastryInShop";
- buttonAddPastryInShop.Size = new Size(147, 31);
- buttonAddPastryInShop.TabIndex = 7;
- buttonAddPastryInShop.Text = "Пополнение магазина";
- buttonAddPastryInShop.UseVisualStyleBackColor = true;
- buttonAddPastryInShop.Click += ButtonAddPastryInShop_Click;
- //
- // buttonSellPastry
- //
- buttonSellPastry.Anchor = AnchorStyles.Top | AnchorStyles.Right;
- buttonSellPastry.Location = new Point(624, 331);
- buttonSellPastry.Name = "buttonSellPastry";
- buttonSellPastry.Size = new Size(147, 31);
- buttonSellPastry.TabIndex = 8;
- buttonSellPastry.Text = "Продать изделие";
- buttonSellPastry.UseVisualStyleBackColor = true;
- buttonSellPastry.Click += ButtonSellPastry_Click;
- //
- // FormMain
- //
- AutoScaleDimensions = new SizeF(7F, 15F);
- AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(783, 438);
- Controls.Add(buttonSellPastry);
- Controls.Add(buttonAddPastryInShop);
- Controls.Add(button4);
- Controls.Add(button3);
- Controls.Add(button2);
- Controls.Add(buttonTakeOrderInWork);
- Controls.Add(buttonCreateOrder);
- Controls.Add(dataGridView);
- Controls.Add(menuStrip1);
- MainMenuStrip = menuStrip1;
- Name = "FormMain";
- Text = "Кондитерская";
- Load += FormMain_Load;
- menuStrip1.ResumeLayout(false);
- menuStrip1.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
- ResumeLayout(false);
- PerformLayout();
- }
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ menuStrip1 = new MenuStrip();
+ справочникиToolStripMenuItem = new ToolStripMenuItem();
+ pastryToolStripMenuItem = new ToolStripMenuItem();
+ componentToolStripMenuItem = new ToolStripMenuItem();
+ ShopsToolStripMenuItem = new ToolStripMenuItem();
+ reportsToolStripMenuItem = new ToolStripMenuItem();
+ reportShopsToolStripMenuItem = new ToolStripMenuItem();
+ ShopPastriesToolStripMenuItem = new ToolStripMenuItem();
+ groupOrdersToolStripMenuItem = new ToolStripMenuItem();
+ pastriesToolStripMenuItem = new ToolStripMenuItem();
+ pastryComponentsToolStripMenuItem = new ToolStripMenuItem();
+ ordersToolStripMenuItem = new ToolStripMenuItem();
+ dataGridView = new DataGridView();
+ buttonCreateOrder = new Button();
+ buttonTakeOrderInWork = new Button();
+ button2 = new Button();
+ button3 = new Button();
+ button4 = new Button();
+ buttonAddPastryInShop = new Button();
+ buttonSellPastry = new Button();
+ menuStrip1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
+ SuspendLayout();
+ //
+ // menuStrip1
+ //
+ menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, reportsToolStripMenuItem });
+ menuStrip1.Location = new Point(0, 0);
+ menuStrip1.Name = "menuStrip1";
+ menuStrip1.Size = new Size(783, 24);
+ menuStrip1.TabIndex = 0;
+ menuStrip1.Text = "menuStrip1";
+ //
+ // справочникиToolStripMenuItem
+ //
+ справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { pastryToolStripMenuItem, componentToolStripMenuItem, ShopsToolStripMenuItem });
+ справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
+ справочникиToolStripMenuItem.Size = new Size(94, 20);
+ справочникиToolStripMenuItem.Text = "Справочники";
+ //
+ // pastryToolStripMenuItem
+ //
+ pastryToolStripMenuItem.Name = "pastryToolStripMenuItem";
+ pastryToolStripMenuItem.Size = new Size(145, 22);
+ pastryToolStripMenuItem.Text = "Изделия";
+ pastryToolStripMenuItem.Click += PastryToolStripMenuItem_Click;
+ //
+ // componentToolStripMenuItem
+ //
+ componentToolStripMenuItem.Name = "componentToolStripMenuItem";
+ componentToolStripMenuItem.Size = new Size(145, 22);
+ componentToolStripMenuItem.Text = "Компоненты";
+ componentToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click;
+ //
+ // ShopsToolStripMenuItem
+ //
+ ShopsToolStripMenuItem.Name = "ShopsToolStripMenuItem";
+ ShopsToolStripMenuItem.Size = new Size(145, 22);
+ ShopsToolStripMenuItem.Text = "Магазины";
+ ShopsToolStripMenuItem.Click += ShopsToolStripMenuItem_Click;
+ //
+ // reportsToolStripMenuItem
+ //
+ reportsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { reportShopsToolStripMenuItem, ShopPastriesToolStripMenuItem, groupOrdersToolStripMenuItem, pastriesToolStripMenuItem, pastryComponentsToolStripMenuItem, ordersToolStripMenuItem });
+ reportsToolStripMenuItem.Name = "reportsToolStripMenuItem";
+ reportsToolStripMenuItem.Size = new Size(60, 20);
+ reportsToolStripMenuItem.Text = "Отчеты";
+ //
+ // reportShopsToolStripMenuItem
+ //
+ reportShopsToolStripMenuItem.Name = "reportShopsToolStripMenuItem";
+ reportShopsToolStripMenuItem.Size = new Size(215, 22);
+ reportShopsToolStripMenuItem.Text = "Список магазинов";
+ reportShopsToolStripMenuItem.Click += ReportShopsToolStripMenuItem_Click;
+ //
+ // ShopPastriesToolStripMenuItem
+ //
+ ShopPastriesToolStripMenuItem.Name = "ShopPastriesToolStripMenuItem";
+ ShopPastriesToolStripMenuItem.Size = new Size(215, 22);
+ ShopPastriesToolStripMenuItem.Text = "Магазины с изделиями";
+ ShopPastriesToolStripMenuItem.Click += ShopPastriesToolStripMenuItem_Click;
+ //
+ // groupOrdersToolStripMenuItem
+ //
+ groupOrdersToolStripMenuItem.Name = "groupOrdersToolStripMenuItem";
+ groupOrdersToolStripMenuItem.Size = new Size(215, 22);
+ groupOrdersToolStripMenuItem.Text = "Список групп заказов";
+ groupOrdersToolStripMenuItem.Click += GroupOrdersToolStripMenuItem_Click;
+ //
+ // pastriesToolStripMenuItem
+ //
+ pastriesToolStripMenuItem.Name = "pastriesToolStripMenuItem";
+ pastriesToolStripMenuItem.Size = new Size(215, 22);
+ pastriesToolStripMenuItem.Text = "Список изделий";
+ pastriesToolStripMenuItem.Click += PastriesToolStripMenuItem_Click;
+ //
+ // pastryComponentsToolStripMenuItem
+ //
+ pastryComponentsToolStripMenuItem.Name = "pastryComponentsToolStripMenuItem";
+ pastryComponentsToolStripMenuItem.Size = new Size(215, 22);
+ pastryComponentsToolStripMenuItem.Text = "Изделия с компонентами";
+ pastryComponentsToolStripMenuItem.Click += PastryComponentsToolStripMenuItem_Click;
+ //
+ // ordersToolStripMenuItem
+ //
+ ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
+ ordersToolStripMenuItem.Size = new Size(215, 22);
+ ordersToolStripMenuItem.Text = "Список заказов";
+ ordersToolStripMenuItem.Click += OrdersToolStripMenuItem_Click;
+ //
+ // dataGridView
+ //
+ dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+ dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dataGridView.Location = new Point(12, 27);
+ dataGridView.Name = "dataGridView";
+ dataGridView.RowTemplate.Height = 25;
+ dataGridView.Size = new Size(606, 399);
+ dataGridView.TabIndex = 1;
+ //
+ // buttonCreateOrder
+ //
+ buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
+ buttonCreateOrder.Location = new Point(624, 39);
+ buttonCreateOrder.Name = "buttonCreateOrder";
+ buttonCreateOrder.Size = new Size(147, 32);
+ buttonCreateOrder.TabIndex = 2;
+ buttonCreateOrder.Text = "Создать заказ";
+ buttonCreateOrder.UseVisualStyleBackColor = true;
+ buttonCreateOrder.Click += ButtonCreateOrder_Click;
+ //
+ // buttonTakeOrderInWork
+ //
+ buttonTakeOrderInWork.Anchor = AnchorStyles.Top | AnchorStyles.Right;
+ buttonTakeOrderInWork.Location = new Point(624, 98);
+ buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
+ buttonTakeOrderInWork.Size = new Size(147, 32);
+ buttonTakeOrderInWork.TabIndex = 3;
+ buttonTakeOrderInWork.Text = "Отдать на выполнение";
+ buttonTakeOrderInWork.UseVisualStyleBackColor = true;
+ buttonTakeOrderInWork.Click += ButtonTakeOrderInWork_Click;
+ //
+ // button2
+ //
+ button2.Anchor = AnchorStyles.Top | AnchorStyles.Right;
+ button2.Location = new Point(624, 157);
+ button2.Name = "button2";
+ button2.Size = new Size(147, 32);
+ button2.TabIndex = 4;
+ button2.Text = "Заказ готов";
+ button2.UseVisualStyleBackColor = true;
+ button2.Click += ButtonOrderReady_Click;
+ //
+ // button3
+ //
+ button3.Anchor = AnchorStyles.Top | AnchorStyles.Right;
+ button3.Location = new Point(624, 215);
+ button3.Name = "button3";
+ button3.Size = new Size(147, 32);
+ button3.TabIndex = 5;
+ button3.Text = "Заказ выдан";
+ button3.UseVisualStyleBackColor = true;
+ button3.Click += ButtonIssuedOrder_Click;
+ //
+ // button4
+ //
+ button4.Anchor = AnchorStyles.Top | AnchorStyles.Right;
+ button4.Location = new Point(624, 274);
+ button4.Name = "button4";
+ button4.Size = new Size(147, 32);
+ button4.TabIndex = 6;
+ button4.Text = "Обновить список";
+ button4.UseVisualStyleBackColor = true;
+ button4.Click += ButtonRef_Click;
+ //
+ // buttonAddPastryInShop
+ //
+ buttonAddPastryInShop.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ buttonAddPastryInShop.Location = new Point(624, 384);
+ buttonAddPastryInShop.Name = "buttonAddPastryInShop";
+ buttonAddPastryInShop.Size = new Size(147, 31);
+ buttonAddPastryInShop.TabIndex = 7;
+ buttonAddPastryInShop.Text = "Пополнение магазина";
+ buttonAddPastryInShop.UseVisualStyleBackColor = true;
+ buttonAddPastryInShop.Click += ButtonAddPastryInShop_Click;
+ //
+ // buttonSellPastry
+ //
+ buttonSellPastry.Anchor = AnchorStyles.Top | AnchorStyles.Right;
+ buttonSellPastry.Location = new Point(624, 331);
+ buttonSellPastry.Name = "buttonSellPastry";
+ buttonSellPastry.Size = new Size(147, 31);
+ buttonSellPastry.TabIndex = 8;
+ buttonSellPastry.Text = "Продать изделие";
+ buttonSellPastry.UseVisualStyleBackColor = true;
+ buttonSellPastry.Click += ButtonSellPastry_Click;
+ //
+ // FormMain
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(783, 438);
+ Controls.Add(buttonSellPastry);
+ Controls.Add(buttonAddPastryInShop);
+ Controls.Add(button4);
+ Controls.Add(button3);
+ Controls.Add(button2);
+ Controls.Add(buttonTakeOrderInWork);
+ Controls.Add(buttonCreateOrder);
+ Controls.Add(dataGridView);
+ Controls.Add(menuStrip1);
+ MainMenuStrip = menuStrip1;
+ Name = "FormMain";
+ Text = "Кондитерская";
+ Load += FormMain_Load;
+ menuStrip1.ResumeLayout(false);
+ menuStrip1.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
+ ResumeLayout(false);
+ PerformLayout();
+ }
- #endregion
+ #endregion
- private MenuStrip menuStrip1;
- private ToolStripMenuItem справочникиToolStripMenuItem;
- private DataGridView dataGridView;
- private Button buttonCreateOrder;
- private Button buttonTakeOrderInWork;
- private Button button2;
- private Button button3;
- private Button button4;
- private ToolStripMenuItem pastryToolStripMenuItem;
- private ToolStripMenuItem componentToolStripMenuItem;
- private ToolStripMenuItem reportsToolStripMenuItem;
- private ToolStripMenuItem reportShopsToolStripMenuItem;
- private ToolStripMenuItem ShopPastriesToolStripMenuItem;
- private ToolStripMenuItem ordersToolStripMenuItem;
- private ToolStripMenuItem ShopsToolStripMenuItem;
- private Button buttonAddPastryInShop;
- private Button buttonSellPastry;
- }
+ private MenuStrip menuStrip1;
+ private ToolStripMenuItem справочникиToolStripMenuItem;
+ private DataGridView dataGridView;
+ private Button buttonCreateOrder;
+ private Button buttonTakeOrderInWork;
+ private Button button2;
+ private Button button3;
+ private Button button4;
+ private ToolStripMenuItem pastryToolStripMenuItem;
+ private ToolStripMenuItem componentToolStripMenuItem;
+ private ToolStripMenuItem reportsToolStripMenuItem;
+ private ToolStripMenuItem reportShopsToolStripMenuItem;
+ private ToolStripMenuItem ShopPastriesToolStripMenuItem;
+ private ToolStripMenuItem groupOrdersToolStripMenuItem;
+ private ToolStripMenuItem ShopsToolStripMenuItem;
+ private Button buttonAddPastryInShop;
+ private Button buttonSellPastry;
+ private ToolStripMenuItem pastriesToolStripMenuItem;
+ private ToolStripMenuItem pastryComponentsToolStripMenuItem;
+ private ToolStripMenuItem ordersToolStripMenuItem;
+ }
}
\ No newline at end of file
diff --git a/Confectionery/FormMain.cs b/Confectionery/FormMain.cs
index 24994e7..1285ef5 100644
--- a/Confectionery/FormMain.cs
+++ b/Confectionery/FormMain.cs
@@ -7,207 +7,236 @@ using System.Windows.Forms;
namespace ConfectioneryView
{
- public partial class FormMain : Form
- {
- private readonly ILogger _logger;
- private readonly IOrderLogic _orderLogic;
- private readonly IReportLogic _reportLogic;
+ public partial class FormMain : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IOrderLogic _orderLogic;
+ private readonly IReportLogic _reportLogic;
- public FormMain(ILogger logger, IOrderLogic orderLogic, IReportLogic reportLogic)
- {
- InitializeComponent();
- _logger = logger;
- _orderLogic = orderLogic;
- _reportLogic = reportLogic;
- }
- private void FormMain_Load(object sender, EventArgs e)
- {
- LoadData();
- }
- private void LoadData()
- {
- try
- {
- var list = _orderLogic.ReadList(null);
- if (list != null)
- {
- dataGridView.DataSource = list;
- dataGridView.Columns["Id"].HeaderText = " ";
- dataGridView.Columns["PastryId"].Visible = false;
- dataGridView.Columns["PastryName"].AutoSizeMode =
- DataGridViewAutoSizeColumnMode.Fill;
- }
- _logger.LogInformation(" ");
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, " ");
- MessageBox.Show(ex.Message, "", MessageBoxButtons.OK,
- MessageBoxIcon.Error);
- }
- }
- private void ComponentsToolStripMenuItem_Click(object sender, EventArgs
- e)
- {
- var service = Program.ServiceProvider?.GetService(typeof(FormComponents));
- if (service is FormComponents form)
- {
- form.ShowDialog();
- }
- }
- private void PastryToolStripMenuItem_Click(object sender, EventArgs e)
- {
- var service = Program.ServiceProvider?.GetService(typeof(FormViewPastry));
- if (service is FormViewPastry form)
- {
- form.ShowDialog();
- }
- }
+ public FormMain(ILogger logger, IOrderLogic orderLogic, IReportLogic reportLogic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _orderLogic = orderLogic;
+ _reportLogic = reportLogic;
+ }
+ private void FormMain_Load(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+ private void LoadData()
+ {
+ try
+ {
+ var list = _orderLogic.ReadList(null);
+ if (list != null)
+ {
+ dataGridView.DataSource = list;
+ dataGridView.Columns["Id"].HeaderText = " ";
+ dataGridView.Columns["PastryId"].Visible = false;
+ dataGridView.Columns["PastryName"].AutoSizeMode =
+ DataGridViewAutoSizeColumnMode.Fill;
+ }
+ _logger.LogInformation(" ");
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, " ");
+ MessageBox.Show(ex.Message, "", MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ }
+ }
+ private void ComponentsToolStripMenuItem_Click(object sender, EventArgs
+ e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormComponents));
+ if (service is FormComponents form)
+ {
+ form.ShowDialog();
+ }
+ }
+ private void PastryToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormViewPastry));
+ if (service is FormViewPastry form)
+ {
+ form.ShowDialog();
+ }
+ }
- private void ButtonCreateOrder_Click(object sender, EventArgs e)
- {
- var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
- if (service is FormCreateOrder form)
- {
- form.ShowDialog();
- LoadData();
- }
- }
+ private void ButtonCreateOrder_Click(object sender, EventArgs e)
+ {
+ 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(" No{id}. ' '", id);
- try
- {
- var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id });
- if (!operationResult)
- {
- throw new Exception(" . .");
- }
- LoadData();
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, " ");
- MessageBox.Show(ex.Message, "", MessageBoxButtons.OK,
- MessageBoxIcon.Error);
- }
- }
- }
- private void ButtonOrderReady_Click(object sender, EventArgs e)
- {
- if (dataGridView.SelectedRows.Count == 1)
- {
- int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
- OrderStatus orderStatus = (OrderStatus)dataGridView.SelectedRows[0].Cells["Status"].Value;
- _logger.LogInformation(" No{id}. ''", id);
- try
- {
- var operationResult = _orderLogic.FinishOrder(new OrderBindingModel
- {
- Id = id,
- Status = orderStatus
- });
- if (!operationResult)
- {
- throw new Exception(" . .");
- }
- LoadData();
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, " ");
- MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
- }
- private void ButtonIssuedOrder_Click(object sender, EventArgs e)
- {
- if (dataGridView.SelectedRows.Count == 1)
- {
- int id =
- Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
- _logger.LogInformation(" No{id}. ''", id);
- try
- {
- var operationResult = _orderLogic.DeliveryOrder(new
- OrderBindingModel
- { Id = id });
- if (!operationResult)
- {
- throw new Exception(" . .");
- }
- _logger.LogInformation(" No{id} ", id);
- LoadData();
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, " ");
- MessageBox.Show(ex.Message, "", MessageBoxButtons.OK,
- MessageBoxIcon.Error);
- }
- }
- }
- private void ButtonRef_Click(object sender, EventArgs e)
- {
- LoadData();
- }
+ private void ButtonTakeOrderInWork_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+ _logger.LogInformation(" No{id}. ' '", id);
+ try
+ {
+ var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id });
+ if (!operationResult)
+ {
+ throw new Exception(" . .");
+ }
+ LoadData();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, " ");
+ MessageBox.Show(ex.Message, "", MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ }
+ }
+ }
+ private void ButtonOrderReady_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+ OrderStatus orderStatus = (OrderStatus)dataGridView.SelectedRows[0].Cells["Status"].Value;
+ _logger.LogInformation(" No{id}. ''", id);
+ try
+ {
+ var operationResult = _orderLogic.FinishOrder(new OrderBindingModel
+ {
+ Id = id,
+ Status = orderStatus
+ });
+ if (!operationResult)
+ {
+ throw new Exception(" . .");
+ }
+ LoadData();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, " ");
+ MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+ private void ButtonIssuedOrder_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ int id =
+ Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+ _logger.LogInformation(" No{id}. ''", id);
+ try
+ {
+ var operationResult = _orderLogic.DeliveryOrder(new
+ OrderBindingModel
+ { Id = id });
+ if (!operationResult)
+ {
+ throw new Exception(" . .");
+ }
+ _logger.LogInformation(" No{id} ", id);
+ LoadData();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, " ");
+ MessageBox.Show(ex.Message, "", MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ }
+ }
+ }
+ private void ButtonRef_Click(object sender, EventArgs e)
+ {
+ LoadData();
+ }
- private void ReportShopsToolStripMenuItem_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 ReportShopsToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ _reportLogic.SaveShopsTableToWordFile(new ReportBindingModel { FileName = dialog.FileName });
+ MessageBox.Show("", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ }
- private void ShopPastriesToolStripMenuItem_Click(object sender, EventArgs e)
- {
- var service = Program.ServiceProvider?.GetService(typeof(FormReportShopPastries));
- if (service is FormReportShopPastries form)
- {
- form.ShowDialog();
- }
- }
+ private void PastriesToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ _reportLogic.SavePastriesToWordFile(new ReportBindingModel { FileName = dialog.FileName });
+ MessageBox.Show("", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ }
- private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
- {
- var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
- if (service is FormReportOrders form)
- {
- form.ShowDialog();
- }
- }
- private void ShopsToolStripMenuItem_Click(object sender, EventArgs e)
- {
- var service = Program.ServiceProvider?.GetService(typeof(FormViewShops));
- if (service is FormViewShops form)
- {
- form.ShowDialog();
- }
- }
+ private void ShopPastriesToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReportShopPastries));
+ if (service is FormReportShopPastries form)
+ {
+ form.ShowDialog();
+ }
+ }
- private void ButtonAddPastryInShop_Click(object sender, EventArgs e)
- {
- var service = Program.ServiceProvider?.GetService(typeof(FormAddPastryInShop));
- if (service is FormAddPastryInShop form)
- {
- form.ShowDialog();
- }
- }
+ private void PastryComponentsToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReportPastryComponents));
+ if (service is FormReportPastryComponents form)
+ {
+ form.ShowDialog();
+ }
+ }
- private void ButtonSellPastry_Click(object sender, EventArgs e)
- {
- var service = Program.ServiceProvider?.GetService(typeof(FormSellPastry));
- if (service is FormSellPastry form)
- {
- form.ShowDialog();
- }
- }
- }
+ private void GroupOrdersToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReportGroupOrders));
+ if (service is FormReportGroupOrders form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
+ if (service is FormReportOrders form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void ShopsToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormViewShops));
+ if (service is FormViewShops form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void ButtonAddPastryInShop_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormAddPastryInShop));
+ if (service is FormAddPastryInShop form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void ButtonSellPastry_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormSellPastry));
+ if (service is FormSellPastry form)
+ {
+ form.ShowDialog();
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/Confectionery/FormReportGroupOrders.Designer.cs b/Confectionery/FormReportGroupOrders.Designer.cs
new file mode 100644
index 0000000..ef8c4ee
--- /dev/null
+++ b/Confectionery/FormReportGroupOrders.Designer.cs
@@ -0,0 +1,141 @@
+namespace ConfectioneryView
+{
+ partial class FormReportGroupOrders
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.panel = new System.Windows.Forms.Panel();
+ this.buttonToPdf = new System.Windows.Forms.Button();
+ this.buttonMake = new System.Windows.Forms.Button();
+ this.dateTimePickerTo = new System.Windows.Forms.DateTimePicker();
+ this.labelTo = new System.Windows.Forms.Label();
+ this.dateTimePickerFrom = new System.Windows.Forms.DateTimePicker();
+ this.labelFrom = new System.Windows.Forms.Label();
+ this.panel.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // panel
+ //
+ this.panel.Controls.Add(this.buttonToPdf);
+ this.panel.Controls.Add(this.buttonMake);
+ this.panel.Controls.Add(this.dateTimePickerTo);
+ this.panel.Controls.Add(this.labelTo);
+ this.panel.Controls.Add(this.dateTimePickerFrom);
+ this.panel.Controls.Add(this.labelFrom);
+ this.panel.Dock = System.Windows.Forms.DockStyle.Top;
+ this.panel.Location = new System.Drawing.Point(0, 0);
+ this.panel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.panel.Name = "panel";
+ this.panel.Size = new System.Drawing.Size(1031, 40);
+ this.panel.TabIndex = 0;
+ //
+ // buttonToPdf
+ //
+ this.buttonToPdf.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonToPdf.Location = new System.Drawing.Point(878, 8);
+ this.buttonToPdf.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.buttonToPdf.Name = "buttonToPdf";
+ this.buttonToPdf.Size = new System.Drawing.Size(139, 27);
+ this.buttonToPdf.TabIndex = 5;
+ this.buttonToPdf.Text = "В Pdf";
+ this.buttonToPdf.UseVisualStyleBackColor = true;
+ this.buttonToPdf.Click += new System.EventHandler(this.ButtonToPdf_Click);
+ //
+ // buttonMake
+ //
+ this.buttonMake.Location = new System.Drawing.Point(476, 8);
+ this.buttonMake.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.buttonMake.Name = "buttonMake";
+ this.buttonMake.Size = new System.Drawing.Size(139, 27);
+ this.buttonMake.TabIndex = 4;
+ this.buttonMake.Text = "Сформировать";
+ this.buttonMake.UseVisualStyleBackColor = true;
+ this.buttonMake.Click += new System.EventHandler(this.ButtonMake_Click);
+ //
+ // dateTimePickerTo
+ //
+ this.dateTimePickerTo.Location = new System.Drawing.Point(237, 7);
+ this.dateTimePickerTo.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.dateTimePickerTo.Name = "dateTimePickerTo";
+ this.dateTimePickerTo.Size = new System.Drawing.Size(163, 23);
+ this.dateTimePickerTo.TabIndex = 3;
+ //
+ // labelTo
+ //
+ this.labelTo.AutoSize = true;
+ this.labelTo.Location = new System.Drawing.Point(208, 10);
+ this.labelTo.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+ this.labelTo.Name = "labelTo";
+ this.labelTo.Size = new System.Drawing.Size(21, 15);
+ this.labelTo.TabIndex = 2;
+ this.labelTo.Text = "по";
+ //
+ // dateTimePickerFrom
+ //
+ this.dateTimePickerFrom.Location = new System.Drawing.Point(37, 7);
+ this.dateTimePickerFrom.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.dateTimePickerFrom.Name = "dateTimePickerFrom";
+ this.dateTimePickerFrom.Size = new System.Drawing.Size(163, 23);
+ this.dateTimePickerFrom.TabIndex = 1;
+ //
+ // labelFrom
+ //
+ this.labelFrom.AutoSize = true;
+ this.labelFrom.Location = new System.Drawing.Point(14, 10);
+ this.labelFrom.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+ this.labelFrom.Name = "labelFrom";
+ this.labelFrom.Size = new System.Drawing.Size(15, 15);
+ this.labelFrom.TabIndex = 0;
+ this.labelFrom.Text = "С";
+ //
+ // FormReportOrders
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(1031, 647);
+ this.Controls.Add(this.panel);
+ this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.Name = "FormReportOrders";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ this.Text = "Заказы";
+ this.panel.ResumeLayout(false);
+ this.panel.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Panel panel;
+ private System.Windows.Forms.Button buttonToPdf;
+ private System.Windows.Forms.Button buttonMake;
+ private System.Windows.Forms.DateTimePicker dateTimePickerTo;
+ private System.Windows.Forms.Label labelTo;
+ private System.Windows.Forms.DateTimePicker dateTimePickerFrom;
+ private System.Windows.Forms.Label labelFrom;
+ }
+}
\ No newline at end of file
diff --git a/Confectionery/FormReportGroupOrders.cs b/Confectionery/FormReportGroupOrders.cs
new file mode 100644
index 0000000..d290793
--- /dev/null
+++ b/Confectionery/FormReportGroupOrders.cs
@@ -0,0 +1,91 @@
+using ConfectioneryContracts.BindingModels;
+using ConfectioneryContracts.BusinessLogicsContracts;
+using Microsoft.Extensions.Logging;
+using Microsoft.Reporting.WinForms;
+
+namespace ConfectioneryView
+{
+ public partial class FormReportGroupOrders : Form
+ {
+ private readonly ReportViewer reportViewer;
+
+ private readonly ILogger _logger;
+
+ private readonly IReportLogic _logic;
+
+ public FormReportGroupOrders(ILogger logger, IReportLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ reportViewer = new ReportViewer
+ {
+ Dock = DockStyle.Fill
+ };
+ reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportGroupOrders.rdlc", FileMode.Open));
+ Controls.Clear();
+ Controls.Add(reportViewer);
+ Controls.Add(panel);
+ }
+
+ private void ButtonMake_Click(object sender, EventArgs e)
+ {
+ if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date)
+ {
+ MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ try
+ {
+ var dataSource = _logic.GetGroupOrders(new ReportBindingModel
+ {
+ DateFrom = dateTimePickerFrom.Value,
+ DateTo = dateTimePickerTo.Value
+ });
+ var source = new ReportDataSource("DataSetOrders", dataSource);
+ reportViewer.LocalReport.DataSources.Clear();
+ reportViewer.LocalReport.DataSources.Add(source);
+ var parameters = new[] { new ReportParameter("ReportParameterPeriod",
+ $"c {dateTimePickerFrom.Value.ToShortDateString()} по {dateTimePickerTo.Value.ToShortDateString()}") };
+ reportViewer.LocalReport.SetParameters(parameters);
+
+ reportViewer.RefreshReport();
+ _logger.LogInformation("Загрузка списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки списка заказов на период");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonToPdf_Click(object sender, EventArgs e)
+ {
+ if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date)
+ {
+ MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" };
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ try
+ {
+ _logic.SaveOrdersToPdfFile(new ReportBindingModel
+ {
+ FileName = dialog.FileName,
+ DateFrom = dateTimePickerFrom.Value,
+ DateTo = dateTimePickerTo.Value
+ });
+ _logger.LogInformation("Сохранение списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
+ MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка сохранения списка заказов на период");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+ }
+}
diff --git a/Confectionery/FormReportGroupOrders.resx b/Confectionery/FormReportGroupOrders.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/Confectionery/FormReportGroupOrders.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Confectionery/FormReportPastryComponents.Designer.cs b/Confectionery/FormReportPastryComponents.Designer.cs
new file mode 100644
index 0000000..c03df90
--- /dev/null
+++ b/Confectionery/FormReportPastryComponents.Designer.cs
@@ -0,0 +1,113 @@
+namespace ConfectioneryView
+{
+ partial class FormReportPastryComponents
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ dataGridView = new DataGridView();
+ buttonSaveToExcel = new Button();
+ ColumnPastry = new DataGridViewTextBoxColumn();
+ ColumnComponent = 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[] { ColumnPastry, ColumnComponent, 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(14, 14);
+ 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;
+ //
+ // ColumnPastry
+ //
+ ColumnPastry.HeaderText = "Изделие";
+ ColumnPastry.Name = "ColumnPastry";
+ ColumnPastry.ReadOnly = true;
+ ColumnPastry.Width = 200;
+ //
+ // ColumnComponent
+ //
+ ColumnComponent.HeaderText = "Компонент";
+ ColumnComponent.Name = "ColumnComponent";
+ ColumnComponent.ReadOnly = true;
+ ColumnComponent.Width = 200;
+ //
+ // ColumnCount
+ //
+ ColumnCount.HeaderText = "Количество";
+ ColumnCount.Name = "ColumnCount";
+ ColumnCount.ReadOnly = true;
+ //
+ // FormReportPastryComponents
+ //
+ 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 = "FormReportPastryComponents";
+ Text = "Изделия с компонентами";
+ Load += FormReportPastryComponents_Load;
+ ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private System.Windows.Forms.DataGridView dataGridView;
+ private System.Windows.Forms.Button buttonSaveToExcel;
+ private DataGridViewTextBoxColumn ColumnPastry;
+ private DataGridViewTextBoxColumn ColumnComponent;
+ private DataGridViewTextBoxColumn ColumnCount;
+ }
+}
\ No newline at end of file
diff --git a/Confectionery/FormReportPastryComponents.cs b/Confectionery/FormReportPastryComponents.cs
new file mode 100644
index 0000000..16d7a9a
--- /dev/null
+++ b/Confectionery/FormReportPastryComponents.cs
@@ -0,0 +1,79 @@
+using ConfectioneryContracts.BindingModels;
+using ConfectioneryContracts.BusinessLogicsContracts;
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace ConfectioneryView
+{
+ public partial class FormReportPastryComponents : Form
+ {
+ private readonly ILogger _logger;
+
+ private readonly IReportLogic _logic;
+
+ public FormReportPastryComponents(ILogger logger, IReportLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ }
+
+ private void FormReportPastryComponents_Load(object sender, EventArgs e)
+ {
+ try
+ {
+ var dict = _logic.GetPastryComponent();
+ if (dict != null)
+ {
+ dataGridView.Rows.Clear();
+ foreach (var elem in dict)
+ {
+ dataGridView.Rows.Add(new object[] { elem.PastryName, "", "" });
+ foreach (var listElem in elem.Components)
+ {
+ dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
+ }
+ dataGridView.Rows.Add(new object[] { "Итого", "", elem.TotalCount });
+ dataGridView.Rows.Add(Array.Empty