This commit is contained in:
shadowik 2023-03-26 14:35:17 +04:00
parent ecd81f8a8c
commit 9d8b26ae9b
20 changed files with 415 additions and 105 deletions

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>PizzeriaContracts.BusinessLogicsContracts.IComponentLogic, PizzeriaContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@ -34,7 +34,7 @@
this.pizzasToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.pizzasToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.отчётыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.отчётыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.componentsToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.componentsToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.componentReinforcedToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.componentPizzaToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.ordersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ordersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.dataGridView = new System.Windows.Forms.DataGridView(); this.dataGridView = new System.Windows.Forms.DataGridView();
this.buttonCreateOrder = new System.Windows.Forms.Button(); this.buttonCreateOrder = new System.Windows.Forms.Button();
@ -86,7 +86,7 @@
// //
this.отчётыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.отчётыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.componentsToolStripMenuItem1, this.componentsToolStripMenuItem1,
this.componentReinforcedToolStripMenuItem1, this.componentPizzaToolStripMenuItem1,
this.ordersToolStripMenuItem}); this.ordersToolStripMenuItem});
this.отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem"; this.отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
this.отчётыToolStripMenuItem.Size = new System.Drawing.Size(60, 20); this.отчётыToolStripMenuItem.Size = new System.Drawing.Size(60, 20);
@ -95,21 +95,21 @@
// componentsToolStripMenuItem1 // componentsToolStripMenuItem1
// //
this.componentsToolStripMenuItem1.Name = "componentsToolStripMenuItem1"; this.componentsToolStripMenuItem1.Name = "componentsToolStripMenuItem1";
this.componentsToolStripMenuItem1.Size = new System.Drawing.Size(215, 22); this.componentsToolStripMenuItem1.Size = new System.Drawing.Size(205, 22);
this.componentsToolStripMenuItem1.Text = "Изделия"; this.componentsToolStripMenuItem1.Text = "Пиццы";
this.componentsToolStripMenuItem1.Click += new System.EventHandler(this.ComponentsToolStripMenuItem_Click); this.componentsToolStripMenuItem1.Click += new System.EventHandler(this.ComponentsToolStripMenuItem_Click);
// //
// componentReinforcedToolStripMenuItem1 // componentPizzaToolStripMenuItem1
// //
this.componentReinforcedToolStripMenuItem1.Name = "componentReinforcedToolStripMenuItem1"; this.componentPizzaToolStripMenuItem1.Name = "componentPizzaToolStripMenuItem1";
this.componentReinforcedToolStripMenuItem1.Size = new System.Drawing.Size(215, 22); this.componentPizzaToolStripMenuItem1.Size = new System.Drawing.Size(205, 22);
this.componentReinforcedToolStripMenuItem1.Text = "Изделия с компонентами"; this.componentPizzaToolStripMenuItem1.Text = "Пицца с компонентами";
this.componentReinforcedToolStripMenuItem1.Click += new System.EventHandler(this.ComponentReinforcedToolStripMenuItem_Click); this.componentPizzaToolStripMenuItem1.Click += new System.EventHandler(this.ComponentPizzaToolStripMenuItem_Click);
// //
// ordersToolStripMenuItem // ordersToolStripMenuItem
// //
this.ordersToolStripMenuItem.Name = "ordersToolStripMenuItem"; this.ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
this.ordersToolStripMenuItem.Size = new System.Drawing.Size(215, 22); this.ordersToolStripMenuItem.Size = new System.Drawing.Size(205, 22);
this.ordersToolStripMenuItem.Text = "Заказы"; this.ordersToolStripMenuItem.Text = "Заказы";
this.ordersToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click); this.ordersToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
// //
@ -221,7 +221,7 @@
private Button buttonRef; private Button buttonRef;
private ToolStripMenuItem отчётыToolStripMenuItem; private ToolStripMenuItem отчётыToolStripMenuItem;
private ToolStripMenuItem componentsToolStripMenuItem1; private ToolStripMenuItem componentsToolStripMenuItem1;
private ToolStripMenuItem componentReinforcedToolStripMenuItem1; private ToolStripMenuItem componentPizzaToolStripMenuItem1;
private ToolStripMenuItem ordersToolStripMenuItem; private ToolStripMenuItem ordersToolStripMenuItem;
} }
} }

