почти почти

This commit is contained in:
Андрей Байгулов 2024-04-25 22:03:18 +04:00
parent d4bc068717
commit 7b725a5d74
8 changed files with 16 additions and 29 deletions

View File

@ -18,10 +18,10 @@ namespace SushiBarBusinessLogic.OfficePackage
CreateParagraph(new PdfParagraph
{
Text = $"с { info.DateFrom.ToShortDateString() } по { info.DateTo.ToShortDateString() }", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center});
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm" });
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm", "3cm" });
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "Номер", "Дата заказа", "Изделие", "Сумма" },
Texts = new List<string> { "Номер", "Дата заказа", "Изделие", "Статус", "Сумма" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
@ -29,7 +29,7 @@ namespace SushiBarBusinessLogic.OfficePackage
{
CreateRow(new PdfRowParameters
{
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.SushiName, order.Sum.ToString() },
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.SushiName, order.Status.ToString(), order.Sum.ToString() },
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});

View File

@ -65,8 +65,7 @@ namespace SushiBarBusinessLogic.BusinessLogics
{
return _orderStorage.GetFilteredList(new OrderSearchModel
{
DateFrom
= model.DateFrom,
DateFrom = model.DateFrom,
DateTo = model.DateTo
})
.Select(x => new ReportOrdersViewModel
@ -74,7 +73,8 @@ namespace SushiBarBusinessLogic.BusinessLogics
Id = x.Id,
DateCreate = x.DateCreate,
SushiName = x.SushiName,
Sum = x.Sum
Sum = x.Sum,
Status = x.Status.ToString()
})
.ToList();
}

View File

@ -10,8 +10,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
{

View File

@ -6,5 +6,6 @@
public DateTime DateCreate { get; set; }
public string SushiName{ get; set; } = string.Empty;
public double Sum { get; set; }
public string Status { get; set; } = string.Empty;
}
}

View File

@ -17,12 +17,9 @@ namespace SushiBarDatabaseImplement.Implements
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{
if (!model.Id.HasValue)
{
return new();
}
using var context = new SushiBarDatabase();
return context.Orders.Include(x => x.Sushi).Where(x => x.Id == model.Id).Select(x => x.GetViewModel).ToList();
var result = context.Orders.Include(x => x.Sushi).Select(x => x.GetViewModel).ToList();
return result;
}
public OrderViewModel? GetElement(OrderSearchModel model)

View File

@ -199,7 +199,6 @@
private ToolStripMenuItem componentsToolStripMenuItem;
private ToolStripMenuItem sushiToolStripMenuItem;
private ToolStripMenuItem ReportsToolStripMenuItem;
private ToolStripMenuItem toolStripMenuItem1;
private ToolStripMenuItem ComponentsListToolStripMenuItem;
private ToolStripMenuItem ComponentSushisToolStripMenuItem;
private ToolStripMenuItem OrdersToolStripMenuItem;

View File

@ -66,8 +66,7 @@ namespace SushiBarView
{
if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date)
{
MessageBox.Show("Дата начала должна быть меньше даты окончания",
"Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
using var dialog = new SaveFileDialog
@ -84,13 +83,14 @@ namespace SushiBarView
DateFrom = dateTimePickerFrom.Value,
DateTo = dateTimePickerTo.Value
});
_logger.LogInformation("Сохранение списка заказов на период { From}-{ To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK,
MessageBoxIcon.Information);
_logger.LogInformation("Сохранение списка заказов на период {From}-{To} ",
dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка сохранения списка заказов на период"); MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
_logger.LogError(ex, "Ошибка сохранения списка заказов на период");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}

View File

@ -9,15 +9,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.9.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
<PackageReference Include="ReportViewerCore.WinForms" Version="15.1.19" />
</ItemGroup>