починить пдфку
This commit is contained in:
parent
f235faaa0c
commit
c3d9757ad1
@ -14,8 +14,8 @@
|
|||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.Reporting.WinForms.v11" Version="1.0.0" />
|
|
||||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
|
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
|
||||||
|
<PackageReference Include="ReportViewerCore.WinForms" Version="15.1.19" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -41,4 +41,10 @@
|
|||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="ReportOrders.rdlc">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
120
FishFactory/Forms/FormMain.Designer.cs
generated
120
FishFactory/Forms/FormMain.Designer.cs
generated
@ -33,16 +33,16 @@
|
|||||||
toolStripDropDownButton1 = new ToolStripDropDownButton();
|
toolStripDropDownButton1 = new ToolStripDropDownButton();
|
||||||
компонентыToolStripMenuItem = new ToolStripMenuItem();
|
компонентыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
консервыToolStripMenuItem = new ToolStripMenuItem();
|
консервыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
toolStripDropDownButton2 = new ToolStripDropDownButton();
|
||||||
|
списокКомпонентовToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
компонентыПоКонсервамToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
списокЗаказовToolStripMenuItem = new ToolStripMenuItem();
|
||||||
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();
|
||||||
dataGridView = new DataGridView();
|
dataGridView = new DataGridView();
|
||||||
toolStripDropDownButton2 = new ToolStripDropDownButton();
|
|
||||||
списокКомпонентовToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
компонентыПоИзделиямToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
списокЗаказовToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
toolStrip1.SuspendLayout();
|
toolStrip1.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
@ -53,7 +53,7 @@
|
|||||||
toolStrip1.Items.AddRange(new ToolStripItem[] { toolStripDropDownButton1, toolStripDropDownButton2 });
|
toolStrip1.Items.AddRange(new ToolStripItem[] { toolStripDropDownButton1, toolStripDropDownButton2 });
|
||||||
toolStrip1.Location = new Point(0, 0);
|
toolStrip1.Location = new Point(0, 0);
|
||||||
toolStrip1.Name = "toolStrip1";
|
toolStrip1.Name = "toolStrip1";
|
||||||
toolStrip1.Size = new Size(969, 25);
|
toolStrip1.Size = new Size(1107, 27);
|
||||||
toolStrip1.TabIndex = 0;
|
toolStrip1.TabIndex = 0;
|
||||||
toolStrip1.Text = "toolStrip1";
|
toolStrip1.Text = "toolStrip1";
|
||||||
//
|
//
|
||||||
@ -64,28 +64,61 @@
|
|||||||
toolStripDropDownButton1.Image = (Image)resources.GetObject("toolStripDropDownButton1.Image");
|
toolStripDropDownButton1.Image = (Image)resources.GetObject("toolStripDropDownButton1.Image");
|
||||||
toolStripDropDownButton1.ImageTransparentColor = Color.Magenta;
|
toolStripDropDownButton1.ImageTransparentColor = Color.Magenta;
|
||||||
toolStripDropDownButton1.Name = "toolStripDropDownButton1";
|
toolStripDropDownButton1.Name = "toolStripDropDownButton1";
|
||||||
toolStripDropDownButton1.Size = new Size(88, 22);
|
toolStripDropDownButton1.Size = new Size(108, 24);
|
||||||
toolStripDropDownButton1.Text = "Справочник";
|
toolStripDropDownButton1.Text = "Справочник";
|
||||||
//
|
//
|
||||||
// компонентыToolStripMenuItem
|
// компонентыToolStripMenuItem
|
||||||
//
|
//
|
||||||
компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
||||||
компонентыToolStripMenuItem.Size = new Size(145, 22);
|
компонентыToolStripMenuItem.Size = new Size(182, 26);
|
||||||
компонентыToolStripMenuItem.Text = "Компоненты";
|
компонентыToolStripMenuItem.Text = "Компоненты";
|
||||||
компонентыToolStripMenuItem.Click += компонентыToolStripMenuItem_Click;
|
компонентыToolStripMenuItem.Click += компонентыToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// консервыToolStripMenuItem
|
// консервыToolStripMenuItem
|
||||||
//
|
//
|
||||||
консервыToolStripMenuItem.Name = "консервыToolStripMenuItem";
|
консервыToolStripMenuItem.Name = "консервыToolStripMenuItem";
|
||||||
консервыToolStripMenuItem.Size = new Size(145, 22);
|
консервыToolStripMenuItem.Size = new Size(182, 26);
|
||||||
консервыToolStripMenuItem.Text = "Консервы";
|
консервыToolStripMenuItem.Text = "Консервы";
|
||||||
консервыToolStripMenuItem.Click += консервыToolStripMenuItem_Click;
|
консервыToolStripMenuItem.Click += консервыToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
|
// toolStripDropDownButton2
|
||||||
|
//
|
||||||
|
toolStripDropDownButton2.DisplayStyle = ToolStripItemDisplayStyle.Text;
|
||||||
|
toolStripDropDownButton2.DropDownItems.AddRange(new ToolStripItem[] { списокКомпонентовToolStripMenuItem, компонентыПоКонсервамToolStripMenuItem, списокЗаказовToolStripMenuItem });
|
||||||
|
toolStripDropDownButton2.Image = (Image)resources.GetObject("toolStripDropDownButton2.Image");
|
||||||
|
toolStripDropDownButton2.ImageTransparentColor = Color.Magenta;
|
||||||
|
toolStripDropDownButton2.Name = "toolStripDropDownButton2";
|
||||||
|
toolStripDropDownButton2.Size = new Size(73, 24);
|
||||||
|
toolStripDropDownButton2.Text = "Отчёты";
|
||||||
|
//
|
||||||
|
// списокКомпонентовToolStripMenuItem
|
||||||
|
//
|
||||||
|
списокКомпонентовToolStripMenuItem.Name = "списокКомпонентовToolStripMenuItem";
|
||||||
|
списокКомпонентовToolStripMenuItem.Size = new Size(284, 26);
|
||||||
|
списокКомпонентовToolStripMenuItem.Text = "Список компонентов";
|
||||||
|
списокКомпонентовToolStripMenuItem.Click += списокКомпонентовToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// компонентыПоКонсервамToolStripMenuItem
|
||||||
|
//
|
||||||
|
компонентыПоКонсервамToolStripMenuItem.Name = "компонентыПоКонсервамToolStripMenuItem";
|
||||||
|
компонентыПоКонсервамToolStripMenuItem.Size = new Size(284, 26);
|
||||||
|
компонентыПоКонсервамToolStripMenuItem.Text = "Компоненты по консервам";
|
||||||
|
компонентыПоКонсервамToolStripMenuItem.Click += компонентыПоИзделиямToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// списокЗаказовToolStripMenuItem
|
||||||
|
//
|
||||||
|
списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
|
||||||
|
списокЗаказовToolStripMenuItem.Size = new Size(284, 26);
|
||||||
|
списокЗаказовToolStripMenuItem.Text = "Список заказов";
|
||||||
|
списокЗаказовToolStripMenuItem.Click += списокЗаказовToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
// buttonCreateOrder
|
// buttonCreateOrder
|
||||||
//
|
//
|
||||||
buttonCreateOrder.Location = new Point(800, 56);
|
buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
|
buttonCreateOrder.Location = new Point(914, 75);
|
||||||
|
buttonCreateOrder.Margin = new Padding(3, 4, 3, 4);
|
||||||
buttonCreateOrder.Name = "buttonCreateOrder";
|
buttonCreateOrder.Name = "buttonCreateOrder";
|
||||||
buttonCreateOrder.Size = new Size(141, 24);
|
buttonCreateOrder.Size = new Size(161, 32);
|
||||||
buttonCreateOrder.TabIndex = 1;
|
buttonCreateOrder.TabIndex = 1;
|
||||||
buttonCreateOrder.Text = "Создать заказ";
|
buttonCreateOrder.Text = "Создать заказ";
|
||||||
buttonCreateOrder.UseVisualStyleBackColor = true;
|
buttonCreateOrder.UseVisualStyleBackColor = true;
|
||||||
@ -93,9 +126,11 @@
|
|||||||
//
|
//
|
||||||
// buttonTakeOrderInWork
|
// buttonTakeOrderInWork
|
||||||
//
|
//
|
||||||
buttonTakeOrderInWork.Location = new Point(800, 100);
|
buttonTakeOrderInWork.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
|
buttonTakeOrderInWork.Location = new Point(914, 133);
|
||||||
|
buttonTakeOrderInWork.Margin = new Padding(3, 4, 3, 4);
|
||||||
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
||||||
buttonTakeOrderInWork.Size = new Size(141, 24);
|
buttonTakeOrderInWork.Size = new Size(161, 32);
|
||||||
buttonTakeOrderInWork.TabIndex = 2;
|
buttonTakeOrderInWork.TabIndex = 2;
|
||||||
buttonTakeOrderInWork.Text = "Отдать на выполнение";
|
buttonTakeOrderInWork.Text = "Отдать на выполнение";
|
||||||
buttonTakeOrderInWork.UseVisualStyleBackColor = true;
|
buttonTakeOrderInWork.UseVisualStyleBackColor = true;
|
||||||
@ -103,9 +138,11 @@
|
|||||||
//
|
//
|
||||||
// buttonOrderReady
|
// buttonOrderReady
|
||||||
//
|
//
|
||||||
buttonOrderReady.Location = new Point(800, 142);
|
buttonOrderReady.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
|
buttonOrderReady.Location = new Point(914, 189);
|
||||||
|
buttonOrderReady.Margin = new Padding(3, 4, 3, 4);
|
||||||
buttonOrderReady.Name = "buttonOrderReady";
|
buttonOrderReady.Name = "buttonOrderReady";
|
||||||
buttonOrderReady.Size = new Size(141, 24);
|
buttonOrderReady.Size = new Size(161, 32);
|
||||||
buttonOrderReady.TabIndex = 3;
|
buttonOrderReady.TabIndex = 3;
|
||||||
buttonOrderReady.Text = "Заказ готов";
|
buttonOrderReady.Text = "Заказ готов";
|
||||||
buttonOrderReady.UseVisualStyleBackColor = true;
|
buttonOrderReady.UseVisualStyleBackColor = true;
|
||||||
@ -113,9 +150,11 @@
|
|||||||
//
|
//
|
||||||
// buttonIssuedOrder
|
// buttonIssuedOrder
|
||||||
//
|
//
|
||||||
buttonIssuedOrder.Location = new Point(800, 181);
|
buttonIssuedOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
|
buttonIssuedOrder.Location = new Point(914, 241);
|
||||||
|
buttonIssuedOrder.Margin = new Padding(3, 4, 3, 4);
|
||||||
buttonIssuedOrder.Name = "buttonIssuedOrder";
|
buttonIssuedOrder.Name = "buttonIssuedOrder";
|
||||||
buttonIssuedOrder.Size = new Size(141, 24);
|
buttonIssuedOrder.Size = new Size(161, 32);
|
||||||
buttonIssuedOrder.TabIndex = 4;
|
buttonIssuedOrder.TabIndex = 4;
|
||||||
buttonIssuedOrder.Text = "Заказ выдан";
|
buttonIssuedOrder.Text = "Заказ выдан";
|
||||||
buttonIssuedOrder.UseVisualStyleBackColor = true;
|
buttonIssuedOrder.UseVisualStyleBackColor = true;
|
||||||
@ -123,9 +162,11 @@
|
|||||||
//
|
//
|
||||||
// buttonRef
|
// buttonRef
|
||||||
//
|
//
|
||||||
buttonRef.Location = new Point(800, 222);
|
buttonRef.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
|
buttonRef.Location = new Point(914, 296);
|
||||||
|
buttonRef.Margin = new Padding(3, 4, 3, 4);
|
||||||
buttonRef.Name = "buttonRef";
|
buttonRef.Name = "buttonRef";
|
||||||
buttonRef.Size = new Size(141, 24);
|
buttonRef.Size = new Size(161, 32);
|
||||||
buttonRef.TabIndex = 5;
|
buttonRef.TabIndex = 5;
|
||||||
buttonRef.Text = "Обновить список";
|
buttonRef.Text = "Обновить список";
|
||||||
buttonRef.UseVisualStyleBackColor = true;
|
buttonRef.UseVisualStyleBackColor = true;
|
||||||
@ -134,51 +175,21 @@
|
|||||||
// dataGridView
|
// dataGridView
|
||||||
//
|
//
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
dataGridView.Location = new Point(0, 26);
|
dataGridView.Location = new Point(0, 27);
|
||||||
|
dataGridView.Margin = new Padding(3, 4, 3, 4);
|
||||||
dataGridView.Name = "dataGridView";
|
dataGridView.Name = "dataGridView";
|
||||||
dataGridView.ReadOnly = true;
|
dataGridView.ReadOnly = true;
|
||||||
dataGridView.RowHeadersWidth = 51;
|
dataGridView.RowHeadersWidth = 51;
|
||||||
dataGridView.RowTemplate.Height = 24;
|
dataGridView.RowTemplate.Height = 24;
|
||||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
dataGridView.Size = new Size(763, 435);
|
dataGridView.Size = new Size(872, 588);
|
||||||
dataGridView.TabIndex = 6;
|
dataGridView.TabIndex = 6;
|
||||||
//
|
//
|
||||||
// toolStripDropDownButton2
|
|
||||||
//
|
|
||||||
toolStripDropDownButton2.DisplayStyle = ToolStripItemDisplayStyle.Text;
|
|
||||||
toolStripDropDownButton2.DropDownItems.AddRange(new ToolStripItem[] { списокКомпонентовToolStripMenuItem, компонентыПоИзделиямToolStripMenuItem, списокЗаказовToolStripMenuItem });
|
|
||||||
toolStripDropDownButton2.Image = (Image)resources.GetObject("toolStripDropDownButton2.Image");
|
|
||||||
toolStripDropDownButton2.ImageTransparentColor = Color.Magenta;
|
|
||||||
toolStripDropDownButton2.Name = "toolStripDropDownButton2";
|
|
||||||
toolStripDropDownButton2.Size = new Size(61, 22);
|
|
||||||
toolStripDropDownButton2.Text = "Отчёты";
|
|
||||||
//
|
|
||||||
// списокКомпонентовToolStripMenuItem
|
|
||||||
//
|
|
||||||
списокКомпонентовToolStripMenuItem.Name = "списокКомпонентовToolStripMenuItem";
|
|
||||||
списокКомпонентовToolStripMenuItem.Size = new Size(225, 22);
|
|
||||||
списокКомпонентовToolStripMenuItem.Text = "Список компонентов";
|
|
||||||
списокКомпонентовToolStripMenuItem.Click += списокКомпонентовToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// компонентыПоИзделиямToolStripMenuItem
|
|
||||||
//
|
|
||||||
компонентыПоИзделиямToolStripMenuItem.Name = "компонентыПоИзделиямToolStripMenuItem";
|
|
||||||
компонентыПоИзделиямToolStripMenuItem.Size = new Size(225, 22);
|
|
||||||
компонентыПоИзделиямToolStripMenuItem.Text = "Компоненты по консервам";
|
|
||||||
компонентыПоИзделиямToolStripMenuItem.Click += компонентыПоИзделиямToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// списокЗаказовToolStripMenuItem
|
|
||||||
//
|
|
||||||
списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
|
|
||||||
списокЗаказовToolStripMenuItem.Size = new Size(225, 22);
|
|
||||||
списокЗаказовToolStripMenuItem.Text = "Список заказов";
|
|
||||||
списокЗаказовToolStripMenuItem.Click += списокЗаказовToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// FormMain
|
// FormMain
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(969, 461);
|
ClientSize = new Size(1107, 615);
|
||||||
Controls.Add(dataGridView);
|
Controls.Add(dataGridView);
|
||||||
Controls.Add(buttonRef);
|
Controls.Add(buttonRef);
|
||||||
Controls.Add(buttonIssuedOrder);
|
Controls.Add(buttonIssuedOrder);
|
||||||
@ -186,6 +197,7 @@
|
|||||||
Controls.Add(buttonTakeOrderInWork);
|
Controls.Add(buttonTakeOrderInWork);
|
||||||
Controls.Add(buttonCreateOrder);
|
Controls.Add(buttonCreateOrder);
|
||||||
Controls.Add(toolStrip1);
|
Controls.Add(toolStrip1);
|
||||||
|
Margin = new Padding(3, 4, 3, 4);
|
||||||
Name = "FormMain";
|
Name = "FormMain";
|
||||||
Text = "Рыбный завод";
|
Text = "Рыбный завод";
|
||||||
Load += FormMain_Load;
|
Load += FormMain_Load;
|
||||||
@ -210,7 +222,7 @@
|
|||||||
private ToolStripMenuItem консервыToolStripMenuItem;
|
private ToolStripMenuItem консервыToolStripMenuItem;
|
||||||
private ToolStripDropDownButton toolStripDropDownButton2;
|
private ToolStripDropDownButton toolStripDropDownButton2;
|
||||||
private ToolStripMenuItem списокКомпонентовToolStripMenuItem;
|
private ToolStripMenuItem списокКомпонентовToolStripMenuItem;
|
||||||
private ToolStripMenuItem компонентыПоИзделиямToolStripMenuItem;
|
private ToolStripMenuItem компонентыПоКонсервамToolStripMenuItem;
|
||||||
private ToolStripMenuItem списокЗаказовToolStripMenuItem;
|
private ToolStripMenuItem списокЗаказовToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,11 +10,12 @@ namespace FishFactory.Forms
|
|||||||
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)
|
||||||
{
|
{
|
||||||
@ -150,7 +151,7 @@ namespace FishFactory.Forms
|
|||||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
_reportLogic.SaveComponentsToWordFile(new ReportBindingModel
|
_reportLogic.SaveCannedsToWordFile(new ReportBindingModel
|
||||||
{
|
{
|
||||||
FileName = dialog.FileName
|
FileName = dialog.FileName
|
||||||
});
|
});
|
||||||
|
@ -124,7 +124,7 @@
|
|||||||
<data name="toolStripDropDownButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
<data name="toolStripDropDownButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
<value>
|
<value>
|
||||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
|
YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
|
||||||
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
|
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
|
||||||
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
|
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
|
||||||
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
|
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
|
||||||
@ -139,12 +139,12 @@
|
|||||||
<data name="toolStripDropDownButton2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
<data name="toolStripDropDownButton2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
<value>
|
<value>
|
||||||
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEISURBVEhL3ZErDsJAGIR7DlA47oArV8CDR9RiSDAQPBcA
|
YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAEKSURBVEhL3ZG9DsFQHMXvczDZvIOtXsHObuhqkViI3Quw
|
||||||
Qx1BgUMQBEk1ooJAKE0I4Wlqf5gmu1n6oqW7hiZfthkx33aqeZ5HKvEFpmmSYRhSQScXINB1XSroDAke
|
6CYmNoMYJJ0NBiFFIoIytOuf0+TeXP3yde+iyS+3OcP53Z4y3/dJJ4HAsiwyTVMp6BQCBIZhKAWdEcHV
|
||||||
96cUpAmupyPZsx7Z8x4drAnPpQmsgU7LdoHDJNIEYjnAlyBXJ3jPhVyaYLca8nLMhX+CPJXAOT+ouTj5
|
vSlBmeB82NFy1KLluEWOPRC5MoHdMWhazwi4RJlALgf4EuT6BI+5kCsTrGddUY658E+QvyXYHq9UnRyC
|
||||||
p5in4asApdWpS8XRwT+zShIFG/fOyxlZJbGC9f5G5bHzUf6LJFJQqTViyxlxEmRiHhLUW10qDbeRpUGC
|
U87f4aUApcXhnrI9Jzg/laQKFntXlHM+lSQK5psL5fvbp/JvJLGCQqmSWM5JkiCT84igXGtSrruKLQ0T
|
||||||
ErwjE/OQoG9dIsviYGWsXMwxc24BYLcO5pgZc+cWJIG5MbsyAUDnHwlUAkFHJZraR9NeMVq3zi+WF/0A
|
luAdmZxHBG37FFuWBC/j5XKOmX8WAH7rcI6ZMffPgjQwN2bXJgDo/COBTpjneQ2dML0PY3cISreGe8HM
|
||||||
AAAASUVORK5CYII=
|
qgAAAABJRU5ErkJggg==
|
||||||
</value>
|
</value>
|
||||||
</data>
|
</data>
|
||||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
@ -30,17 +30,18 @@
|
|||||||
{
|
{
|
||||||
buttonSaveToExcel = new Button();
|
buttonSaveToExcel = new Button();
|
||||||
dataGridView = new DataGridView();
|
dataGridView = new DataGridView();
|
||||||
Component = new DataGridViewTextBoxColumn();
|
|
||||||
Canned = new DataGridViewTextBoxColumn();
|
|
||||||
Count = new DataGridViewTextBoxColumn();
|
Count = new DataGridViewTextBoxColumn();
|
||||||
|
Canned = new DataGridViewTextBoxColumn();
|
||||||
|
Component = new DataGridViewTextBoxColumn();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// buttonSaveToExcel
|
// buttonSaveToExcel
|
||||||
//
|
//
|
||||||
buttonSaveToExcel.Location = new Point(27, 15);
|
buttonSaveToExcel.Location = new Point(31, 19);
|
||||||
|
buttonSaveToExcel.Margin = new Padding(3, 4, 3, 4);
|
||||||
buttonSaveToExcel.Name = "buttonSaveToExcel";
|
buttonSaveToExcel.Name = "buttonSaveToExcel";
|
||||||
buttonSaveToExcel.Size = new Size(160, 23);
|
buttonSaveToExcel.Size = new Size(183, 29);
|
||||||
buttonSaveToExcel.TabIndex = 0;
|
buttonSaveToExcel.TabIndex = 0;
|
||||||
buttonSaveToExcel.Text = "Сохранить в Excel";
|
buttonSaveToExcel.Text = "Сохранить в Excel";
|
||||||
buttonSaveToExcel.UseVisualStyleBackColor = true;
|
buttonSaveToExcel.UseVisualStyleBackColor = true;
|
||||||
@ -51,39 +52,45 @@
|
|||||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
dataGridView.Columns.AddRange(new DataGridViewColumn[] { Component, Canned, Count });
|
dataGridView.Columns.AddRange(new DataGridViewColumn[] { Component, Canned, Count });
|
||||||
dataGridView.Location = new Point(0, 47);
|
dataGridView.Location = new Point(0, 60);
|
||||||
|
dataGridView.Margin = new Padding(3, 4, 3, 4);
|
||||||
dataGridView.Name = "dataGridView";
|
dataGridView.Name = "dataGridView";
|
||||||
dataGridView.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
|
dataGridView.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
|
||||||
dataGridView.RowTemplate.Height = 25;
|
dataGridView.RowTemplate.Height = 25;
|
||||||
dataGridView.Size = new Size(799, 438);
|
dataGridView.Size = new Size(913, 555);
|
||||||
dataGridView.TabIndex = 1;
|
dataGridView.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// Component
|
|
||||||
//
|
|
||||||
Component.HeaderText = "Компонент";
|
|
||||||
Component.Name = "Component";
|
|
||||||
Component.ReadOnly = true;
|
|
||||||
//
|
|
||||||
// Canned
|
|
||||||
//
|
|
||||||
Canned.HeaderText = "Консервы";
|
|
||||||
Canned.Name = "Canned";
|
|
||||||
//
|
|
||||||
// Count
|
// Count
|
||||||
//
|
//
|
||||||
Count.HeaderText = "Количество";
|
Count.HeaderText = "Количество";
|
||||||
|
Count.MinimumWidth = 6;
|
||||||
Count.Name = "Count";
|
Count.Name = "Count";
|
||||||
Count.ReadOnly = true;
|
Count.ReadOnly = true;
|
||||||
//
|
//
|
||||||
|
// Canned
|
||||||
|
//
|
||||||
|
Canned.HeaderText = "Консервы";
|
||||||
|
Canned.MinimumWidth = 6;
|
||||||
|
Canned.Name = "Canned";
|
||||||
|
//
|
||||||
|
// Component
|
||||||
|
//
|
||||||
|
Component.HeaderText = "Компонент";
|
||||||
|
Component.MinimumWidth = 6;
|
||||||
|
Component.Name = "Component";
|
||||||
|
Component.ReadOnly = true;
|
||||||
|
//
|
||||||
// FormReportCannedComponents
|
// FormReportCannedComponents
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(8F, 19F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(801, 484);
|
ClientSize = new Size(915, 613);
|
||||||
Controls.Add(dataGridView);
|
Controls.Add(dataGridView);
|
||||||
Controls.Add(buttonSaveToExcel);
|
Controls.Add(buttonSaveToExcel);
|
||||||
|
Margin = new Padding(3, 4, 3, 4);
|
||||||
Name = "FormReportCannedComponents";
|
Name = "FormReportCannedComponents";
|
||||||
Text = "Компоненты по консервам";
|
Text = "Компоненты по консервам";
|
||||||
|
Load += FormReportCannedComponents_Load;
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
@ -18,14 +18,14 @@ namespace FishFactory.Forms
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var dict = _logic.GetCannedComponent();
|
var dict = _logic.GetCannedComponents();
|
||||||
if (dict != null)
|
if (dict != null)
|
||||||
{
|
{
|
||||||
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.CannedName, "", "" });
|
||||||
foreach (var listElem in elem.Canneds)
|
foreach (var listElem in elem.Components)
|
||||||
{
|
{
|
||||||
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
|
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
|
||||||
}
|
}
|
||||||
@ -33,11 +33,11 @@ namespace FishFactory.Forms
|
|||||||
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,
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||||
MessageBoxIcon.Error);
|
MessageBoxIcon.Error);
|
||||||
@ -57,13 +57,13 @@ namespace FishFactory.Forms
|
|||||||
{
|
{
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
61
FishFactory/Forms/FormReportOrders.Designer.cs
generated
61
FishFactory/Forms/FormReportOrders.Designer.cs
generated
@ -34,27 +34,32 @@
|
|||||||
label1 = new Label();
|
label1 = new Label();
|
||||||
label2 = new Label();
|
label2 = new Label();
|
||||||
panel = new Panel();
|
panel = new Panel();
|
||||||
|
buttonSaveToPdf = new Button();
|
||||||
|
panel.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// dateTimePickerFrom
|
// dateTimePickerFrom
|
||||||
//
|
//
|
||||||
dateTimePickerFrom.Location = new Point(33, 7);
|
dateTimePickerFrom.Location = new Point(38, 12);
|
||||||
|
dateTimePickerFrom.Margin = new Padding(3, 4, 3, 4);
|
||||||
dateTimePickerFrom.Name = "dateTimePickerFrom";
|
dateTimePickerFrom.Name = "dateTimePickerFrom";
|
||||||
dateTimePickerFrom.Size = new Size(149, 23);
|
dateTimePickerFrom.Size = new Size(170, 27);
|
||||||
dateTimePickerFrom.TabIndex = 0;
|
dateTimePickerFrom.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// dateTimePickerTo
|
// dateTimePickerTo
|
||||||
//
|
//
|
||||||
dateTimePickerTo.Location = new Point(215, 7);
|
dateTimePickerTo.Location = new Point(246, 12);
|
||||||
|
dateTimePickerTo.Margin = new Padding(3, 4, 3, 4);
|
||||||
dateTimePickerTo.Name = "dateTimePickerTo";
|
dateTimePickerTo.Name = "dateTimePickerTo";
|
||||||
dateTimePickerTo.Size = new Size(149, 23);
|
dateTimePickerTo.Size = new Size(170, 27);
|
||||||
dateTimePickerTo.TabIndex = 1;
|
dateTimePickerTo.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// buttonMake
|
// buttonMake
|
||||||
//
|
//
|
||||||
buttonMake.Location = new Point(570, 7);
|
buttonMake.Location = new Point(597, 13);
|
||||||
|
buttonMake.Margin = new Padding(3, 4, 3, 4);
|
||||||
buttonMake.Name = "buttonMake";
|
buttonMake.Name = "buttonMake";
|
||||||
buttonMake.Size = new Size(120, 23);
|
buttonMake.Size = new Size(137, 31);
|
||||||
buttonMake.TabIndex = 2;
|
buttonMake.TabIndex = 2;
|
||||||
buttonMake.Text = "Сформировать";
|
buttonMake.Text = "Сформировать";
|
||||||
buttonMake.UseVisualStyleBackColor = true;
|
buttonMake.UseVisualStyleBackColor = true;
|
||||||
@ -63,43 +68,58 @@
|
|||||||
// label1
|
// label1
|
||||||
//
|
//
|
||||||
label1.AutoSize = true;
|
label1.AutoSize = true;
|
||||||
label1.Location = new Point(14, 12);
|
label1.Location = new Point(15, 16);
|
||||||
label1.Name = "label1";
|
label1.Name = "label1";
|
||||||
label1.Size = new Size(15, 15);
|
label1.Size = new Size(18, 20);
|
||||||
label1.TabIndex = 3;
|
label1.TabIndex = 3;
|
||||||
label1.Text = "С";
|
label1.Text = "С";
|
||||||
//
|
//
|
||||||
// label2
|
// label2
|
||||||
//
|
//
|
||||||
label2.AutoSize = true;
|
label2.AutoSize = true;
|
||||||
label2.Location = new Point(192, 11);
|
label2.Location = new Point(218, 15);
|
||||||
label2.Name = "label2";
|
label2.Name = "label2";
|
||||||
label2.Size = new Size(21, 15);
|
label2.Size = new Size(27, 20);
|
||||||
label2.TabIndex = 4;
|
label2.TabIndex = 4;
|
||||||
label2.Text = "по";
|
label2.Text = "по";
|
||||||
//
|
//
|
||||||
// panel
|
// panel
|
||||||
//
|
//
|
||||||
panel.Location = new Point(0, 36);
|
panel.Controls.Add(buttonSaveToPdf);
|
||||||
|
panel.Controls.Add(dateTimePickerFrom);
|
||||||
|
panel.Controls.Add(label2);
|
||||||
|
panel.Controls.Add(dateTimePickerTo);
|
||||||
|
panel.Controls.Add(label1);
|
||||||
|
panel.Controls.Add(buttonMake);
|
||||||
|
panel.Dock = DockStyle.Top;
|
||||||
|
panel.Location = new Point(0, 0);
|
||||||
|
panel.Margin = new Padding(3, 3, 3, 4);
|
||||||
panel.Name = "panel";
|
panel.Name = "panel";
|
||||||
panel.Size = new Size(802, 418);
|
panel.Size = new Size(941, 51);
|
||||||
panel.TabIndex = 5;
|
panel.TabIndex = 5;
|
||||||
//
|
//
|
||||||
|
// buttonSaveToPdf
|
||||||
|
//
|
||||||
|
buttonSaveToPdf.Location = new Point(749, 13);
|
||||||
|
buttonSaveToPdf.Name = "buttonSaveToPdf";
|
||||||
|
buttonSaveToPdf.Size = new Size(140, 31);
|
||||||
|
buttonSaveToPdf.TabIndex = 6;
|
||||||
|
buttonSaveToPdf.Text = "Сохранить в pdf";
|
||||||
|
buttonSaveToPdf.UseVisualStyleBackColor = true;
|
||||||
|
buttonSaveToPdf.Click += buttonSaveToPdf_Click;
|
||||||
|
//
|
||||||
// FormReportOrders
|
// FormReportOrders
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(800, 450);
|
ClientSize = new Size(941, 723);
|
||||||
Controls.Add(panel);
|
Controls.Add(panel);
|
||||||
Controls.Add(label2);
|
Margin = new Padding(3, 4, 3, 4);
|
||||||
Controls.Add(label1);
|
|
||||||
Controls.Add(buttonMake);
|
|
||||||
Controls.Add(dateTimePickerTo);
|
|
||||||
Controls.Add(dateTimePickerFrom);
|
|
||||||
Name = "FormReportOrders";
|
Name = "FormReportOrders";
|
||||||
Text = "Заказы";
|
Text = "Заказы";
|
||||||
|
panel.ResumeLayout(false);
|
||||||
|
panel.PerformLayout();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -110,5 +130,6 @@
|
|||||||
private Label label1;
|
private Label label1;
|
||||||
private Label label2;
|
private Label label2;
|
||||||
private Panel panel;
|
private Panel panel;
|
||||||
|
private Button buttonSaveToPdf;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,8 +10,8 @@ namespace FishFactory.Forms
|
|||||||
private readonly ReportViewer reportViewer;
|
private readonly ReportViewer reportViewer;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IReportLogic _logic;
|
private readonly IReportLogic _logic;
|
||||||
public FormReportOrders(ILogger<FormReportOrders> logger, IReportLogic
|
|
||||||
logic)
|
public FormReportOrders(ILogger<FormReportOrders> logger, IReportLogic logic)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
@ -20,8 +20,7 @@ namespace FishFactory.Forms
|
|||||||
{
|
{
|
||||||
Dock = DockStyle.Fill
|
Dock = DockStyle.Fill
|
||||||
};
|
};
|
||||||
reportViewer.LocalReport.LoadReportDefinition(new
|
reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrders.rdlc", FileMode.Open));
|
||||||
FileStream("ReportOrders.rdlc", FileMode.Open));
|
|
||||||
Controls.Clear();
|
Controls.Clear();
|
||||||
Controls.Add(reportViewer);
|
Controls.Add(reportViewer);
|
||||||
Controls.Add(panel);
|
Controls.Add(panel);
|
||||||
@ -43,10 +42,10 @@ namespace FishFactory.Forms
|
|||||||
var source = new ReportDataSource("DataSetOrders", dataSource);
|
var source = new ReportDataSource("DataSetOrders", dataSource);
|
||||||
reportViewer.LocalReport.DataSources.Clear();
|
reportViewer.LocalReport.DataSources.Clear();
|
||||||
reportViewer.LocalReport.DataSources.Add(source);
|
reportViewer.LocalReport.DataSources.Add(source);
|
||||||
var parameters = new[] { new ReportParameter("ReportParameterPeriod", $"c" +
|
var parameters = new[] { new ReportParameter("ReportParameterPeriod",
|
||||||
$"{dateTimePickerFrom.Value.ToShortDateString()} по" +
|
$"c {dateTimePickerFrom.Value.ToShortDateString()} по {dateTimePickerTo.Value.ToShortDateString()}") };
|
||||||
$"{dateTimePickerTo.Value.ToShortDateString()}") };
|
|
||||||
reportViewer.LocalReport.SetParameters(parameters);
|
reportViewer.LocalReport.SetParameters(parameters);
|
||||||
|
|
||||||
reportViewer.RefreshReport();
|
reportViewer.RefreshReport();
|
||||||
_logger.LogInformation("Загрузка списка заказов на период {From}-{ To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
|
_logger.LogInformation("Загрузка списка заказов на период {From}-{ To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
|
||||||
}
|
}
|
||||||
@ -56,7 +55,7 @@ namespace FishFactory.Forms
|
|||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void ButtonToPdf_Click(object sender, EventArgs e)
|
private void buttonSaveToPdf_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date)
|
if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date)
|
||||||
{
|
{
|
||||||
@ -83,7 +82,7 @@ namespace FishFactory.Forms
|
|||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,12 @@ using FishFactory.Forms;
|
|||||||
using FishFactoryContracts.BusinessLogicsContracts;
|
using FishFactoryContracts.BusinessLogicsContracts;
|
||||||
using FishFactoryBusinessLogic.BusinessLogic;
|
using FishFactoryBusinessLogic.BusinessLogic;
|
||||||
using FishFactoryContracts.StoragesContracts;
|
using FishFactoryContracts.StoragesContracts;
|
||||||
using FishFactoryDatabaseImplement.Implements;
|
using FishFactoryFileImplement.Implements;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using NLog.Extensions.Logging;
|
using NLog.Extensions.Logging;
|
||||||
|
using FishFactoryBusinessLogic.OfficePackage;
|
||||||
|
using FishFactoryBusinessLogic.OfficePackage.Implements;
|
||||||
|
|
||||||
namespace FishFactory
|
namespace FishFactory
|
||||||
{
|
{
|
||||||
@ -42,6 +44,9 @@ namespace FishFactory
|
|||||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||||
services.AddTransient<ICannedLogic, CannedLogic>();
|
services.AddTransient<ICannedLogic, CannedLogic>();
|
||||||
services.AddTransient<IReportLogic, ReportLogic>();
|
services.AddTransient<IReportLogic, ReportLogic>();
|
||||||
|
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
||||||
|
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
||||||
|
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
||||||
services.AddTransient<FormMain>();
|
services.AddTransient<FormMain>();
|
||||||
services.AddTransient<FormComponent>();
|
services.AddTransient<FormComponent>();
|
||||||
services.AddTransient<FormComponents>();
|
services.AddTransient<FormComponents>();
|
||||||
|
@ -11,59 +11,31 @@ namespace FishFactoryBusinessLogic.BusinessLogic
|
|||||||
public class ReportLogic : IReportLogic
|
public class ReportLogic : IReportLogic
|
||||||
{
|
{
|
||||||
private readonly IComponentStorage _componentStorage;
|
private readonly IComponentStorage _componentStorage;
|
||||||
private readonly ICannedStorage _CannedStorage;
|
private readonly ICannedStorage _cannedStorage;
|
||||||
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(ICannedStorage CannedStorage, IComponentStorage
|
public ReportLogic(ICannedStorage CannedStorage, IComponentStorage componentStorage, IOrderStorage orderStorage,
|
||||||
componentStorage, IOrderStorage orderStorage,
|
AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
|
||||||
AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord,
|
|
||||||
AbstractSaveToPdf saveToPdf)
|
|
||||||
{
|
{
|
||||||
_CannedStorage = CannedStorage;
|
_cannedStorage = CannedStorage;
|
||||||
_componentStorage = componentStorage;
|
_componentStorage = componentStorage;
|
||||||
_orderStorage = orderStorage;
|
_orderStorage = orderStorage;
|
||||||
_saveToExcel = saveToExcel;
|
_saveToExcel = saveToExcel;
|
||||||
_saveToWord = saveToWord;
|
_saveToWord = saveToWord;
|
||||||
_saveToPdf = saveToPdf;
|
_saveToPdf = saveToPdf;
|
||||||
}
|
}
|
||||||
/// <summary>
|
public List<ReportCannedComponentViewModel> GetCannedComponents()
|
||||||
/// Получение списка компонент с указанием, в каких изделиях используются
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public List<ReportCannedComponentViewModel> GetCannedComponent()
|
|
||||||
{
|
{
|
||||||
var components = _componentStorage.GetFullList();
|
return _cannedStorage.GetFullList().Select( x => new ReportCannedComponentViewModel
|
||||||
var Canneds = _CannedStorage.GetFullList();
|
|
||||||
var list = new List<ReportCannedComponentViewModel>();
|
|
||||||
foreach (var component in components)
|
|
||||||
{
|
{
|
||||||
var record = new ReportCannedComponentViewModel
|
CannedName = x.CannedName,
|
||||||
{
|
Components = x.CannedComponents.Select(x => (x.Value.Item1.ComponentName, x.Value.Item2)).ToList(),
|
||||||
ComponentName = component.ComponentName,
|
TotalCount = x.CannedComponents.Select(x => x.Value.Item2).Sum()
|
||||||
Canneds = new List<Tuple<string, int>>(),
|
}).ToList();
|
||||||
TotalCount = 0
|
|
||||||
};
|
|
||||||
foreach (var Canned in Canneds)
|
|
||||||
{
|
|
||||||
if (Canned.CannedComponents.ContainsKey(component.Id))
|
|
||||||
{
|
|
||||||
record.Canneds.Add(new Tuple<string,
|
|
||||||
int>(Canned.CannedName, Canned.CannedComponents[component.Id].Item2));
|
|
||||||
record.TotalCount +=
|
|
||||||
Canned.CannedComponents[component.Id].Item2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
list.Add(record);
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// Получение списка заказов за определенный период
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public List<ReportOrdersViewModel> GetOrders(ReportBindingModel model)
|
public List<ReportOrdersViewModel> GetOrders(ReportBindingModel model)
|
||||||
{
|
{
|
||||||
return _orderStorage.GetFilteredList(new OrderSearchModel
|
return _orderStorage.GetFilteredList(new OrderSearchModel
|
||||||
@ -76,40 +48,32 @@ namespace FishFactoryBusinessLogic.BusinessLogic
|
|||||||
Id = x.Id,
|
Id = x.Id,
|
||||||
DateCreate = x.DateCreate,
|
DateCreate = x.DateCreate,
|
||||||
CannedName = x.CannedName,
|
CannedName = x.CannedName,
|
||||||
Sum = x.Sum
|
Sum = x.Sum,
|
||||||
|
Status = x.Status.ToString()
|
||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// Сохранение компонент в файл-Word
|
public void SaveCannedsToWordFile(ReportBindingModel model)
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
public void SaveComponentsToWordFile(ReportBindingModel model)
|
|
||||||
{
|
{
|
||||||
_saveToWord.CreateDoc(new WordInfo
|
_saveToWord.CreateDoc(new WordInfo
|
||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
Title = "Список компонент",
|
Title = "Список консерв",
|
||||||
Components = _componentStorage.GetFullList()
|
Components = _componentStorage.GetFullList()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// Сохранение компонент с указаеним продуктов в файл-Excel
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
public void SaveCannedComponentToExcelFile(ReportBindingModel model)
|
public void SaveCannedComponentToExcelFile(ReportBindingModel model)
|
||||||
{
|
{
|
||||||
_saveToExcel.CreateReport(new ExcelInfo
|
_saveToExcel.CreateReport(new ExcelInfo
|
||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
Title = "Список компонент",
|
Title = "Список консерв",
|
||||||
CannedComponents = GetCannedComponent()
|
CannedComponents = GetCannedComponents()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// Сохранение заказов в файл-Pdf
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
public void SaveOrdersToPdfFile(ReportBindingModel model)
|
public void SaveOrdersToPdfFile(ReportBindingModel model)
|
||||||
{
|
{
|
||||||
_saveToPdf.CreateDoc(new PdfInfo
|
_saveToPdf.CreateDoc(new PdfInfo
|
||||||
|
@ -5,13 +5,10 @@ namespace FishFactoryBusinessLogic.OfficePackage
|
|||||||
{
|
{
|
||||||
public abstract class AbstractSaveToExcel
|
public abstract class AbstractSaveToExcel
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Создание отчета
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="info"></param>
|
|
||||||
public void CreateReport(ExcelInfo info)
|
public void CreateReport(ExcelInfo info)
|
||||||
{
|
{
|
||||||
CreateExcel(info);
|
CreateExcel(info);
|
||||||
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
{
|
{
|
||||||
ColumnName = "A",
|
ColumnName = "A",
|
||||||
@ -31,28 +28,27 @@ namespace FishFactoryBusinessLogic.OfficePackage
|
|||||||
{
|
{
|
||||||
ColumnName = "A",
|
ColumnName = "A",
|
||||||
RowIndex = rowIndex,
|
RowIndex = rowIndex,
|
||||||
Text = pc.ComponentName,
|
Text = pc.CannedName,
|
||||||
StyleInfo = ExcelStyleInfoType.Text
|
StyleInfo = ExcelStyleInfoType.Text
|
||||||
});
|
});
|
||||||
rowIndex++;
|
rowIndex++;
|
||||||
foreach (var Canned in pc.Canneds)
|
foreach (var Component in pc.Components)
|
||||||
{
|
{
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
{
|
{
|
||||||
ColumnName = "B",
|
ColumnName = "B",
|
||||||
RowIndex = rowIndex,
|
RowIndex = rowIndex,
|
||||||
Text = Canned.Item1,
|
Text = Component.Item1,
|
||||||
StyleInfo =
|
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||||
ExcelStyleInfoType.TextWithBroder
|
|
||||||
});
|
});
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
{
|
{
|
||||||
ColumnName = "C",
|
ColumnName = "C",
|
||||||
RowIndex = rowIndex,
|
RowIndex = rowIndex,
|
||||||
Text = Canned.Item2.ToString(),
|
Text = Component.Item2.ToString(),
|
||||||
StyleInfo =
|
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||||
ExcelStyleInfoType.TextWithBroder
|
|
||||||
});
|
});
|
||||||
|
|
||||||
rowIndex++;
|
rowIndex++;
|
||||||
}
|
}
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
@ -73,27 +69,13 @@ namespace FishFactoryBusinessLogic.OfficePackage
|
|||||||
}
|
}
|
||||||
SaveExcel(info);
|
SaveExcel(info);
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// Создание excel-файла
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="info"></param>
|
|
||||||
protected abstract void CreateExcel(ExcelInfo info);
|
|
||||||
/// <summary>
|
|
||||||
/// Добавляем новую ячейку в лист
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="cellParameters"></param>
|
|
||||||
protected abstract void InsertCellInWorksheet(ExcelCellParameters
|
|
||||||
excelParams);
|
|
||||||
/// <summary>
|
|
||||||
/// Объединение ячеек
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="mergeParameters"></param>
|
|
||||||
protected abstract void MergeCells(ExcelMergeParameters excelParams);
|
|
||||||
/// <summary>
|
|
||||||
/// Сохранение файла
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="info"></param>
|
|
||||||
protected abstract void SaveExcel(ExcelInfo info);
|
|
||||||
|
|
||||||
|
protected abstract void CreateExcel(ExcelInfo info);
|
||||||
|
|
||||||
|
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
|
||||||
|
|
||||||
|
protected abstract void MergeCells(ExcelMergeParameters excelParams);
|
||||||
|
|
||||||
|
protected abstract void SaveExcel(ExcelInfo info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,7 @@ namespace FishFactoryBusinessLogic.OfficePackage.Implements
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private static JustificationValues
|
private static JustificationValues GetJustificationValues(WordJustificationType type)
|
||||||
GetJustificationValues(WordJustificationType type)
|
|
||||||
{
|
{
|
||||||
return type switch
|
return type switch
|
||||||
{
|
{
|
||||||
@ -45,8 +44,7 @@ namespace FishFactoryBusinessLogic.OfficePackage.Implements
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="paragraphProperties"></param>
|
/// <param name="paragraphProperties"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private static ParagraphProperties?
|
private static ParagraphProperties? CreateParagraphProperties(WordTextProperties? paragraphProperties)
|
||||||
CreateParagraphProperties(WordTextProperties? paragraphProperties)
|
|
||||||
{
|
{
|
||||||
if (paragraphProperties == null)
|
if (paragraphProperties == null)
|
||||||
{
|
{
|
||||||
@ -62,6 +60,7 @@ namespace FishFactoryBusinessLogic.OfficePackage.Implements
|
|||||||
LineRule = LineSpacingRuleValues.Auto
|
LineRule = LineSpacingRuleValues.Auto
|
||||||
});
|
});
|
||||||
properties.AppendChild(new Indentation());
|
properties.AppendChild(new Indentation());
|
||||||
|
|
||||||
var paragraphMarkRunProperties = new ParagraphMarkRunProperties();
|
var paragraphMarkRunProperties = new ParagraphMarkRunProperties();
|
||||||
if (!string.IsNullOrEmpty(paragraphProperties.Size))
|
if (!string.IsNullOrEmpty(paragraphProperties.Size))
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,7 @@ namespace FishFactoryContracts.BusinessLogicsContracts
|
|||||||
/// Получение списка компонент с указанием, в каких изделиях используются
|
/// Получение списка компонент с указанием, в каких изделиях используются
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
List<ReportCannedComponentViewModel> GetCannedComponent();
|
List<ReportCannedComponentViewModel> GetCannedComponents();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получение списка заказов за определенный период
|
/// Получение списка заказов за определенный период
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -20,7 +20,7 @@ namespace FishFactoryContracts.BusinessLogicsContracts
|
|||||||
/// Сохранение компонент в файл-Word
|
/// Сохранение компонент в файл-Word
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="model"></param>
|
/// <param name="model"></param>
|
||||||
void SaveComponentsToWordFile(ReportBindingModel model);
|
void SaveCannedsToWordFile(ReportBindingModel model);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Сохранение компонент с указаеним продуктов в файл-Excel
|
/// Сохранение компонент с указаеним продуктов в файл-Excel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
{
|
{
|
||||||
public class ReportCannedComponentViewModel
|
public class ReportCannedComponentViewModel
|
||||||
{
|
{
|
||||||
public string ComponentName { get; set; } = string.Empty;
|
public string CannedName { get; set; } = string.Empty;
|
||||||
public int TotalCount { get; set; }
|
public int TotalCount { get; set; }
|
||||||
public List<Tuple<string, int>> Canneds { get; set; } = new();
|
public List<(string Component, int Count)> Components { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,6 @@ namespace FishFactoryContracts.ViewModels
|
|||||||
public DateTime DateCreate { get; set; }
|
public DateTime DateCreate { get; set; }
|
||||||
public string CannedName { get; set; } = string.Empty;
|
public string CannedName { get; set; } = string.Empty;
|
||||||
public double Sum { get; set; }
|
public double Sum { get; set; }
|
||||||
|
public string Status { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ namespace FishFactoryDatabaseImplement
|
|||||||
{
|
{
|
||||||
if (optionsBuilder.IsConfigured == false)
|
if (optionsBuilder.IsConfigured == false)
|
||||||
{
|
{
|
||||||
optionsBuilder.UseNpgsql(@"Host=localhost;Database=FishFactory2;Username=postgres;Password=postgres");
|
optionsBuilder.UseNpgsql(@"Host=localhost;Database=FishFactory;Username=postgres;Password=postgres");
|
||||||
}
|
}
|
||||||
base.OnConfiguring(optionsBuilder);
|
base.OnConfiguring(optionsBuilder);
|
||||||
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
||||||
|
@ -19,11 +19,21 @@ namespace FishFactoryDatabaseImplement.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 FishFactoryDatabase();
|
using var context = new FishFactoryDatabase();
|
||||||
|
|
||||||
|
if (model.DateFrom.HasValue)
|
||||||
|
{
|
||||||
|
return context.Orders
|
||||||
|
.Include(x => x.Canned)
|
||||||
|
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
return context.Orders
|
return context.Orders
|
||||||
.Include(x => x.Canned)
|
.Include(x => x.Canned)
|
||||||
.Where(x => x.Id == model.Id)
|
.Where(x => x.Id == model.Id)
|
||||||
|
@ -3,6 +3,7 @@ using FishFactoryContracts.SearchModels;
|
|||||||
using FishFactoryContracts.StoragesContracts;
|
using FishFactoryContracts.StoragesContracts;
|
||||||
using FishFactoryContracts.ViewModels;
|
using FishFactoryContracts.ViewModels;
|
||||||
using FishFactoryFileImplement.Models;
|
using FishFactoryFileImplement.Models;
|
||||||
|
using System.Reflection;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace FishFactoryFileImplement.Implements
|
namespace FishFactoryFileImplement.Implements
|
||||||
@ -18,15 +19,15 @@ namespace FishFactoryFileImplement.Implements
|
|||||||
|
|
||||||
public List<OrderViewModel> GetFullList()
|
public List<OrderViewModel> GetFullList()
|
||||||
{
|
{
|
||||||
return _source.Orders.Select(x => AttachCannedName(x)).ToList();
|
return _source.Orders.Select(x => AttachCannedName(x.GetViewModel)).ToList();
|
||||||
}
|
}
|
||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
if (model == null || !model.Id.HasValue)
|
if (!model.Id.HasValue || !model.DateFrom.HasValue || !model.DateTo.HasValue)
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
return _source.Orders.Where(x => x.Id == model.Id).Select(x => AttachCannedName(x)).ToList();
|
return _source.Orders.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo).Select(x => AttachCannedName(x.GetViewModel)).ToList();
|
||||||
}
|
}
|
||||||
public OrderViewModel? GetElement(OrderSearchModel model)
|
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
@ -34,7 +35,7 @@ namespace FishFactoryFileImplement.Implements
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return AttachCannedName(_source.Orders.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id));
|
return AttachCannedName(_source.Orders.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel);
|
||||||
}
|
}
|
||||||
public OrderViewModel? Insert(OrderBindingModel model)
|
public OrderViewModel? Insert(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
@ -46,7 +47,7 @@ namespace FishFactoryFileImplement.Implements
|
|||||||
}
|
}
|
||||||
_source.Orders.Add(newOrder);
|
_source.Orders.Add(newOrder);
|
||||||
_source.SaveOrders();
|
_source.SaveOrders();
|
||||||
return AttachCannedName(newOrder);
|
return AttachCannedName(newOrder.GetViewModel);
|
||||||
}
|
}
|
||||||
public OrderViewModel? Update(OrderBindingModel model)
|
public OrderViewModel? Update(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
@ -57,7 +58,7 @@ namespace FishFactoryFileImplement.Implements
|
|||||||
}
|
}
|
||||||
order.Update(model);
|
order.Update(model);
|
||||||
_source.SaveOrders();
|
_source.SaveOrders();
|
||||||
return AttachCannedName(order);
|
return AttachCannedName(order.GetViewModel);
|
||||||
}
|
}
|
||||||
public OrderViewModel? Delete(OrderBindingModel model)
|
public OrderViewModel? Delete(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
@ -68,17 +69,20 @@ namespace FishFactoryFileImplement.Implements
|
|||||||
}
|
}
|
||||||
_source.Orders.Remove(order);
|
_source.Orders.Remove(order);
|
||||||
_source.SaveOrders();
|
_source.SaveOrders();
|
||||||
return AttachCannedName(order);
|
return AttachCannedName(order.GetViewModel);
|
||||||
}
|
}
|
||||||
private OrderViewModel AttachCannedName(Order order)
|
private OrderViewModel? AttachCannedName(OrderViewModel? model)
|
||||||
{
|
{
|
||||||
var viewModel = order.GetViewModel;
|
if (model == null)
|
||||||
var canned = _source.Canneds.FirstOrDefault(x => x.Id == order.CannedId);
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var canned = _source.Canneds.FirstOrDefault(x => x.Id == model.CannedId);
|
||||||
if (canned != null)
|
if (canned != null)
|
||||||
{
|
{
|
||||||
viewModel.CannedName = canned.CannedName;
|
model.CannedName = canned.CannedName;
|
||||||
}
|
}
|
||||||
return viewModel;
|
return model;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,13 +33,13 @@ namespace FishFactoryListImplement.Implements
|
|||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
var result = new List<OrderViewModel>();
|
var result = new List<OrderViewModel>();
|
||||||
if (model == null || !model.Id.HasValue)
|
if (model == null || !model.Id.HasValue || !model.DateFrom.HasValue || !model.DateFrom.HasValue)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
foreach (var order in _source.Orders)
|
foreach (var order in _source.Orders)
|
||||||
{
|
{
|
||||||
if (order.Id == model.Id)
|
if (order.DateCreate >= model.DateFrom && order.DateCreate <= model.DateTo)
|
||||||
{
|
{
|
||||||
result.Add(AttachCannedName(order.GetViewModel));
|
result.Add(AttachCannedName(order.GetViewModel));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user