View File

@ -11,11 +11,12 @@ namespace PizzeriaView
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IOrderLogic _orderLogic; private readonly IOrderLogic _orderLogic;
private readonly IReportLogic _reportLogic; private readonly IReportLogic _reportLogic;
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic) 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)
{ {
@ -157,7 +158,7 @@ namespace PizzeriaView
} }
} }
private void ComponentReinforcedToolStripMenuItem_Click(object sender, EventArgs e) private void ComponentPizzaToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormReportPizzaComponents)); var service = Program.ServiceProvider?.GetService(typeof(FormReportPizzaComponents));
if (service is FormReportPizzaComponents form) if (service is FormReportPizzaComponents form)

View File

@ -172,8 +172,7 @@ namespace PizzeriaView
Price = Convert.ToDouble(textBoxPrice.Text), Price = Convert.ToDouble(textBoxPrice.Text),
PizzaComponents = _PizzaComponents PizzaComponents = _PizzaComponents
}; };
var operationResult = _id.HasValue ? _logic.Update(model) : var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
_logic.Create(model);
if (!operationResult) if (!operationResult)
{ {
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");

View File

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

View File

@ -60,7 +60,7 @@
// ColumnPizza // ColumnPizza
// //
this.ColumnPizza.FillWeight = 130F; this.ColumnPizza.FillWeight = 130F;
this.ColumnPizza.HeaderText = "Изделие"; this.ColumnPizza.HeaderText = "Пицца";
this.ColumnPizza.MinimumWidth = 6; this.ColumnPizza.MinimumWidth = 6;
this.ColumnPizza.Name = "ColumnPizza"; this.ColumnPizza.Name = "ColumnPizza";
this.ColumnPizza.ReadOnly = true; this.ColumnPizza.ReadOnly = true;

View File

@ -43,11 +43,11 @@ namespace PizzeriaView
dataGridView.Rows.Add(Array.Empty<object>()); dataGridView.Rows.Add(Array.Empty<object>());
} }
} }
_logger.LogInformation("Загрузка списка изделий по компонентам"); _logger.LogInformation("Загрузка списка пиццы по компонентам");
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "Ошибка загрузки списка изделий по компонентам"); _logger.LogError(ex, "Ошибка загрузки списка пицц по компонентам");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
@ -62,12 +62,12 @@ namespace PizzeriaView
{ {
FileName = dialog.FileName FileName = dialog.FileName
}); });
_logger.LogInformation("Сохранение списка изделий по компонентам"); _logger.LogInformation("Сохранение списка пиццы по компонентам");
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "Ошибка сохранения списка изделий по компонентам"); _logger.LogError(ex, "Ошибка сохранения списка пиццы по компонентам");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }

View File

