лабораторная 4

This commit is contained in:
DavidMakarov 2024-04-04 00:39:31 +04:00
parent 091ec47f7a
commit 3b7d750669
40 changed files with 917 additions and 275 deletions

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework> <TargetFramework>net7.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>

View File

@ -32,16 +32,16 @@
справочникиToolStripMenuItem = new ToolStripMenuItem(); справочникиToolStripMenuItem = new ToolStripMenuItem();
ЦветыToolStripMenuItem = new ToolStripMenuItem(); ЦветыToolStripMenuItem = new ToolStripMenuItem();
КомпонентыToolStripMenuItem = new ToolStripMenuItem(); КомпонентыToolStripMenuItem = new ToolStripMenuItem();
отчётыToolStripMenuItem = new ToolStripMenuItem();
списокЦветковToolStripMenuItem = new ToolStripMenuItem();
компонентыПоЦветамToolStripMenuItem = new ToolStripMenuItem();
списокЗаказовToolStripMenuItem = new ToolStripMenuItem();
dataGridView = new DataGridView(); dataGridView = new DataGridView();
buttonCreateOrder = new Button(); buttonCreateOrder = new Button();
buttonTakeOrderInWork = new Button(); buttonTakeOrderInWork = new Button();
buttonOrderReady = new Button(); buttonOrderReady = new Button();
buttonIssuedOrder = new Button(); buttonIssuedOrder = new Button();
buttonRef = new Button(); buttonRef = new Button();
отчётыToolStripMenuItem = new ToolStripMenuItem();
списокКомпонентовToolStripMenuItem = new ToolStripMenuItem();
компонентыПоИзделиямToolStripMenuItem = new ToolStripMenuItem();
списокЗаказовToolStripMenuItem = new ToolStripMenuItem();
menuStrip1.SuspendLayout(); menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout(); SuspendLayout();
@ -76,6 +76,34 @@
КомпонентыToolStripMenuItem.Text = "Компоненты"; КомпонентыToolStripMenuItem.Text = "Компоненты";
КомпонентыToolStripMenuItem.Click += КомпонентыToolStripMenuItem_Click; КомпонентыToolStripMenuItem.Click += КомпонентыToolStripMenuItem_Click;
// //
// отчётыToolStripMenuItem
//
отчётыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокЦветковToolStripMenuItem, компонентыПоЦветамToolStripMenuItem, списокЗаказовToolStripMenuItem });
отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
отчётыToolStripMenuItem.Size = new Size(60, 20);
отчётыToolStripMenuItem.Text = "Отчёты";
//
// списокЦветковToolStripMenuItem
//
списокЦветковToolStripMenuItem.Name = "списокЦветковToolStripMenuItem";
списокЦветковToolStripMenuItem.Size = new Size(204, 22);
списокЦветковToolStripMenuItem.Text = "Список цветков";
списокЦветковToolStripMenuItem.Click += списокЦветковToolStripMenuItem_Click;
//
// компонентыПоЦветамToolStripMenuItem
//
компонентыПоЦветамToolStripMenuItem.Name = омпонентыПоЦветамToolStripMenuItem";
компонентыПоЦветамToolStripMenuItem.Size = new Size(204, 22);
компонентыПоЦветамToolStripMenuItem.Text = "Компоненты по цветам";
компонентыПоЦветамToolStripMenuItem.Click += компонентыПоЦветамToolStripMenuItem_Click;
//
// списокЗаказовToolStripMenuItem
//
списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
списокЗаказовToolStripMenuItem.Size = new Size(204, 22);
списокЗаказовToolStripMenuItem.Text = "Список заказов";
списокЗаказовToolStripMenuItem.Click += списокЗаказовToolStripMenuItem_Click;
//
// dataGridView // dataGridView
// //
dataGridView.BackgroundColor = Color.White; dataGridView.BackgroundColor = Color.White;
@ -136,31 +164,6 @@
buttonRef.UseVisualStyleBackColor = true; buttonRef.UseVisualStyleBackColor = true;
buttonRef.Click += ButtonRef_Click; buttonRef.Click += ButtonRef_Click;
// //
// отчётыToolStripMenuItem
//
отчётыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокКомпонентовToolStripMenuItem, компонентыПоИзделиямToolStripMenuItem, списокЗаказовToolStripMenuItem });
отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
отчётыToolStripMenuItem.Size = new Size(60, 20);
отчётыToolStripMenuItem.Text = "Отчёты";
//
// списокКомпонентовToolStripMenuItem
//
списокКомпонентовToolStripMenuItem.Name = "списокКомпонентовToolStripMenuItem";
списокКомпонентовToolStripMenuItem.Size = new Size(218, 22);
списокКомпонентовToolStripMenuItem.Text = "Список компонентов";
//
// компонентыПоИзделиямToolStripMenuItem
//
компонентыПоИзделиямToolStripMenuItem.Name = омпонентыПоИзделиямToolStripMenuItem";
компонентыПоИзделиямToolStripMenuItem.Size = new Size(218, 22);
компонентыПоИзделиямToolStripMenuItem.Text = "Компоненты по изделиям";
//
// списокЗаказовToolStripMenuItem
//
списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
списокЗаказовToolStripMenuItem.Size = new Size(218, 22);
списокЗаказовToolStripMenuItem.Text = "Список заказов";
//
// FormMain // FormMain
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
@ -197,8 +200,8 @@
private Button buttonIssuedOrder; private Button buttonIssuedOrder;
private Button buttonRef; private Button buttonRef;
private ToolStripMenuItem отчётыToolStripMenuItem; private ToolStripMenuItem отчётыToolStripMenuItem;
private ToolStripMenuItem списокКомпонентовToolStripMenuItem; private ToolStripMenuItem списокЦветковToolStripMenuItem;
private ToolStripMenuItem компонентыПоИзделиямToolStripMenuItem; private ToolStripMenuItem компонентыПоЦветамToolStripMenuItem;
private ToolStripMenuItem списокЗаказовToolStripMenuItem; private ToolStripMenuItem списокЗаказовToolStripMenuItem;
} }
} }

