Реализовал сохранение списка изделий в word
This commit is contained in:
parent
f47e53df7d
commit
e37e94a14f
@ -79,13 +79,13 @@ namespace SecuritySystemBusinessLogic.BusinessLogics
|
|||||||
/// Сохранение компонент в файл-Word
|
/// Сохранение компонент в файл-Word
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="model"></param>
|
/// <param name="model"></param>
|
||||||
public void SaveComponentsToWordFile(ReportBindingModel model)
|
public void SaveSecuresToWordFile(ReportBindingModel model)
|
||||||
{
|
{
|
||||||
_saveToWord.CreateDoc(new WordInfo
|
_saveToWord.CreateDoc(new WordInfo
|
||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
Title = "Список компонент",
|
Title = "Список изделий",
|
||||||
Components = _componentStorage.GetFullList()
|
Secures = _secureStorage.GetFullList()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -17,11 +17,14 @@ namespace SecuritySystemBusinessLogic.OfficePackage
|
|||||||
JustificationType = WordJustificationType.Center
|
JustificationType = WordJustificationType.Center
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
foreach (var component in info.Components)
|
foreach (var secure in info.Secures)
|
||||||
{
|
{
|
||||||
CreateParagraph(new WordParagraph
|
CreateParagraph(new WordParagraph
|
||||||
{
|
{
|
||||||
Texts = new List<(string, WordTextProperties)> { (component.ComponentName, new WordTextProperties { Size = "24", }) },
|
Texts = new List<(string, WordTextProperties)> {
|
||||||
|
(secure.SecureName, new WordTextProperties { Bold = true, Size = "24", }),
|
||||||
|
("\t" + secure.Price.ToString() + " руб.", new WordTextProperties { Size = "24", })
|
||||||
|
},
|
||||||
TextProperties = new WordTextProperties
|
TextProperties = new WordTextProperties
|
||||||
{
|
{
|
||||||
Size = "24",
|
Size = "24",
|
||||||
|
@ -6,6 +6,6 @@ namespace SecuritySystemBusinessLogic.OfficePackage.HelperModels
|
|||||||
{
|
{
|
||||||
public string FileName { get; set; } = string.Empty;
|
public string FileName { get; set; } = string.Empty;
|
||||||
public string Title { get; set; } = string.Empty;
|
public string Title { get; set; } = string.Empty;
|
||||||
public List<ComponentViewModel> Components { get; set; } = new();
|
public List<SecureViewModel> Secures { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ namespace SecuritySystemContracts.BusinessLogicsContracts
|
|||||||
/// Сохранение компонент в файл-Word
|
/// Сохранение компонент в файл-Word
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="model"></param>
|
/// <param name="model"></param>
|
||||||
void SaveComponentsToWordFile(ReportBindingModel model);
|
void SaveSecuresToWordFile(ReportBindingModel model);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Сохранение компонент с указаеним продуктов в файл-Excel
|
/// Сохранение компонент с указаеним продуктов в файл-Excel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -88,8 +88,8 @@
|
|||||||
//
|
//
|
||||||
списокКомпонентовToolStripMenuItem.Name = "списокКомпонентовToolStripMenuItem";
|
списокКомпонентовToolStripMenuItem.Name = "списокКомпонентовToolStripMenuItem";
|
||||||
списокКомпонентовToolStripMenuItem.Size = new Size(276, 26);
|
списокКомпонентовToolStripMenuItem.Size = new Size(276, 26);
|
||||||
списокКомпонентовToolStripMenuItem.Text = "Список компонентов";
|
списокКомпонентовToolStripMenuItem.Text = "Список изделий";
|
||||||
списокКомпонентовToolStripMenuItem.Click += ReportComponentsToolStripMenuItem_Click;
|
списокКомпонентовToolStripMenuItem.Click += ReportSecuresToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// компонентыПоИзделиямToolStripMenuItem
|
// компонентыПоИзделиямToolStripMenuItem
|
||||||
//
|
//
|
||||||
|
@ -140,12 +140,12 @@ namespace SecuritySystemView
|
|||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ReportComponentsToolStripMenuItem_Click(object sender, EventArgs e)
|
private void ReportSecuresToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
_reportLogic.SaveComponentsToWordFile(new ReportBindingModel
|
_reportLogic.SaveSecuresToWordFile(new ReportBindingModel
|
||||||
{
|
{
|
||||||
FileName = dialog.FileName
|
FileName = dialog.FileName
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user