@ -20,16 +20,13 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\PizzeriaDatabaseImplement\PizzeriaDatabaseImplement.csproj" /> <ProjectReference Include="..\PizzeriaDatabaseImplement\PizzeriaDatabaseImplement.csproj" />
<ProjectReference Include="..\PizzeriaDataModels\PizzeriaDataModels.csproj" />
<ProjectReference Include="..\PizzeriaBusinessLogic\PizzeriaBusinessLogic.csproj" /> <ProjectReference Include="..\PizzeriaBusinessLogic\PizzeriaBusinessLogic.csproj" />
<ProjectReference Include="..\PizzeriaContracts\PizzeriaContracts.csproj" /> <ProjectReference Include="..\PizzeriaContracts\PizzeriaContracts.csproj" />
<ProjectReference Include="..\PizzeriaFileImplement\PizzeriaFileImplement.csproj" />
<ProjectReference Include="..\PizzeriaListImplement\PizzeriaListImplement.csproj" />
<ProjectReference Include="..\PizzeriaContracts\PizzeriaContracts.csproj" /> <ProjectReference Include="..\PizzeriaContracts\PizzeriaContracts.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Update="ReportOrders.rdlc"> <None Update="ReportOrder.rdlc">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
</ItemGroup> </ItemGroup>

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>PizzeriaContracts.BusinessLogicsContracts.IOrderLogic, PizzeriaContracts, 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="IPizzaLogic" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>PizzeriaContracts.BusinessLogicsContracts.IPizzaLogic, PizzeriaContracts, 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>PizzeriaContracts.BusinessLogicsContracts.IReportLogic, PizzeriaContracts, 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>PizzeriaContracts.StoragesContracts.IComponentStorage, PizzeriaContracts, 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>PizzeriaContracts.StoragesContracts.IOrderStorage, PizzeriaContracts, 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="IPizzaStorage" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>PizzeriaContracts.StoragesContracts.IPizzaStorage, PizzeriaContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@ -25,14 +25,18 @@
<DataField>DateCreate</DataField> <DataField>DateCreate</DataField>
<rd:TypeName>System.DateTime</rd:TypeName> <rd:TypeName>System.DateTime</rd:TypeName>
</Field> </Field>
<Field Name="ProductName"> <Field Name="PizzaName">
<DataField>ProductName</DataField> <DataField>PizzaName</DataField>
<rd:TypeName>System.String</rd:TypeName> <rd:TypeName>System.String</rd:TypeName>
</Field> </Field>
<Field Name="Sum"> <Field Name="Sum">
<DataField>Sum</DataField> <DataField>Sum</DataField>
<rd:TypeName>System.Decimal</rd:TypeName> <rd:TypeName>System.Decimal</rd:TypeName>
</Field> </Field>
<Field Name="Status">
<DataField>Status</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
</Fields> </Fields>
<rd:DataSetInfo> <rd:DataSetInfo>
<rd:DataSetName>PizzeriaContracts.ViewModels</rd:DataSetName> <rd:DataSetName>PizzeriaContracts.ViewModels</rd:DataSetName>
@ -45,18 +49,15 @@
<ReportSection> <ReportSection>
<Body> <Body>
<ReportItems> <ReportItems>
<Textbox Name="ReportParameterPeriod"> <Textbox Name="TextboxTitle">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Paragraphs> <Paragraphs>
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>=Parameters!ReportParameterPeriod.Value</Value> <Value>Заказы</Value>
<Style> <Style />
<FontSize>14pt</FontSize>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style> <Style>
@ -64,10 +65,8 @@
</Style> </Style>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>ReportParameterPeriod</rd:DefaultName> <Height>0.6cm</Height>
<Top>1cm</Top> <Width>16.51cm</Width>
<Height>1cm</Height>
<Width>21cm</Width>
<Style> <Style>
<Border> <Border>
<Style>None</Style> <Style>None</Style>
@ -79,18 +78,15 @@
<PaddingBottom>2pt</PaddingBottom> <PaddingBottom>2pt</PaddingBottom>
</Style> </Style>
</Textbox> </Textbox>
<Textbox Name="TextboxTitle"> <Textbox Name="ReportParameterPeriod">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Paragraphs> <Paragraphs>
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>Заказы</Value> <Value>=Parameters!ReportParameterPeriod.Value</Value>
<Style> <Style />
<FontSize>16pt</FontSize>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style> <Style>
@ -98,8 +94,10 @@
</Style> </Style>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<Height>1cm</Height> <rd:DefaultName>ReportParameterPeriod</rd:DefaultName>
<Width>21cm</Width> <Top>0.6cm</Top>
<Height>0.6cm</Height>
<Width>16.51cm</Width>
<ZIndex>1</ZIndex> <ZIndex>1</ZIndex>
<Style> <Style>
<Border> <Border>
@ -112,18 +110,21 @@
<PaddingBottom>2pt</PaddingBottom> <PaddingBottom>2pt</PaddingBottom>
</Style> </Style>
</Textbox> </Textbox>
<Tablix Name="Tablix1"> <Tablix Name="Tablix">
<TablixBody> <TablixBody>
<TablixColumns> <TablixColumns>
<TablixColumn>
<Width>2.60583cm</Width>
</TablixColumn>
<TablixColumn>
<Width>3.262cm</Width>
</TablixColumn>
<TablixColumn>
<Width>4.8495cm</Width>
</TablixColumn>
<TablixColumn> <TablixColumn>
<Width>2.5cm</Width> <Width>2.5cm</Width>
</TablixColumn> </TablixColumn>
<TablixColumn>
<Width>3.21438cm</Width>
</TablixColumn>
<TablixColumn>
<Width>8.23317cm</Width>
</TablixColumn>
<TablixColumn> <TablixColumn>
<Width>2.5cm</Width> <Width>2.5cm</Width>
</TablixColumn> </TablixColumn>
@ -134,7 +135,7 @@
<TablixCells> <TablixCells>
<TablixCell> <TablixCell>
<CellContents> <CellContents>
<Textbox Name="Textbox5"> <Textbox Name="TextboxId">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Paragraphs> <Paragraphs>
@ -142,15 +143,12 @@
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>Номер</Value> <Value>Номер</Value>
<Style> <Style />
<FontWeight>Bold</FontWeight>
</Style>
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style /> <Style />
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox5</rd:DefaultName>
<Style> <Style>
<Border> <Border>
<Color>LightGrey</Color> <Color>LightGrey</Color>
@ -166,7 +164,7 @@
</TablixCell> </TablixCell>
<TablixCell> <TablixCell>
<CellContents> <CellContents>
<Textbox Name="Textbox1"> <Textbox Name="TextboxDateCreate">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Paragraphs> <Paragraphs>
@ -174,15 +172,12 @@
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>Дата создания</Value> <Value>Дата создания</Value>
<Style> <Style />
<FontWeight>Bold</FontWeight>
</Style>
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style /> <Style />
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox1</rd:DefaultName>
<Style> <Style>
<Border> <Border>
<Color>LightGrey</Color> <Color>LightGrey</Color>
@ -198,23 +193,20 @@
</TablixCell> </TablixCell>
<TablixCell> <TablixCell>
<CellContents> <CellContents>
<Textbox Name="Textbox3"> <Textbox Name="TextboxPizzaName">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Paragraphs> <Paragraphs>
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>Изделие</Value> <Value>Пицца</Value>
<Style> <Style />
<FontWeight>Bold</FontWeight>
</Style>
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style /> <Style />
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox3</rd:DefaultName>
<Style> <Style>
<Border> <Border>
<Color>LightGrey</Color> <Color>LightGrey</Color>
@ -230,7 +222,37 @@
</TablixCell> </TablixCell>
<TablixCell> <TablixCell>
<CellContents> <CellContents>
<Textbox Name="Textbox7"> <Textbox Name="Textbox2">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Статус</Value>
<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="TextboxSum">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Paragraphs> <Paragraphs>
@ -238,15 +260,12 @@
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>Сумма</Value> <Value>Сумма</Value>
<Style> <Style />
<FontWeight>Bold</FontWeight>
</Style>
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style /> <Style />
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox7</rd:DefaultName>
<Style> <Style>
<Border> <Border>
<Color>LightGrey</Color> <Color>LightGrey</Color>
@ -305,9 +324,7 @@
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>=Fields!DateCreate.Value</Value> <Value>=Fields!DateCreate.Value</Value>
<Style> <Style />
<Format>d</Format>
</Style>
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style /> <Style />
@ -329,21 +346,51 @@
</TablixCell> </TablixCell>
<TablixCell> <TablixCell>
<CellContents> <CellContents>
<Textbox Name="ProductName"> <Textbox Name="PizzaName">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Paragraphs> <Paragraphs>
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>=Fields!ProductName.Value</Value> <Value>=Fields!PizzaName.Value</Value>
<Style /> <Style />
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style /> <Style />
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>ProductName</rd:DefaultName> <rd:DefaultName>PizzaName</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="Status1">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!Status.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Status1</rd:DefaultName>
<Style> <Style>
<Border> <Border>
<Color>LightGrey</Color> <Color>LightGrey</Color>
@ -397,6 +444,7 @@
<TablixMember /> <TablixMember />
<TablixMember /> <TablixMember />
<TablixMember /> <TablixMember />
<TablixMember />
</TablixMembers> </TablixMembers>
</TablixColumnHierarchy> </TablixColumnHierarchy>
<TablixRowHierarchy> <TablixRowHierarchy>
@ -410,18 +458,18 @@
</TablixMembers> </TablixMembers>
</TablixRowHierarchy> </TablixRowHierarchy>
<DataSetName>DataSetOrders</DataSetName> <DataSetName>DataSetOrders</DataSetName>
<Top>2.48391cm</Top> <Top>1.9177cm</Top>
<Left>0.55245cm</Left> <Left>0.79267cm</Left>
<Height>1.2cm</Height> <Height>1.2cm</Height>
<Width>16.44755cm</Width> <Width>15.71733cm</Width>
<ZIndex>2</ZIndex> <ZIndex>2</ZIndex>
<Style> <Style>
<Border> <Border>
<Style>Double</Style> <Style>None</Style>
</Border> </Border>
</Style> </Style>
</Tablix> </Tablix>
<Textbox Name="TextboxTotalSum"> <Textbox Name="TextboxResout">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Paragraphs> <Paragraphs>
@ -429,9 +477,7 @@
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>Итого:</Value> <Value>Итого:</Value>
<Style> <Style />
<FontWeight>Bold</FontWeight>
</Style>
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style> <Style>
@ -439,8 +485,8 @@
</Style> </Style>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<Top>4cm</Top> <Top>3.46287cm</Top>
<Left>12cm</Left> <Left>11.51cm</Left>
<Height>0.6cm</Height> <Height>0.6cm</Height>
<Width>2.5cm</Width> <Width>2.5cm</Width>
<ZIndex>3</ZIndex> <ZIndex>3</ZIndex>
@ -454,7 +500,7 @@
<PaddingBottom>2pt</PaddingBottom> <PaddingBottom>2pt</PaddingBottom>
</Style> </Style>
</Textbox> </Textbox>
<Textbox Name="SumTotal"> <Textbox Name="Textbox10">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Paragraphs> <Paragraphs>
@ -462,18 +508,15 @@
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>=Sum(Fields!Sum.Value, "DataSetOrders")</Value> <Value>=Sum(Fields!Sum.Value, "DataSetOrders")</Value>
<Style> <Style />
<FontWeight>Bold</FontWeight>
</Style>
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style> <Style />
<TextAlign>Right</TextAlign>
</Style>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<Top>4cm</Top> <rd:DefaultName>Textbox10</rd:DefaultName>
<Left>14.5cm</Left> <Top>3.46287cm</Top>
<Left>14.01cm</Left>
<Height>0.6cm</Height> <Height>0.6cm</Height>
<Width>2.5cm</Width> <Width>2.5cm</Width>
<ZIndex>4</ZIndex> <ZIndex>4</ZIndex>
@ -488,10 +531,10 @@
</Style> </Style>
</Textbox> </Textbox>
</ReportItems> </ReportItems>
<Height>5.72875cm</Height> <Height>2in</Height>
<Style /> <Style />
</Body> </Body>
<Width>21cm</Width> <Width>7.48425in</Width>
<Page> <Page>
<PageHeight>29.7cm</PageHeight> <PageHeight>29.7cm</PageHeight>
<PageWidth>21cm</PageWidth> <PageWidth>21cm</PageWidth>
@ -525,5 +568,5 @@
</GridLayoutDefinition> </GridLayoutDefinition>
</ReportParametersLayout> </ReportParametersLayout>
<rd:ReportUnitType>Cm</rd:ReportUnitType> <rd:ReportUnitType>Cm</rd:ReportUnitType>
<rd:ReportID>2de0031a-4d17-449d-922d-d9fc54572312</rd:ReportID> <rd:ReportID>0c9e94bc-df40-42bd-a526-01713dd3057f</rd:ReportID>
</Report> </Report>