View File

@ -1,4 +1,5 @@
using FlowerShopContracts.BindingModels; using FlowerShopBusinessLogic.BusinessLogics;
using FlowerShopContracts.BindingModels;
using FlowerShopContracts.BusinessLogicsContracts; using FlowerShopContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
@ -8,11 +9,13 @@ namespace FlowerShopView
{ {
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IOrderLogic _orderLogic; private readonly IOrderLogic _orderLogic;
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic) private readonly IReportLogic _reportLogic;
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic)
{ {
InitializeComponent(); InitializeComponent();
_logger = logger; _logger = logger;
_orderLogic = orderLogic; _orderLogic = orderLogic;
_reportLogic = reportLogic;
} }
private void FormMain_Load(object sender, EventArgs e) private void FormMain_Load(object sender, EventArgs e)
{ {
@ -140,5 +143,36 @@ namespace FlowerShopView
{ {
LoadData(); LoadData();
} }
private void списокЦветковToolStripMenuItem_Click(object sender, EventArgs e)
{
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
if (dialog.ShowDialog() == DialogResult.OK)
{
_reportLogic.SaveComponentsToWordFile(new ReportBindingModel
{
FileName = dialog.FileName
});
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void списокЗаказовToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
if (service is FormReportOrders form)
{
form.ShowDialog();
}
}
private void компонентыПоЦветамToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReportFlowerComponents));
if (service is FormReportFlowerComponents form)
{
form.ShowDialog();
}
}
} }
} }

View File

@ -18,7 +18,7 @@
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value> <value>[base64 mime encoded serialized .NET Framework object]</value>
</data> </data>

View File

@ -28,87 +28,86 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.dataGridView = new System.Windows.Forms.DataGridView(); dataGridView = new DataGridView();
this.buttonSaveToExcel = new System.Windows.Forms.Button(); buttonSaveToExcel = new Button();
this.ColumnComponent = new System.Windows.Forms.DataGridViewTextBoxColumn(); ColumnComponent = new DataGridViewTextBoxColumn();
this.ColumnFlower = new System.Windows.Forms.DataGridViewTextBoxColumn(); ColumnFlower = new DataGridViewTextBoxColumn();
this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn(); ColumnCount = new DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
this.SuspendLayout(); SuspendLayout();
// //
// dataGridView // dataGridView
// //
this.dataGridView.AllowUserToAddRows = false; dataGridView.AllowUserToAddRows = false;
this.dataGridView.AllowUserToDeleteRows = false; dataGridView.AllowUserToDeleteRows = false;
this.dataGridView.AllowUserToOrderColumns = true; dataGridView.AllowUserToOrderColumns = true;
this.dataGridView.AllowUserToResizeColumns = false; dataGridView.AllowUserToResizeColumns = false;
this.dataGridView.AllowUserToResizeRows = false; dataGridView.AllowUserToResizeRows = false;
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ControlLightLight; dataGridView.BackgroundColor = SystemColors.ControlLightLight;
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnComponent, ColumnFlower, ColumnCount });
this.ColumnComponent, dataGridView.Dock = DockStyle.Bottom;
this.ColumnFlower, dataGridView.Location = new Point(0, 47);
this.ColumnCount}); dataGridView.Margin = new Padding(4, 3, 4, 3);
this.dataGridView.Dock = System.Windows.Forms.DockStyle.Bottom; dataGridView.MultiSelect = false;
this.dataGridView.Location = new System.Drawing.Point(0, 41); dataGridView.Name = "dataGridView";
this.dataGridView.MultiSelect = false; dataGridView.ReadOnly = true;
this.dataGridView.Name = "dataGridView"; dataGridView.RowHeadersVisible = false;
this.dataGridView.ReadOnly = true; dataGridView.Size = new Size(616, 510);
this.dataGridView.RowHeadersVisible = false; dataGridView.TabIndex = 0;
this.dataGridView.Size = new System.Drawing.Size(528, 442);
this.dataGridView.TabIndex = 0;
// //
// buttonSaveToExcel // buttonSaveToExcel
// //
this.buttonSaveToExcel.Location = new System.Drawing.Point(12, 12); buttonSaveToExcel.Location = new Point(14, 14);
this.buttonSaveToExcel.Name = "buttonSaveToExcel"; buttonSaveToExcel.Margin = new Padding(4, 3, 4, 3);
this.buttonSaveToExcel.Size = new System.Drawing.Size(159, 23); buttonSaveToExcel.Name = "buttonSaveToExcel";
this.buttonSaveToExcel.TabIndex = 1; buttonSaveToExcel.Size = new Size(186, 27);
this.buttonSaveToExcel.Text = "Сохранить в Excel"; buttonSaveToExcel.TabIndex = 1;
this.buttonSaveToExcel.UseVisualStyleBackColor = true; buttonSaveToExcel.Text = "Сохранить в Excel";
this.buttonSaveToExcel.Click += new System.EventHandler(this.ButtonSaveToExcel_Click); buttonSaveToExcel.UseVisualStyleBackColor = true;
buttonSaveToExcel.Click += ButtonSaveToExcel_Click;
// //
// ColumnComponent // ColumnComponent
// //
this.ColumnComponent.HeaderText = "Компонент"; ColumnComponent.HeaderText = "Цветы";
this.ColumnComponent.Name = "ColumnComponent"; ColumnComponent.Name = "ColumnComponent";
this.ColumnComponent.ReadOnly = true; ColumnComponent.ReadOnly = true;
this.ColumnComponent.Width = 200; ColumnComponent.Width = 200;
// //
// ColumnFlower // ColumnFlower
// //
this.ColumnFlower.HeaderText = "Цветы"; ColumnFlower.HeaderText = "Компонент";
this.ColumnFlower.Name = "ColumnFlower"; ColumnFlower.Name = "ColumnFlower";
this.ColumnFlower.ReadOnly = true; ColumnFlower.ReadOnly = true;
this.ColumnFlower.Width = 200; ColumnFlower.Width = 200;
// //
// ColumnCount // ColumnCount
// //
this.ColumnCount.HeaderText = "Количество"; ColumnCount.HeaderText = "Количество";
this.ColumnCount.Name = "ColumnCount"; ColumnCount.Name = "ColumnCount";
this.ColumnCount.ReadOnly = true; ColumnCount.ReadOnly = true;
// //
// FormReportFlowerComponents // FormReportFlowerComponents
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); AutoScaleDimensions = new SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(528, 483); ClientSize = new Size(616, 557);
this.Controls.Add(this.buttonSaveToExcel); Controls.Add(buttonSaveToExcel);
this.Controls.Add(this.dataGridView); Controls.Add(dataGridView);
this.Name = "FormReportFlowerComponents"; Margin = new Padding(4, 3, 4, 3);
this.Text = "Компоненты по цветам"; Name = "FormReportFlowerComponents";
this.Load += new System.EventHandler(this.FormReportFlowerComponents_Load); Text = "Компоненты по цветам";
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); Load += FormReportFlowerComponents_Load;
this.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
} }
#endregion #endregion
private System.Windows.Forms.DataGridView dataGridView; private System.Windows.Forms.DataGridView dataGridView;
private System.Windows.Forms.Button buttonSaveToExcel; private System.Windows.Forms.Button buttonSaveToExcel;
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnComponent; private DataGridViewTextBoxColumn ColumnComponent;
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnFlower; private DataGridViewTextBoxColumn ColumnFlower;
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnCount; private DataGridViewTextBoxColumn ColumnCount;
} }
} }

