This commit is contained in:
Artyom_Yashin 2024-05-26 16:27:23 +04:00
commit fd1e2ed283
2 changed files with 34 additions and 3 deletions

View File

@ -43,7 +43,7 @@ namespace BankBusinessLogic.BusinessLogic
public void SaveRequestsToWordFile(ReportBindingModel model)
{
_saveToWord.CreateDoc(new WordInfo
_saveToWord.CreateRequestsDoc(new WordInfo
{
FileName = model.FileName,
Title = "Список заявок",
@ -56,7 +56,7 @@ namespace BankBusinessLogic.BusinessLogic
public void SaveRequestsComponentsToExcelFile(ReportBindingModel model)
{
_saveToExcel.CreateDoc(new ExcelInfo
_saveToExcel.CreateRequestsDoc(new ExcelInfo
{
FileName = model.FileName,
Title = "Список заявок",

View File

@ -1,6 +1,7 @@
using BankBusinessLogic.OfficePackage.DocumentModels;
using BankBusinessLogic.OfficePackage.HelperEnums;
using BankBusinessLogic.OfficePackage.HelperModels;
using BlacksmithWorkshopBusinessLogic.OfficePackage.HelperModels;
using System;
using System.Collections.Generic;
using System.Linq;
@ -11,6 +12,33 @@ namespace BankBusinessLogic.OfficePackage
{
public abstract class AbstractSaveToWord
{
public void CreateRequestsDoc(WordInfo info)
{
CreateWord(info);
List<List<string>> list = new List<List<string>>();
foreach (var shop in info.Shops)
{
var ls = new List<string>
{
shop.ShopName,
shop.Address,
shop.OpeningDate.ToShortDateString()
};
list.Add(ls);
}
var wordTable = new WordTable
{
Headers = new List<string> {
"Название",
"Адрес",
"Дата открытия"},
Columns = 3,
RowText = list
};
CreateTable(wordTable);
SaveWord(info);
}
public void CreateTransfersDoc(WordInfo info)
{
CreateWord(info);
@ -54,7 +82,10 @@ namespace BankBusinessLogic.OfficePackage
/// <param name="info"></param>
protected abstract void SaveWord(WordInfo info);
/// <summary>
/// Создание doc-файла с таблицей
/// </summary>
/// <param name="info"></param>
protected abstract void CreateTable(WordTable table);
}
}