View File

@ -60,7 +60,7 @@ namespace PizzeriaBusinessLogic.BusinessLogics
_saveToWord.CreateDoc(new WordInfo _saveToWord.CreateDoc(new WordInfo
{ {
FileName = model.FileName, FileName = model.FileName,
Title = "Список изделий", Title = "Список пицц",
Pizzas = _pizzaStorage.GetFullList() Pizzas = _pizzaStorage.GetFullList()
}); });
} }
@ -69,7 +69,7 @@ namespace PizzeriaBusinessLogic.BusinessLogics
_saveToExcel.CreateReport(new ExcelInfo _saveToExcel.CreateReport(new ExcelInfo
{ {
FileName = model.FileName, FileName = model.FileName,
Title = "Список изделий", Title = "Список пицц",
PizzaComponents = GetPizzaComponents() PizzaComponents = GetPizzaComponents()
}); });
} }

View File

@ -20,7 +20,7 @@ namespace PizzeriaBusinessLogic.OfficePackage
CreateRow(new PdfRowParameters CreateRow(new PdfRowParameters
{ {
Texts = new List<string> { "Номер", "Дата заказа", "Изделие", "Статус", "Сумма" }, Texts = new List<string> { "Номер", "Дата заказа", "Пицца", "Статус", "Сумма" },
Style = "NormalTitle", Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center ParagraphAlignment = PdfParagraphAlignmentType.Center
}); });