View File

@ -36,8 +36,8 @@ namespace FlowerShopView
dataGridView.Rows.Clear(); dataGridView.Rows.Clear();
foreach (var elem in dict) foreach (var elem in dict)
{ {
dataGridView.Rows.Add(new object[] { elem.ComponentName, "", "" }); dataGridView.Rows.Add(new object[] { elem.FlowerName, "", "" });
foreach (var listElem in elem.Flowers) foreach (var listElem in elem.Components)
{ {
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 }); dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
} }

View File

@ -22,7 +22,7 @@ namespace FlowerShopView
{ {
Dock = DockStyle.Fill Dock = DockStyle.Fill
}; };
reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrders.rdlc", FileMode.Open)); reportViewer.LocalReport.LoadReportDefinition(new FileStream("..\\..\\..\\ReportOrders.rdlc", FileMode.Open));
Controls.Clear(); Controls.Clear();
Controls.Add(reportViewer); Controls.Add(reportViewer);
Controls.Add(panel); Controls.Add(panel);

View File

@ -1,4 +1,6 @@
using FlowerShopBusinessLogic.BusinessLogics; using FlowerShopBusinessLogic.BusinessLogics;
using FlowerShopBusinessLogic.OfficePackage.Implements;
using FlowerShopBusinessLogic.OfficePackage;
using FlowerShopContracts.BusinessLogicsContracts; using FlowerShopContracts.BusinessLogicsContracts;
using FlowerShopContracts.StoragesContracts; using FlowerShopContracts.StoragesContracts;
using FlowerShopDatabaseImplement.Implements; using FlowerShopDatabaseImplement.Implements;
@ -40,6 +42,11 @@ namespace FlowerShopView
services.AddTransient<IComponentLogic, ComponentLogic>(); services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>(); services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IFlowerLogic, FlowerLogic>(); services.AddTransient<IFlowerLogic, FlowerLogic>();
services.AddTransient<IReportLogic, ReportLogic>();
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
services.AddTransient<AbstractSaveToWord, SaveToWord>();
services.AddTransient<FormMain>(); services.AddTransient<FormMain>();
services.AddTransient<FormComponent>(); services.AddTransient<FormComponent>();
@ -48,6 +55,8 @@ namespace FlowerShopView
services.AddTransient<FormFlower>(); services.AddTransient<FormFlower>();
services.AddTransient<FormFlowerComponent>(); services.AddTransient<FormFlowerComponent>();
services.AddTransient<FormFlowers>(); services.AddTransient<FormFlowers>();
services.AddTransient<FormReportOrders>();
services.AddTransient<FormReportFlowerComponents>();
} }
} }
} }

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="IComponentLogic" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>FlowerShopContracts.BusinessLogicsContracts.IComponentLogic, FlowerShopContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="IFlowerLogic" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>FlowerShopContracts.BusinessLogicsContracts.IFlowerLogic, FlowerShopContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="IOrderLogic" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>FlowerShopContracts.BusinessLogicsContracts.IOrderLogic, FlowerShopContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="IReportLogic" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>FlowerShopContracts.BusinessLogicsContracts.IReportLogic, FlowerShopContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="IComponentStorage" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>FlowerShopContracts.StoragesContracts.IComponentStorage, FlowerShopContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="IFlowerStorage" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>FlowerShopContracts.StoragesContracts.IFlowerStorage, FlowerShopContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="IOrderStorage" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>FlowerShopContracts.StoragesContracts.IOrderStorage, FlowerShopContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@ -1,10 +1,179 @@
<?xml version="1.0" encoding="utf-8"?> <?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"> <Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<AutoRefresh>0</AutoRefresh> <AutoRefresh>0</AutoRefresh>
<DataSources>
<DataSource Name="FlowerShopContractsViewModels">
<ConnectionProperties>
<DataProvider>System.Data.DataSet</DataProvider>
<ConnectString>/* Local Connection */</ConnectString>
</ConnectionProperties>
<rd:DataSourceID>10791c83-cee8-4a38-bbd0-245fc17cefb3</rd:DataSourceID>
</DataSource>
</DataSources>
<DataSets>
<DataSet Name="DataSetOrders">
<Query>
<DataSourceName>FlowerShopContractsViewModels</DataSourceName>
<CommandText>/* Local Query */</CommandText>
</Query>
<Fields>
<Field Name="Id">
<DataField>Id</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="DateCreate">
<DataField>DateCreate</DataField>
<rd:TypeName>System.DateTime</rd:TypeName>
</Field>
<Field Name="FlowerName">
<DataField>FlowerName</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Status">
<DataField>Status</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Sum">
<DataField>Sum</DataField>
<rd:TypeName>System.Decimal</rd:TypeName>
</Field>
</Fields>
<rd:DataSetInfo>
<rd:DataSetName>FlowerShopContracts.ViewModels</rd:DataSetName>
<rd:TableName>ReportOrdersViewModel</rd:TableName>
<rd:ObjectDataSourceType>FlowerShopContracts.ViewModels.ReportOrdersViewModel, FlowerShopContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
</rd:DataSetInfo>
</DataSet>
</DataSets>
<ReportSections> <ReportSections>
<ReportSection> <ReportSection>
<Body> <Body>
<ReportItems> <ReportItems>
<Textbox Name="ReportParameterPeriod">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Parameters!ReportParameterPeriod.Value</Value>
<Style>
<FontSize>14pt</FontSize>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>ReportParameterPeriod</rd:DefaultName>
<Top>1.25764cm</Top>
<Height>1cm</Height>
<Width>21cm</Width>
<Style>
<Border>
<Style>None</Style>
</Border>
<VerticalAlign>Middle</VerticalAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<Textbox Name="TextboxTitle">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Заказы</Value>
<Style>
<FontSize>16pt</FontSize>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<Top>0.22236cm</Top>
<Height>1cm</Height>
<Width>21cm</Width>
<ZIndex>1</ZIndex>
<Style>
<Border>
<Style>None</Style>
</Border>
<VerticalAlign>Middle</VerticalAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<Tablix Name="Tablix1">
<TablixBody>
<TablixColumns>
<TablixColumn>
<Width>2.5cm</Width>
</TablixColumn>
<TablixColumn>
<Width>3.21438cm</Width>
</TablixColumn>
<TablixColumn>
<Width>8.23317cm</Width>
</TablixColumn>
<TablixColumn>
<Width>2.5cm</Width>
</TablixColumn>
<TablixColumn>
<Width>2.5cm</Width>
</TablixColumn>
</TablixColumns>
<TablixRows>
<TablixRow>
<Height>0.6cm</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="Textbox5">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Номер</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox5</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox1"> <Textbox Name="Textbox1">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
@ -12,18 +181,373 @@
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value /> <Value>Дата создания</Value>
<Style /> <Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style /> <Style />
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox1</rd:DefaultName> <rd:DefaultName>Textbox1</rd:DefaultName>
<Top>0.60537cm</Top> <Style>
<Left>6.24099cm</Left> <Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox3">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Изделие</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox3</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox2">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Статус</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox2</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox7">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Сумма</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox7</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
</TablixCells>
</TablixRow>
<TablixRow>
<Height>0.6cm</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="Id">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!Id.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Id</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="DateCreate">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!DateCreate.Value</Value>
<Style>
<Format>d</Format>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>DateCreate</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="ProductName">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!FlowerName.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>ProductName</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Status">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!Status.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Status</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Sum">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!Sum.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Sum</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
</TablixCells>
</TablixRow>
</TablixRows>
</TablixBody>
<TablixColumnHierarchy>
<TablixMembers>
<TablixMember />
<TablixMember />
<TablixMember />
<TablixMember />
<TablixMember />
</TablixMembers>
</TablixColumnHierarchy>
<TablixRowHierarchy>
<TablixMembers>
<TablixMember>
<KeepWithGroup>After</KeepWithGroup>
</TablixMember>
<TablixMember>
<Group Name="Подробности" />
</TablixMember>
</TablixMembers>
</TablixRowHierarchy>
<DataSetName>DataSetOrders</DataSetName>
<Top>2.74155cm</Top>
<Left>0.55245cm</Left>
<Height>1.2cm</Height>
<Width>18.94755cm</Width>
<ZIndex>2</ZIndex>
<Style>
<Border>
<Style>Double</Style>
</Border>
</Style>
</Tablix>
<Textbox Name="TextboxTotalSum">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Итого:</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<Top>4.25764cm</Top>
<Left>14.5cm</Left>
<Height>0.6cm</Height> <Height>0.6cm</Height>
<Width>2.5cm</Width> <Width>2.5cm</Width>
<ZIndex>3</ZIndex>
<Style>
<Border>
<Style>None</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<Textbox Name="SumTotal">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Sum(Fields!Sum.Value, "DataSetOrders")</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<Top>4.25764cm</Top>
<Left>17cm</Left>
<Height>0.6cm</Height>
<Width>2.5cm</Width>
<ZIndex>4</ZIndex>
<Style> <Style>
<Border> <Border>
<Style>None</Style> <Style>None</Style>
@ -38,7 +562,7 @@
<Height>2in</Height> <Height>2in</Height>
<Style /> <Style />
</Body> </Body>
<Width>6.5in</Width> <Width>8.26772in</Width>
<Page> <Page>
<PageHeight>29.7cm</PageHeight> <PageHeight>29.7cm</PageHeight>
<PageWidth>21cm</PageWidth> <PageWidth>21cm</PageWidth>
@ -54,7 +578,6 @@
<ReportParameters> <ReportParameters>
<ReportParameter Name="ReportParameterPeriod"> <ReportParameter Name="ReportParameterPeriod">
<DataType>String</DataType> <DataType>String</DataType>
<Nullable>true</Nullable>
<Prompt>ReportParameter1</Prompt> <Prompt>ReportParameter1</Prompt>
</ReportParameter> </ReportParameter>
</ReportParameters> </ReportParameters>
@ -72,5 +595,5 @@
</GridLayoutDefinition> </GridLayoutDefinition>
</ReportParametersLayout> </ReportParametersLayout>
<rd:ReportUnitType>Cm</rd:ReportUnitType> <rd:ReportUnitType>Cm</rd:ReportUnitType>
<rd:ReportID>985bb8b6-bdf3-4630-8ced-977f08669c73</rd:ReportID> <rd:ReportID>30112a89-8080-456e-a2a9-4d45faa65740</rd:ReportID>
</Report> </Report>

