diff --git a/GarmentFactory/FormMain.Designer.cs b/GarmentFactory/FormMain.Designer.cs
index 64267c1..ad17815 100644
--- a/GarmentFactory/FormMain.Designer.cs
+++ b/GarmentFactory/FormMain.Designer.cs
@@ -1,26 +1,26 @@
namespace GarmentFactoryView
{
- 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
@@ -46,6 +46,7 @@
textilesToolStripMenuItem = new ToolStripMenuItem();
textileComponentsToolStripMenuItem = new ToolStripMenuItem();
ordersToolStripMenuItem = new ToolStripMenuItem();
+ магазиныВDocToolStripMenuItem = new ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
menuStrip1.SuspendLayout();
SuspendLayout();
@@ -182,7 +183,7 @@
//
// отчётыToolStripMenuItem
//
- отчётыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { textilesToolStripMenuItem, textileComponentsToolStripMenuItem, ordersToolStripMenuItem });
+ отчётыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { textilesToolStripMenuItem, textileComponentsToolStripMenuItem, ordersToolStripMenuItem, магазиныВDocToolStripMenuItem });
отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
отчётыToolStripMenuItem.Size = new Size(73, 24);
отчётыToolStripMenuItem.Text = "Отчёты";
@@ -208,6 +209,13 @@
ordersToolStripMenuItem.Text = "Заказы";
ordersToolStripMenuItem.Click += OrdersToolStripMenuItem_Click;
//
+ // магазиныВDocToolStripMenuItem
+ //
+ магазиныВDocToolStripMenuItem.Name = "магазиныВDocToolStripMenuItem";
+ магазиныВDocToolStripMenuItem.Size = new Size(274, 26);
+ магазиныВDocToolStripMenuItem.Text = "Магазины в doc";
+ магазиныВDocToolStripMenuItem.Click += магазиныВDocToolStripMenuItem_Click;
+ //
// FormMain
//
AutoScaleDimensions = new SizeF(8F, 20F);
@@ -231,7 +239,7 @@
PerformLayout();
}
- #endregion
+ #endregion
private DataGridView dataGridView;
private Button buttonCreateOrder;
@@ -251,5 +259,6 @@
private ToolStripMenuItem textilesToolStripMenuItem;
private ToolStripMenuItem textileComponentsToolStripMenuItem;
private ToolStripMenuItem ordersToolStripMenuItem;
+ private ToolStripMenuItem магазиныВDocToolStripMenuItem;
}
}
\ No newline at end of file
diff --git a/GarmentFactory/FormMain.cs b/GarmentFactory/FormMain.cs
index 41d91ef..6803151 100644
--- a/GarmentFactory/FormMain.cs
+++ b/GarmentFactory/FormMain.cs
@@ -52,15 +52,15 @@ namespace GarmentFactoryView
LoadData();
}
- private void компонентыToolStripMenuItem_Click(object sender, EventArgs e)
- {
- 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(FormComponents));
+ if (service is FormComponents form)
+ {
+ form.ShowDialog();
+ }
- }
+ }
private void текстилиToolStripMenuItem_Click(object sender, EventArgs e)
{
@@ -102,114 +102,124 @@ namespace GarmentFactoryView
- private void магазиныToolStripMenuItem_Click(object sender, EventArgs e)
- {
- var service = Program.ServiceProvider?.GetService(typeof(FormShops));
+ private void магазиныToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormShops));
- if (service is FormShops form)
- {
- form.ShowDialog();
- }
- }
+ if (service is FormShops 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 ButtonTakeOrderInWork_Click(object sender, EventArgs e)
- {
- if (dataGridView.SelectedRows.Count == 1)
- {
- int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
- _logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id);
- try
- {
- var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id });
- if (!operationResult)
- {
- throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
- }
- LoadData();
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Ошибка передачи заказа в работу");
- MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
- }
- private void ButtonOrderReady_Click(object sender, EventArgs e)
- {
- if (dataGridView.SelectedRows.Count == 1)
- {
- int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
- _logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'", id);
- try
- {
- var operationResult = _orderLogic.FinishOrder(new OrderBindingModel { Id = id });
- if (!operationResult)
- {
- throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
- }
- LoadData();
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Ошибка отметки о готовности заказа");
- MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
- }
- private void ButtonCompletedOrder_Click(object sender, EventArgs e)
- {
- if (dataGridView.SelectedRows.Count == 1)
- {
- int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
- _logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'", id);
- try
- {
- var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel { Id = id });
- if (!operationResult)
- {
- throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
- }
- _logger.LogInformation("Заказ №{id} выдан", id);
- LoadData();
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Ошибка отметки о выдачи заказа");
- MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
- }
- private void ButtonRefresh_Click(object sender, EventArgs e)
- {
- 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("Заказ №{id}. Меняется статус на 'В работе'", id);
+ try
+ {
+ var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id });
+ if (!operationResult)
+ {
+ throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
+ }
+ LoadData();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка передачи заказа в работу");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+ private void ButtonOrderReady_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+ _logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'", id);
+ try
+ {
+ var operationResult = _orderLogic.FinishOrder(new OrderBindingModel { Id = id });
+ if (!operationResult)
+ {
+ throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
+ }
+ LoadData();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка отметки о готовности заказа");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+ private void ButtonCompletedOrder_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+ _logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'", id);
+ try
+ {
+ var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel { Id = id });
+ if (!operationResult)
+ {
+ throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
+ }
+ _logger.LogInformation("Заказ №{id} выдан", id);
+ LoadData();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка отметки о выдачи заказа");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+ private void ButtonRefresh_Click(object sender, EventArgs e)
+ {
+ LoadData();
+ }
- private void пополнениеМагазинаToolStripMenuItem1_Click(object sender, EventArgs e)
- {
- var service = Program.ServiceProvider?.GetService(typeof(FormAddTextile));
+ private void пополнениеМагазинаToolStripMenuItem1_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormAddTextile));
- if (service is FormAddTextile form)
- {
- form.ShowDialog();
- }
- }
+ if (service is FormAddTextile form)
+ {
+ form.ShowDialog();
+ }
+ }
- private void продажаТовараToolStripMenuItem_Click(object sender, EventArgs e)
- {
- var service = Program.ServiceProvider?.GetService(typeof(FormSellTextile));
- if (service is FormSellTextile form)
- {
- form.ShowDialog();
- }
- }
- }
+ private void продажаТовараToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormSellTextile));
+ if (service is FormSellTextile form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void магазиныВDocToolStripMenuItem_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);
+ }
+ }
+ }
}
diff --git a/GarmentFactoryBusinessLogic/BusinessLogics/ReportLogic.cs b/GarmentFactoryBusinessLogic/BusinessLogics/ReportLogic.cs
index aeb1ad3..c2aa447 100644
--- a/GarmentFactoryBusinessLogic/BusinessLogics/ReportLogic.cs
+++ b/GarmentFactoryBusinessLogic/BusinessLogics/ReportLogic.cs
@@ -10,6 +10,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using GarmentFactoryContracts.ViewModels;
namespace GarmentFactoryBusinessLogic.BusinessLogics
{
@@ -18,16 +19,18 @@ namespace GarmentFactoryBusinessLogic.BusinessLogics
private readonly IComponentStorage _componentStorage;
private readonly ITextileStorage _textileStorage;
private readonly IOrderStorage _orderStorage;
+ private readonly IShopStorage _shopStorage;
private readonly AbstractSaveToExcel _saveToExcel;
private readonly AbstractSaveToWord _saveToWord;
private readonly AbstractSaveToPdf _saveToPdf;
- public ReportLogic(ITextileStorage textileStorage, IComponentStorage componentStorage, IOrderStorage orderStorage,
+ public ReportLogic(ITextileStorage textileStorage, IComponentStorage componentStorage, IOrderStorage orderStorage, IShopStorage shopStorage,
AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
{
_textileStorage = textileStorage;
_componentStorage = componentStorage;
_orderStorage = orderStorage;
+ _shopStorage = shopStorage;
_saveToExcel = saveToExcel;
_saveToWord = saveToWord;
@@ -106,5 +109,55 @@ namespace GarmentFactoryBusinessLogic.BusinessLogics
Orders = GetOrders(model)
});
}
+
+ public List GetShops()
+ {
+ return _shopStorage.GetFullList().Select(x => new ReportShopsViewModel
+ {
+ ShopName = x.ShopName,
+ Textiles = x.ShopTextiles.Select(x => (x.Value.Item1.TextileName, x.Value.Item2)).ToList(),
+ TotalCount = x.ShopTextiles.Select(x => x.Value.Item2).Sum()
+ }).ToList();
+ }
+
+ //public List GetGroupedOrders()
+ //{
+ // return _orderStorage.GetFullList().GroupBy(x => x.DateCreate.Date).Select(x => new ReportGroupOrdersViewModel
+ // {
+ // Date = x.Key,
+ // OrdersCount = x.Count(),
+ // OrdersSum = x.Select(y => y.Sum).Sum()
+ // }).ToList();
+ //}
+
+ public void SaveShopsToWordFile(ReportBindingModel model)
+ {
+ _saveToWord.CreateShopsDoc(new WordShopInfo
+ {
+ FileName = model.FileName,
+ Title = "Список магазинов",
+ Shops = _shopStorage.GetFullList()
+ });
+ }
+
+ //public void SaveShopsToExcelFile(ReportBindingModel model)
+ //{
+ // _saveToExcel.CreateShopTextilesReport(new ExcelShop
+ // {
+ // FileName = model.FileName,
+ // Title = "Наполненость магазинов",
+ // ShopTextiles = GetShops()
+ // });
+ //}
+
+ //public void SaveGroupedOrdersToPdfFile(ReportBindingModel model)
+ //{
+ // _saveToPdf.CreateGroupedOrdersDoc(new PdfGroupedOrdersInfo
+ // {
+ // FileName = model.FileName,
+ // Title = "Список заказов сгруппированных по дате заказов",
+ // GroupedOrders = GetGroupedOrders()
+ // });
+ //}
}
}
diff --git a/GarmentFactoryBusinessLogic/OfficePackage/AbstractSaveToWord.cs b/GarmentFactoryBusinessLogic/OfficePackage/AbstractSaveToWord.cs
index b5cd100..a91be19 100644
--- a/GarmentFactoryBusinessLogic/OfficePackage/AbstractSaveToWord.cs
+++ b/GarmentFactoryBusinessLogic/OfficePackage/AbstractSaveToWord.cs
@@ -1,5 +1,7 @@
using GarmentFactoryBusinessLogic.OfficePackage.HelperEnums;
using GarmentFactoryBusinessLogic.OfficePackage.HelperModels;
+using GarmentFactoryBusinessLogic.OfficePackage;
+using GarmentFactoryBusinessLogic.OfficePackage.HelperModels;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -43,11 +45,52 @@ namespace GarmentFactoryBusinessLogic.OfficePackage
SaveWord(info);
}
+ public void CreateShopsDoc(WordShopInfo info)
+ {
+ CreateWord(info);
+ CreateParagraph(new WordParagraph
+ {
+ Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
+ TextProperties = new WordTextProperties
+ {
+ Size = "24",
+ JustificationType = WordJustificationType.Center
+ }
+ });
+
+ CreateTable(new List { "3000", "3000", "3000" });
+ CreateRow(new WordRowParameters
+ {
+ Texts = new List { "Название", "Адрес", "Дата открытия" },
+ TextProperties = new WordTextProperties
+ {
+ Size = "24",
+ Bold = true,
+ JustificationType = WordJustificationType.Center
+ }
+ });
+
+ foreach (var shop in info.Shops)
+ {
+ CreateRow(new WordRowParameters
+ {
+ Texts = new List { shop.ShopName, shop.Address, shop.DateOpen.ToString() },
+ TextProperties = new WordTextProperties
+ {
+ Size = "22",
+ JustificationType = WordJustificationType.Center
+ }
+ });
+ }
+
+ SaveWord(info);
+ }
+
///
/// Создание doc-файла
///
///
- protected abstract void CreateWord(WordInfo info);
+ protected abstract void CreateWord(IDocumentInfo info);
///
/// Создание абзаца с текстом
@@ -60,6 +103,9 @@ namespace GarmentFactoryBusinessLogic.OfficePackage
/// Сохранение файла
///
///
- protected abstract void SaveWord(WordInfo info);
+ protected abstract void SaveWord(IDocumentInfo info);
+
+ protected abstract void CreateTable(List colums);
+ protected abstract void CreateRow(WordRowParameters rowParameters);
}
}
diff --git a/GarmentFactoryBusinessLogic/OfficePackage/HelperModels/WordInfo.cs b/GarmentFactoryBusinessLogic/OfficePackage/HelperModels/WordInfo.cs
index 975a3d4..220e317 100644
--- a/GarmentFactoryBusinessLogic/OfficePackage/HelperModels/WordInfo.cs
+++ b/GarmentFactoryBusinessLogic/OfficePackage/HelperModels/WordInfo.cs
@@ -1,4 +1,5 @@
using GarmentFactoryContracts.ViewModels;
+using GarmentFactoryBusinessLogic.OfficePackage;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -7,7 +8,7 @@ using System.Threading.Tasks;
namespace GarmentFactoryBusinessLogic.OfficePackage.HelperModels
{
- public class WordInfo
+ public class WordInfo : IDocumentInfo
{
public string FileName { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;
diff --git a/GarmentFactoryBusinessLogic/OfficePackage/HelperModels/WordRowParameters.cs b/GarmentFactoryBusinessLogic/OfficePackage/HelperModels/WordRowParameters.cs
new file mode 100644
index 0000000..1a466a3
--- /dev/null
+++ b/GarmentFactoryBusinessLogic/OfficePackage/HelperModels/WordRowParameters.cs
@@ -0,0 +1,15 @@
+using GarmentFactoryBusinessLogic.OfficePackage.HelperModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace GarmentFactoryBusinessLogic.OfficePackage.HelperModels
+{
+ public class WordRowParameters
+ {
+ public List Texts { get; set; } = new();
+ public WordTextProperties TextProperties { get; set; } = new();
+ }
+}
diff --git a/GarmentFactoryBusinessLogic/OfficePackage/HelperModels/WordShopInfo.cs b/GarmentFactoryBusinessLogic/OfficePackage/HelperModels/WordShopInfo.cs
new file mode 100644
index 0000000..94ce0de
--- /dev/null
+++ b/GarmentFactoryBusinessLogic/OfficePackage/HelperModels/WordShopInfo.cs
@@ -0,0 +1,16 @@
+using GarmentFactoryContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace GarmentFactoryBusinessLogic.OfficePackage.HelperModels
+{
+ public class WordShopInfo : IDocumentInfo
+ {
+ public string FileName { get; set; } = string.Empty;
+ public string Title { get; set; } = string.Empty;
+ public List Shops { get; set; } = new();
+ }
+}
diff --git a/GarmentFactoryBusinessLogic/OfficePackage/IDocument.cs b/GarmentFactoryBusinessLogic/OfficePackage/IDocument.cs
new file mode 100644
index 0000000..bbb14a9
--- /dev/null
+++ b/GarmentFactoryBusinessLogic/OfficePackage/IDocument.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace GarmentFactoryBusinessLogic.OfficePackage
+{
+ public interface IDocumentInfo
+ {
+ public string FileName { get; set; }
+ public string Title { get; set; }
+ }
+}
diff --git a/GarmentFactoryBusinessLogic/OfficePackage/Implements/SaveToWord.cs b/GarmentFactoryBusinessLogic/OfficePackage/Implements/SaveToWord.cs
index 6305128..05bf2f1 100644
--- a/GarmentFactoryBusinessLogic/OfficePackage/Implements/SaveToWord.cs
+++ b/GarmentFactoryBusinessLogic/OfficePackage/Implements/SaveToWord.cs
@@ -85,7 +85,7 @@ namespace GarmentFactoryBusinessLogic.OfficePackage.Implements
return properties;
}
- protected override void CreateWord(WordInfo info)
+ protected override void CreateWord(IDocumentInfo info)
{
_wordDocument = WordprocessingDocument.Create(info.FileName, WordprocessingDocumentType.Document);
MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart();
@@ -123,7 +123,7 @@ namespace GarmentFactoryBusinessLogic.OfficePackage.Implements
_docBody.AppendChild(docParagraph);
}
- protected override void SaveWord(WordInfo info)
+ protected override void SaveWord(IDocumentInfo info)
{
if (_docBody == null || _wordDocument == null)
{
@@ -135,5 +135,77 @@ namespace GarmentFactoryBusinessLogic.OfficePackage.Implements
_wordDocument.Close();
}
+
+ private Table? _lastTable;
+ protected override void CreateTable(List columns)
+ {
+ if (_docBody == null)
+ return;
+
+ _lastTable = new Table();
+
+ var tableProp = new TableProperties();
+ tableProp.AppendChild(new TableLayout { Type = TableLayoutValues.Fixed });
+ tableProp.AppendChild(new TableBorders(
+ new TopBorder() { Val = new EnumValue(BorderValues.Single), Size = 4 },
+ new LeftBorder() { Val = new EnumValue(BorderValues.Single), Size = 4 },
+ new RightBorder() { Val = new EnumValue(BorderValues.Single), Size = 4 },
+ new BottomBorder() { Val = new EnumValue(BorderValues.Single), Size = 4 },
+ new InsideHorizontalBorder() { Val = new EnumValue(BorderValues.Single), Size = 4 },
+ new InsideVerticalBorder() { Val = new EnumValue(BorderValues.Single), Size = 4 }
+ ));
+ tableProp.AppendChild(new TableWidth { Type = TableWidthUnitValues.Auto });
+ _lastTable.AppendChild(tableProp);
+
+ TableGrid tableGrid = new TableGrid();
+ foreach (var column in columns)
+ {
+ tableGrid.AppendChild(new GridColumn() { Width = column });
+ }
+ _lastTable.AppendChild(tableGrid);
+
+ _docBody.AppendChild(_lastTable);
+ }
+
+ protected override void CreateRow(WordRowParameters rowParameters)
+ {
+ if (_docBody == null || _lastTable == null)
+ return;
+
+ TableRow docRow = new TableRow();
+ foreach (var column in rowParameters.Texts)
+ {
+ var docParagraph = new Paragraph();
+ WordParagraph paragraph = new WordParagraph
+ {
+ Texts = new List<(string, WordTextProperties)> { (column, rowParameters.TextProperties) },
+ TextProperties = rowParameters.TextProperties
+ };
+
+ docParagraph.AppendChild(CreateParagraphProperties(paragraph.TextProperties));
+
+ foreach (var run in paragraph.Texts)
+ {
+ var docRun = new Run();
+
+ var properties = new RunProperties();
+ properties.AppendChild(new FontSize { Val = run.Item2.Size });
+ if (run.Item2.Bold)
+ {
+ properties.AppendChild(new Bold());
+ }
+ docRun.AppendChild(properties);
+
+ docRun.AppendChild(new Text { Text = run.Item1, Space = SpaceProcessingModeValues.Preserve });
+
+ docParagraph.AppendChild(docRun);
+ }
+
+ TableCell docCell = new TableCell();
+ docCell.AppendChild(docParagraph);
+ docRow.AppendChild(docCell);
+ }
+ _lastTable.AppendChild(docRow);
+ }
}
}
diff --git a/GarmentFactoryContracts/BusinessLogicsContracts/IReportLogic.cs b/GarmentFactoryContracts/BusinessLogicsContracts/IReportLogic.cs
index 5b27402..685ee72 100644
--- a/GarmentFactoryContracts/BusinessLogicsContracts/IReportLogic.cs
+++ b/GarmentFactoryContracts/BusinessLogicsContracts/IReportLogic.cs
@@ -20,5 +20,9 @@ namespace GarmentFactoryContracts.BusinessLogicsContracts
void SaveOrdersToPdfFile(ReportBindingModel model);
+ void SaveShopsToWordFile(ReportBindingModel model);
+ //void SaveShopsToExcelFile(ReportBindingModel model);
+ //void SaveGroupedOrdersToPdfFile(ReportBindingModel model);
+
}
}
diff --git a/GarmentFactoryContracts/ViewModels/ReportShopsViewModel.cs b/GarmentFactoryContracts/ViewModels/ReportShopsViewModel.cs
new file mode 100644
index 0000000..f8e627e
--- /dev/null
+++ b/GarmentFactoryContracts/ViewModels/ReportShopsViewModel.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace GarmentFactoryContracts.ViewModels
+{
+ public class ReportShopsViewModel
+ {
+ public string ShopName { get; set; } = string.Empty;
+ public int TotalCount { get; set; }
+ public List<(string textile, int count)> Textiles { get; set; } = new();
+ }
+}