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

View File

@ -11,11 +11,12 @@ namespace PizzeriaView
private readonly ILogger _logger;
private readonly IOrderLogic _orderLogic;
private readonly IReportLogic _reportLogic;
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic)
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic)
{
InitializeComponent();
_logger = logger;
_orderLogic = orderLogic;
_reportLogic = reportLogic;
}
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));
if (service is FormReportPizzaComponents form)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -17,11 +17,15 @@ namespace PizzeriaDatabaseImplement.Implements
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{
if (!model.Id.HasValue)
if (!model.DateFrom.HasValue || !model.DateTo.HasValue)
{
return new();
}
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();
}

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)
{
}
}
}