ISEbd-21 Melnikov I. O. Lab Work 04 Advanced #28
@ -45,6 +45,7 @@
|
||||
this.buttonRef = new System.Windows.Forms.Button();
|
||||
this.buttonFillStore = new System.Windows.Forms.Button();
|
||||
this.buttonSellManufacture = new System.Windows.Forms.Button();
|
||||
this.reportStoresToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuStrip.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
@ -96,7 +97,8 @@
|
||||
this.reportToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.reportComponentsToolStripMenuItem,
|
||||
this.reportManufactureComponentsToolStripMenuItem,
|
||||
this.reportOrdersToolStripMenuItem});
|
||||
this.reportOrdersToolStripMenuItem,
|
||||
this.reportStoresToolStripMenuItem});
|
||||
this.reportToolStripMenuItem.Name = "reportToolStripMenuItem";
|
||||
this.reportToolStripMenuItem.Size = new System.Drawing.Size(51, 20);
|
||||
this.reportToolStripMenuItem.Text = "Отчет";
|
||||
@ -208,6 +210,13 @@
|
||||
this.buttonSellManufacture.UseVisualStyleBackColor = true;
|
||||
this.buttonSellManufacture.Click += new System.EventHandler(this.ButtonSellManufacture_Click);
|
||||
//
|
||||
// reportStoresToolStripMenuItem
|
||||
//
|
||||
this.reportStoresToolStripMenuItem.Name = "reportStoresToolStripMenuItem";
|
||||
this.reportStoresToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
|
||||
this.reportStoresToolStripMenuItem.Text = "Список магазинов";
|
||||
this.reportStoresToolStripMenuItem.Click += new System.EventHandler(this.ReportStoresToolStripMenuItem_Click);
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
@ -253,5 +262,6 @@
|
||||
private ToolStripMenuItem reportComponentsToolStripMenuItem;
|
||||
private ToolStripMenuItem reportManufactureComponentsToolStripMenuItem;
|
||||
private ToolStripMenuItem reportOrdersToolStripMenuItem;
|
||||
private ToolStripMenuItem reportStoresToolStripMenuItem;
|
||||
}
|
||||
}
|
@ -200,5 +200,15 @@ namespace BlacksmithWorkshopView
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
private void ReportStoresToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_reportLogic.SaveStoresToWordFile(new ReportBindingModel { FileName = dialog.FileName });
|
||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -15,16 +15,18 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics
|
||||
{
|
||||
private readonly IComponentStorage _componentStorage;
|
||||
private readonly IManufactureStorage _manufactureStorage;
|
||||
private readonly IStoreStorage _storeStorage;
|
||||
private readonly IOrderStorage _orderStorage;
|
||||
private readonly AbstractSaveToExcel _saveToExcel;
|
||||
private readonly AbstractSaveToWord _saveToWord;
|
||||
private readonly AbstractSaveToPdf _saveToPdf;
|
||||
public ReportLogic(IManufactureStorage manufactureStorage, IComponentStorage componentStorage, IOrderStorage orderStorage,
|
||||
public ReportLogic(IManufactureStorage manufactureStorage, IComponentStorage componentStorage, IOrderStorage orderStorage, IStoreStorage storeStorage,
|
||||
AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
|
||||
{
|
||||
_manufactureStorage = manufactureStorage;
|
||||
_componentStorage = componentStorage;
|
||||
_orderStorage = orderStorage;
|
||||
_storeStorage = storeStorage;
|
||||
_saveToExcel = saveToExcel;
|
||||
_saveToWord = saveToWord;
|
||||
_saveToPdf = saveToPdf;
|
||||
@ -92,11 +94,24 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics
|
||||
Manufactures = _manufactureStorage.GetFullList()
|
||||
});
|
||||
}
|
||||
/// <summary>
|
||||
/// Сохранение изделий с указаеним продуктов в файл-Excel
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
public void SaveManufactureComponentToExcelFile(ReportBindingModel model)
|
||||
/// <summary>
|
||||
/// Сохранение магазинов в файл-Word
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
public void SaveStoresToWordFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToWord.CreateDocStores(new WordInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список магазинов",
|
||||
Stores = _storeStorage.GetFullList()
|
||||
});
|
||||
}
|
||||
/// <summary>
|
||||
/// Сохранение изделий с указаеним продуктов в файл-Excel
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
public void SaveManufactureComponentToExcelFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToExcel.CreateReport(new ExcelInfo
|
||||
{
|
||||
|
@ -39,6 +39,42 @@ namespace BlacksmithWorkshopBusinessLogic.OfficePackage
|
||||
}
|
||||
SaveWord(info);
|
||||
}
|
||||
public void CreateDocStores(WordInfo 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
|
||||
}
|
||||
});
|
||||
foreach (var store in info.Stores)
|
||||
{
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)>
|
||||
{
|
||||
(store.StoreName, new WordTextProperties { Bold = true, Size = "24", }),
|
||||
(" ", new WordTextProperties { Size = "24"}),
|
||||
(store.Address, new WordTextProperties { Size = "24" }),
|
||||
(" ", new WordTextProperties { Size = "24"}),
|
||||
(store.OpeningDate.ToShortDateString(), new WordTextProperties { Size = "24" })
|
||||
},
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Both
|
||||
}
|
||||
});
|
||||
}
|
||||
SaveWord(info);
|
||||
}
|
||||
/// <summary>
|
||||
/// Создание doc-файла
|
||||
/// </summary>
|
||||
|
@ -7,5 +7,6 @@ namespace BlacksmithWorkshopBusinessLogic.OfficePackage.HelperModels
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public List<ManufactureViewModel> Manufactures { get; set; } = new();
|
||||
public List<StoreViewModel> Stores { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -31,5 +31,10 @@ namespace BlacksmithWorkshopContracts.BusinessLogicsContracts
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
void SaveOrdersToPdfFile(ReportBindingModel model);
|
||||
}
|
||||
/// <summary>
|
||||
/// Сохранение магазинов в файл-Word
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
void SaveStoresToWordFile(ReportBindingModel model);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user