Borschevskaya A.A. Lab work 4 #6
@ -39,8 +39,8 @@
|
||||
this.компонентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.изделияToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.отчетыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.списокКомонентовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.компонентыПоИзделиямToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.FurnituresToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.FurnituresComponentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.списокЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
@ -142,26 +142,26 @@
|
||||
// отчетыToolStripMenuItem
|
||||
//
|
||||
this.отчетыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.списокКомонентовToolStripMenuItem,
|
||||
this.компонентыПоИзделиямToolStripMenuItem,
|
||||
this.FurnituresToolStripMenuItem,
|
||||
this.FurnituresComponentsToolStripMenuItem,
|
||||
this.списокЗаказовToolStripMenuItem});
|
||||
this.отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
||||
this.отчетыToolStripMenuItem.Size = new System.Drawing.Size(60, 20);
|
||||
this.отчетыToolStripMenuItem.Text = "Отчеты";
|
||||
//
|
||||
// списокКомонентовToolStripMenuItem
|
||||
// FurnituresToolStripMenuItem
|
||||
//
|
||||
this.списокКомонентовToolStripMenuItem.Name = "списокКомонентовToolStripMenuItem";
|
||||
this.списокКомонентовToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
|
||||
this.списокКомонентовToolStripMenuItem.Text = "Список комонентов";
|
||||
this.списокКомонентовToolStripMenuItem.Click += new System.EventHandler(this.ComponentsToolStripMenuItem_Click);
|
||||
this.FurnituresToolStripMenuItem.Name = "FurnituresToolStripMenuItem";
|
||||
this.FurnituresToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
|
||||
this.FurnituresToolStripMenuItem.Text = "Список изделий";
|
||||
this.FurnituresToolStripMenuItem.Click += new System.EventHandler(this.FurnituresToolStripMenuItem_Click);
|
||||
//
|
||||
// компонентыПоИзделиямToolStripMenuItem
|
||||
// FurnituresComponentsToolStripMenuItem
|
||||
//
|
||||
this.компонентыПоИзделиямToolStripMenuItem.Name = "компонентыПоИзделиямToolStripMenuItem";
|
||||
this.компонентыПоИзделиямToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
|
||||
this.компонентыПоИзделиямToolStripMenuItem.Text = "Компоненты по изделиям";
|
||||
this.компонентыПоИзделиямToolStripMenuItem.Click += new System.EventHandler(this.ComponentProductsToolStripMenuItem_Click);
|
||||
this.FurnituresComponentsToolStripMenuItem.Name = "FurnituresComponentsToolStripMenuItem";
|
||||
this.FurnituresComponentsToolStripMenuItem.Size = new System.Drawing.Size(216, 22);
|
||||
this.FurnituresComponentsToolStripMenuItem.Text = "Изделия по компонентам";
|
||||
this.FurnituresComponentsToolStripMenuItem.Click += new System.EventHandler(this.FurnitureComponentsToolStripMenuItem_Click);
|
||||
//
|
||||
// списокЗаказовToolStripMenuItem
|
||||
//
|
||||
@ -207,8 +207,8 @@
|
||||
private ToolStripMenuItem компонентыToolStripMenuItem;
|
||||
private ToolStripMenuItem изделияToolStripMenuItem;
|
||||
private ToolStripMenuItem отчетыToolStripMenuItem;
|
||||
private ToolStripMenuItem списокКомонентовToolStripMenuItem;
|
||||
private ToolStripMenuItem компонентыПоИзделиямToolStripMenuItem;
|
||||
private ToolStripMenuItem FurnituresToolStripMenuItem;
|
||||
private ToolStripMenuItem FurnituresComponentsToolStripMenuItem;
|
||||
private ToolStripMenuItem списокЗаказовToolStripMenuItem;
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
using FurnitureAssemblyBusinessLogic;
|
||||
using FurnitureAssemblyContracts.BindingModels;
|
||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
||||
using FurnitureAssemblyDataModels.Enums;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -158,13 +157,13 @@ namespace FurnitureAssembly
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void ComponentsToolStripMenuItem_Click(object sender, EventArgs
|
||||
private void FurnituresToolStripMenuItem_Click(object sender, EventArgs
|
||||
e)
|
||||
{
|
||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_reportLogic.SaveComponentsToWordFile(new ReportBindingModel
|
||||
_reportLogic.SaveFurnituresToWordFile(new ReportBindingModel
|
||||
{
|
||||
FileName = dialog.FileName
|
||||
});
|
||||
@ -172,7 +171,7 @@ namespace FurnitureAssembly
|
||||
MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
private void ComponentProductsToolStripMenuItem_Click(object sender,
|
||||
private void FurnitureComponentsToolStripMenuItem_Click(object sender,
|
||||
EventArgs e)
|
||||
{
|
||||
var service =
|
||||
|
@ -18,17 +18,18 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
foreach (var component in info.Components)
|
||||
foreach (var furniture in info.Furnitures)
|
||||
{
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { (component.ComponentName, new WordTextProperties { Size = "24", }) },
|
||||
Texts = new List<(string, WordTextProperties)> { (furniture.FurnitureName, new WordTextProperties { Size = "24", Bold=true}), (" - " + furniture.Price.ToString(), new WordTextProperties { Size = "24", }) },
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Both
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
SaveWord(info);
|
||||
}
|
||||
|
@ -6,6 +6,6 @@ namespace FurnitureAssemblyBusinessLogic.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<FurnitureViewModel> Furnitures { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -16,15 +16,15 @@ namespace FurnitureAssemblyBusinessLogic
|
||||
public class ReportLogic : IReportLogic
|
||||
{
|
||||
private readonly IComponentStorage _componentStorage;
|
||||
private readonly IFurnitureStorage _productStorage;
|
||||
private readonly IFurnitureStorage _furnitureStorage;
|
||||
private readonly IOrderStorage _orderStorage;
|
||||
private readonly AbstractSaveToExcel _saveToExcel;
|
||||
private readonly AbstractSaveToWord _saveToWord;
|
||||
private readonly AbstractSaveToPdf _saveToPdf;
|
||||
public ReportLogic(IFurnitureStorage productStorage, IComponentStorage componentStorage, IOrderStorage orderStorage,
|
||||
public ReportLogic(IFurnitureStorage furnitureStorage, IComponentStorage componentStorage, IOrderStorage orderStorage,
|
||||
AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
|
||||
{
|
||||
_productStorage = productStorage;
|
||||
_furnitureStorage = furnitureStorage;
|
||||
_componentStorage = componentStorage;
|
||||
_orderStorage = orderStorage;
|
||||
_saveToExcel = saveToExcel;
|
||||
@ -38,7 +38,7 @@ namespace FurnitureAssemblyBusinessLogic
|
||||
public List<ReportFurnitureComponentViewModel> GetFurnitureComponent()
|
||||
{
|
||||
var components = _componentStorage.GetFullList();
|
||||
var products = _productStorage.GetFullList();
|
||||
var products = _furnitureStorage.GetFullList();
|
||||
var list = new List<ReportFurnitureComponentViewModel>();
|
||||
foreach (var component in components)
|
||||
{
|
||||
@ -86,13 +86,13 @@ namespace FurnitureAssemblyBusinessLogic
|
||||
/// Сохранение компонент в файл-Word
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
public void SaveComponentsToWordFile(ReportBindingModel model)
|
||||
public void SaveFurnituresToWordFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToWord.CreateDoc(new WordInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список компонент",
|
||||
Components = _componentStorage.GetFullList()
|
||||
Title = "Список изделий",
|
||||
Furnitures = _furnitureStorage.GetFullList()
|
||||
});
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -20,7 +20,7 @@ namespace FurnitureAssemblyContracts.BusinessLogicsContarcts
|
||||
/// Сохранение компонент в файл-Word
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
void SaveComponentsToWordFile(ReportBindingModel model);
|
||||
void SaveFurnituresToWordFile(ReportBindingModel model);
|
||||
/// <summary>
|
||||
/// Сохранение компонент с указаеним продуктов в файл-Excel
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user