View File

@ -11,18 +11,15 @@ namespace FlowerShopBusinessLogic.BusinessLogics
public class ReportLogic : IReportLogic public class ReportLogic : IReportLogic
{ {
private readonly IComponentStorage _componentStorage; private readonly IComponentStorage _componentStorage;
private readonly IFlowerStorage _productStorage; private readonly IFlowerStorage _flowerStorage;
private readonly IOrderStorage _orderStorage; private readonly IOrderStorage _orderStorage;
private readonly AbstractSaveToExcel _saveToExcel; private readonly AbstractSaveToExcel _saveToExcel;
private readonly AbstractSaveToWord _saveToWord; private readonly AbstractSaveToWord _saveToWord;
private readonly AbstractSaveToPdf _saveToPdf; private readonly AbstractSaveToPdf _saveToPdf;
public ReportLogic(IFlowerStorage productStorage, public ReportLogic(IComponentStorage componentStorage, IFlowerStorage flowerStorage, IOrderStorage orderStorage, AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
IComponentStorage componentStorage, IOrderStorage orderStorage,
AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord,
AbstractSaveToPdf saveToPdf)
{ {
_productStorage = productStorage;
_componentStorage = componentStorage; _componentStorage = componentStorage;
_flowerStorage = flowerStorage;
_orderStorage = orderStorage; _orderStorage = orderStorage;
_saveToExcel = saveToExcel; _saveToExcel = saveToExcel;
_saveToWord = saveToWord; _saveToWord = saveToWord;
@ -31,24 +28,23 @@ namespace FlowerShopBusinessLogic.BusinessLogics
public List<ReportFlowerComponentViewModel> GetFlowerComponent() public List<ReportFlowerComponentViewModel> GetFlowerComponent()
{ {
var components = _componentStorage.GetFullList(); var components = _componentStorage.GetFullList();
var products = _productStorage.GetFullList(); var floweres = _flowerStorage.GetFullList();
var list = new List<ReportFlowerComponentViewModel>(); var list = new List<ReportFlowerComponentViewModel>();
foreach (var component in components)
foreach (var flower in floweres)
{ {
var record = new ReportFlowerComponentViewModel var record = new ReportFlowerComponentViewModel
{ {
ComponentName = component.ComponentName, FlowerName = flower.FlowerName,
Flowers = new List<Tuple<string, int>>(), Components = new List<Tuple<string, int>>(),
TotalCount = 0 TotalCount = 0
}; };
foreach (var product in products) foreach (var component in components)
{ {
if (product.FlowerComponents.ContainsKey(component.Id)) if (flower.FlowerComponents.ContainsKey(component.Id))
{ {
record.Flowers.Add(new Tuple<string, record.Components.Add(new Tuple<string, int>(component.ComponentName, flower.FlowerComponents[component.Id].Item2));
int>(product.FlowerName, product.FlowerComponents[component.Id].Item2)); record.TotalCount += flower.FlowerComponents[component.Id].Item2;
record.TotalCount +=
product.FlowerComponents[component.Id].Item2;
} }
} }
list.Add(record); list.Add(record);
@ -59,34 +55,34 @@ namespace FlowerShopBusinessLogic.BusinessLogics
{ {
return _orderStorage.GetFilteredList(new OrderSearchModel return _orderStorage.GetFilteredList(new OrderSearchModel
{ {
DateFrom DateFrom = model.DateFrom,
= model.DateFrom,
DateTo = model.DateTo DateTo = model.DateTo
}) }).Select(x => new ReportOrdersViewModel
.Select(x => new ReportOrdersViewModel
{ {
Id = x.Id, Id = x.Id,
DateCreate = x.DateCreate, DateCreate = x.DateCreate,
FlowerName = x.FlowerName, FlowerName = x.FlowerName,
Status = x.Status.ToString(),
Sum = x.Sum Sum = x.Sum
}) }).ToList();
.ToList();
} }
public void SaveComponentsToWordFile(ReportBindingModel model) public void SaveComponentsToWordFile(ReportBindingModel model)
{ {
_saveToWord.CreateDoc(new WordInfo _saveToWord.CreateDoc(new WordInfo
{ {
FileName = model.FileName, FileName = model.FileName,
Title = "Список компонент", Title = "Список платьев",
Components = _componentStorage.GetFullList() Flowers = _flowerStorage.GetFullList()
}); });
} }
public void SaveFlowerComponentToExcelFile(ReportBindingModel model) public void SaveFlowerComponentToExcelFile(ReportBindingModel model)
{ {
_saveToExcel.CreateReport(new ExcelInfo _saveToExcel.CreateReport(new ExcelInfo
{ {
FileName = model.FileName, FileName = model.FileName,
Title = "Список компонент", Title = "Список компонентов",
FlowerComponents = GetFlowerComponent() FlowerComponents = GetFlowerComponent()
}); });
} }
@ -101,6 +97,6 @@ namespace FlowerShopBusinessLogic.BusinessLogics
Orders = GetOrders(model) Orders = GetOrders(model)
}); });
} }
}
} }
}

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>

