This commit is contained in:
Владимир Данилов 2024-04-19 09:01:13 +04:00
parent dfc0fb1c1f
commit 90bdd2cc2a
3 changed files with 15 additions and 24 deletions

View File

@ -34,7 +34,7 @@ namespace RenovationWorkView
MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
//try
try
{
var dataSource = _logic.GetOrders(new ReportBindingModel
{
@ -51,11 +51,11 @@ namespace RenovationWorkView
reportViewer.RefreshReport();
_logger.LogInformation("Loading list of orders for period {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
}
//catch (Exception ex)
//{
// _logger.LogError(ex, "Loading list of orders for period error");
// MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
//}
catch (Exception ex)
{
_logger.LogError(ex, "Loading list of orders for period error");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonToPdf_Click(object sender, EventArgs e)

View File

@ -1,15 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<AutoRefresh>0</AutoRefresh>
<DataSources>
<DataSource Name="RenovationWorkContractsViewModels">
<ConnectionProperties>
<DataProvider>System.Data.DataSet</DataProvider>
<ConnectString>/* Local Connection */</ConnectString>
</ConnectionProperties>
<rd:DataSourceID>47cb53f0-7dde-4717-ba03-866a0bc4f4dd</rd:DataSourceID>
</DataSource>
</DataSources>
<DataSets>
<DataSet Name="DataSetOrders">
<Query>
@ -104,7 +95,7 @@
</Paragraphs>
<rd:DefaultName>TextboxTitle</rd:DefaultName>
<Height>0.83812cm</Height>
<Width>16.51cm</Width>
<Width>21cm</Width>
<ZIndex>1</ZIndex>
<Style>
<Border>
@ -368,7 +359,7 @@
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="EngineName">
<Textbox Name="RepairName">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
@ -382,7 +373,7 @@
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>EngineName</rd:DefaultName>
<rd:DefaultName>RepairName</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
@ -595,5 +586,5 @@
</GridLayoutDefinition>
</ReportParametersLayout>
<rd:ReportUnitType>Cm</rd:ReportUnitType>
<rd:ReportID>51339ff3-57a4-433f-b70d-c4e0508adcb3</rd:ReportID>
<rd:ReportID>4d09d569-730a-46f4-8266-77bb279f2dec</rd:ReportID>
</Report>

View File

@ -42,19 +42,19 @@ namespace RenovationWorkBusinessLogic.BusinessLogics
public List<ReportRepairComponentViewModel> GetRepairComponent()
{
var engines = _repairStorage.GetFullList();
var repairs = _repairStorage.GetFullList();
var list = new List<ReportRepairComponentViewModel>();
foreach (var engine in engines)
foreach (var repair in repairs)
{
var record = new ReportRepairComponentViewModel
{
RepairName = engine.RepairName,
RepairName = repair.RepairName,
Repairs = new List<(string Component, int Count)>(),
TotalCount = 0,
};
foreach (var component in engine.RepairComponents)
foreach (var component in repair.RepairComponents)
{
record.Repairs.Add(new(component.Value.Item1.ComponentName, component.Value.Item2));
record.TotalCount += component.Value.Item2;