ПИбд-23 Салин Олег Алексеевич Лабораторная работа №4 #12

Closed
Oleja123 wants to merge 6 commits from Lab4 into Lab3
6 changed files with 44 additions and 38 deletions
Showing only changes of commit 8cab06f963 - Show all commits

View File

@ -8,6 +8,10 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<None Remove="ReportOrders.rdlc" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Corrected.Microsoft.ReportingServices.ReportViewerControl.Winforms" Version="150.1358.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.3">
@ -27,6 +31,10 @@
<ProjectReference Include="..\IceCreamShopListImplement\IceCreamShopListImplement.csproj" />
</ItemGroup>
<ItemGroup>
<Resource Include="ReportOrders.rdlc" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>

View File

@ -29,41 +29,23 @@
private void InitializeComponent()
{
dataGridView = new DataGridView();
ComponentColumn = new DataGridViewTextBoxColumn();
IceCreamColumn = new DataGridViewTextBoxColumn();
CountColumn = new DataGridViewTextBoxColumn();
SaveButton = new Button();
IceCreamColumn = new DataGridViewTextBoxColumn();
ComponentColumn = new DataGridViewTextBoxColumn();
CountColumn = new DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// dataGridView
//
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ComponentColumn, IceCreamColumn, CountColumn });
dataGridView.Columns.AddRange(new DataGridViewColumn[] { IceCreamColumn, ComponentColumn, CountColumn });
dataGridView.Location = new Point(12, 46);
dataGridView.Name = "dataGridView";
dataGridView.RowTemplate.Height = 25;
dataGridView.Size = new Size(570, 392);
dataGridView.TabIndex = 0;
//
// ComponentColumn
//
ComponentColumn.HeaderText = "Компонент";
ComponentColumn.Name = "ComponentColumn";
ComponentColumn.Width = 200;
//
// IceCreamColumn
//
IceCreamColumn.HeaderText = "Мороженное";
IceCreamColumn.Name = "IceCreamColumn";
IceCreamColumn.Width = 200;
//
// CountColumn
//
CountColumn.HeaderText = "Количество";
CountColumn.Name = "CountColumn";
CountColumn.Width = 130;
//
// SaveButton
//
SaveButton.Location = new Point(12, 17);
@ -74,6 +56,24 @@
SaveButton.UseVisualStyleBackColor = true;
SaveButton.Click += SaveButton_Click;
//
// IceCreamColumn
//
IceCreamColumn.HeaderText = "Мороженное";
IceCreamColumn.Name = "IceCreamColumn";
IceCreamColumn.Width = 200;
//
// ComponentColumn
//
ComponentColumn.HeaderText = "Компоненты";
ComponentColumn.Name = "ComponentColumn";
ComponentColumn.Width = 200;
//
// CountColumn
//
CountColumn.HeaderText = "Количество";
CountColumn.Name = "CountColumn";
CountColumn.Width = 130;
//
// ReportIceCreamComponentForm
//
AutoScaleDimensions = new SizeF(7F, 15F);
@ -92,8 +92,8 @@
private DataGridView dataGridView;
private Button SaveButton;
private DataGridViewTextBoxColumn ComponentColumn;
private DataGridViewTextBoxColumn IceCreamColumn;
private DataGridViewTextBoxColumn ComponentColumn;
private DataGridViewTextBoxColumn CountColumn;
}
}

View File

@ -117,10 +117,10 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ComponentColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="IceCreamColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="IceCreamColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="ComponentColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CountColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

View File

@ -424,7 +424,6 @@
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<rd:Selected>true</rd:Selected>
</CellContents>
</TablixCell>
<TablixCell>

View File

@ -29,14 +29,15 @@ namespace IceCreamShopFileImplement.Implements
public List<OrderViewModel> GetFilteredList(OrderSearchModel
model)
{
if (!model.Id.HasValue)
{
return new();
}
return source.Orders
.Where(x => x.Id == model.Id)
.Select( x => AccessIceCreamStorage( x.GetViewModel))
.ToList();
.Where(x => (
(!model.Id.HasValue || x.Id == model.Id) &&
(!model.DateFrom.HasValue || x.DateCreate >= model.DateFrom) &&
(!model.DateTo.HasValue || x.DateCreate <= model.DateTo)
)
)
.Select(x => x.GetViewModel)
.ToList();
}
public OrderViewModel? GetElement(OrderSearchModel model)

View File

@ -31,13 +31,11 @@ namespace IceCreamShopListImplement.Implements
model)
{
var result = new List<OrderViewModel>();
if (!model.Id.HasValue)
{
return result;
}
foreach (var order in _source.Orders)
{
if (order.Id == model.Id)
if ((!model.Id.HasValue || order.Id == model.Id) &&
(!model.DateFrom.HasValue || order.DateCreate >= model.DateFrom) &&
(!model.DateTo.HasValue || order.DateCreate <= model.DateTo))
{
result.Add(AccessIceCreamStorage(order.GetViewModel));
}