View File

@ -1,4 +1,5 @@
using FlowerShopBusinessLogic.OfficePackage.HelperEnums; using DocumentFormat.OpenXml.Office2016.Drawing.ChartDrawing;
using FlowerShopBusinessLogic.OfficePackage.HelperEnums;
using FlowerShopBusinessLogic.OfficePackage.HelperModels; using FlowerShopBusinessLogic.OfficePackage.HelperModels;
namespace FlowerShopBusinessLogic.OfficePackage namespace FlowerShopBusinessLogic.OfficePackage
@ -21,34 +22,34 @@ namespace FlowerShopBusinessLogic.OfficePackage
CellToName = "C1" CellToName = "C1"
}); });
uint rowIndex = 2; uint rowIndex = 2;
foreach (var pc in info.FlowerComponents) foreach (var fc in info.FlowerComponents)
{ {
InsertCellInWorksheet(new ExcelCellParameters InsertCellInWorksheet(new ExcelCellParameters
{ {
ColumnName = "A", ColumnName = "A",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = pc.ComponentName, Text = fc.FlowerName,
StyleInfo = ExcelStyleInfoType.Text StyleInfo = ExcelStyleInfoType.Text
}); });
rowIndex++; rowIndex++;
foreach (var product in pc.Flowers) foreach (var (Flower, Count) in fc.Components)
{ {
InsertCellInWorksheet(new ExcelCellParameters InsertCellInWorksheet(new ExcelCellParameters
{ {
ColumnName = "B", ColumnName = "B",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = product.Item1, Text = Flower,
StyleInfo = StyleInfo = ExcelStyleInfoType.TextWithBorder
ExcelStyleInfoType.TextWithBorder
}); });
InsertCellInWorksheet(new ExcelCellParameters InsertCellInWorksheet(new ExcelCellParameters
{ {
ColumnName = "C", ColumnName = "C",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = product.Item2.ToString(), Text = Count.ToString(),
StyleInfo = StyleInfo = ExcelStyleInfoType.TextWithBorder
ExcelStyleInfoType.TextWithBorder
}); });
rowIndex++; rowIndex++;
} }
InsertCellInWorksheet(new ExcelCellParameters InsertCellInWorksheet(new ExcelCellParameters
@ -62,7 +63,7 @@ namespace FlowerShopBusinessLogic.OfficePackage
{ {
ColumnName = "C", ColumnName = "C",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = pc.TotalCount.ToString(), Text = fc.TotalCount.ToString(),
StyleInfo = ExcelStyleInfoType.Text StyleInfo = ExcelStyleInfoType.Text
}); });
rowIndex++; rowIndex++;

View File

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

View File

@ -1,6 +1,5 @@
using FlowerShopBusinessLogic.OfficePackage.HelperEnums; using FlowerShopBusinessLogic.OfficePackage.HelperEnums;
using FlowerShopBusinessLogic.OfficePackage.HelperModels; using FlowerShopBusinessLogic.OfficePackage.HelperModels;
using System.Collections.Generic;
namespace FlowerShopBusinessLogic.OfficePackage namespace FlowerShopBusinessLogic.OfficePackage
{ {
@ -19,17 +18,20 @@ namespace FlowerShopBusinessLogic.OfficePackage
JustificationType = WordJustificationType.Center JustificationType = WordJustificationType.Center
} }
}); });
foreach (var component in info.Components) foreach (var flower in info.Flowers)
{ {
CreateParagraph(new WordParagraph CreateParagraph(new WordParagraph
{ {
Texts = new List<(string, WordTextProperties)> { Texts = new List<(string, WordTextProperties)> {
(component.ComponentName, new WordTextProperties { Size = "24", }) }, (flower.FlowerName, new WordTextProperties { Bold = true, Size = "24", }),
(flower.Price.ToString(), new WordTextProperties { Size = "24" })
},
TextProperties = new WordTextProperties TextProperties = new WordTextProperties
{ {
Size = "24", Size = "24",
JustificationType = WordJustificationType.Both JustificationType = WordJustificationType.Both
} }
}); });
} }
SaveWord(info); SaveWord(info);

