fix
This commit is contained in:
parent
611652dfd0
commit
b85d1773bf
@ -43,7 +43,7 @@ namespace BankBusinessLogic.BusinessLogic
|
||||
|
||||
public void SaveRequestsToWordFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToWord.CreateDoc(new WordInfo
|
||||
_saveToWord.CreateRequestsDoc(new WordInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список заявок",
|
||||
|
@ -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,34 +12,32 @@ namespace BankBusinessLogic.OfficePackage
|
||||
{
|
||||
public abstract class AbstractSaveToWord
|
||||
{
|
||||
public void CreateDoc(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 transfer in info.Transfers)
|
||||
{
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { (transfer.CardNumber, new WordTextProperties { Size = "24", Bold = true}),
|
||||
(" - цена " + transfer.Transfers.ToString(), new WordTextProperties { Size = "24"})
|
||||
},
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Both,
|
||||
}
|
||||
});
|
||||
}
|
||||
SaveWord(info);
|
||||
}
|
||||
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);
|
||||
}
|
||||
/// <summary>
|
||||
/// Создание doc-файла
|
||||
/// </summary>
|
||||
@ -55,5 +54,11 @@ namespace BankBusinessLogic.OfficePackage
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
protected abstract void SaveWord(WordInfo info);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Создание doc-файла с таблицей
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
protected abstract void CreateTable(WordTable table);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BlacksmithWorkshopBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordTable
|
||||
{
|
||||
public List<string> Headers { get; set; } = new();
|
||||
public List<List<string>> RowText { get; set; } = new();
|
||||
public int Columns { get; set; }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user