View File

@ -17,11 +17,15 @@ namespace PizzeriaDatabaseImplement.Implements
public List<OrderViewModel> GetFilteredList(OrderSearchModel model) public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{ {
if (!model.Id.HasValue) if (!model.DateFrom.HasValue || !model.DateTo.HasValue)
{ {
return new(); return new();
} }
using var context = new PizzeriaDatabase(); using var context = new PizzeriaDatabase();
if (model.DateFrom.HasValue)
{
return context.Orders.Include(x => x.Pizza).Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo).Select(x => x.GetViewModel).ToList();
}
return context.Orders.Include(x => x.Pizza).Where(x => x.Id == model.Id).Select(x => x.GetViewModel).ToList(); return context.Orders.Include(x => x.Pizza).Where(x => x.Id == model.Id).Select(x => x.GetViewModel).ToList();
} }

View File

@ -0,0 +1,174 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using PizzeriaDatabaseImplement;
#nullable disable
namespace PizzeriaDatabaseImplement.Migrations
{
[DbContext(typeof(PizzeriaDatabase))]
[Migration("20230323055304_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Component", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ComponentName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<double>("Cost")
.HasColumnType("float");
b.HasKey("Id");
b.ToTable("Components");
});
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Order", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("int");
b.Property<DateTime>("DateCreate")
.HasColumnType("datetime2");
b.Property<DateTime?>("DateImplement")
.HasColumnType("datetime2");
b.Property<int>("PizzaId")
.HasColumnType("int");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<double>("Sum")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("PizzaId");
b.ToTable("Orders");
});
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Pizza", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("PizzaName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<double>("Price")
.HasColumnType("float");
b.HasKey("Id");
b.ToTable("Pizzas");
});
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.PizzaComponent", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("ComponentId")
.HasColumnType("int");
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("PizzaId")
.HasColumnType("int");
b.Property<int>("ProductId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ComponentId");
b.HasIndex("PizzaId");
b.ToTable("PizzaComponents");
});
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Order", b =>
{
b.HasOne("PizzeriaDatabaseImplement.Models.Pizza", "Pizza")
.WithMany("Orders")
.HasForeignKey("PizzaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Pizza");
});
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.PizzaComponent", b =>
{
b.HasOne("PizzeriaDatabaseImplement.Models.Component", "Component")
.WithMany("PizzaComponents")
.HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PizzeriaDatabaseImplement.Models.Pizza", "Product")
.WithMany("Components")
.HasForeignKey("PizzaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Component");
b.Navigation("Product");
});
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Component", b =>
{
b.Navigation("PizzaComponents");
});
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Pizza", b =>
{
b.Navigation("Components");
b.Navigation("Orders");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PizzeriaDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}