начальные изменения в ворд по требованиям
This commit is contained in:
parent
890f11f6d4
commit
8c41ac1719
@ -148,7 +148,7 @@ namespace SushiBarView
|
|||||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
_reportLogic.SaveComponentsToWordFile(new ReportBindingModel
|
_reportLogic.SaveSushisToWordFile(new ReportBindingModel
|
||||||
{
|
{
|
||||||
FileName = dialog.FileName
|
FileName = dialog.FileName
|
||||||
});
|
});
|
||||||
|
@ -17,12 +17,12 @@ namespace SushiBarBusinessLogic.OfficePackage
|
|||||||
JustificationType = WordJustificationType.Center
|
JustificationType = WordJustificationType.Center
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
foreach (var component in info.Components)
|
foreach (var sushi in info.Sushi)
|
||||||
{
|
{
|
||||||
CreateParagraph(new WordParagraph
|
CreateParagraph(new WordParagraph
|
||||||
{
|
{
|
||||||
Texts = new List<(string, WordTextProperties)> {
|
Texts = new List<(string, WordTextProperties)> {
|
||||||
(component.ComponentName, new WordTextProperties { Size = "24", })
|
(sushi.SushiName, new WordTextProperties { Size = "24", })
|
||||||
},
|
},
|
||||||
TextProperties = new WordTextProperties
|
TextProperties = new WordTextProperties
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,7 @@ namespace SushiBarBusinessLogic.OfficePackage.HelperModels
|
|||||||
{
|
{
|
||||||
public string FileName { get; set; } = string.Empty;
|
public string FileName { get; set; } = string.Empty;
|
||||||
public string Title { 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();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,7 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
|
|||||||
private Document? _document;
|
private Document? _document;
|
||||||
private Section? _section;
|
private Section? _section;
|
||||||
private Table? _table;
|
private Table? _table;
|
||||||
private static ParagraphAlignment
|
private static ParagraphAlignment GetParagraphAlignment(PdfParagraphAlignmentType type)
|
||||||
GetParagraphAlignment(PdfParagraphAlignmentType type)
|
|
||||||
{
|
{
|
||||||
return type switch
|
return type switch
|
||||||
{
|
{
|
||||||
@ -86,7 +85,6 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
|
|||||||
row.Cells[i].VerticalAlignment = VerticalAlignment.Center;
|
row.Cells[i].VerticalAlignment = VerticalAlignment.Center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void SavePdf(PdfInfo info)
|
protected override void SavePdf(PdfInfo info)
|
||||||
{
|
{
|
||||||
var renderer = new PdfDocumentRenderer(true)
|
var renderer = new PdfDocumentRenderer(true)
|
||||||
|
@ -80,13 +80,13 @@ namespace SushiBarBusinessLogic
|
|||||||
/// Сохранение компонент в файл-Word
|
/// Сохранение компонент в файл-Word
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="model"></param>
|
/// <param name="model"></param>
|
||||||
public void SaveComponentsToWordFile(ReportBindingModel model)
|
public void SaveSushisToWordFile(ReportBindingModel model)
|
||||||
{
|
{
|
||||||
_saveToWord.CreateDoc(new WordInfo
|
_saveToWord.CreateDoc(new WordInfo
|
||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
Title = "Список компонент",
|
Title = "Список компонент",
|
||||||
Components = _componentStorage.GetFullList()
|
Sushi = _sushiStorage.GetFullList()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -12,8 +12,10 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" 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="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="NLog.Extensions.Logging" Version="5.3.8" />
|
||||||
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
|
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
|
||||||
|
<PackageReference Include="PdfSharp.MigraDoc.Standard.DocumentObjectModel" Version="1.51.15" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -20,7 +20,7 @@ namespace SushiBarContracts.BusinessLogicsContracts
|
|||||||
/// Сохранение компонент в файл-Word
|
/// Сохранение компонент в файл-Word
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="model"></param>
|
/// <param name="model"></param>
|
||||||
void SaveComponentsToWordFile(ReportBindingModel model);
|
void SaveSushisToWordFile(ReportBindingModel model);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Сохранение компонент с указаеним продуктов в файл-Excel
|
/// Сохранение компонент с указаеним продуктов в файл-Excel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -17,23 +17,15 @@ namespace SushiBarDatabaseImplement.Implements
|
|||||||
|
|
||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
|
if (!model.Id.HasValue && !model.DateTo.HasValue && !model.DateFrom.HasValue)
|
||||||
|
{
|
||||||
|
return new();
|
||||||
|
}
|
||||||
using var context = new SushiBarDatabase();
|
using var context = new SushiBarDatabase();
|
||||||
var orders = context.Orders
|
|
||||||
.Select(x => x.GetViewModel)
|
|
||||||
.ToList();
|
|
||||||
if (model.Id.HasValue)
|
if (model.Id.HasValue)
|
||||||
{
|
return context.Orders.Where(x => x.Id == model.Id).Select(x => AccessViewModel(x.GetViewModel)).ToList();
|
||||||
orders = orders.Where(x => x.Id == model.Id.Value).ToList();
|
else
|
||||||
}
|
return context.Orders.Where(x => x.DateCreate >= model.DateFrom).Where(x => x.DateCreate <= model.DateTo).Select(x => AccessViewModel(x.GetViewModel)).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;
|
|
||||||
}
|
}
|
||||||
public OrderViewModel? GetElement(OrderSearchModel model)
|
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user