Добавлен отчет списка изделий в doc-файле
This commit is contained in:
parent
ac83f7165b
commit
f1359d2657
@ -24,11 +24,15 @@ namespace ConfectioneryBusinessLogic.OfficePackage
|
||||
}
|
||||
});
|
||||
|
||||
foreach (var component in info.Components)
|
||||
foreach (var pastry in info.Pastries)
|
||||
{
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { (component.ComponentName, new WordTextProperties { Size = "24", }) },
|
||||
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",
|
||||
|
@ -11,6 +11,6 @@ namespace ConfectioneryBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public List<ComponentViewModel> Components { get; set; } = new();
|
||||
public List<PastryViewModel> Pastries { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ namespace ConfectioneryBusinessLogic
|
||||
{
|
||||
private readonly IComponentStorage _componentStorage;
|
||||
|
||||
private readonly IPastryStorage _PastryStorage;
|
||||
private readonly IPastryStorage _pastryStorage;
|
||||
|
||||
private readonly IOrderStorage _orderStorage;
|
||||
|
||||
@ -30,7 +30,7 @@ namespace ConfectioneryBusinessLogic
|
||||
public ReportLogic(IPastryStorage PastryStorage, IComponentStorage componentStorage, IOrderStorage orderStorage,
|
||||
AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
|
||||
{
|
||||
_PastryStorage = PastryStorage;
|
||||
_pastryStorage = PastryStorage;
|
||||
_componentStorage = componentStorage;
|
||||
_orderStorage = orderStorage;
|
||||
|
||||
@ -47,7 +47,7 @@ namespace ConfectioneryBusinessLogic
|
||||
{
|
||||
var components = _componentStorage.GetFullList();
|
||||
|
||||
var Pastrys = _PastryStorage.GetFullList();
|
||||
var Pastrys = _pastryStorage.GetFullList();
|
||||
|
||||
var list = new List<ReportPastryComponentViewModel>();
|
||||
|
||||
@ -96,13 +96,13 @@ namespace ConfectioneryBusinessLogic
|
||||
/// Сохранение компонент в файл-Word
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
public void SaveComponentsToWordFile(ReportBindingModel model)
|
||||
public void SavePastriesToWordFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToWord.CreateDoc(new WordInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список компонент",
|
||||
Components = _componentStorage.GetFullList()
|
||||
Title = "Список изделий",
|
||||
Pastries = _pastryStorage.GetFullList()
|
||||
});
|
||||
}
|
||||
|
||||
|
16
Confectionery/FormMain.Designer.cs
generated
16
Confectionery/FormMain.Designer.cs
generated
@ -33,7 +33,7 @@
|
||||
pastryToolStripMenuItem = new ToolStripMenuItem();
|
||||
componentToolStripMenuItem = new ToolStripMenuItem();
|
||||
reportsToolStripMenuItem = new ToolStripMenuItem();
|
||||
componentsToolStripMenuItem = new ToolStripMenuItem();
|
||||
pastriesToolStripMenuItem = new ToolStripMenuItem();
|
||||
pastryComponentsToolStripMenuItem = new ToolStripMenuItem();
|
||||
ordersToolStripMenuItem = new ToolStripMenuItem();
|
||||
dataGridView = new DataGridView();
|
||||
@ -78,17 +78,17 @@
|
||||
//
|
||||
// reportsToolStripMenuItem
|
||||
//
|
||||
reportsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { componentsToolStripMenuItem, pastryComponentsToolStripMenuItem, ordersToolStripMenuItem });
|
||||
reportsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { pastriesToolStripMenuItem, pastryComponentsToolStripMenuItem, ordersToolStripMenuItem });
|
||||
reportsToolStripMenuItem.Name = "reportsToolStripMenuItem";
|
||||
reportsToolStripMenuItem.Size = new Size(60, 20);
|
||||
reportsToolStripMenuItem.Text = "Отчеты";
|
||||
//
|
||||
// componentsToolStripMenuItem
|
||||
// pastriesToolStripMenuItem
|
||||
//
|
||||
componentsToolStripMenuItem.Name = "componentsToolStripMenuItem";
|
||||
componentsToolStripMenuItem.Size = new Size(218, 22);
|
||||
componentsToolStripMenuItem.Text = "Список компонентов";
|
||||
componentsToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click_1;
|
||||
pastriesToolStripMenuItem.Name = "pastriesToolStripMenuItem";
|
||||
pastriesToolStripMenuItem.Size = new Size(218, 22);
|
||||
pastriesToolStripMenuItem.Text = "Список изделий";
|
||||
pastriesToolStripMenuItem.Click += PastriesToolStripMenuItem_Click_1;
|
||||
//
|
||||
// pastryComponentsToolStripMenuItem
|
||||
//
|
||||
@ -205,7 +205,7 @@
|
||||
private ToolStripMenuItem pastryToolStripMenuItem;
|
||||
private ToolStripMenuItem componentToolStripMenuItem;
|
||||
private ToolStripMenuItem reportsToolStripMenuItem;
|
||||
private ToolStripMenuItem componentsToolStripMenuItem;
|
||||
private ToolStripMenuItem pastriesToolStripMenuItem;
|
||||
private ToolStripMenuItem pastryComponentsToolStripMenuItem;
|
||||
private ToolStripMenuItem ordersToolStripMenuItem;
|
||||
}
|
||||
|
@ -157,12 +157,12 @@ namespace ConfectioneryView
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void ComponentsToolStripMenuItem_Click_1(object sender, EventArgs e)
|
||||
private void PastriesToolStripMenuItem_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_reportLogic.SaveComponentsToWordFile(new ReportBindingModel { FileName = dialog.FileName });
|
||||
_reportLogic.SavePastriesToWordFile(new ReportBindingModel { FileName = dialog.FileName });
|
||||
MessageBox.Show("Âûïîëíåíî", "Óñïåõ", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace ConfectioneryContracts.BusinessLogicsContracts
|
||||
/// Сохранение компонент в файл-Word
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
void SaveComponentsToWordFile(ReportBindingModel model);
|
||||
void SavePastriesToWordFile(ReportBindingModel model);
|
||||
/// <summary>
|
||||
/// Сохранение компонент с указаеним продуктов в файл-Excel
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user