Сдано
This commit is contained in:
parent
09bae5ce9d
commit
966aff265e
33
IceCreamShop/IceCreamShop/ComponentForm.Designer.cs
generated
33
IceCreamShop/IceCreamShop/ComponentForm.Designer.cs
generated
@ -38,42 +38,45 @@
|
||||
//
|
||||
// NameTextBox
|
||||
//
|
||||
NameTextBox.Location = new Point(72, 12);
|
||||
NameTextBox.Location = new Point(92, 13);
|
||||
NameTextBox.Margin = new Padding(3, 4, 3, 4);
|
||||
NameTextBox.Name = "NameTextBox";
|
||||
NameTextBox.Size = new Size(243, 23);
|
||||
NameTextBox.Size = new Size(277, 27);
|
||||
NameTextBox.TabIndex = 0;
|
||||
//
|
||||
// CostTextBox
|
||||
//
|
||||
CostTextBox.Location = new Point(72, 41);
|
||||
CostTextBox.Location = new Point(92, 56);
|
||||
CostTextBox.Margin = new Padding(3, 4, 3, 4);
|
||||
CostTextBox.Name = "CostTextBox";
|
||||
CostTextBox.Size = new Size(119, 23);
|
||||
CostTextBox.Size = new Size(135, 27);
|
||||
CostTextBox.TabIndex = 1;
|
||||
//
|
||||
// NameLabel
|
||||
//
|
||||
NameLabel.AutoSize = true;
|
||||
NameLabel.Location = new Point(7, 20);
|
||||
NameLabel.Location = new Point(8, 27);
|
||||
NameLabel.Name = "NameLabel";
|
||||
NameLabel.Size = new Size(59, 15);
|
||||
NameLabel.Size = new Size(77, 20);
|
||||
NameLabel.TabIndex = 2;
|
||||
NameLabel.Text = "Название";
|
||||
//
|
||||
// CostLabel
|
||||
//
|
||||
CostLabel.AutoSize = true;
|
||||
CostLabel.Location = new Point(7, 49);
|
||||
CostLabel.Location = new Point(8, 65);
|
||||
CostLabel.Name = "CostLabel";
|
||||
CostLabel.Size = new Size(35, 15);
|
||||
CostLabel.Size = new Size(45, 20);
|
||||
CostLabel.TabIndex = 3;
|
||||
CostLabel.Text = "Цена";
|
||||
//
|
||||
// CancelButton
|
||||
//
|
||||
CancelButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
CancelButton.Location = new Point(235, 68);
|
||||
CancelButton.Location = new Point(282, 91);
|
||||
CancelButton.Margin = new Padding(3, 4, 3, 4);
|
||||
CancelButton.Name = "CancelButton";
|
||||
CancelButton.Size = new Size(75, 23);
|
||||
CancelButton.Size = new Size(86, 31);
|
||||
CancelButton.TabIndex = 4;
|
||||
CancelButton.Text = "Отмена";
|
||||
CancelButton.UseVisualStyleBackColor = true;
|
||||
@ -82,9 +85,10 @@
|
||||
// SaveButton
|
||||
//
|
||||
SaveButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
SaveButton.Location = new Point(154, 68);
|
||||
SaveButton.Location = new Point(189, 91);
|
||||
SaveButton.Margin = new Padding(3, 4, 3, 4);
|
||||
SaveButton.Name = "SaveButton";
|
||||
SaveButton.Size = new Size(75, 23);
|
||||
SaveButton.Size = new Size(86, 31);
|
||||
SaveButton.TabIndex = 5;
|
||||
SaveButton.Text = "Сохранить";
|
||||
SaveButton.UseVisualStyleBackColor = true;
|
||||
@ -92,16 +96,17 @@
|
||||
//
|
||||
// ComponentForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
ClientSize = new Size(322, 97);
|
||||
ClientSize = new Size(381, 129);
|
||||
Controls.Add(SaveButton);
|
||||
Controls.Add(CancelButton);
|
||||
Controls.Add(CostLabel);
|
||||
Controls.Add(NameLabel);
|
||||
Controls.Add(CostTextBox);
|
||||
Controls.Add(NameTextBox);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "ComponentForm";
|
||||
Text = "Компонент";
|
||||
Load += FormComponent_Load;
|
||||
|
@ -61,7 +61,7 @@ namespace IceCreamShop
|
||||
{
|
||||
Id = _id ?? 0,
|
||||
ComponentName = NameTextBox.Text,
|
||||
Cost = Convert.ToDouble(NameTextBox.Text)
|
||||
Cost = Convert.ToDouble(CostTextBox.Text)
|
||||
};
|
||||
var operationResult = _id.HasValue ? _logic.Update(model) :
|
||||
_logic.Create(model);
|
||||
|
@ -39,65 +39,72 @@
|
||||
// ComponentLabel
|
||||
//
|
||||
ComponentLabel.AutoSize = true;
|
||||
ComponentLabel.Location = new Point(12, 9);
|
||||
ComponentLabel.Location = new Point(14, 12);
|
||||
ComponentLabel.Name = "ComponentLabel";
|
||||
ComponentLabel.Size = new Size(69, 15);
|
||||
ComponentLabel.Size = new Size(88, 20);
|
||||
ComponentLabel.TabIndex = 0;
|
||||
ComponentLabel.Text = "Компонент";
|
||||
//
|
||||
// CountLabel
|
||||
//
|
||||
CountLabel.AutoSize = true;
|
||||
CountLabel.Location = new Point(12, 40);
|
||||
CountLabel.Location = new Point(14, 53);
|
||||
CountLabel.Name = "CountLabel";
|
||||
CountLabel.Size = new Size(72, 15);
|
||||
CountLabel.Size = new Size(90, 20);
|
||||
CountLabel.TabIndex = 1;
|
||||
CountLabel.Text = "Количество";
|
||||
//
|
||||
// CountTextBox
|
||||
//
|
||||
CountTextBox.Location = new Point(87, 37);
|
||||
CountTextBox.Location = new Point(99, 49);
|
||||
CountTextBox.Margin = new Padding(3, 4, 3, 4);
|
||||
CountTextBox.Name = "CountTextBox";
|
||||
CountTextBox.Size = new Size(292, 23);
|
||||
CountTextBox.Size = new Size(333, 27);
|
||||
CountTextBox.TabIndex = 2;
|
||||
//
|
||||
// ComboBox
|
||||
//
|
||||
ComboBox.FormattingEnabled = true;
|
||||
ComboBox.Location = new Point(87, 6);
|
||||
ComboBox.Location = new Point(99, 8);
|
||||
ComboBox.Margin = new Padding(3, 4, 3, 4);
|
||||
ComboBox.Name = "ComboBox";
|
||||
ComboBox.Size = new Size(292, 23);
|
||||
ComboBox.Size = new Size(333, 28);
|
||||
ComboBox.TabIndex = 3;
|
||||
//
|
||||
// SaveButton
|
||||
//
|
||||
SaveButton.Location = new Point(218, 66);
|
||||
SaveButton.Location = new Point(249, 88);
|
||||
SaveButton.Margin = new Padding(3, 4, 3, 4);
|
||||
SaveButton.Name = "SaveButton";
|
||||
SaveButton.Size = new Size(75, 23);
|
||||
SaveButton.Size = new Size(86, 31);
|
||||
SaveButton.TabIndex = 4;
|
||||
SaveButton.Text = "Сохранить";
|
||||
SaveButton.UseVisualStyleBackColor = true;
|
||||
SaveButton.Click += ButtonSave_Click;
|
||||
//
|
||||
// CancelButton
|
||||
//
|
||||
CancelButton.Location = new Point(299, 66);
|
||||
CancelButton.Location = new Point(342, 88);
|
||||
CancelButton.Margin = new Padding(3, 4, 3, 4);
|
||||
CancelButton.Name = "CancelButton";
|
||||
CancelButton.Size = new Size(75, 23);
|
||||
CancelButton.Size = new Size(86, 31);
|
||||
CancelButton.TabIndex = 5;
|
||||
CancelButton.Text = "Отмена";
|
||||
CancelButton.UseVisualStyleBackColor = true;
|
||||
CancelButton.Click += ButtonCancel_Click;
|
||||
//
|
||||
// IceCreamComponentForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(391, 96);
|
||||
ClientSize = new Size(447, 128);
|
||||
Controls.Add(CancelButton);
|
||||
Controls.Add(SaveButton);
|
||||
Controls.Add(ComboBox);
|
||||
Controls.Add(CountTextBox);
|
||||
Controls.Add(CountLabel);
|
||||
Controls.Add(ComponentLabel);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "IceCreamComponentForm";
|
||||
Text = "Компонент мороженного";
|
||||
ResumeLayout(false);
|
||||
|
71
IceCreamShop/IceCreamShop/IceCreamForm.Designer.cs
generated
71
IceCreamShop/IceCreamShop/IceCreamForm.Designer.cs
generated
@ -50,33 +50,35 @@
|
||||
// NameLabel
|
||||
//
|
||||
NameLabel.AutoSize = true;
|
||||
NameLabel.Location = new Point(12, 9);
|
||||
NameLabel.Location = new Point(14, 12);
|
||||
NameLabel.Name = "NameLabel";
|
||||
NameLabel.Size = new Size(59, 15);
|
||||
NameLabel.Size = new Size(77, 20);
|
||||
NameLabel.TabIndex = 0;
|
||||
NameLabel.Text = "Название";
|
||||
//
|
||||
// PriceLabel
|
||||
//
|
||||
PriceLabel.AutoSize = true;
|
||||
PriceLabel.Location = new Point(12, 35);
|
||||
PriceLabel.Location = new Point(14, 47);
|
||||
PriceLabel.Name = "PriceLabel";
|
||||
PriceLabel.Size = new Size(35, 15);
|
||||
PriceLabel.Size = new Size(45, 20);
|
||||
PriceLabel.TabIndex = 1;
|
||||
PriceLabel.Text = "Цена";
|
||||
//
|
||||
// NameTextBox
|
||||
//
|
||||
NameTextBox.Location = new Point(77, 6);
|
||||
NameTextBox.Location = new Point(88, 8);
|
||||
NameTextBox.Margin = new Padding(3, 4, 3, 4);
|
||||
NameTextBox.Name = "NameTextBox";
|
||||
NameTextBox.Size = new Size(237, 23);
|
||||
NameTextBox.Size = new Size(270, 27);
|
||||
NameTextBox.TabIndex = 2;
|
||||
//
|
||||
// PriceTextBox
|
||||
//
|
||||
PriceTextBox.Location = new Point(77, 32);
|
||||
PriceTextBox.Location = new Point(88, 43);
|
||||
PriceTextBox.Margin = new Padding(3, 4, 3, 4);
|
||||
PriceTextBox.Name = "PriceTextBox";
|
||||
PriceTextBox.Size = new Size(100, 23);
|
||||
PriceTextBox.Size = new Size(114, 27);
|
||||
PriceTextBox.TabIndex = 3;
|
||||
//
|
||||
// ComponentsGroupBox
|
||||
@ -86,18 +88,21 @@
|
||||
ComponentsGroupBox.Controls.Add(UpdateButton);
|
||||
ComponentsGroupBox.Controls.Add(AddButton);
|
||||
ComponentsGroupBox.Controls.Add(DataGridView);
|
||||
ComponentsGroupBox.Location = new Point(12, 64);
|
||||
ComponentsGroupBox.Location = new Point(14, 85);
|
||||
ComponentsGroupBox.Margin = new Padding(3, 4, 3, 4);
|
||||
ComponentsGroupBox.Name = "ComponentsGroupBox";
|
||||
ComponentsGroupBox.Size = new Size(582, 287);
|
||||
ComponentsGroupBox.Padding = new Padding(3, 4, 3, 4);
|
||||
ComponentsGroupBox.Size = new Size(665, 383);
|
||||
ComponentsGroupBox.TabIndex = 4;
|
||||
ComponentsGroupBox.TabStop = false;
|
||||
ComponentsGroupBox.Text = "Компоненты";
|
||||
//
|
||||
// RefreshButton
|
||||
//
|
||||
RefreshButton.Location = new Point(481, 109);
|
||||
RefreshButton.Location = new Point(550, 145);
|
||||
RefreshButton.Margin = new Padding(3, 4, 3, 4);
|
||||
RefreshButton.Name = "RefreshButton";
|
||||
RefreshButton.Size = new Size(75, 23);
|
||||
RefreshButton.Size = new Size(86, 31);
|
||||
RefreshButton.TabIndex = 4;
|
||||
RefreshButton.Text = "Обновить";
|
||||
RefreshButton.UseVisualStyleBackColor = true;
|
||||
@ -105,9 +110,10 @@
|
||||
//
|
||||
// DeleteButton
|
||||
//
|
||||
DeleteButton.Location = new Point(481, 80);
|
||||
DeleteButton.Location = new Point(550, 107);
|
||||
DeleteButton.Margin = new Padding(3, 4, 3, 4);
|
||||
DeleteButton.Name = "DeleteButton";
|
||||
DeleteButton.Size = new Size(75, 23);
|
||||
DeleteButton.Size = new Size(86, 31);
|
||||
DeleteButton.TabIndex = 3;
|
||||
DeleteButton.Text = "Удалить";
|
||||
DeleteButton.UseVisualStyleBackColor = true;
|
||||
@ -115,9 +121,10 @@
|
||||
//
|
||||
// UpdateButton
|
||||
//
|
||||
UpdateButton.Location = new Point(481, 51);
|
||||
UpdateButton.Location = new Point(550, 68);
|
||||
UpdateButton.Margin = new Padding(3, 4, 3, 4);
|
||||
UpdateButton.Name = "UpdateButton";
|
||||
UpdateButton.Size = new Size(75, 23);
|
||||
UpdateButton.Size = new Size(86, 31);
|
||||
UpdateButton.TabIndex = 2;
|
||||
UpdateButton.Text = "Изменить";
|
||||
UpdateButton.UseVisualStyleBackColor = true;
|
||||
@ -125,9 +132,10 @@
|
||||
//
|
||||
// AddButton
|
||||
//
|
||||
AddButton.Location = new Point(481, 22);
|
||||
AddButton.Location = new Point(550, 29);
|
||||
AddButton.Margin = new Padding(3, 4, 3, 4);
|
||||
AddButton.Name = "AddButton";
|
||||
AddButton.Size = new Size(75, 23);
|
||||
AddButton.Size = new Size(86, 31);
|
||||
AddButton.TabIndex = 1;
|
||||
AddButton.Text = "Добавить";
|
||||
AddButton.UseVisualStyleBackColor = true;
|
||||
@ -137,34 +145,41 @@
|
||||
//
|
||||
DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
DataGridView.Columns.AddRange(new DataGridViewColumn[] { IdColumn, ComponentNameColumn, CountColumn });
|
||||
DataGridView.Location = new Point(6, 22);
|
||||
DataGridView.Location = new Point(7, 29);
|
||||
DataGridView.Margin = new Padding(3, 4, 3, 4);
|
||||
DataGridView.Name = "DataGridView";
|
||||
DataGridView.Size = new Size(442, 259);
|
||||
DataGridView.RowHeadersWidth = 51;
|
||||
DataGridView.Size = new Size(505, 345);
|
||||
DataGridView.TabIndex = 0;
|
||||
//
|
||||
// IdColumn
|
||||
//
|
||||
IdColumn.HeaderText = "Column1";
|
||||
IdColumn.MinimumWidth = 6;
|
||||
IdColumn.Name = "IdColumn";
|
||||
IdColumn.Visible = false;
|
||||
IdColumn.Width = 5;
|
||||
IdColumn.Width = 6;
|
||||
//
|
||||
// ComponentNameColumn
|
||||
//
|
||||
ComponentNameColumn.HeaderText = "Компонент";
|
||||
ComponentNameColumn.MinimumWidth = 6;
|
||||
ComponentNameColumn.Name = "ComponentNameColumn";
|
||||
ComponentNameColumn.Width = 300;
|
||||
//
|
||||
// CountColumn
|
||||
//
|
||||
CountColumn.HeaderText = "Количество";
|
||||
CountColumn.MinimumWidth = 6;
|
||||
CountColumn.Name = "CountColumn";
|
||||
CountColumn.Width = 125;
|
||||
//
|
||||
// SaveButton
|
||||
//
|
||||
SaveButton.Location = new Point(424, 363);
|
||||
SaveButton.Location = new Point(485, 484);
|
||||
SaveButton.Margin = new Padding(3, 4, 3, 4);
|
||||
SaveButton.Name = "SaveButton";
|
||||
SaveButton.Size = new Size(75, 23);
|
||||
SaveButton.Size = new Size(86, 31);
|
||||
SaveButton.TabIndex = 5;
|
||||
SaveButton.Text = "Сохранить";
|
||||
SaveButton.UseVisualStyleBackColor = true;
|
||||
@ -172,18 +187,19 @@
|
||||
//
|
||||
// CancelButton
|
||||
//
|
||||
CancelButton.Location = new Point(505, 363);
|
||||
CancelButton.Location = new Point(577, 484);
|
||||
CancelButton.Margin = new Padding(3, 4, 3, 4);
|
||||
CancelButton.Name = "CancelButton";
|
||||
CancelButton.Size = new Size(75, 23);
|
||||
CancelButton.Size = new Size(86, 31);
|
||||
CancelButton.TabIndex = 6;
|
||||
CancelButton.Text = "Отмена";
|
||||
CancelButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// IceCreamForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(606, 398);
|
||||
ClientSize = new Size(693, 531);
|
||||
Controls.Add(CancelButton);
|
||||
Controls.Add(SaveButton);
|
||||
Controls.Add(ComponentsGroupBox);
|
||||
@ -191,6 +207,7 @@
|
||||
Controls.Add(NameTextBox);
|
||||
Controls.Add(PriceLabel);
|
||||
Controls.Add(NameLabel);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "IceCreamForm";
|
||||
Text = "Мороженное";
|
||||
ComponentsGroupBox.ResumeLayout(false);
|
||||
|
@ -117,6 +117,9 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="PriceTextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="IdColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
|
@ -8,6 +8,12 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||
<PackageReference Include="NLog" Version="5.2.8" />
|
||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\IceCreamShopBusinessLogic\IceCreamShopBusinessLogic.csproj" />
|
||||
<ProjectReference Include="..\IceCreamShopListImplement\IceCreamShopListImplement.csproj" />
|
||||
|
113
IceCreamShop/IceCreamShop/IceCreamsForm.Designer.cs
generated
Normal file
113
IceCreamShop/IceCreamShop/IceCreamsForm.Designer.cs
generated
Normal file
@ -0,0 +1,113 @@
|
||||
namespace IceCreamShop
|
||||
{
|
||||
partial class IceCreamsForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
DataGridView = new DataGridView();
|
||||
AddButton = new Button();
|
||||
UpdateButton = new Button();
|
||||
DeleteButton = new Button();
|
||||
RefreshButton = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)DataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// DataGridView
|
||||
//
|
||||
DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
DataGridView.Location = new Point(12, 12);
|
||||
DataGridView.Name = "DataGridView";
|
||||
DataGridView.RowHeadersWidth = 51;
|
||||
DataGridView.Size = new Size(379, 426);
|
||||
DataGridView.TabIndex = 0;
|
||||
//
|
||||
// AddButton
|
||||
//
|
||||
AddButton.Location = new Point(397, 12);
|
||||
AddButton.Name = "AddButton";
|
||||
AddButton.Size = new Size(148, 29);
|
||||
AddButton.TabIndex = 1;
|
||||
AddButton.Text = "Добавить";
|
||||
AddButton.UseVisualStyleBackColor = true;
|
||||
AddButton.Click += AddButton_Click;
|
||||
//
|
||||
// UpdateButton
|
||||
//
|
||||
UpdateButton.Location = new Point(397, 47);
|
||||
UpdateButton.Name = "UpdateButton";
|
||||
UpdateButton.Size = new Size(148, 29);
|
||||
UpdateButton.TabIndex = 2;
|
||||
UpdateButton.Text = "Изменить";
|
||||
UpdateButton.UseVisualStyleBackColor = true;
|
||||
UpdateButton.Click += UpdateButton_Click;
|
||||
//
|
||||
// DeleteButton
|
||||
//
|
||||
DeleteButton.Location = new Point(397, 82);
|
||||
DeleteButton.Name = "DeleteButton";
|
||||
DeleteButton.Size = new Size(148, 29);
|
||||
DeleteButton.TabIndex = 3;
|
||||
DeleteButton.Text = "Удалить";
|
||||
DeleteButton.UseVisualStyleBackColor = true;
|
||||
DeleteButton.Click += DeleteButton_Click;
|
||||
//
|
||||
// RefreshButton
|
||||
//
|
||||
RefreshButton.Location = new Point(397, 117);
|
||||
RefreshButton.Name = "RefreshButton";
|
||||
RefreshButton.Size = new Size(148, 29);
|
||||
RefreshButton.TabIndex = 4;
|
||||
RefreshButton.Text = "Обновить";
|
||||
RefreshButton.UseVisualStyleBackColor = true;
|
||||
RefreshButton.Click += RefreshButton_Click;
|
||||
//
|
||||
// IceCreamsForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(557, 450);
|
||||
Controls.Add(RefreshButton);
|
||||
Controls.Add(DeleteButton);
|
||||
Controls.Add(UpdateButton);
|
||||
Controls.Add(AddButton);
|
||||
Controls.Add(DataGridView);
|
||||
Name = "IceCreamsForm";
|
||||
Text = "IceCreamsForm";
|
||||
Load += IceCreamsForm_Load;
|
||||
((System.ComponentModel.ISupportInitialize)DataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView DataGridView;
|
||||
private Button AddButton;
|
||||
private Button UpdateButton;
|
||||
private Button DeleteButton;
|
||||
private Button RefreshButton;
|
||||
}
|
||||
}
|
116
IceCreamShop/IceCreamShop/IceCreamsForm.cs
Normal file
116
IceCreamShop/IceCreamShop/IceCreamsForm.cs
Normal file
@ -0,0 +1,116 @@
|
||||
using IceCreamShopContracts.BindingModels;
|
||||
using IceCreamShopContracts.BusinessLogicsContracts;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace IceCreamShop
|
||||
{
|
||||
public partial class IceCreamsForm : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IIceCreamLogic _logic;
|
||||
public IceCreamsForm(ILogger<IceCreamsForm> logger, IIceCreamLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
|
||||
private void IceCreamsForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _logic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
DataGridView.DataSource = list;
|
||||
DataGridView.Columns["Id"].Visible = false;
|
||||
DataGridView.Columns["IceCreamName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
DataGridView.Columns["IceCreamComponents"].Visible = false;
|
||||
}
|
||||
_logger.LogInformation("Загрузка мороженого");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки мороженого");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(IceCreamForm));
|
||||
if (service is IceCreamForm form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (DataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(IceCreamForm));
|
||||
if (service is IceCreamForm form)
|
||||
{
|
||||
var tmp = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
form.Id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DeleteButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (DataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
int id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Удаление мороженого");
|
||||
try
|
||||
{
|
||||
if (!_logic.Delete(new IceCreamBindingModel
|
||||
{
|
||||
Id = id
|
||||
}))
|
||||
{
|
||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка удаления мороженого");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
120
IceCreamShop/IceCreamShop/IceCreamsForm.resx
Normal file
120
IceCreamShop/IceCreamShop/IceCreamsForm.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
171
IceCreamShop/IceCreamShop/MainForm.Designer.cs
generated
Normal file
171
IceCreamShop/IceCreamShop/MainForm.Designer.cs
generated
Normal file
@ -0,0 +1,171 @@
|
||||
namespace IceCreamShop
|
||||
{
|
||||
partial class MainForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
menuStrip1 = new MenuStrip();
|
||||
ToolStripMenu = new ToolStripMenuItem();
|
||||
КомпонентыStripMenuItem = new ToolStripMenuItem();
|
||||
МороженноеStripMenuItem = new ToolStripMenuItem();
|
||||
DataGridView = new DataGridView();
|
||||
CreateOrderButton = new Button();
|
||||
TakeInWorkButton = new Button();
|
||||
ReadyButton = new Button();
|
||||
IssuedButton = new Button();
|
||||
RefreshButton = new Button();
|
||||
menuStrip1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)DataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
menuStrip1.ImageScalingSize = new Size(20, 20);
|
||||
menuStrip1.Items.AddRange(new ToolStripItem[] { ToolStripMenu });
|
||||
menuStrip1.Location = new Point(0, 0);
|
||||
menuStrip1.Name = "menuStrip1";
|
||||
menuStrip1.Size = new Size(1296, 28);
|
||||
menuStrip1.TabIndex = 0;
|
||||
menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// ToolStripMenu
|
||||
//
|
||||
ToolStripMenu.DropDownItems.AddRange(new ToolStripItem[] { КомпонентыStripMenuItem, МороженноеStripMenuItem });
|
||||
ToolStripMenu.Name = "ToolStripMenu";
|
||||
ToolStripMenu.Size = new Size(117, 24);
|
||||
ToolStripMenu.Text = "Справочники";
|
||||
//
|
||||
// КомпонентыStripMenuItem
|
||||
//
|
||||
КомпонентыStripMenuItem.Name = "КомпонентыStripMenuItem";
|
||||
КомпонентыStripMenuItem.Size = new Size(186, 26);
|
||||
КомпонентыStripMenuItem.Text = "Компоненты";
|
||||
КомпонентыStripMenuItem.Click += КомпонентыStripMenuItem_Click;
|
||||
//
|
||||
// МороженноеStripMenuItem
|
||||
//
|
||||
МороженноеStripMenuItem.Name = "МороженноеStripMenuItem";
|
||||
МороженноеStripMenuItem.Size = new Size(186, 26);
|
||||
МороженноеStripMenuItem.Text = "Мороженное";
|
||||
МороженноеStripMenuItem.Click += МороженноеStripMenuItem_Click;
|
||||
//
|
||||
// DataGridView
|
||||
//
|
||||
DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
DataGridView.Location = new Point(12, 31);
|
||||
DataGridView.Name = "DataGridView";
|
||||
DataGridView.RowHeadersWidth = 51;
|
||||
DataGridView.Size = new Size(1007, 407);
|
||||
DataGridView.TabIndex = 1;
|
||||
//
|
||||
// CreateOrderButton
|
||||
//
|
||||
CreateOrderButton.Location = new Point(1025, 31);
|
||||
CreateOrderButton.Name = "CreateOrderButton";
|
||||
CreateOrderButton.Size = new Size(259, 29);
|
||||
CreateOrderButton.TabIndex = 2;
|
||||
CreateOrderButton.Text = "Создать заказ";
|
||||
CreateOrderButton.UseVisualStyleBackColor = true;
|
||||
CreateOrderButton.Click += CreateOrderButton_Click;
|
||||
//
|
||||
// TakeInWorkButton
|
||||
//
|
||||
TakeInWorkButton.Location = new Point(1025, 66);
|
||||
TakeInWorkButton.Name = "TakeInWorkButton";
|
||||
TakeInWorkButton.Size = new Size(259, 29);
|
||||
TakeInWorkButton.TabIndex = 3;
|
||||
TakeInWorkButton.Text = "Отдать заказ в работу";
|
||||
TakeInWorkButton.UseVisualStyleBackColor = true;
|
||||
TakeInWorkButton.Click += TakeInWorkButton_Click;
|
||||
//
|
||||
// ReadyButton
|
||||
//
|
||||
ReadyButton.Location = new Point(1025, 101);
|
||||
ReadyButton.Name = "ReadyButton";
|
||||
ReadyButton.Size = new Size(259, 29);
|
||||
ReadyButton.TabIndex = 4;
|
||||
ReadyButton.Text = "Заказ готов";
|
||||
ReadyButton.UseVisualStyleBackColor = true;
|
||||
ReadyButton.Click += ReadyButton_Click;
|
||||
//
|
||||
// IssuedButton
|
||||
//
|
||||
IssuedButton.Location = new Point(1025, 136);
|
||||
IssuedButton.Name = "IssuedButton";
|
||||
IssuedButton.Size = new Size(259, 29);
|
||||
IssuedButton.TabIndex = 5;
|
||||
IssuedButton.Text = "Заказ выдан";
|
||||
IssuedButton.UseVisualStyleBackColor = true;
|
||||
IssuedButton.Click += IssuedButton_Click;
|
||||
//
|
||||
// RefreshButton
|
||||
//
|
||||
RefreshButton.Location = new Point(1025, 171);
|
||||
RefreshButton.Name = "RefreshButton";
|
||||
RefreshButton.Size = new Size(259, 29);
|
||||
RefreshButton.TabIndex = 6;
|
||||
RefreshButton.Text = "Обновить";
|
||||
RefreshButton.UseVisualStyleBackColor = true;
|
||||
RefreshButton.Click += RefreshButton_Click;
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1296, 450);
|
||||
Controls.Add(RefreshButton);
|
||||
Controls.Add(IssuedButton);
|
||||
Controls.Add(ReadyButton);
|
||||
Controls.Add(TakeInWorkButton);
|
||||
Controls.Add(CreateOrderButton);
|
||||
Controls.Add(DataGridView);
|
||||
Controls.Add(menuStrip1);
|
||||
MainMenuStrip = menuStrip1;
|
||||
Name = "MainForm";
|
||||
Text = "MainForm";
|
||||
Load += MainForm_Load;
|
||||
menuStrip1.ResumeLayout(false);
|
||||
menuStrip1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)DataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private MenuStrip menuStrip1;
|
||||
private ToolStripMenuItem ToolStripMenu;
|
||||
private ToolStripMenuItem КомпонентыStripMenuItem;
|
||||
private ToolStripMenuItem МороженноеStripMenuItem;
|
||||
private DataGridView DataGridView;
|
||||
private Button CreateOrderButton;
|
||||
private Button TakeInWorkButton;
|
||||
private Button ReadyButton;
|
||||
private Button IssuedButton;
|
||||
private Button RefreshButton;
|
||||
}
|
||||
}
|
183
IceCreamShop/IceCreamShop/MainForm.cs
Normal file
183
IceCreamShop/IceCreamShop/MainForm.cs
Normal file
@ -0,0 +1,183 @@
|
||||
using IceCreamShopContracts.BindingModels;
|
||||
using IceCreamShopContracts.BusinessLogicsContracts;
|
||||
using IceCreamShopDataModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace IceCreamShop
|
||||
{
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IOrderLogic _orderLogic;
|
||||
public MainForm(ILogger<MainForm> logger, IOrderLogic orderLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_orderLogic = orderLogic;
|
||||
}
|
||||
|
||||
private void КомпонентыStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service =
|
||||
Program.ServiceProvider?.GetService(typeof(ComponentsForm));
|
||||
if (service is ComponentsForm form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void MainForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
_logger.LogInformation("Загрузка заказов");
|
||||
try
|
||||
{
|
||||
var list = _orderLogic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
DataGridView.DataSource = list;
|
||||
DataGridView.Columns["IceCreamId"].Visible = false;
|
||||
DataGridView.Columns["IceCreamName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
_logger.LogInformation("Загрузка заказов");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки заказов");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void МороженноеStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(IceCreamsForm));
|
||||
if (service is IceCreamsForm form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateOrderButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service =
|
||||
Program.ServiceProvider?.GetService(typeof(OrderForm));
|
||||
if (service is OrderForm form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
private OrderBindingModel CreateBindingModel(int id, bool isDone = false)
|
||||
{
|
||||
return new OrderBindingModel
|
||||
{
|
||||
Id = id,
|
||||
IceCreamId = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["IceCreamId"].Value),
|
||||
Status = Enum.Parse<OrderStatus>(DataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
||||
Count = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Count"].Value),
|
||||
Sum = double.Parse(DataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
|
||||
DateCreate = DateTime.Parse(DataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()),
|
||||
};
|
||||
}
|
||||
|
||||
private void TakeInWorkButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (DataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
int id =
|
||||
Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.TakeOrderInWork(CreateBindingModel(id));
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка передачи заказа в работу");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ReadyButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (DataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
int id =
|
||||
Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'",
|
||||
id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.FinishOrder(CreateBindingModel(id));
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка отметки о готовности заказа");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void IssuedButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (DataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
int id =
|
||||
Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'",
|
||||
id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.DeliveryOrder(CreateBindingModel(id));
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
_logger.LogInformation("Заказ №{id} выдан", id);
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка отметки о выдачи заказа");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void RefreshButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
123
IceCreamShop/IceCreamShop/MainForm.resx
Normal file
123
IceCreamShop/IceCreamShop/MainForm.resx
Normal file
@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
86
IceCreamShop/IceCreamShop/OrderForm.Designer.cs
generated
86
IceCreamShop/IceCreamShop/OrderForm.Designer.cs
generated
@ -28,9 +28,9 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
comboBox1 = new ComboBox();
|
||||
textBox1 = new TextBox();
|
||||
textBox2 = new TextBox();
|
||||
IceCreamComboBox = new ComboBox();
|
||||
CountTextBox = new TextBox();
|
||||
SumTextBox = new TextBox();
|
||||
SaveButton = new Button();
|
||||
CancelButton = new Button();
|
||||
IceCreamLabel = new Label();
|
||||
@ -38,97 +38,109 @@
|
||||
SumLabel = new Label();
|
||||
SuspendLayout();
|
||||
//
|
||||
// comboBox1
|
||||
// IceCreamComboBox
|
||||
//
|
||||
comboBox1.FormattingEnabled = true;
|
||||
comboBox1.Location = new Point(103, 12);
|
||||
comboBox1.Name = "comboBox1";
|
||||
comboBox1.Size = new Size(232, 23);
|
||||
comboBox1.TabIndex = 0;
|
||||
IceCreamComboBox.FormattingEnabled = true;
|
||||
IceCreamComboBox.Location = new Point(118, 16);
|
||||
IceCreamComboBox.Margin = new Padding(3, 4, 3, 4);
|
||||
IceCreamComboBox.Name = "IceCreamComboBox";
|
||||
IceCreamComboBox.Size = new Size(265, 28);
|
||||
IceCreamComboBox.TabIndex = 0;
|
||||
IceCreamComboBox.SelectedIndexChanged += IceCreamComboBox_SelectedIndexChanged;
|
||||
//
|
||||
// textBox1
|
||||
// CountTextBox
|
||||
//
|
||||
textBox1.Location = new Point(103, 41);
|
||||
textBox1.Name = "textBox1";
|
||||
textBox1.Size = new Size(232, 23);
|
||||
textBox1.TabIndex = 1;
|
||||
CountTextBox.Location = new Point(118, 55);
|
||||
CountTextBox.Margin = new Padding(3, 4, 3, 4);
|
||||
CountTextBox.Name = "CountTextBox";
|
||||
CountTextBox.Size = new Size(265, 27);
|
||||
CountTextBox.TabIndex = 1;
|
||||
CountTextBox.TextChanged += CountTextBox_TextChanged;
|
||||
//
|
||||
// textBox2
|
||||
// SumTextBox
|
||||
//
|
||||
textBox2.Location = new Point(103, 70);
|
||||
textBox2.Name = "textBox2";
|
||||
textBox2.Size = new Size(232, 23);
|
||||
textBox2.TabIndex = 2;
|
||||
SumTextBox.Location = new Point(118, 93);
|
||||
SumTextBox.Margin = new Padding(3, 4, 3, 4);
|
||||
SumTextBox.Name = "SumTextBox";
|
||||
SumTextBox.Size = new Size(265, 27);
|
||||
SumTextBox.TabIndex = 2;
|
||||
SumTextBox.TextChanged += SumTextBox_TextChanged;
|
||||
//
|
||||
// SaveButton
|
||||
//
|
||||
SaveButton.Location = new Point(179, 99);
|
||||
SaveButton.Location = new Point(198, 132);
|
||||
SaveButton.Margin = new Padding(3, 4, 3, 4);
|
||||
SaveButton.Name = "SaveButton";
|
||||
SaveButton.Size = new Size(75, 23);
|
||||
SaveButton.Size = new Size(93, 31);
|
||||
SaveButton.TabIndex = 3;
|
||||
SaveButton.Text = "Сохранить";
|
||||
SaveButton.UseVisualStyleBackColor = true;
|
||||
SaveButton.Click += SaveButton_Click;
|
||||
//
|
||||
// CancelButton
|
||||
//
|
||||
CancelButton.Location = new Point(260, 99);
|
||||
CancelButton.Location = new Point(297, 132);
|
||||
CancelButton.Margin = new Padding(3, 4, 3, 4);
|
||||
CancelButton.Name = "CancelButton";
|
||||
CancelButton.Size = new Size(75, 23);
|
||||
CancelButton.Size = new Size(86, 31);
|
||||
CancelButton.TabIndex = 4;
|
||||
CancelButton.Text = "Отмена";
|
||||
CancelButton.UseVisualStyleBackColor = true;
|
||||
CancelButton.Click += CancelButton_Click;
|
||||
//
|
||||
// IceCreamLabel
|
||||
//
|
||||
IceCreamLabel.AutoSize = true;
|
||||
IceCreamLabel.Location = new Point(12, 15);
|
||||
IceCreamLabel.Location = new Point(14, 20);
|
||||
IceCreamLabel.Name = "IceCreamLabel";
|
||||
IceCreamLabel.Size = new Size(81, 15);
|
||||
IceCreamLabel.Size = new Size(103, 20);
|
||||
IceCreamLabel.TabIndex = 5;
|
||||
IceCreamLabel.Text = "Мороженное";
|
||||
//
|
||||
// CountLabel
|
||||
//
|
||||
CountLabel.AutoSize = true;
|
||||
CountLabel.Location = new Point(12, 44);
|
||||
CountLabel.Location = new Point(14, 59);
|
||||
CountLabel.Name = "CountLabel";
|
||||
CountLabel.Size = new Size(72, 15);
|
||||
CountLabel.Size = new Size(90, 20);
|
||||
CountLabel.TabIndex = 6;
|
||||
CountLabel.Text = "Количество";
|
||||
//
|
||||
// SumLabel
|
||||
//
|
||||
SumLabel.AutoSize = true;
|
||||
SumLabel.Location = new Point(12, 73);
|
||||
SumLabel.Location = new Point(14, 97);
|
||||
SumLabel.Name = "SumLabel";
|
||||
SumLabel.Size = new Size(45, 15);
|
||||
SumLabel.Size = new Size(55, 20);
|
||||
SumLabel.TabIndex = 7;
|
||||
SumLabel.Text = "Сумма";
|
||||
//
|
||||
// OrderForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(348, 128);
|
||||
ClientSize = new Size(398, 171);
|
||||
Controls.Add(SumLabel);
|
||||
Controls.Add(CountLabel);
|
||||
Controls.Add(IceCreamLabel);
|
||||
Controls.Add(CancelButton);
|
||||
Controls.Add(SaveButton);
|
||||
Controls.Add(textBox2);
|
||||
Controls.Add(textBox1);
|
||||
Controls.Add(comboBox1);
|
||||
Controls.Add(SumTextBox);
|
||||
Controls.Add(CountTextBox);
|
||||
Controls.Add(IceCreamComboBox);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "OrderForm";
|
||||
Text = "OrderForm";
|
||||
Load += OrderForm_Load;
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ComboBox comboBox1;
|
||||
private TextBox textBox1;
|
||||
private TextBox textBox2;
|
||||
private ComboBox IceCreamComboBox;
|
||||
private TextBox CountTextBox;
|
||||
private TextBox SumTextBox;
|
||||
private Button SaveButton;
|
||||
private Button CancelButton;
|
||||
private Label IceCreamLabel;
|
||||
|
@ -1,4 +1,6 @@
|
||||
using IceCreamShopContracts.BusinessLogicsContracts;
|
||||
using IceCreamShopContracts.BindingModels;
|
||||
using IceCreamShopContracts.BusinessLogicsContracts;
|
||||
using IceCreamShopContracts.SearchModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -29,9 +31,113 @@ logicI, IOrderLogic logicO)
|
||||
private void OrderForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
_logger.LogInformation("Загрузка мороженного для заказа");
|
||||
// прописать логику
|
||||
try
|
||||
{
|
||||
var list = _logicI.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
IceCreamComboBox.DisplayMember = "IceCreamName";
|
||||
IceCreamComboBox.ValueMember = "Id";
|
||||
IceCreamComboBox.DataSource = list;
|
||||
IceCreamComboBox.SelectedItem = null;
|
||||
}
|
||||
_logger.LogInformation("Мороженное загружено");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки мороженного");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void CalcSum()
|
||||
{
|
||||
if (IceCreamComboBox.SelectedValue != null &&
|
||||
!string.IsNullOrEmpty(CountTextBox.Text))
|
||||
{
|
||||
try
|
||||
{
|
||||
int id = Convert.ToInt32(IceCreamComboBox.SelectedValue);
|
||||
var product = _logicI.ReadElement(new IceCreamSearchModel
|
||||
{
|
||||
Id
|
||||
= id
|
||||
});
|
||||
int count = Convert.ToInt32(CountTextBox.Text);
|
||||
SumTextBox.Text = Math.Round(count * (product?.Price ?? 0),
|
||||
2).ToString();
|
||||
_logger.LogInformation("Расчет суммы заказа");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка расчета суммы заказа");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CountTextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
CalcSum();
|
||||
}
|
||||
|
||||
private void SumTextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
CalcSum();
|
||||
}
|
||||
|
||||
private void SaveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(CountTextBox.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните поле Количество", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (IceCreamComboBox.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите мороженное", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Создание заказа");
|
||||
try
|
||||
{
|
||||
var operationResult = _logicO.CreateOrder(new OrderBindingModel
|
||||
{
|
||||
IceCreamId = Convert.ToInt32(IceCreamComboBox.SelectedValue),
|
||||
Count = Convert.ToInt32(CountTextBox.Text),
|
||||
Sum = Convert.ToDouble(SumTextBox.Text)
|
||||
});
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при создании заказа. Дополнительная информация в логах.");
|
||||
}
|
||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания заказа");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void CancelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void IceCreamComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
CalcSum();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,4 +117,7 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="SumTextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
@ -1,7 +1,17 @@
|
||||
using IceCreamShopBusinessLogic.BusinessLogic;
|
||||
using IceCreamShopContracts.BusinessLogicsContracts;
|
||||
using IceCreamShopContracts.StoragesContracts;
|
||||
using IceCreamShopListImplement.Implements;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NLog.Extensions.Logging;
|
||||
|
||||
namespace IceCreamShop
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
private static ServiceProvider? _serviceProvider;
|
||||
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
@ -11,7 +21,31 @@ namespace IceCreamShop
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new ComponentForm());
|
||||
var services = new ServiceCollection();
|
||||
ConfigureServices(services);
|
||||
_serviceProvider = services.BuildServiceProvider();
|
||||
Application.Run(_serviceProvider.GetRequiredService<MainForm>());
|
||||
}
|
||||
private static void ConfigureServices(ServiceCollection services)
|
||||
{
|
||||
services.AddLogging(option =>
|
||||
{
|
||||
option.SetMinimumLevel(LogLevel.Information);
|
||||
option.AddNLog("nlog.config");
|
||||
});
|
||||
services.AddTransient<IComponentStorage, ComponentStorage>();
|
||||
services.AddTransient<IOrderStorage, OrderStorage>();
|
||||
services.AddTransient<IIceCreamStorage, IceCreamStorage>();
|
||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||
services.AddTransient<IIceCreamLogic, IceCreamLogic>();
|
||||
services.AddTransient<MainForm>();
|
||||
services.AddTransient<ComponentForm>();
|
||||
services.AddTransient<ComponentsForm>();
|
||||
services.AddTransient<OrderForm>();
|
||||
services.AddTransient<IceCreamForm>();
|
||||
services.AddTransient<IceCreamComponentForm>();
|
||||
services.AddTransient<IceCreamsForm>();
|
||||
}
|
||||
}
|
||||
}
|
@ -66,6 +66,7 @@ namespace IceCreamShopBusinessLogic.BusinessLogic
|
||||
throw new InvalidOperationException("Текущий статус заказа не может быть переведен в выбранный");
|
||||
}
|
||||
model.Status = status;
|
||||
if (model.Status == OrderStatus.Выдан) model.DateImplement = DateTime.Now;
|
||||
_orderStorage.Update(model);
|
||||
return true;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ namespace IceCreamShopContracts.ViewModels
|
||||
public int Id { get; set; }
|
||||
public int IceCreamId { get; set; }
|
||||
[DisplayName("Мороженное")]
|
||||
public string ProductName { get; set; } = string.Empty;
|
||||
public string IceCreamName { get; set; } = string.Empty;
|
||||
[DisplayName("Количество")]
|
||||
public int Count { get; set; }
|
||||
[DisplayName("Сумма")]
|
||||
|
@ -21,9 +21,9 @@ namespace IceCreamShopListImplement.Implements
|
||||
public List<OrderViewModel> GetFullList()
|
||||
{
|
||||
var result = new List<OrderViewModel>();
|
||||
foreach (var component in _source.Orders)
|
||||
foreach (var order in _source.Orders)
|
||||
{
|
||||
result.Add(component.GetViewModel);
|
||||
result.Add(AccessIceCreamStorage(order.GetViewModel));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -39,7 +39,7 @@ namespace IceCreamShopListImplement.Implements
|
||||
{
|
||||
if (order.Id == model.Id)
|
||||
{
|
||||
result.Add(order.GetViewModel);
|
||||
result.Add(AccessIceCreamStorage(order.GetViewModel));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@ -102,6 +102,19 @@ namespace IceCreamShopListImplement.Implements
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public OrderViewModel AccessIceCreamStorage(OrderViewModel model)
|
||||
{
|
||||
foreach (var iceCream in _source.IceCreams)
|
||||
{
|
||||
if (iceCream.Id == model.IceCreamId)
|
||||
{
|
||||
model.IceCreamName = iceCream.IceCreamName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return model;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user