View File

@ -1,4 +1,5 @@
using FlowerShopContracts.ViewModels; using FlowerShopContracts.ViewModels;
using FlowerShopDataModels.Enums;
namespace FlowerShopBusinessLogic.OfficePackage.HelperModels namespace FlowerShopBusinessLogic.OfficePackage.HelperModels
{ {

View File

@ -6,7 +6,7 @@ namespace FlowerShopBusinessLogic.OfficePackage.HelperModels
{ {
public string FileName { get; set; } = string.Empty; public string FileName { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty; public string Title { get; set; } = string.Empty;
public List<ComponentViewModel> Components { get; set; } = new(); public List<FlowerViewModel> Flowers { get; set; } = new();
} }
} }

View File

@ -305,6 +305,4 @@ namespace FlowerShopBusinessLogic.OfficePackage.Implements
_spreadsheetDocument.Dispose(); _spreadsheetDocument.Dispose();
} }
} }
} }

View File

@ -85,8 +85,7 @@ namespace FlowerShopBusinessLogic.OfficePackage.Implements
docRun.AppendChild(new Text docRun.AppendChild(new Text
{ {
Text = run.Item1, Text = run.Item1,
Space = Space = SpaceProcessingModeValues.Preserve
SpaceProcessingModeValues.Preserve
}); });
docParagraph.AppendChild(docRun); docParagraph.AppendChild(docRun);
} }

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>

