ПИбд-22 Боровков М В 4 лабораторная работа #4

Closed
bekodeg wants to merge 23 commits from labWork4 into labWork3
4 changed files with 41 additions and 20 deletions
Showing only changes of commit b47fccbd24 - Show all commits

View File

@ -35,6 +35,7 @@
dateTimePickerFrom = new DateTimePicker();
buttonToPdf = new Button();
buttonMake = new Button();
panelBody = new Panel();
panel.SuspendLayout();
SuspendLayout();
//
@ -104,11 +105,19 @@
buttonMake.UseVisualStyleBackColor = true;
buttonMake.Click += buttonMake_Click;
//
// panelBody
//
panelBody.Location = new Point(0, 57);
panelBody.Name = "panelBody";
panelBody.Size = new Size(800, 393);
panelBody.TabIndex = 1;
//
// FormReportOrders
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(panelBody);
Controls.Add(panel);
Name = "FormReportOrders";
Text = "FormReportOrders";
@ -126,5 +135,6 @@
private DateTimePicker dateTimePickerFrom;
private Label label1;
private Label label2;
private Panel panelBody;
}
}

View File

@ -20,10 +20,9 @@ namespace SushiBar.Forms
{
Dock = DockStyle.Fill
};
reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrders.rdlc", FileMode.Open));
Controls.Clear();
Controls.Add(reportViewer);
Controls.Add(panel);
reportViewer.LocalReport.LoadReportDefinition(
new FileStream("Report/ReportOrders.rdlc", FileMode.Open));
panelBody.Controls.Add(reportViewer);
}
private void ButtonMake_Click(object sender, EventArgs e)
{
@ -43,10 +42,15 @@ namespace SushiBar.Forms
var source = new ReportDataSource("DataSetOrders", dataSource);
reportViewer.LocalReport.DataSources.Clear();
reportViewer.LocalReport.DataSources.Add(source);
var parameters = new[] { new ReportParameter("ReportParameterPeriod", $"c{dateTimePickerFrom.Value.ToShortDateString()} по {dateTimePickerTo.Value.ToShortDateString()}") };
var parameters = new[] {
new ReportParameter("ReportParameterPeriod",
$"c{dateTimePickerFrom.Value.ToShortDateString()} по" +
$" {dateTimePickerTo.Value.ToShortDateString()}") };
reportViewer.LocalReport.SetParameters(parameters);
reportViewer.RefreshReport();
_logger.LogInformation("Загрузка списка заказов на период {From}-{ To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
_logger.LogInformation("Загрузка списка заказов на период {From}-{ To}",
dateTimePickerFrom.Value.ToShortDateString(),
dateTimePickerTo.Value.ToShortDateString());
}
catch (Exception ex)
{
@ -69,6 +73,7 @@ namespace SushiBar.Forms
{
try
{
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
_logic.SaveOrdersToPdfFile(new ReportBindingModel
{
FileName = dialog.FileName,

View File

@ -26,16 +26,22 @@ namespace SushiBar.Forms
dataGridView.Rows.Clear();
foreach (var elem in dict)
{
dataGridView.Rows.Add(new object[] { elem.ComponentName, "", "" });
foreach (var listElem in elem.Sushis)
dataGridView.Rows.Add(new object[] {
elem.SushiName, "", ""
});
foreach (var listElem in elem.Components)
{
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
dataGridView.Rows.Add(new object[] {
"", listElem.Item1, listElem.Item2
});
}
dataGridView.Rows.Add(new object[] { "Итого", "", elem.TotalCount });
dataGridView.Rows.Add(new object[] {
"Итого", "", elem.TotalCount
});
dataGridView.Rows.Add(Array.Empty<object>());
}
}
_logger.LogInformation("Загрузка списка изделий по компонентам");
_logger.LogInformation("Загрузка списка суши по компонентам");
}
catch (Exception ex)
{

View File

@ -2,7 +2,7 @@
<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="FishFactoryContractsViewModels">
<DataSource Name="SushiBarContractsViewModels">
<ConnectionProperties>
<DataProvider>System.Data.DataSet</DataProvider>
<ConnectString>/* Local Connection */</ConnectString>
@ -13,7 +13,7 @@
<DataSets>
<DataSet Name="DataSetOrders">
<Query>
<DataSourceName>FishFactoryContractsViewModels</DataSourceName>
<DataSourceName>SushiBarContractsViewModels</DataSourceName>
<CommandText>/* Local Query */</CommandText>
</Query>
<Fields>
@ -25,8 +25,8 @@
<DataField>DateCreate</DataField>
<rd:TypeName>System.DateTime</rd:TypeName>
</Field>
<Field Name="CannedName">
<DataField>CannedName</DataField>
<Field Name="SushiName">
<DataField>SushiName</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Sum">
@ -35,13 +35,13 @@
</Field>
<Field Name="OrderStatus">
<DataField>OrderStatus</DataField>
<rd:TypeName>FishFactoryDataModels.OrderStatus</rd:TypeName>
<rd:TypeName>SushiBarDataModels.OrderStatus</rd:TypeName>
</Field>
</Fields>
<rd:DataSetInfo>
<rd:DataSetName>FishFactoryContracts.ViewModels</rd:DataSetName>
<rd:DataSetName>SushiBarContracts.ViewModels</rd:DataSetName>
<rd:TableName>ReportOrderViewModel</rd:TableName>
<rd:ObjectDataSourceType>FishFactoryContracts.ViewModels.ReportOrderViewModel, FishFactoryContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
<rd:ObjectDataSourceType>SushiBarContracts.ViewModels.ReportOrderViewModel, SushiBarContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
</rd:DataSetInfo>
</DataSet>
</DataSets>
@ -368,7 +368,7 @@
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="CannedName">
<Textbox Name="SushiName">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
@ -382,7 +382,7 @@
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>CannedName</rd:DefaultName>
<rd:DefaultName>SushiName</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>