начальные изменения в ворд по требованиям

This commit is contained in:
ekallin 2024-03-25 10:50:13 +04:00
parent 890f11f6d4
commit 8c41ac1719
8 changed files with 17 additions and 25 deletions

View File

@ -148,7 +148,7 @@ namespace SushiBarView
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
if (dialog.ShowDialog() == DialogResult.OK)
{
_reportLogic.SaveComponentsToWordFile(new ReportBindingModel
_reportLogic.SaveSushisToWordFile(new ReportBindingModel
{
FileName = dialog.FileName
});

View File

@ -17,12 +17,12 @@ namespace SushiBarBusinessLogic.OfficePackage
JustificationType = WordJustificationType.Center
}
});
foreach (var component in info.Components)
foreach (var sushi in info.Sushi)
{
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)> {
(component.ComponentName, new WordTextProperties { Size = "24", })
(sushi.SushiName, new WordTextProperties { Size = "24", })
},
TextProperties = new WordTextProperties
{

View File

@ -6,7 +6,7 @@ namespace SushiBarBusinessLogic.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<SushiViewModel> Sushi { get; set; } = new();
}
}

View File

@ -11,8 +11,7 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
private Document? _document;
private Section? _section;
private Table? _table;
private static ParagraphAlignment
GetParagraphAlignment(PdfParagraphAlignmentType type)
private static ParagraphAlignment GetParagraphAlignment(PdfParagraphAlignmentType type)
{
return type switch
{
@ -86,7 +85,6 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
row.Cells[i].VerticalAlignment = VerticalAlignment.Center;
}
}
protected override void SavePdf(PdfInfo info)
{
var renderer = new PdfDocumentRenderer(true)

View File

@ -80,13 +80,13 @@ namespace SushiBarBusinessLogic
/// Сохранение компонент в файл-Word
/// </summary>
/// <param name="model"></param>
public void SaveComponentsToWordFile(ReportBindingModel model)
public void SaveSushisToWordFile(ReportBindingModel model)
{
_saveToWord.CreateDoc(new WordInfo
{
FileName = model.FileName,
Title = "Список компонент",
Components = _componentStorage.GetFullList()
Sushi = _sushiStorage.GetFullList()
});
}
/// <summary>

View File

@ -12,8 +12,10 @@
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="MigraDocCore.Rendering" Version="1.3.63" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
<PackageReference Include="PdfSharp.MigraDoc.Standard.DocumentObjectModel" Version="1.51.15" />
</ItemGroup>
<ItemGroup>

View File

@ -20,7 +20,7 @@ namespace SushiBarContracts.BusinessLogicsContracts
/// Сохранение компонент в файл-Word
/// </summary>
/// <param name="model"></param>
void SaveComponentsToWordFile(ReportBindingModel model);
void SaveSushisToWordFile(ReportBindingModel model);
/// <summary>
/// Сохранение компонент с указаеним продуктов в файл-Excel
/// </summary>

View File

@ -17,23 +17,15 @@ namespace SushiBarDatabaseImplement.Implements
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{
if (!model.Id.HasValue && !model.DateTo.HasValue && !model.DateFrom.HasValue)
{
return new();
}
using var context = new SushiBarDatabase();
var orders = context.Orders
.Select(x => x.GetViewModel)
.ToList();
if (model.Id.HasValue)
{
orders = orders.Where(x => x.Id == model.Id.Value).ToList();
}
if (model.DateFrom.HasValue)
{
orders = orders.Where(x => x.DateCreate >= model.DateFrom.Value).ToList();
}
if (model.DateTo.HasValue)
{
orders = orders.Where(x => x.DateCreate <= model.DateTo.Value).ToList();
}
return orders;
return context.Orders.Where(x => x.Id == model.Id).Select(x => AccessViewModel(x.GetViewModel)).ToList();
else
return context.Orders.Where(x => x.DateCreate >= model.DateFrom).Where(x => x.DateCreate <= model.DateTo).Select(x => AccessViewModel(x.GetViewModel)).ToList();
}
public OrderViewModel? GetElement(OrderSearchModel model)
{