View File

@ -2,9 +2,9 @@
{ {
public class ReportFlowerComponentViewModel public class ReportFlowerComponentViewModel
{ {
public string ComponentName { get; set; } = string.Empty; public string FlowerName { get; set; } = string.Empty;
public int TotalCount { get; set; } public int TotalCount { get; set; }
public List<Tuple<string, int>> Flowers { get; set; } = new(); public List<Tuple<string, int>> Components { get; set; } = new();
} }
} }

View File

@ -1,4 +1,6 @@
namespace FlowerShopContracts.ViewModels using FlowerShopDataModels.Enums;
namespace FlowerShopContracts.ViewModels
{ {
public class ReportOrdersViewModel public class ReportOrdersViewModel
{ {
@ -6,6 +8,7 @@
public DateTime DateCreate { get; set; } public DateTime DateCreate { get; set; }
public string FlowerName { get; set; } = string.Empty; public string FlowerName { get; set; } = string.Empty;
public double Sum { get; set; } public double Sum { get; set; }
public string Status { get; set; }
} }
} }

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>

View File

@ -9,9 +9,12 @@ namespace FlowerShopDatabaseImplement
{ {
if (optionsBuilder.IsConfigured == false) if (optionsBuilder.IsConfigured == false)
{ {
optionsBuilder.UseSqlServer(@"Data Source=WHITEBEAR\SQLEXPRESS;Initial Catalog=FlowerShopDatabaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); optionsBuilder.UseNpgsql(@"Host=localhost;Database=FlowerShopDatabaseFull;Username=postgres;Password=postgres");
//optionsBuilder.UseSqlServer(@"Data Source=USER\SQLEXPRESS;Initial Catalog=FlowerShopDatabaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
} }
base.OnConfiguring(optionsBuilder); base.OnConfiguring(optionsBuilder);
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
AppContext.SetSwitch("Npgsql.DisableDataTimeInfinityConversions", true);
} }
public virtual DbSet<Component> Components { set; get; } public virtual DbSet<Component> Components { set; get; }
public virtual DbSet<Flower> Flowers { set; get; } public virtual DbSet<Flower> Flowers { set; get; }

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
@ -13,6 +13,7 @@
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.22" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -17,15 +17,15 @@ namespace FlowerShopDatabaseImplement.Implements
} }
public List<OrderViewModel> GetFilteredList(OrderSearchModel model) public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{ {
if (!model.Id.HasValue) if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue)
{ {
return new(); return new();
} }
using var context = new FlowerShopDatabase(); using var context = new FlowerShopDatabase();
return context.Orders if (model.Id.HasValue)
.Where(x => x.Id == model.Id) return context.Orders.Where(x => x.Id == model.Id).Select(x => AccessFlowerStorage(x.GetViewModel)).ToList();
.Select(x => AccessFlowerStorage(x.GetViewModel)) else
.ToList(); return context.Orders.Where(x => x.DateCreate >= model.DateFrom).Where(x => x.DateCreate <= model.DateTo).Select(x => AccessFlowerStorage(x.GetViewModel)).ToList();
} }
public OrderViewModel? GetElement(OrderSearchModel model) public OrderViewModel? GetElement(OrderSearchModel model)
{ {

View File

@ -3,41 +3,41 @@ using System;
using FlowerShopDatabaseImplement; using FlowerShopDatabaseImplement;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable #nullable disable
namespace FlowerShopDatabaseImplement.Migrations namespace FlowerShopDatabaseImplement.Migrations
{ {
[DbContext(typeof(FlowerShopDatabase))] [DbContext(typeof(FlowerShopDatabase))]
[Migration("20240308215929_InitialCreate")] [Migration("20240324210216_InitCreate")]
partial class InitialCreate partial class InitCreate
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "6.0.27") .HasAnnotation("ProductVersion", "6.0.27")
.HasAnnotation("Relational:MaxIdentifierLength", 128); .HasAnnotation("Relational:MaxIdentifierLength", 63);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Component", b => modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Component", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ComponentName") b.Property<string>("ComponentName")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<double>("Cost") b.Property<double>("Cost")
.HasColumnType("float"); .HasColumnType("double precision");
b.HasKey("Id"); b.HasKey("Id");
@ -48,16 +48,16 @@ namespace FlowerShopDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("FlowerName") b.Property<string>("FlowerName")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<double>("Price") b.Property<double>("Price")
.HasColumnType("float"); .HasColumnType("double precision");
b.HasKey("Id"); b.HasKey("Id");
@ -68,18 +68,18 @@ namespace FlowerShopDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ComponentId") b.Property<int>("ComponentId")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<int>("Count") b.Property<int>("Count")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<int>("FlowerId") b.Property<int>("FlowerId")
.HasColumnType("int"); .HasColumnType("integer");
b.HasKey("Id"); b.HasKey("Id");
@ -94,28 +94,27 @@ namespace FlowerShopDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("Count") b.Property<int>("Count")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<DateTime>("DateCreate") b.Property<DateTime>("DateCreate")
.HasColumnType("datetime2"); .HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateImplement") b.Property<DateTime?>("DateImplement")
.IsRequired() .HasColumnType("timestamp without time zone");
.HasColumnType("datetime2");
b.Property<int>("FlowerId") b.Property<int>("FlowerId")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<int>("Status") b.Property<int>("Status")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<double>("Sum") b.Property<double>("Sum")
.HasColumnType("float"); .HasColumnType("double precision");
b.HasKey("Id"); b.HasKey("Id");

View File

@ -1,11 +1,12 @@
using System; using System;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable #nullable disable
namespace FlowerShopDatabaseImplement.Migrations namespace FlowerShopDatabaseImplement.Migrations
{ {
public partial class InitialCreate : Migration public partial class InitCreate : Migration
{ {
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
@ -13,10 +14,10 @@ namespace FlowerShopDatabaseImplement.Migrations
name: "Components", name: "Components",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ComponentName = table.Column<string>(type: "nvarchar(max)", nullable: false), ComponentName = table.Column<string>(type: "text", nullable: false),
Cost = table.Column<double>(type: "float", nullable: false) Cost = table.Column<double>(type: "double precision", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -27,10 +28,10 @@ namespace FlowerShopDatabaseImplement.Migrations
name: "Flowers", name: "Flowers",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
FlowerName = table.Column<string>(type: "nvarchar(max)", nullable: false), FlowerName = table.Column<string>(type: "text", nullable: false),
Price = table.Column<double>(type: "float", nullable: false) Price = table.Column<double>(type: "double precision", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -41,11 +42,11 @@ namespace FlowerShopDatabaseImplement.Migrations
name: "FlowerComponents", name: "FlowerComponents",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
FlowerId = table.Column<int>(type: "int", nullable: false), FlowerId = table.Column<int>(type: "integer", nullable: false),
ComponentId = table.Column<int>(type: "int", nullable: false), ComponentId = table.Column<int>(type: "integer", nullable: false),
Count = table.Column<int>(type: "int", nullable: false) Count = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -68,14 +69,14 @@ namespace FlowerShopDatabaseImplement.Migrations
name: "Orders", name: "Orders",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
FlowerId = table.Column<int>(type: "int", nullable: false), FlowerId = table.Column<int>(type: "integer", nullable: false),
Count = table.Column<int>(type: "int", nullable: false), Count = table.Column<int>(type: "integer", nullable: false),
Sum = table.Column<double>(type: "float", nullable: false), Sum = table.Column<double>(type: "double precision", nullable: false),
Status = table.Column<int>(type: "int", nullable: false), Status = table.Column<int>(type: "integer", nullable: false),
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false), DateCreate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
DateImplement = table.Column<DateTime>(type: "datetime2", nullable: true) DateImplement = table.Column<DateTime>(type: "timestamp without time zone", nullable: true)
}, },
constraints: table => constraints: table =>
{ {

View File

@ -3,8 +3,8 @@ using System;
using FlowerShopDatabaseImplement; using FlowerShopDatabaseImplement;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable #nullable disable
@ -18,24 +18,24 @@ namespace FlowerShopDatabaseImplement.Migrations
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "6.0.27") .HasAnnotation("ProductVersion", "6.0.27")
.HasAnnotation("Relational:MaxIdentifierLength", 128); .HasAnnotation("Relational:MaxIdentifierLength", 63);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Component", b => modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Component", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ComponentName") b.Property<string>("ComponentName")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<double>("Cost") b.Property<double>("Cost")
.HasColumnType("float"); .HasColumnType("double precision");
b.HasKey("Id"); b.HasKey("Id");
@ -46,16 +46,16 @@ namespace FlowerShopDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("FlowerName") b.Property<string>("FlowerName")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("text");
b.Property<double>("Price") b.Property<double>("Price")
.HasColumnType("float"); .HasColumnType("double precision");
b.HasKey("Id"); b.HasKey("Id");
@ -66,18 +66,18 @@ namespace FlowerShopDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ComponentId") b.Property<int>("ComponentId")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<int>("Count") b.Property<int>("Count")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<int>("FlowerId") b.Property<int>("FlowerId")
.HasColumnType("int"); .HasColumnType("integer");
b.HasKey("Id"); b.HasKey("Id");
@ -92,28 +92,27 @@ namespace FlowerShopDatabaseImplement.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("integer");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("Count") b.Property<int>("Count")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<DateTime>("DateCreate") b.Property<DateTime>("DateCreate")
.HasColumnType("datetime2"); .HasColumnType("timestamp without time zone");
b.Property<DateTime?>("DateImplement") b.Property<DateTime?>("DateImplement")
.IsRequired() .HasColumnType("timestamp without time zone");
.HasColumnType("datetime2");
b.Property<int>("FlowerId") b.Property<int>("FlowerId")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<int>("Status") b.Property<int>("Status")
.HasColumnType("int"); .HasColumnType("integer");
b.Property<double>("Sum") b.Property<double>("Sum")
.HasColumnType("float"); .HasColumnType("double precision");
b.HasKey("Id"); b.HasKey("Id");

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>

View File

@ -19,11 +19,12 @@ namespace FlowerShopFileImplement.Implements
} }
public List<OrderViewModel> GetFilteredList(OrderSearchModel model) public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{ {
if (!model.Id.HasValue) if (model.Id.HasValue)
{ return source.Orders.Where(x => x.Id == model.Id)
return new(); .Select(x => GetViewModel(x))
} .ToList();
return source.Orders.Where(x => x.Id == model.Id).Select(x => GetViewModel(x)).ToList(); else
return source.Orders.Where(x => x.DateCreate >= model.DateFrom).Where(x => x.DateCreate <= model.DateTo).Select(x => GetViewModel(x)).ToList();
} }
public OrderViewModel? GetElement(OrderSearchModel model) public OrderViewModel? GetElement(OrderSearchModel model)
{ {

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>

View File

@ -31,7 +31,7 @@ namespace FlowerShopListImplement.Implements
} }
foreach (var order in _source.Orders) foreach (var order in _source.Orders)
{ {
if (order.Id == model.Id) if (order.Id == model.Id && order.DateCreate >= model.DateFrom && order.DateCreate <= model.DateTo)
{ {
result.Add(AttachFlowerName(order.GetViewModel)); result.Add(AttachFlowerName(order.GetViewModel));
} }