This commit is contained in:
gg12 darfren 2024-03-26 22:57:55 +04:00
parent 4c86765f3d
commit 8cab06f963
6 changed files with 44 additions and 38 deletions

View File

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

View File

@ -29,41 +29,23 @@
private void InitializeComponent() private void InitializeComponent()
{ {
dataGridView = new DataGridView(); dataGridView = new DataGridView();
ComponentColumn = new DataGridViewTextBoxColumn();
IceCreamColumn = new DataGridViewTextBoxColumn();
CountColumn = new DataGridViewTextBoxColumn();
SaveButton = new Button(); SaveButton = new Button();
IceCreamColumn = new DataGridViewTextBoxColumn();
ComponentColumn = new DataGridViewTextBoxColumn();
CountColumn = new DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout(); SuspendLayout();
// //
// dataGridView // dataGridView
// //
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; 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.Location = new Point(12, 46);
dataGridView.Name = "dataGridView"; dataGridView.Name = "dataGridView";
dataGridView.RowTemplate.Height = 25; dataGridView.RowTemplate.Height = 25;
dataGridView.Size = new Size(570, 392); dataGridView.Size = new Size(570, 392);
dataGridView.TabIndex = 0; 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
// //
SaveButton.Location = new Point(12, 17); SaveButton.Location = new Point(12, 17);
@ -74,6 +56,24 @@
SaveButton.UseVisualStyleBackColor = true; SaveButton.UseVisualStyleBackColor = true;
SaveButton.Click += SaveButton_Click; 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 // ReportIceCreamComponentForm
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
@ -92,8 +92,8 @@
private DataGridView dataGridView; private DataGridView dataGridView;
private Button SaveButton; private Button SaveButton;
private DataGridViewTextBoxColumn ComponentColumn;
private DataGridViewTextBoxColumn IceCreamColumn; private DataGridViewTextBoxColumn IceCreamColumn;
private DataGridViewTextBoxColumn ComponentColumn;
private DataGridViewTextBoxColumn CountColumn; private DataGridViewTextBoxColumn CountColumn;
} }
} }

View File

@ -117,10 +117,10 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </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> <value>True</value>
</metadata> </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> <value>True</value>
</metadata> </metadata>
<metadata name="CountColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <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> <PaddingBottom>2pt</PaddingBottom>
</Style> </Style>
</Textbox> </Textbox>
<rd:Selected>true</rd:Selected>
</CellContents> </CellContents>
</TablixCell> </TablixCell>
<TablixCell> <TablixCell>

View File

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

View File

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