загрузил
This commit is contained in:
parent
97b9443a66
commit
fe793c7943
24
SoftwareInstallation/FormComponent.Designer.cs
generated
24
SoftwareInstallation/FormComponent.Designer.cs
generated
@ -1,4 +1,4 @@
|
||||
namespace SoftwareInstallationView
|
||||
namespace PizzeriaView
|
||||
{
|
||||
partial class FormComponent
|
||||
{
|
||||
@ -39,7 +39,7 @@
|
||||
// labelName
|
||||
//
|
||||
labelName.AutoSize = true;
|
||||
labelName.Location = new Point(21, 22);
|
||||
labelName.Location = new Point(10, 7);
|
||||
labelName.Name = "labelName";
|
||||
labelName.Size = new Size(62, 15);
|
||||
labelName.TabIndex = 0;
|
||||
@ -47,24 +47,24 @@
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Location = new Point(103, 20);
|
||||
textBoxName.Location = new Point(86, 7);
|
||||
textBoxName.Margin = new Padding(3, 2, 3, 2);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(267, 23);
|
||||
textBoxName.Size = new Size(321, 23);
|
||||
textBoxName.TabIndex = 1;
|
||||
//
|
||||
// textBoxCost
|
||||
//
|
||||
textBoxCost.Location = new Point(103, 49);
|
||||
textBoxCost.Location = new Point(86, 32);
|
||||
textBoxCost.Margin = new Padding(3, 2, 3, 2);
|
||||
textBoxCost.Name = "textBoxCost";
|
||||
textBoxCost.Size = new Size(163, 23);
|
||||
textBoxCost.Size = new Size(117, 23);
|
||||
textBoxCost.TabIndex = 3;
|
||||
//
|
||||
// labelCost
|
||||
//
|
||||
labelCost.AutoSize = true;
|
||||
labelCost.Location = new Point(21, 52);
|
||||
labelCost.Location = new Point(10, 32);
|
||||
labelCost.Name = "labelCost";
|
||||
labelCost.Size = new Size(35, 15);
|
||||
labelCost.TabIndex = 2;
|
||||
@ -72,10 +72,10 @@
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(190, 89);
|
||||
buttonSave.Location = new Point(150, 68);
|
||||
buttonSave.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(86, 26);
|
||||
buttonSave.Size = new Size(114, 30);
|
||||
buttonSave.TabIndex = 4;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
@ -83,10 +83,10 @@
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(284, 89);
|
||||
buttonCancel.Location = new Point(287, 68);
|
||||
buttonCancel.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(86, 26);
|
||||
buttonCancel.Size = new Size(119, 30);
|
||||
buttonCancel.TabIndex = 5;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
@ -96,7 +96,7 @@
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(404, 130);
|
||||
ClientSize = new Size(418, 106);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(textBoxCost);
|
||||
|
@ -12,7 +12,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace SoftwareInstallationView
|
||||
namespace PizzeriaView
|
||||
{
|
||||
public partial class FormComponent : Form
|
||||
{
|
||||
@ -34,7 +34,7 @@ namespace SoftwareInstallationView
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogInformation("Получение ингридиента");
|
||||
_logger.LogInformation("Получение компонента");
|
||||
var view = _logic.ReadElement(new ComponentSearchModel
|
||||
{
|
||||
Id = _id.Value
|
||||
@ -47,7 +47,7 @@ namespace SoftwareInstallationView
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения ингридиента");
|
||||
_logger.LogError(ex, "Ошибка получения компонента");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
@ -60,7 +60,7 @@ namespace SoftwareInstallationView
|
||||
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Сохранение ингридиента");
|
||||
_logger.LogInformation("Сохранение компонента");
|
||||
try
|
||||
{
|
||||
var model = new ComponentBindingModel
|
||||
@ -80,7 +80,7 @@ namespace SoftwareInstallationView
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка сохранения ингридиента");
|
||||
_logger.LogError(ex, "Ошибка сохранения компонента");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
<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="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>
|
||||
|
47
SoftwareInstallation/FormComponents.Designer.cs
generated
47
SoftwareInstallation/FormComponents.Designer.cs
generated
@ -1,4 +1,4 @@
|
||||
namespace SoftwareInstallationView
|
||||
namespace PizzeriaView
|
||||
{
|
||||
partial class FormComponents
|
||||
{
|
||||
@ -29,11 +29,13 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
dataGridView = new DataGridView();
|
||||
ToolsPanel = new Panel();
|
||||
buttonUpdate = new Button();
|
||||
buttonDelete = new Button();
|
||||
buttonEdit = new Button();
|
||||
buttonAdd = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
ToolsPanel.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridView
|
||||
@ -41,21 +43,33 @@
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Location = new Point(-1, -2);
|
||||
dataGridView.Location = new Point(10, 9);
|
||||
dataGridView.Margin = new Padding(3, 2, 3, 2);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.RowTemplate.Height = 29;
|
||||
dataGridView.Size = new Size(437, 426);
|
||||
dataGridView.Size = new Size(516, 320);
|
||||
dataGridView.TabIndex = 0;
|
||||
//
|
||||
// ToolsPanel
|
||||
//
|
||||
ToolsPanel.Controls.Add(buttonUpdate);
|
||||
ToolsPanel.Controls.Add(buttonDelete);
|
||||
ToolsPanel.Controls.Add(buttonEdit);
|
||||
ToolsPanel.Controls.Add(buttonAdd);
|
||||
ToolsPanel.Location = new Point(532, 9);
|
||||
ToolsPanel.Margin = new Padding(3, 2, 3, 2);
|
||||
ToolsPanel.Name = "ToolsPanel";
|
||||
ToolsPanel.Size = new Size(158, 320);
|
||||
ToolsPanel.TabIndex = 1;
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
buttonUpdate.Location = new Point(459, 151);
|
||||
buttonUpdate.Location = new Point(27, 154);
|
||||
buttonUpdate.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonUpdate.Name = "buttonUpdate";
|
||||
buttonUpdate.Size = new Size(109, 26);
|
||||
buttonUpdate.Size = new Size(110, 27);
|
||||
buttonUpdate.TabIndex = 3;
|
||||
buttonUpdate.Text = "Обновить";
|
||||
buttonUpdate.UseVisualStyleBackColor = true;
|
||||
@ -63,10 +77,10 @@
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
buttonDelete.Location = new Point(459, 112);
|
||||
buttonDelete.Location = new Point(27, 106);
|
||||
buttonDelete.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonDelete.Name = "buttonDelete";
|
||||
buttonDelete.Size = new Size(109, 26);
|
||||
buttonDelete.Size = new Size(110, 27);
|
||||
buttonDelete.TabIndex = 2;
|
||||
buttonDelete.Text = "Удалить";
|
||||
buttonDelete.UseVisualStyleBackColor = true;
|
||||
@ -74,10 +88,10 @@
|
||||
//
|
||||
// buttonEdit
|
||||
//
|
||||
buttonEdit.Location = new Point(459, 74);
|
||||
buttonEdit.Location = new Point(27, 57);
|
||||
buttonEdit.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonEdit.Name = "buttonEdit";
|
||||
buttonEdit.Size = new Size(109, 26);
|
||||
buttonEdit.Size = new Size(110, 27);
|
||||
buttonEdit.TabIndex = 1;
|
||||
buttonEdit.Text = "Изменить";
|
||||
buttonEdit.UseVisualStyleBackColor = true;
|
||||
@ -85,10 +99,10 @@
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(459, 36);
|
||||
buttonAdd.Location = new Point(27, 12);
|
||||
buttonAdd.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(109, 26);
|
||||
buttonAdd.Size = new Size(110, 27);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.Text = "Добавить";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
@ -98,23 +112,22 @@
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(592, 422);
|
||||
Controls.Add(buttonUpdate);
|
||||
Controls.Add(buttonDelete);
|
||||
ClientSize = new Size(700, 338);
|
||||
Controls.Add(ToolsPanel);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(buttonEdit);
|
||||
Controls.Add(buttonAdd);
|
||||
Margin = new Padding(3, 2, 3, 2);
|
||||
Name = "FormComponents";
|
||||
Text = "Список компонентов";
|
||||
Text = "Компоненты";
|
||||
Load += FormComponents_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ToolsPanel.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridView;
|
||||
private Panel ToolsPanel;
|
||||
private Button buttonUpdate;
|
||||
private Button buttonDelete;
|
||||
private Button buttonEdit;
|
||||
|
@ -1,9 +1,9 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SoftwareInstallation;
|
||||
using Pizzeria;
|
||||
using SoftwareInstallationContracts.BindingModels;
|
||||
using SoftwareInstallationContracts.BusinessLogicsContracts;
|
||||
|
||||
namespace SoftwareInstallationView
|
||||
namespace PizzeriaView
|
||||
{
|
||||
public partial class FormComponents : Form
|
||||
{
|
||||
@ -34,11 +34,11 @@ namespace SoftwareInstallationView
|
||||
dataGridView.Columns["ComponentName"].AutoSizeMode =
|
||||
DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
_logger.LogInformation("Загрузка ингридиентов");
|
||||
_logger.LogInformation("Загрузка компонентов");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки ингридиентов");
|
||||
_logger.LogError(ex, "Ошибка загрузки компонентов");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
@ -82,7 +82,7 @@ namespace SoftwareInstallationView
|
||||
{
|
||||
int id =
|
||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Удаление ингридиента");
|
||||
_logger.LogInformation("Удаление компонента");
|
||||
try
|
||||
{
|
||||
if (!_logic.Delete(new ComponentBindingModel
|
||||
@ -96,7 +96,7 @@ namespace SoftwareInstallationView
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка удаления ингридиента");
|
||||
_logger.LogError(ex, "Ошибка удаления компонента");
|
||||
MessageBox.Show(ex.Message, "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
<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="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>
|
||||
|
34
SoftwareInstallation/FormCreateOrder.Designer.cs
generated
34
SoftwareInstallation/FormCreateOrder.Designer.cs
generated
@ -1,4 +1,4 @@
|
||||
namespace SoftwareInstallationView
|
||||
namespace PizzeriaView
|
||||
{
|
||||
partial class FormCreateOrder
|
||||
{
|
||||
@ -41,26 +41,26 @@
|
||||
// labelPackage
|
||||
//
|
||||
labelPackage.AutoSize = true;
|
||||
labelPackage.Location = new Point(19, 12);
|
||||
labelPackage.Location = new Point(10, 11);
|
||||
labelPackage.Name = "labelPackage";
|
||||
labelPackage.Size = new Size(56, 15);
|
||||
labelPackage.Size = new Size(39, 15);
|
||||
labelPackage.TabIndex = 0;
|
||||
labelPackage.Text = "Изделие:";
|
||||
labelPackage.Text = "Пакет";
|
||||
//
|
||||
// comboBoxPackage
|
||||
//
|
||||
comboBoxPackage.FormattingEnabled = true;
|
||||
comboBoxPackage.Location = new Point(103, 10);
|
||||
comboBoxPackage.Location = new Point(101, 9);
|
||||
comboBoxPackage.Margin = new Padding(3, 2, 3, 2);
|
||||
comboBoxPackage.Name = "comboBoxPackage";
|
||||
comboBoxPackage.Size = new Size(246, 23);
|
||||
comboBoxPackage.Size = new Size(314, 23);
|
||||
comboBoxPackage.TabIndex = 1;
|
||||
comboBoxPackage.SelectedIndexChanged += ComboBoxPackage_SelectedIndexChanged;
|
||||
//
|
||||
// labelCount
|
||||
//
|
||||
labelCount.AutoSize = true;
|
||||
labelCount.Location = new Point(19, 44);
|
||||
labelCount.Location = new Point(10, 37);
|
||||
labelCount.Name = "labelCount";
|
||||
labelCount.Size = new Size(78, 15);
|
||||
labelCount.TabIndex = 2;
|
||||
@ -68,17 +68,17 @@
|
||||
//
|
||||
// textBoxCount
|
||||
//
|
||||
textBoxCount.Location = new Point(103, 41);
|
||||
textBoxCount.Location = new Point(101, 34);
|
||||
textBoxCount.Margin = new Padding(3, 2, 3, 2);
|
||||
textBoxCount.Name = "textBoxCount";
|
||||
textBoxCount.Size = new Size(246, 23);
|
||||
textBoxCount.Size = new Size(314, 23);
|
||||
textBoxCount.TabIndex = 3;
|
||||
textBoxCount.TextChanged += TextBoxCount_TextChanged;
|
||||
//
|
||||
// labelSum
|
||||
//
|
||||
labelSum.AutoSize = true;
|
||||
labelSum.Location = new Point(19, 70);
|
||||
labelSum.Location = new Point(10, 60);
|
||||
labelSum.Name = "labelSum";
|
||||
labelSum.Size = new Size(51, 15);
|
||||
labelSum.TabIndex = 4;
|
||||
@ -86,19 +86,19 @@
|
||||
//
|
||||
// textBoxSum
|
||||
//
|
||||
textBoxSum.Location = new Point(103, 70);
|
||||
textBoxSum.Location = new Point(101, 60);
|
||||
textBoxSum.Margin = new Padding(3, 2, 3, 2);
|
||||
textBoxSum.Name = "textBoxSum";
|
||||
textBoxSum.ReadOnly = true;
|
||||
textBoxSum.Size = new Size(246, 23);
|
||||
textBoxSum.Size = new Size(314, 23);
|
||||
textBoxSum.TabIndex = 5;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(249, 101);
|
||||
buttonCancel.Location = new Point(295, 85);
|
||||
buttonCancel.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(94, 26);
|
||||
buttonCancel.Size = new Size(96, 24);
|
||||
buttonCancel.TabIndex = 6;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
@ -106,10 +106,10 @@
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(150, 101);
|
||||
buttonSave.Location = new Point(193, 85);
|
||||
buttonSave.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(94, 26);
|
||||
buttonSave.Size = new Size(96, 24);
|
||||
buttonSave.TabIndex = 7;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
@ -119,7 +119,7 @@
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(374, 136);
|
||||
ClientSize = new Size(424, 118);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(textBoxSum);
|
||||
|
@ -13,7 +13,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace SoftwareInstallationView
|
||||
namespace PizzeriaView
|
||||
{
|
||||
public partial class FormCreateOrder : Form
|
||||
{
|
||||
@ -39,7 +39,7 @@ namespace SoftwareInstallationView
|
||||
comboBoxPackage.ValueMember = "Id";
|
||||
comboBoxPackage.DataSource = _list;
|
||||
comboBoxPackage.SelectedItem = null;
|
||||
_logger.LogInformation("Загрузка пиццы для заказа");
|
||||
_logger.LogInformation("Загрузка пакета для заказа");
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ namespace SoftwareInstallationView
|
||||
}
|
||||
if (comboBoxPackage.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите пиццу", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show("Выберите пакет", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Создание заказа");
|
||||
|
@ -18,7 +18,7 @@
|
||||
<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="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>
|
||||
|
143
SoftwareInstallation/FormCreateSupply.Designer.cs
generated
Normal file
143
SoftwareInstallation/FormCreateSupply.Designer.cs
generated
Normal file
@ -0,0 +1,143 @@
|
||||
namespace PizzeriaView
|
||||
{
|
||||
partial class FormCreateSupply
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
this.comboBoxShop = new System.Windows.Forms.ComboBox();
|
||||
this.labelShop = new System.Windows.Forms.Label();
|
||||
this.labelPackage = new System.Windows.Forms.Label();
|
||||
this.comboBoxPackage = new System.Windows.Forms.ComboBox();
|
||||
this.labelCount = new System.Windows.Forms.Label();
|
||||
this.textBoxCount = new System.Windows.Forms.TextBox();
|
||||
this.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.buttonSave = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// comboBoxShop
|
||||
//
|
||||
this.comboBoxShop.FormattingEnabled = true;
|
||||
this.comboBoxShop.Location = new System.Drawing.Point(115, 12);
|
||||
this.comboBoxShop.Name = "comboBoxShop";
|
||||
this.comboBoxShop.Size = new System.Drawing.Size(344, 28);
|
||||
this.comboBoxShop.TabIndex = 0;
|
||||
//
|
||||
// labelShop
|
||||
//
|
||||
this.labelShop.AutoSize = true;
|
||||
this.labelShop.Location = new System.Drawing.Point(12, 15);
|
||||
this.labelShop.Name = "labelShop";
|
||||
this.labelShop.Size = new System.Drawing.Size(76, 20);
|
||||
this.labelShop.TabIndex = 1;
|
||||
this.labelShop.Text = "Магазин: ";
|
||||
//
|
||||
// labelPackage
|
||||
//
|
||||
this.labelPackage.AutoSize = true;
|
||||
this.labelPackage.Location = new System.Drawing.Point(12, 49);
|
||||
this.labelPackage.Name = "labelPackage";
|
||||
this.labelPackage.Size = new System.Drawing.Size(75, 20);
|
||||
this.labelPackage.TabIndex = 2;
|
||||
this.labelPackage.Text = "Изделие: ";
|
||||
//
|
||||
// comboBoxPackage
|
||||
//
|
||||
this.comboBoxPackage.FormattingEnabled = true;
|
||||
this.comboBoxPackage.Location = new System.Drawing.Point(115, 46);
|
||||
this.comboBoxPackage.Name = "comboBoxPackage";
|
||||
this.comboBoxPackage.Size = new System.Drawing.Size(344, 28);
|
||||
this.comboBoxPackage.TabIndex = 3;
|
||||
//
|
||||
// labelCount
|
||||
//
|
||||
this.labelCount.AutoSize = true;
|
||||
this.labelCount.Location = new System.Drawing.Point(12, 83);
|
||||
this.labelCount.Name = "labelCount";
|
||||
this.labelCount.Size = new System.Drawing.Size(97, 20);
|
||||
this.labelCount.TabIndex = 4;
|
||||
this.labelCount.Text = "Количество: ";
|
||||
//
|
||||
// textBoxCount
|
||||
//
|
||||
this.textBoxCount.Location = new System.Drawing.Point(115, 80);
|
||||
this.textBoxCount.Name = "textBoxCount";
|
||||
this.textBoxCount.Size = new System.Drawing.Size(344, 27);
|
||||
this.textBoxCount.TabIndex = 5;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
this.buttonCancel.Location = new System.Drawing.Point(300, 113);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(116, 39);
|
||||
this.buttonCancel.TabIndex = 6;
|
||||
this.buttonCancel.Text = "Отмена";
|
||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
this.buttonSave.Location = new System.Drawing.Point(168, 113);
|
||||
this.buttonSave.Name = "buttonSave";
|
||||
this.buttonSave.Size = new System.Drawing.Size(116, 39);
|
||||
this.buttonSave.TabIndex = 7;
|
||||
this.buttonSave.Text = "Сохранить";
|
||||
this.buttonSave.UseVisualStyleBackColor = true;
|
||||
this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
||||
//
|
||||
// FormCreateSupply
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(471, 164);
|
||||
this.Controls.Add(this.buttonSave);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.Controls.Add(this.textBoxCount);
|
||||
this.Controls.Add(this.labelCount);
|
||||
this.Controls.Add(this.comboBoxPackage);
|
||||
this.Controls.Add(this.labelPackage);
|
||||
this.Controls.Add(this.labelShop);
|
||||
this.Controls.Add(this.comboBoxShop);
|
||||
this.Name = "FormCreateSupply";
|
||||
this.Text = "Создание поставки";
|
||||
this.Load += new System.EventHandler(this.FormCreateSupply_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ComboBox comboBoxShop;
|
||||
private Label labelShop;
|
||||
private Label labelPackage;
|
||||
private ComboBox comboBoxPackage;
|
||||
private Label labelCount;
|
||||
private TextBox textBoxCount;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
}
|
||||
}
|
99
SoftwareInstallation/FormCreateSupply.cs
Normal file
99
SoftwareInstallation/FormCreateSupply.cs
Normal file
@ -0,0 +1,99 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SoftwareInstallationContracts.BindingModels;
|
||||
using SoftwareInstallationContracts.BusinessLogicsContracts;
|
||||
using SoftwareInstallationContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections;
|
||||
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;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace PizzeriaView
|
||||
{
|
||||
public partial class FormCreateSupply : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IPackageLogic _logicP;
|
||||
private readonly IShopLogic _logicS;
|
||||
private List<ShopViewModel> _shopList = new List<ShopViewModel>();
|
||||
private List<PackageViewModel> _packageList = new List<PackageViewModel>();
|
||||
|
||||
public FormCreateSupply(ILogger<FormCreateSupply> logger, IPackageLogic logicP, IShopLogic logicS)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logicP = logicP;
|
||||
_logicS = logicS;
|
||||
}
|
||||
|
||||
private void FormCreateSupply_Load(object sender, EventArgs e)
|
||||
{
|
||||
_shopList = _logicS.ReadList(null);
|
||||
_packageList = _logicP.ReadList(null);
|
||||
if (_shopList != null)
|
||||
{
|
||||
comboBoxShop.DisplayMember = "ShopName";
|
||||
comboBoxShop.ValueMember = "Id";
|
||||
comboBoxShop.DataSource = _shopList;
|
||||
comboBoxShop.SelectedItem = null;
|
||||
_logger.LogInformation("Загрузка магазинов для поставок");
|
||||
}
|
||||
if (_packageList != null)
|
||||
{
|
||||
comboBoxPackage.DisplayMember = "PackageName";
|
||||
comboBoxPackage.ValueMember = "Id";
|
||||
comboBoxPackage.DataSource = _packageList;
|
||||
comboBoxPackage.SelectedItem = null;
|
||||
_logger.LogInformation("Загрузка пакетов для поставок");
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (comboBoxShop.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите магазин", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (comboBoxPackage.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Создание поставки");
|
||||
try
|
||||
{
|
||||
var operationResult = _logicS.MakeSupply(new SupplyBindingModel
|
||||
{
|
||||
ShopId = Convert.ToInt32(comboBoxShop.SelectedValue),
|
||||
PackageId = Convert.ToInt32(comboBoxPackage.SelectedValue),
|
||||
Count = Convert.ToInt32(textBoxCount.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 ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
120
SoftwareInstallation/FormCreateSupply.resx
Normal file
120
SoftwareInstallation/FormCreateSupply.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>
|
93
SoftwareInstallation/FormMain.Designer.cs
generated
93
SoftwareInstallation/FormMain.Designer.cs
generated
@ -1,4 +1,4 @@
|
||||
namespace SoftwareInstallationView
|
||||
namespace PizzeriaView
|
||||
{
|
||||
partial class FormMain
|
||||
{
|
||||
@ -30,8 +30,10 @@
|
||||
{
|
||||
menuStrip1 = new MenuStrip();
|
||||
bookToolStripMenuItem = new ToolStripMenuItem();
|
||||
компонентыToolStripMenuItem = new ToolStripMenuItem();
|
||||
pizzasToolStripMenuItem = new ToolStripMenuItem();
|
||||
ingridientsToolStripMenuItem = new ToolStripMenuItem();
|
||||
packagesToolStripMenuItem = new ToolStripMenuItem();
|
||||
shopsToolStripMenuItem = new ToolStripMenuItem();
|
||||
transactionToolStripMenuItem = new ToolStripMenuItem();
|
||||
dataGridView = new DataGridView();
|
||||
buttonCreateOrder = new Button();
|
||||
buttonTakeOrderInWork = new Button();
|
||||
@ -48,49 +50,65 @@
|
||||
menuStrip1.Items.AddRange(new ToolStripItem[] { bookToolStripMenuItem });
|
||||
menuStrip1.Location = new Point(0, 0);
|
||||
menuStrip1.Name = "menuStrip1";
|
||||
menuStrip1.Padding = new Padding(6, 3, 0, 3);
|
||||
menuStrip1.Size = new Size(1107, 30);
|
||||
menuStrip1.Padding = new Padding(5, 2, 0, 2);
|
||||
menuStrip1.Size = new Size(1149, 24);
|
||||
menuStrip1.TabIndex = 0;
|
||||
menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// bookToolStripMenuItem
|
||||
//
|
||||
bookToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, pizzasToolStripMenuItem });
|
||||
bookToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ingridientsToolStripMenuItem, packagesToolStripMenuItem, shopsToolStripMenuItem, transactionToolStripMenuItem });
|
||||
bookToolStripMenuItem.Name = "bookToolStripMenuItem";
|
||||
bookToolStripMenuItem.Size = new Size(108, 24);
|
||||
bookToolStripMenuItem.Size = new Size(87, 20);
|
||||
bookToolStripMenuItem.Text = "Справочник";
|
||||
//
|
||||
// компонентыToolStripMenuItem
|
||||
// ingridientsToolStripMenuItem
|
||||
//
|
||||
компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
||||
компонентыToolStripMenuItem.Size = new Size(224, 26);
|
||||
компонентыToolStripMenuItem.Text = "Компоненты";
|
||||
компонентыToolStripMenuItem.Click += IngridentsToolStripMenuItem_Click;
|
||||
ingridientsToolStripMenuItem.Name = "ingridientsToolStripMenuItem";
|
||||
ingridientsToolStripMenuItem.Size = new Size(180, 22);
|
||||
ingridientsToolStripMenuItem.Text = "Компоненты";
|
||||
ingridientsToolStripMenuItem.Click += IngridentsToolStripMenuItem_Click;
|
||||
//
|
||||
// pizzasToolStripMenuItem
|
||||
// packagesToolStripMenuItem
|
||||
//
|
||||
pizzasToolStripMenuItem.Name = "pizzasToolStripMenuItem";
|
||||
pizzasToolStripMenuItem.Size = new Size(224, 26);
|
||||
pizzasToolStripMenuItem.Text = "ПО";
|
||||
pizzasToolStripMenuItem.Click += PackagesToolStripMenuItem_Click;
|
||||
packagesToolStripMenuItem.Name = "packagesToolStripMenuItem";
|
||||
packagesToolStripMenuItem.Size = new Size(180, 22);
|
||||
packagesToolStripMenuItem.Text = "Пакеты";
|
||||
packagesToolStripMenuItem.Click += PackagesToolStripMenuItem_Click;
|
||||
//
|
||||
// shopsToolStripMenuItem
|
||||
//
|
||||
shopsToolStripMenuItem.Name = "shopsToolStripMenuItem";
|
||||
shopsToolStripMenuItem.Size = new Size(180, 22);
|
||||
shopsToolStripMenuItem.Text = "Магазины";
|
||||
shopsToolStripMenuItem.Click += shopsToolStripMenuItem_Click;
|
||||
//
|
||||
// transactionToolStripMenuItem
|
||||
//
|
||||
transactionToolStripMenuItem.Name = "transactionToolStripMenuItem";
|
||||
transactionToolStripMenuItem.Size = new Size(180, 22);
|
||||
transactionToolStripMenuItem.Text = "Поставки";
|
||||
transactionToolStripMenuItem.Click += transactionToolStripMenuItem_Click;
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Location = new Point(0, 35);
|
||||
dataGridView.Location = new Point(10, 23);
|
||||
dataGridView.Margin = new Padding(3, 2, 3, 2);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.RowTemplate.Height = 29;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.Size = new Size(872, 580);
|
||||
dataGridView.Size = new Size(855, 286);
|
||||
dataGridView.TabIndex = 1;
|
||||
//
|
||||
// buttonCreateOrder
|
||||
//
|
||||
buttonCreateOrder.Location = new Point(914, 75);
|
||||
buttonCreateOrder.Location = new Point(898, 53);
|
||||
buttonCreateOrder.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonCreateOrder.Name = "buttonCreateOrder";
|
||||
buttonCreateOrder.Size = new Size(161, 32);
|
||||
buttonCreateOrder.Size = new Size(216, 22);
|
||||
buttonCreateOrder.TabIndex = 2;
|
||||
buttonCreateOrder.Text = "Создать заказ";
|
||||
buttonCreateOrder.UseVisualStyleBackColor = true;
|
||||
@ -98,9 +116,10 @@
|
||||
//
|
||||
// buttonTakeOrderInWork
|
||||
//
|
||||
buttonTakeOrderInWork.Location = new Point(914, 133);
|
||||
buttonTakeOrderInWork.Location = new Point(898, 92);
|
||||
buttonTakeOrderInWork.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
||||
buttonTakeOrderInWork.Size = new Size(161, 32);
|
||||
buttonTakeOrderInWork.Size = new Size(216, 22);
|
||||
buttonTakeOrderInWork.TabIndex = 3;
|
||||
buttonTakeOrderInWork.Text = "Отдать на выполнение";
|
||||
buttonTakeOrderInWork.UseVisualStyleBackColor = true;
|
||||
@ -108,9 +127,10 @@
|
||||
//
|
||||
// buttonOrderReady
|
||||
//
|
||||
buttonOrderReady.Location = new Point(914, 189);
|
||||
buttonOrderReady.Location = new Point(898, 129);
|
||||
buttonOrderReady.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonOrderReady.Name = "buttonOrderReady";
|
||||
buttonOrderReady.Size = new Size(161, 32);
|
||||
buttonOrderReady.Size = new Size(216, 22);
|
||||
buttonOrderReady.TabIndex = 4;
|
||||
buttonOrderReady.Text = "Заказ готов";
|
||||
buttonOrderReady.UseVisualStyleBackColor = true;
|
||||
@ -118,9 +138,10 @@
|
||||
//
|
||||
// buttonIssuedOrder
|
||||
//
|
||||
buttonIssuedOrder.Location = new Point(914, 241);
|
||||
buttonIssuedOrder.Location = new Point(898, 169);
|
||||
buttonIssuedOrder.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonIssuedOrder.Name = "buttonIssuedOrder";
|
||||
buttonIssuedOrder.Size = new Size(161, 32);
|
||||
buttonIssuedOrder.Size = new Size(216, 22);
|
||||
buttonIssuedOrder.TabIndex = 5;
|
||||
buttonIssuedOrder.Text = "Заказ выдан";
|
||||
buttonIssuedOrder.UseVisualStyleBackColor = true;
|
||||
@ -128,9 +149,10 @@
|
||||
//
|
||||
// buttonRef
|
||||
//
|
||||
buttonRef.Location = new Point(914, 296);
|
||||
buttonRef.Location = new Point(898, 210);
|
||||
buttonRef.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonRef.Name = "buttonRef";
|
||||
buttonRef.Size = new Size(161, 32);
|
||||
buttonRef.Size = new Size(216, 22);
|
||||
buttonRef.TabIndex = 6;
|
||||
buttonRef.Text = "Обновить список";
|
||||
buttonRef.UseVisualStyleBackColor = true;
|
||||
@ -138,9 +160,9 @@
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1107, 615);
|
||||
ClientSize = new Size(1149, 319);
|
||||
Controls.Add(buttonRef);
|
||||
Controls.Add(buttonIssuedOrder);
|
||||
Controls.Add(buttonOrderReady);
|
||||
@ -149,8 +171,9 @@
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(menuStrip1);
|
||||
MainMenuStrip = menuStrip1;
|
||||
Margin = new Padding(3, 2, 3, 2);
|
||||
Name = "FormMain";
|
||||
Text = "ПО";
|
||||
Text = "Уставновка ПО";
|
||||
Load += FormMain_Load;
|
||||
menuStrip1.ResumeLayout(false);
|
||||
menuStrip1.PerformLayout();
|
||||
@ -163,13 +186,15 @@
|
||||
|
||||
private MenuStrip menuStrip1;
|
||||
private ToolStripMenuItem bookToolStripMenuItem;
|
||||
private ToolStripMenuItem компонентыToolStripMenuItem;
|
||||
private ToolStripMenuItem pizzasToolStripMenuItem;
|
||||
private ToolStripMenuItem ingridientsToolStripMenuItem;
|
||||
private ToolStripMenuItem packagesToolStripMenuItem;
|
||||
private DataGridView dataGridView;
|
||||
private Button buttonCreateOrder;
|
||||
private Button buttonTakeOrderInWork;
|
||||
private Button buttonOrderReady;
|
||||
private Button buttonIssuedOrder;
|
||||
private Button buttonRef;
|
||||
private ToolStripMenuItem shopsToolStripMenuItem;
|
||||
private ToolStripMenuItem transactionToolStripMenuItem;
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SoftwareInstallation;
|
||||
using Pizzeria;
|
||||
using SoftwareInstallationContracts.BindingModels;
|
||||
using SoftwareInstallationContracts.BusinessLogicsContracts;
|
||||
|
||||
namespace SoftwareInstallationView
|
||||
namespace PizzeriaView
|
||||
{
|
||||
public partial class FormMain : Form
|
||||
{
|
||||
@ -154,5 +154,23 @@ namespace SoftwareInstallationView
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void shopsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormShops));
|
||||
if (service is FormShops form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void transactionToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormCreateSupply));
|
||||
if (service is FormCreateSupply form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
<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="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>
|
||||
|
132
SoftwareInstallation/FormPackage.Designer.cs
generated
132
SoftwareInstallation/FormPackage.Designer.cs
generated
@ -1,4 +1,4 @@
|
||||
namespace SoftwareInstallationView
|
||||
namespace PizzeriaView
|
||||
{
|
||||
partial class FormPackage
|
||||
{
|
||||
@ -38,11 +38,11 @@
|
||||
buttonUpd = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridView = new DataGridView();
|
||||
Number = new DataGridViewTextBoxColumn();
|
||||
Component = new DataGridViewTextBoxColumn();
|
||||
Count = new DataGridViewTextBoxColumn();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
id = new DataGridViewTextBoxColumn();
|
||||
Component = new DataGridViewTextBoxColumn();
|
||||
Count = new DataGridViewTextBoxColumn();
|
||||
groupBoxComponents.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
@ -50,36 +50,37 @@
|
||||
// labelName
|
||||
//
|
||||
labelName.AutoSize = true;
|
||||
labelName.Location = new Point(18, 20);
|
||||
labelName.Location = new Point(14, 11);
|
||||
labelName.Name = "labelName";
|
||||
labelName.Size = new Size(84, 20);
|
||||
labelName.Size = new Size(65, 15);
|
||||
labelName.TabIndex = 0;
|
||||
labelName.Text = "Название: ";
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Location = new Point(107, 19);
|
||||
textBoxName.Location = new Point(98, 9);
|
||||
textBoxName.Margin = new Padding(3, 2, 3, 2);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(281, 27);
|
||||
textBoxName.Size = new Size(257, 23);
|
||||
textBoxName.TabIndex = 1;
|
||||
//
|
||||
// labelPrice
|
||||
//
|
||||
labelPrice.AutoSize = true;
|
||||
labelPrice.Location = new Point(18, 55);
|
||||
labelPrice.Location = new Point(14, 38);
|
||||
labelPrice.Name = "labelPrice";
|
||||
labelPrice.Size = new Size(90, 20);
|
||||
labelPrice.Size = new Size(73, 15);
|
||||
labelPrice.TabIndex = 2;
|
||||
labelPrice.Text = "Стоимость: ";
|
||||
//
|
||||
// textBoxPrice
|
||||
//
|
||||
textBoxPrice.Location = new Point(107, 52);
|
||||
textBoxPrice.Location = new Point(98, 38);
|
||||
textBoxPrice.Margin = new Padding(3, 2, 3, 2);
|
||||
textBoxPrice.Name = "textBoxPrice";
|
||||
textBoxPrice.ReadOnly = true;
|
||||
textBoxPrice.Size = new Size(97, 27);
|
||||
textBoxPrice.Size = new Size(150, 23);
|
||||
textBoxPrice.TabIndex = 3;
|
||||
textBoxPrice.TabStop = false;
|
||||
//
|
||||
// groupBoxComponents
|
||||
//
|
||||
@ -88,18 +89,21 @@
|
||||
groupBoxComponents.Controls.Add(buttonUpd);
|
||||
groupBoxComponents.Controls.Add(buttonAdd);
|
||||
groupBoxComponents.Controls.Add(dataGridView);
|
||||
groupBoxComponents.Location = new Point(16, 95);
|
||||
groupBoxComponents.Location = new Point(10, 63);
|
||||
groupBoxComponents.Margin = new Padding(3, 2, 3, 2);
|
||||
groupBoxComponents.Name = "groupBoxComponents";
|
||||
groupBoxComponents.Size = new Size(787, 489);
|
||||
groupBoxComponents.Padding = new Padding(3, 2, 3, 2);
|
||||
groupBoxComponents.Size = new Size(578, 239);
|
||||
groupBoxComponents.TabIndex = 4;
|
||||
groupBoxComponents.TabStop = false;
|
||||
groupBoxComponents.Text = "Компоненты";
|
||||
groupBoxComponents.Text = "Ингредиенты";
|
||||
//
|
||||
// buttonRef
|
||||
//
|
||||
buttonRef.Location = new Point(656, 231);
|
||||
buttonRef.Location = new Point(439, 158);
|
||||
buttonRef.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonRef.Name = "buttonRef";
|
||||
buttonRef.Size = new Size(111, 37);
|
||||
buttonRef.Size = new Size(110, 26);
|
||||
buttonRef.TabIndex = 4;
|
||||
buttonRef.Text = "Обновить";
|
||||
buttonRef.UseVisualStyleBackColor = true;
|
||||
@ -107,9 +111,10 @@
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.Location = new Point(656, 179);
|
||||
buttonDel.Location = new Point(439, 118);
|
||||
buttonDel.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(111, 37);
|
||||
buttonDel.Size = new Size(110, 26);
|
||||
buttonDel.TabIndex = 3;
|
||||
buttonDel.Text = "Удалить";
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
@ -117,9 +122,10 @@
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
buttonUpd.Location = new Point(656, 120);
|
||||
buttonUpd.Location = new Point(439, 76);
|
||||
buttonUpd.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new Size(111, 37);
|
||||
buttonUpd.Size = new Size(110, 26);
|
||||
buttonUpd.TabIndex = 2;
|
||||
buttonUpd.Text = "Изменить";
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
@ -127,9 +133,10 @@
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(656, 59);
|
||||
buttonAdd.Location = new Point(439, 35);
|
||||
buttonAdd.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(111, 37);
|
||||
buttonAdd.Size = new Size(110, 26);
|
||||
buttonAdd.TabIndex = 1;
|
||||
buttonAdd.Text = "Добавить";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
@ -137,47 +144,26 @@
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Columns.AddRange(new DataGridViewColumn[] { Number, Component, Count });
|
||||
dataGridView.Location = new Point(0, 27);
|
||||
dataGridView.Columns.AddRange(new DataGridViewColumn[] { id, Component, Count });
|
||||
dataGridView.Location = new Point(5, 20);
|
||||
dataGridView.Margin = new Padding(3, 2, 3, 2);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.RowTemplate.Height = 29;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.ShowEditingIcon = false;
|
||||
dataGridView.Size = new Size(627, 443);
|
||||
dataGridView.Size = new Size(416, 215);
|
||||
dataGridView.TabIndex = 0;
|
||||
//
|
||||
// Number
|
||||
//
|
||||
Number.HeaderText = "Номер";
|
||||
Number.MinimumWidth = 6;
|
||||
Number.Name = "Number";
|
||||
Number.ReadOnly = true;
|
||||
Number.Width = 60;
|
||||
//
|
||||
// Component
|
||||
//
|
||||
Component.HeaderText = "Компонент";
|
||||
Component.MinimumWidth = 6;
|
||||
Component.Name = "Component";
|
||||
Component.ReadOnly = true;
|
||||
Component.Width = 125;
|
||||
//
|
||||
// Count
|
||||
//
|
||||
Count.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
Count.HeaderText = "Количество";
|
||||
Count.MinimumWidth = 6;
|
||||
Count.Name = "Count";
|
||||
Count.ReadOnly = true;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(609, 605);
|
||||
buttonCancel.Location = new Point(450, 313);
|
||||
buttonCancel.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(130, 37);
|
||||
buttonCancel.Size = new Size(110, 26);
|
||||
buttonCancel.TabIndex = 5;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
@ -185,19 +171,42 @@
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(454, 605);
|
||||
buttonSave.Location = new Point(322, 313);
|
||||
buttonSave.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(130, 37);
|
||||
buttonSave.Size = new Size(110, 26);
|
||||
buttonSave.TabIndex = 6;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// id
|
||||
//
|
||||
id.HeaderText = "id";
|
||||
id.MinimumWidth = 6;
|
||||
id.Name = "id";
|
||||
id.ReadOnly = true;
|
||||
id.Visible = false;
|
||||
//
|
||||
// Component
|
||||
//
|
||||
Component.HeaderText = "Компоненты";
|
||||
Component.MinimumWidth = 6;
|
||||
Component.Name = "Component";
|
||||
Component.ReadOnly = true;
|
||||
//
|
||||
// Count
|
||||
//
|
||||
Count.HeaderText = "Количество";
|
||||
Count.MinimumWidth = 6;
|
||||
Count.Name = "Count";
|
||||
Count.ReadOnly = true;
|
||||
//
|
||||
// FormPackage
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(813, 663);
|
||||
ClientSize = new Size(599, 347);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(groupBoxComponents);
|
||||
@ -205,8 +214,9 @@
|
||||
Controls.Add(labelPrice);
|
||||
Controls.Add(textBoxName);
|
||||
Controls.Add(labelName);
|
||||
Margin = new Padding(3, 2, 3, 2);
|
||||
Name = "FormPackage";
|
||||
Text = "ПО";
|
||||
Text = "Пакеты";
|
||||
Load += FormPackage_Load;
|
||||
groupBoxComponents.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
@ -229,7 +239,7 @@
|
||||
private DataGridView dataGridView;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
private DataGridViewTextBoxColumn Number;
|
||||
private DataGridViewTextBoxColumn id;
|
||||
private DataGridViewTextBoxColumn Component;
|
||||
private DataGridViewTextBoxColumn Count;
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SoftwareInstallation;
|
||||
using Pizzeria;
|
||||
using SoftwareInstallationContracts.BindingModels;
|
||||
using SoftwareInstallationContracts.BusinessLogicsContracts;
|
||||
using SoftwareInstallationContracts.SearchModels;
|
||||
using SoftwareInstallationDataModels.Models;
|
||||
|
||||
namespace SoftwareInstallationView
|
||||
namespace PizzeriaView
|
||||
{
|
||||
public partial class FormPackage : Form
|
||||
{
|
||||
@ -27,7 +27,7 @@ namespace SoftwareInstallationView
|
||||
{
|
||||
if (_id.HasValue)
|
||||
{
|
||||
_logger.LogInformation("Загрузка пиццы");
|
||||
_logger.LogInformation("Загрузка пакета");
|
||||
try
|
||||
{
|
||||
var view = _logic.ReadElement(new PackageSearchModel
|
||||
@ -45,7 +45,7 @@ namespace SoftwareInstallationView
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки пиццы");
|
||||
_logger.LogError(ex, "Ошибка загрузки пакета");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
@ -54,7 +54,7 @@ namespace SoftwareInstallationView
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
_logger.LogInformation("Загрузка ингредиент пиццы");
|
||||
_logger.LogInformation("Загрузка компонента пакета");
|
||||
try
|
||||
{
|
||||
if (_PackageComponents != null)
|
||||
@ -69,7 +69,7 @@ namespace SoftwareInstallationView
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки ингредиента пиццы");
|
||||
_logger.LogError(ex, "Ошибка загрузки компонента пакета");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
@ -86,7 +86,7 @@ namespace SoftwareInstallationView
|
||||
{
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Добавление нового ингредиента:{ ComponentName}-{ Count}", form.ComponentModel.ComponentName, form.Count);
|
||||
_logger.LogInformation("Добавление нового компонента:{ ComponentName}-{ Count}", form.ComponentModel.ComponentName, form.Count);
|
||||
if (_PackageComponents.ContainsKey(form.Id))
|
||||
{
|
||||
_PackageComponents[form.Id] = (form.ComponentModel,
|
||||
@ -118,7 +118,7 @@ namespace SoftwareInstallationView
|
||||
{
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Изменение ингредиента:{ ComponentName}-{ Count}", form.ComponentModel.ComponentName, form.Count);
|
||||
_logger.LogInformation("Изменение компонента:{ ComponentName}-{ Count}", form.ComponentModel.ComponentName, form.Count);
|
||||
_PackageComponents[form.Id] = (form.ComponentModel, form.Count);
|
||||
LoadData();
|
||||
}
|
||||
@ -134,7 +134,7 @@ namespace SoftwareInstallationView
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogInformation("Удаление ингредиента:{ ComponentName}-{ Count}", dataGridView.SelectedRows[0].Cells[1].Value);
|
||||
_logger.LogInformation("Удаление компонента:{ ComponentName}-{ Count}", dataGridView.SelectedRows[0].Cells[1].Value);
|
||||
_PackageComponents?.Remove(Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value));
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -166,10 +166,10 @@ namespace SoftwareInstallationView
|
||||
}
|
||||
if (_PackageComponents == null || _PackageComponents.Count == 0)
|
||||
{
|
||||
MessageBox.Show("Заполните ингредиенты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show("Заполните компоненты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Сохранение пиццы");
|
||||
_logger.LogInformation("Сохранение пакета");
|
||||
try
|
||||
{
|
||||
var model = new PackageBindingModel
|
||||
@ -191,7 +191,7 @@ namespace SoftwareInstallationView
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка сохранения пиццы");
|
||||
_logger.LogError(ex, "Ошибка сохранения пакета");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
<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="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>
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace SoftwareInstallationView
|
||||
namespace PizzeriaView
|
||||
{
|
||||
partial class FormPackageComponent
|
||||
{
|
||||
@ -39,41 +39,44 @@
|
||||
// labelComponent
|
||||
//
|
||||
labelComponent.AutoSize = true;
|
||||
labelComponent.Location = new Point(14, 19);
|
||||
labelComponent.Location = new Point(10, 7);
|
||||
labelComponent.Name = "labelComponent";
|
||||
labelComponent.Size = new Size(91, 20);
|
||||
labelComponent.Size = new Size(72, 15);
|
||||
labelComponent.TabIndex = 0;
|
||||
labelComponent.Text = "Компонент:";
|
||||
//
|
||||
// comboBoxComponent
|
||||
//
|
||||
comboBoxComponent.FormattingEnabled = true;
|
||||
comboBoxComponent.Location = new Point(121, 12);
|
||||
comboBoxComponent.Location = new Point(104, 7);
|
||||
comboBoxComponent.Margin = new Padding(3, 2, 3, 2);
|
||||
comboBoxComponent.Name = "comboBoxComponent";
|
||||
comboBoxComponent.Size = new Size(285, 28);
|
||||
comboBoxComponent.Size = new Size(311, 23);
|
||||
comboBoxComponent.TabIndex = 1;
|
||||
//
|
||||
// labelCount
|
||||
//
|
||||
labelCount.AutoSize = true;
|
||||
labelCount.Location = new Point(14, 59);
|
||||
labelCount.Location = new Point(10, 38);
|
||||
labelCount.Name = "labelCount";
|
||||
labelCount.Size = new Size(93, 20);
|
||||
labelCount.Size = new Size(75, 15);
|
||||
labelCount.TabIndex = 2;
|
||||
labelCount.Text = "Количество:";
|
||||
//
|
||||
// textBoxCount
|
||||
//
|
||||
textBoxCount.Location = new Point(121, 59);
|
||||
textBoxCount.Location = new Point(104, 38);
|
||||
textBoxCount.Margin = new Padding(3, 2, 3, 2);
|
||||
textBoxCount.Name = "textBoxCount";
|
||||
textBoxCount.Size = new Size(285, 27);
|
||||
textBoxCount.Size = new Size(311, 23);
|
||||
textBoxCount.TabIndex = 3;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(309, 100);
|
||||
buttonCancel.Location = new Point(277, 70);
|
||||
buttonCancel.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(98, 36);
|
||||
buttonCancel.Size = new Size(119, 31);
|
||||
buttonCancel.TabIndex = 4;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
@ -81,9 +84,10 @@
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(199, 100);
|
||||
buttonSave.Location = new Point(153, 70);
|
||||
buttonSave.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(98, 36);
|
||||
buttonSave.Size = new Size(119, 31);
|
||||
buttonSave.TabIndex = 5;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
@ -91,17 +95,18 @@
|
||||
//
|
||||
// FormPackageComponent
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(426, 149);
|
||||
ClientSize = new Size(425, 110);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(textBoxCount);
|
||||
Controls.Add(labelCount);
|
||||
Controls.Add(comboBoxComponent);
|
||||
Controls.Add(labelComponent);
|
||||
Margin = new Padding(3, 2, 3, 2);
|
||||
Name = "FormPackageComponent";
|
||||
Text = "ПО";
|
||||
Text = "Компоненты пакета";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace SoftwareInstallationView
|
||||
namespace PizzeriaView
|
||||
{
|
||||
public partial class FormPackageComponent : Form
|
||||
{
|
||||
@ -73,7 +73,7 @@ namespace SoftwareInstallationView
|
||||
}
|
||||
if (comboBoxComponent.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите ингредиент", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show("Выберите компонент", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
DialogResult = DialogResult.OK;
|
||||
|
@ -18,7 +18,7 @@
|
||||
<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="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>
|
||||
|
58
SoftwareInstallation/FormPackages.Designer.cs
generated
58
SoftwareInstallation/FormPackages.Designer.cs
generated
@ -1,4 +1,4 @@
|
||||
namespace SoftwareInstallationView
|
||||
namespace PizzeriaView
|
||||
{
|
||||
partial class FormPackages
|
||||
{
|
||||
@ -28,19 +28,34 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
ToolsPanel = new Panel();
|
||||
buttonRef = new Button();
|
||||
buttonDel = new Button();
|
||||
buttonUpd = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridView = new DataGridView();
|
||||
ToolsPanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// ToolsPanel
|
||||
//
|
||||
ToolsPanel.Controls.Add(buttonRef);
|
||||
ToolsPanel.Controls.Add(buttonDel);
|
||||
ToolsPanel.Controls.Add(buttonUpd);
|
||||
ToolsPanel.Controls.Add(buttonAdd);
|
||||
ToolsPanel.Location = new Point(532, 9);
|
||||
ToolsPanel.Margin = new Padding(3, 2, 3, 2);
|
||||
ToolsPanel.Name = "ToolsPanel";
|
||||
ToolsPanel.Size = new Size(158, 320);
|
||||
ToolsPanel.TabIndex = 3;
|
||||
//
|
||||
// buttonRef
|
||||
//
|
||||
buttonRef.Location = new Point(741, 180);
|
||||
buttonRef.Location = new Point(27, 154);
|
||||
buttonRef.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonRef.Name = "buttonRef";
|
||||
buttonRef.Size = new Size(128, 35);
|
||||
buttonRef.Size = new Size(110, 27);
|
||||
buttonRef.TabIndex = 3;
|
||||
buttonRef.Text = "Обновить";
|
||||
buttonRef.UseVisualStyleBackColor = true;
|
||||
@ -48,9 +63,10 @@
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.Location = new Point(741, 129);
|
||||
buttonDel.Location = new Point(27, 106);
|
||||
buttonDel.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(128, 35);
|
||||
buttonDel.Size = new Size(110, 27);
|
||||
buttonDel.TabIndex = 2;
|
||||
buttonDel.Text = "Удалить";
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
@ -58,9 +74,10 @@
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
buttonUpd.Location = new Point(741, 77);
|
||||
buttonUpd.Location = new Point(27, 57);
|
||||
buttonUpd.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new Size(128, 35);
|
||||
buttonUpd.Size = new Size(110, 27);
|
||||
buttonUpd.TabIndex = 1;
|
||||
buttonUpd.Text = "Изменить";
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
@ -68,9 +85,10 @@
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(741, 27);
|
||||
buttonAdd.Location = new Point(27, 12);
|
||||
buttonAdd.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(128, 35);
|
||||
buttonAdd.Size = new Size(110, 27);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.Text = "Добавить";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
@ -78,33 +96,37 @@
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Location = new Point(-1, 0);
|
||||
dataGridView.Location = new Point(10, 9);
|
||||
dataGridView.Margin = new Padding(3, 2, 3, 2);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.RowTemplate.Height = 29;
|
||||
dataGridView.Size = new Size(709, 568);
|
||||
dataGridView.Size = new Size(516, 320);
|
||||
dataGridView.TabIndex = 2;
|
||||
//
|
||||
// FormPackages
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(895, 571);
|
||||
Controls.Add(buttonRef);
|
||||
Controls.Add(buttonDel);
|
||||
ClientSize = new Size(700, 338);
|
||||
Controls.Add(ToolsPanel);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(buttonUpd);
|
||||
Controls.Add(buttonAdd);
|
||||
Margin = new Padding(3, 2, 3, 2);
|
||||
Name = "FormPackages";
|
||||
Text = "Список ПО";
|
||||
Text = "Пакет";
|
||||
Load += FormPackage_Load;
|
||||
ToolsPanel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel ToolsPanel;
|
||||
private Button buttonRef;
|
||||
private Button buttonDel;
|
||||
private Button buttonUpd;
|
||||
|
@ -1,9 +1,9 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SoftwareInstallation;
|
||||
using Pizzeria;
|
||||
using SoftwareInstallationContracts.BindingModels;
|
||||
using SoftwareInstallationContracts.BusinessLogicsContracts;
|
||||
|
||||
namespace SoftwareInstallationView
|
||||
namespace PizzeriaView
|
||||
{
|
||||
public partial class FormPackages : Form
|
||||
{
|
||||
@ -35,11 +35,11 @@ namespace SoftwareInstallationView
|
||||
dataGridView.Columns["PackageName"].AutoSizeMode =
|
||||
DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
_logger.LogInformation("Загрузка пиццы");
|
||||
_logger.LogInformation("Загрузка пакета");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки пиццы");
|
||||
_logger.LogError(ex, "Ошибка загрузки пакета");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
@ -79,7 +79,7 @@ namespace SoftwareInstallationView
|
||||
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Удаление пиццы");
|
||||
_logger.LogInformation("Удаление пакета");
|
||||
try
|
||||
{
|
||||
if (!_logic.Delete(new PackageBindingModel
|
||||
@ -93,7 +93,7 @@ namespace SoftwareInstallationView
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка удаления пиццы");
|
||||
_logger.LogError(ex, "Ошибка удаления пакета");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
<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="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>
|
||||
|
196
SoftwareInstallation/FormShop.Designer.cs
generated
Normal file
196
SoftwareInstallation/FormShop.Designer.cs
generated
Normal file
@ -0,0 +1,196 @@
|
||||
namespace PizzeriaView
|
||||
{
|
||||
partial class FormShop
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
labelName = new Label();
|
||||
textBoxName = new TextBox();
|
||||
textBoxAdress = new TextBox();
|
||||
labelAdress = new Label();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
dataGridView = new DataGridView();
|
||||
label1 = new Label();
|
||||
dateTimeOpen = new DateTimePicker();
|
||||
id = new DataGridViewTextBoxColumn();
|
||||
PackageName = new DataGridViewTextBoxColumn();
|
||||
Count = new DataGridViewTextBoxColumn();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelName
|
||||
//
|
||||
labelName.AutoSize = true;
|
||||
labelName.Location = new Point(10, 11);
|
||||
labelName.Name = "labelName";
|
||||
labelName.Size = new Size(65, 15);
|
||||
labelName.TabIndex = 0;
|
||||
labelName.Text = "Название: ";
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Location = new Point(89, 9);
|
||||
textBoxName.Margin = new Padding(3, 2, 3, 2);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(242, 23);
|
||||
textBoxName.TabIndex = 1;
|
||||
//
|
||||
// textBoxAdress
|
||||
//
|
||||
textBoxAdress.Location = new Point(89, 44);
|
||||
textBoxAdress.Margin = new Padding(3, 2, 3, 2);
|
||||
textBoxAdress.Name = "textBoxAdress";
|
||||
textBoxAdress.Size = new Size(374, 23);
|
||||
textBoxAdress.TabIndex = 3;
|
||||
//
|
||||
// labelAdress
|
||||
//
|
||||
labelAdress.AutoSize = true;
|
||||
labelAdress.Location = new Point(10, 46);
|
||||
labelAdress.Name = "labelAdress";
|
||||
labelAdress.Size = new Size(46, 15);
|
||||
labelAdress.TabIndex = 2;
|
||||
labelAdress.Text = "Адрес: ";
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(395, 343);
|
||||
buttonCancel.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(114, 33);
|
||||
buttonCancel.TabIndex = 5;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(276, 343);
|
||||
buttonSave.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(114, 33);
|
||||
buttonSave.TabIndex = 6;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Columns.AddRange(new DataGridViewColumn[] { id, PackageName, Count });
|
||||
dataGridView.Location = new Point(10, 108);
|
||||
dataGridView.Margin = new Padding(3, 2, 3, 2);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersBorderStyle = DataGridViewHeaderBorderStyle.None;
|
||||
dataGridView.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders;
|
||||
dataGridView.RowTemplate.Height = 29;
|
||||
dataGridView.Size = new Size(498, 230);
|
||||
dataGridView.TabIndex = 7;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(10, 77);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(87, 15);
|
||||
label1.TabIndex = 8;
|
||||
label1.Text = "Дата открытия";
|
||||
//
|
||||
// dateTimeOpen
|
||||
//
|
||||
dateTimeOpen.Location = new Point(112, 77);
|
||||
dateTimeOpen.Margin = new Padding(3, 2, 3, 2);
|
||||
dateTimeOpen.Name = "dateTimeOpen";
|
||||
dateTimeOpen.Size = new Size(351, 23);
|
||||
dateTimeOpen.TabIndex = 9;
|
||||
//
|
||||
// id
|
||||
//
|
||||
id.HeaderText = "id";
|
||||
id.MinimumWidth = 6;
|
||||
id.Name = "id";
|
||||
id.ReadOnly = true;
|
||||
id.Visible = false;
|
||||
//
|
||||
// PackageName
|
||||
//
|
||||
PackageName.HeaderText = "Пакет";
|
||||
PackageName.MinimumWidth = 6;
|
||||
PackageName.Name = "PackageName";
|
||||
PackageName.ReadOnly = true;
|
||||
//
|
||||
// Count
|
||||
//
|
||||
Count.HeaderText = "Количество";
|
||||
Count.MinimumWidth = 6;
|
||||
Count.Name = "Count";
|
||||
Count.ReadOnly = true;
|
||||
//
|
||||
// FormShop
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(519, 385);
|
||||
Controls.Add(dateTimeOpen);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(textBoxAdress);
|
||||
Controls.Add(labelAdress);
|
||||
Controls.Add(textBoxName);
|
||||
Controls.Add(labelName);
|
||||
Margin = new Padding(3, 2, 3, 2);
|
||||
Name = "FormShop";
|
||||
Text = "Магазин";
|
||||
Load += FormShop_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelName;
|
||||
private TextBox textBoxName;
|
||||
private TextBox textBoxAdress;
|
||||
private Label labelAdress;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
private DataGridView dataGridView;
|
||||
private Label label1;
|
||||
private DateTimePicker dateTimeOpen;
|
||||
private DataGridViewTextBoxColumn id;
|
||||
private DataGridViewTextBoxColumn PackageName;
|
||||
private DataGridViewTextBoxColumn Count;
|
||||
}
|
||||
}
|
128
SoftwareInstallation/FormShop.cs
Normal file
128
SoftwareInstallation/FormShop.cs
Normal file
@ -0,0 +1,128 @@
|
||||
using SoftwareInstallationDataModels.Models;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SoftwareInstallationContracts.BindingModels;
|
||||
using SoftwareInstallationContracts.BusinessLogicsContracts;
|
||||
using SoftwareInstallationContracts.SearchModels;
|
||||
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 PizzeriaView
|
||||
{
|
||||
public partial class FormShop : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IShopLogic _logic;
|
||||
private int? _id;
|
||||
public int Id { set { _id = value; } }
|
||||
private Dictionary<int, (IPackageModel, int)> _ShopPackages;
|
||||
private DateTime? _openingDate = null;
|
||||
|
||||
public FormShop(ILogger<FormShop> logger, IShopLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
_ShopPackages = new Dictionary<int, (IPackageModel, int)>();
|
||||
}
|
||||
|
||||
private void FormShop_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (_id.HasValue)
|
||||
{
|
||||
_logger.LogInformation("Загрузка магазина");
|
||||
try
|
||||
{
|
||||
var view = _logic.ReadElement(new ShopSearchModel
|
||||
{
|
||||
Id = _id.Value
|
||||
});
|
||||
if (view != null)
|
||||
{
|
||||
textBoxName.Text = view.ShopName;
|
||||
textBoxAdress.Text = view.Adress;
|
||||
dateTimeOpen.Value = view.OpeningDate;
|
||||
_ShopPackages = view.ShopPackages ?? new Dictionary<int, (IPackageModel, int)>();
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки магазина");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
_logger.LogInformation("Загрузка изделий в магазине");
|
||||
try
|
||||
{
|
||||
if (_ShopPackages != null)
|
||||
{
|
||||
dataGridView.Rows.Clear();
|
||||
foreach (var sr in _ShopPackages)
|
||||
{
|
||||
dataGridView.Rows.Add(new object[] { sr.Key, sr.Value.Item1.PackageName, sr.Value.Item2 });
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки изделий магазина");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxName.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(textBoxAdress.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните адрес", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Сохранение магазина");
|
||||
try
|
||||
{
|
||||
var model = new ShopBindingModel
|
||||
{
|
||||
Id = _id ?? 0,
|
||||
ShopName = textBoxName.Text,
|
||||
Adress = textBoxAdress.Text,
|
||||
OpeningDate = dateTimeOpen.Value
|
||||
};
|
||||
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||
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 buttonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
120
SoftwareInstallation/FormShop.resx
Normal file
120
SoftwareInstallation/FormShop.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>
|
130
SoftwareInstallation/FormShops.Designer.cs
generated
Normal file
130
SoftwareInstallation/FormShops.Designer.cs
generated
Normal file
@ -0,0 +1,130 @@
|
||||
namespace PizzeriaView
|
||||
{
|
||||
partial class FormShops
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
this.ToolsPanel = new System.Windows.Forms.Panel();
|
||||
this.buttonRef = new System.Windows.Forms.Button();
|
||||
this.buttonDel = new System.Windows.Forms.Button();
|
||||
this.buttonUpd = new System.Windows.Forms.Button();
|
||||
this.buttonAdd = new System.Windows.Forms.Button();
|
||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||
this.ToolsPanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// ToolsPanel
|
||||
//
|
||||
this.ToolsPanel.Controls.Add(this.buttonRef);
|
||||
this.ToolsPanel.Controls.Add(this.buttonDel);
|
||||
this.ToolsPanel.Controls.Add(this.buttonUpd);
|
||||
this.ToolsPanel.Controls.Add(this.buttonAdd);
|
||||
this.ToolsPanel.Location = new System.Drawing.Point(608, 12);
|
||||
this.ToolsPanel.Name = "ToolsPanel";
|
||||
this.ToolsPanel.Size = new System.Drawing.Size(180, 426);
|
||||
this.ToolsPanel.TabIndex = 3;
|
||||
//
|
||||
// buttonRef
|
||||
//
|
||||
this.buttonRef.Location = new System.Drawing.Point(31, 206);
|
||||
this.buttonRef.Name = "buttonRef";
|
||||
this.buttonRef.Size = new System.Drawing.Size(126, 36);
|
||||
this.buttonRef.TabIndex = 3;
|
||||
this.buttonRef.Text = "Обновить";
|
||||
this.buttonRef.UseVisualStyleBackColor = true;
|
||||
this.buttonRef.Click += new System.EventHandler(this.ButtonRef_Click);
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
this.buttonDel.Location = new System.Drawing.Point(31, 142);
|
||||
this.buttonDel.Name = "buttonDel";
|
||||
this.buttonDel.Size = new System.Drawing.Size(126, 36);
|
||||
this.buttonDel.TabIndex = 2;
|
||||
this.buttonDel.Text = "Удалить";
|
||||
this.buttonDel.UseVisualStyleBackColor = true;
|
||||
this.buttonDel.Click += new System.EventHandler(this.ButtonDel_Click);
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
this.buttonUpd.Location = new System.Drawing.Point(31, 76);
|
||||
this.buttonUpd.Name = "buttonUpd";
|
||||
this.buttonUpd.Size = new System.Drawing.Size(126, 36);
|
||||
this.buttonUpd.TabIndex = 1;
|
||||
this.buttonUpd.Text = "Изменить";
|
||||
this.buttonUpd.UseVisualStyleBackColor = true;
|
||||
this.buttonUpd.Click += new System.EventHandler(this.ButtonUpd_Click);
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
this.buttonAdd.Location = new System.Drawing.Point(31, 16);
|
||||
this.buttonAdd.Name = "buttonAdd";
|
||||
this.buttonAdd.Size = new System.Drawing.Size(126, 36);
|
||||
this.buttonAdd.TabIndex = 0;
|
||||
this.buttonAdd.Text = "Добавить";
|
||||
this.buttonAdd.UseVisualStyleBackColor = true;
|
||||
this.buttonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
this.dataGridView.AllowUserToAddRows = false;
|
||||
this.dataGridView.AllowUserToDeleteRows = false;
|
||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView.Location = new System.Drawing.Point(12, 12);
|
||||
this.dataGridView.Name = "dataGridView";
|
||||
this.dataGridView.ReadOnly = true;
|
||||
this.dataGridView.RowHeadersWidth = 51;
|
||||
this.dataGridView.RowTemplate.Height = 29;
|
||||
this.dataGridView.Size = new System.Drawing.Size(590, 426);
|
||||
this.dataGridView.TabIndex = 2;
|
||||
//
|
||||
// FormShops
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.ToolsPanel);
|
||||
this.Controls.Add(this.dataGridView);
|
||||
this.Name = "FormShops";
|
||||
this.Text = "Магазины";
|
||||
this.Load += new System.EventHandler(this.FormShops_Load);
|
||||
this.ToolsPanel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel ToolsPanel;
|
||||
private Button buttonRef;
|
||||
private Button buttonDel;
|
||||
private Button buttonUpd;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridView;
|
||||
}
|
||||
}
|
117
SoftwareInstallation/FormShops.cs
Normal file
117
SoftwareInstallation/FormShops.cs
Normal file
@ -0,0 +1,117 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Pizzeria;
|
||||
using SoftwareInstallationContracts.BindingModels;
|
||||
using SoftwareInstallationContracts.BusinessLogicsContracts;
|
||||
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 PizzeriaView
|
||||
{
|
||||
public partial class FormShops : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IShopLogic _logic;
|
||||
|
||||
public FormShops(ILogger<FormShops> logger, IShopLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
|
||||
private void FormShops_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["ShopPackages"].Visible = false;
|
||||
dataGridView.Columns["ShopName"].AutoSizeMode =
|
||||
DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
_logger.LogInformation("Загрузка магазинов");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки магазинов");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormShop));
|
||||
if (service is FormShop form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormShop));
|
||||
if (service is FormShop form)
|
||||
{
|
||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonDel_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 ShopBindingModel
|
||||
{
|
||||
Id = id
|
||||
}))
|
||||
{
|
||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка удаления магазина");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonRef_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
120
SoftwareInstallation/FormShops.resx
Normal file
120
SoftwareInstallation/FormShops.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>
|
@ -1,13 +1,13 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NLog.Extensions.Logging;
|
||||
using SoftwareInstallationBusinessLogic.BusinessLogic;
|
||||
using SoftwareInstallationBusinessLogic.BusinessLogics;
|
||||
using SoftwareInstallationContracts.BusinessLogicsContracts;
|
||||
using SoftwareInstallationContracts.StoragesContracts;
|
||||
using SoftwareInstallationListImplement.Implements;
|
||||
using SoftwareInstallationView;
|
||||
using PizzeriaView;
|
||||
|
||||
namespace SoftwareInstallation
|
||||
namespace Pizzeria
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
@ -49,6 +49,11 @@ namespace SoftwareInstallation
|
||||
services.AddTransient<FormPackage>();
|
||||
services.AddTransient<FormPackageComponent>();
|
||||
services.AddTransient<FormPackages>();
|
||||
services.AddTransient<IShopStorage, ShopStorage>();
|
||||
services.AddTransient<IShopLogic, ShopLogic>();
|
||||
services.AddTransient<FormShop>();
|
||||
services.AddTransient<FormShops>();
|
||||
services.AddTransient<FormCreateSupply>();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,25 +1,31 @@
|
||||
using SoftwareInstallationContracts.BindingModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SoftwareInstallationContracts.BindingModels;
|
||||
using SoftwareInstallationContracts.BusinessLogicsContracts;
|
||||
using SoftwareInstallationContracts.SearchModels;
|
||||
using SoftwareInstallationContracts.StoragesContracts;
|
||||
using SoftwareInstallationContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SoftwareInstallationBusinessLogic.BusinessLogic
|
||||
namespace SoftwareInstallationBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class ComponentLogic : IComponentLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IComponentStorage _componentStorage;
|
||||
public ComponentLogic(ILogger<ComponentLogic> logger, IComponentStorage
|
||||
componentStorage)
|
||||
|
||||
public ComponentLogic(ILogger<ComponentLogic> logger, IComponentStorage componentStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_componentStorage = componentStorage;
|
||||
}
|
||||
|
||||
public List<ComponentViewModel>? ReadList(ComponentSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. ComponentName:{ComponentName}.Id:{Id}", model?.ComponentName, model?.Id);
|
||||
_logger.LogInformation("ReadList. ComponentName:{ComponentName}.Id:{ Id}", model?.ComponentName, model?.Id);
|
||||
var list = model == null ? _componentStorage.GetFullList() : _componentStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
@ -36,7 +42,7 @@ namespace SoftwareInstallationBusinessLogic.BusinessLogic
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. ComponentName:{ComponentName}.Id:{Id}", model.ComponentName, model.Id);
|
||||
_logger.LogInformation("ReadElement. ComponentName:{ComponentName}.Id:{ Id}", model.ComponentName, model.Id);
|
||||
var element = _componentStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
@ -99,10 +105,10 @@ namespace SoftwareInstallationBusinessLogic.BusinessLogic
|
||||
{
|
||||
throw new ArgumentNullException("Цена компонента должна быть больше 0", nameof(model.Cost));
|
||||
}
|
||||
_logger.LogInformation("Component. ComponentName:{ComponentName}.Cost:{Cost}. Id: {Id}", model.ComponentName, model.Cost, model.Id);
|
||||
_logger.LogInformation("Component. ComponentName:{ComponentName}.Cost:{ Cost}.Id: { Id}", model.ComponentName, model.Cost, model.Id);
|
||||
var element = _componentStorage.GetElement(new ComponentSearchModel
|
||||
{
|
||||
ComponentName = model.ComponentName
|
||||
ComponentName = model.ComponentName
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
@ -110,4 +116,4 @@ namespace SoftwareInstallationBusinessLogic.BusinessLogic
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,33 +1,27 @@
|
||||
using SoftwareInstallationContracts.BindingModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SoftwareInstallationContracts.BindingModels;
|
||||
using SoftwareInstallationContracts.BusinessLogicsContracts;
|
||||
using SoftwareInstallationContracts.SearchModels;
|
||||
using SoftwareInstallationContracts.StoragesContracts;
|
||||
using SoftwareInstallationContracts.ViewModels;
|
||||
using SoftwareInstallationDataModels.Enums;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SoftwareInstallationBusinessLogic.BusinessLogic
|
||||
namespace SoftwareInstallationBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class OrderLogic : IOrderLogic
|
||||
{
|
||||
//Класс с логикой для заказов будет отвечать за получение списка заказов,
|
||||
//создания заказа и смены его статусов. Следует учитывать, что у заказа можно
|
||||
//менять статус на новый, если его текущий статус предшествует новому
|
||||
|
||||
private readonly ILogger _logger;
|
||||
private readonly IOrderStorage _orderStorage;
|
||||
|
||||
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_orderStorage = orderStorage;
|
||||
}
|
||||
|
||||
public List<OrderViewModel>? ReadList(OrderSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. OrderId:{Id}", model?.Id);
|
||||
@ -40,18 +34,14 @@ namespace SoftwareInstallationBusinessLogic.BusinessLogic
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
public bool CreateOrder(OrderBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
|
||||
if (model.Status != OrderStatus.Неизвестен)
|
||||
return false;
|
||||
model.Status = OrderStatus.Принят;
|
||||
|
||||
if (_orderStorage.Insert(model) == null)
|
||||
{
|
||||
model.Status = OrderStatus.Неизвестен;
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
@ -60,57 +50,17 @@ namespace SoftwareInstallationBusinessLogic.BusinessLogic
|
||||
|
||||
public bool TakeOrderInWork(OrderBindingModel model)
|
||||
{
|
||||
return ToNextStatus(model, OrderStatus.Выполняется);
|
||||
return ChangeStatus(model, OrderStatus.Выполняется);
|
||||
}
|
||||
|
||||
public bool FinishOrder(OrderBindingModel model)
|
||||
{
|
||||
return ToNextStatus(model, OrderStatus.Готов);
|
||||
return ChangeStatus(model, OrderStatus.Готов);
|
||||
}
|
||||
|
||||
public bool DeliveryOrder(OrderBindingModel model)
|
||||
{
|
||||
return ToNextStatus(model, OrderStatus.Выдан);
|
||||
}
|
||||
|
||||
public bool ToNextStatus(OrderBindingModel model, OrderStatus orderStatus)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
var element = _orderStorage.GetElement(new OrderSearchModel()
|
||||
{
|
||||
Id = model.Id
|
||||
});
|
||||
if (element == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(element));
|
||||
}
|
||||
|
||||
model.PackageId = element.PackageId;
|
||||
model.DateCreate = element.DateCreate;
|
||||
model.DateImplement = element.DateImplement;
|
||||
model.Status = element.Status;
|
||||
model.Count = element.Count;
|
||||
model.Sum = element.Sum;
|
||||
|
||||
if (model.Status != orderStatus - 1)
|
||||
{
|
||||
_logger.LogWarning("Status update to " + orderStatus + " operation failed");
|
||||
return false;
|
||||
}
|
||||
model.Status = orderStatus;
|
||||
|
||||
if (model.Status == OrderStatus.Выдан)
|
||||
{
|
||||
model.DateImplement = DateTime.Now;
|
||||
}
|
||||
|
||||
if (_orderStorage.Update(model) == null)
|
||||
{
|
||||
model.Status--;
|
||||
_logger.LogWarning("Changing status operation faled");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return ChangeStatus(model, OrderStatus.Выдан);
|
||||
}
|
||||
|
||||
private void CheckModel(OrderBindingModel model, bool withParams = true)
|
||||
@ -125,17 +75,51 @@ namespace SoftwareInstallationBusinessLogic.BusinessLogic
|
||||
}
|
||||
if (model.Count <= 0)
|
||||
{
|
||||
throw new ArgumentNullException("Количество изделий должно быть больше 0", nameof(model.Count));
|
||||
throw new ArgumentException("Колличество пакетов в заказе не может быть меньше 1", nameof(model.Count));
|
||||
}
|
||||
if (model.Sum <= 0)
|
||||
{
|
||||
throw new ArgumentNullException("Цена заказа должна быть больше 0", nameof(model.Sum));
|
||||
throw new ArgumentException("Стоимость заказа на может быть меньше 1", nameof(model.Sum));
|
||||
}
|
||||
if (model.DateImplement.HasValue && model.DateImplement < model.DateCreate)
|
||||
{
|
||||
throw new ArithmeticException($"Дата выдачи заказа {model.DateImplement} должна быть позже даты его создания {model.DateCreate}");
|
||||
throw new ArithmeticException($"Дата выдачи заказа {model.DateImplement} не может быть раньше даты его создания {model.DateCreate}");
|
||||
}
|
||||
_logger.LogInformation("Package. PackageId:{PackageId}.Count:{Count}.Sum:{Sum}Id:{Id}", model.PackageId, model.Count, model.Sum, model.Id);
|
||||
_logger.LogInformation("Package. PackageId:{PackageId}.Count:{Count}.Sum:{Sum}Id:{Id}",
|
||||
model.PackageId, model.Count, model.Sum, model.Id);
|
||||
}
|
||||
|
||||
private bool ChangeStatus(OrderBindingModel model, OrderStatus requiredStatus)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
var element = _orderStorage.GetElement(new OrderSearchModel()
|
||||
{
|
||||
Id = model.Id
|
||||
});
|
||||
if (element == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(element));
|
||||
}
|
||||
model.DateCreate = element.DateCreate;
|
||||
model.PackageId = element.PackageId;
|
||||
model.DateImplement = element.DateImplement;
|
||||
model.Status = element.Status;
|
||||
model.Count = element.Count;
|
||||
model.Sum = element.Sum;
|
||||
if (requiredStatus - model.Status == 1)
|
||||
{
|
||||
model.Status = requiredStatus;
|
||||
if (model.Status == OrderStatus.Выдан)
|
||||
model.DateImplement = DateTime.Now;
|
||||
if (_orderStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
_logger.LogWarning("Changing status operation faled: Current-{Status}:required-{requiredStatus}.", model.Status, requiredStatus);
|
||||
throw new ArgumentException($"Невозможно присвоить статус {requiredStatus} заказу с текущим статусом {model.Status}");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,30 +1,29 @@
|
||||
using SoftwareInstallationContracts.BindingModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SoftwareInstallationContracts.BindingModels;
|
||||
using SoftwareInstallationContracts.BusinessLogicsContracts;
|
||||
using SoftwareInstallationContracts.SearchModels;
|
||||
using SoftwareInstallationContracts.StoragesContracts;
|
||||
using SoftwareInstallationContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SoftwareInstallationBusinessLogic.BusinessLogic
|
||||
namespace SoftwareInstallationBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class PackageLogic : IPackageLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IPackageStorage _PackageStorage;
|
||||
public PackageLogic(ILogger<PackageLogic> logger, IPackageStorage
|
||||
PackageStorage)
|
||||
public PackageLogic(ILogger<PackageLogic> logger, IPackageStorage PackageStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_PackageStorage = PackageStorage;
|
||||
}
|
||||
public List<PackageViewModel>? ReadList(PackageSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. PackageName:{PackageName}.Id:{Id}", model?.PackageName, model?.Id);
|
||||
_logger.LogInformation("ReadList. PackageName:{PackageName}.Id:{ Id}", model?.PackageName, model?.Id);
|
||||
var list = model == null ? _PackageStorage.GetFullList() : _PackageStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
@ -34,14 +33,13 @@ namespace SoftwareInstallationBusinessLogic.BusinessLogic
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
public PackageViewModel? ReadElement(PackageSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. PackageName:{PackageName}.Id:{Id}", model.PackageName, model.Id);
|
||||
_logger.LogInformation("ReadElement. PackageName:{PackageName}.Id:{ Id}", model.PackageName, model.Id);
|
||||
var element = _PackageStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
@ -51,7 +49,6 @@ namespace SoftwareInstallationBusinessLogic.BusinessLogic
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
public bool Create(PackageBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
@ -62,7 +59,6 @@ namespace SoftwareInstallationBusinessLogic.BusinessLogic
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(PackageBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
@ -73,7 +69,6 @@ namespace SoftwareInstallationBusinessLogic.BusinessLogic
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(PackageBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
@ -85,7 +80,6 @@ namespace SoftwareInstallationBusinessLogic.BusinessLogic
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckModel(PackageBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
@ -98,20 +92,24 @@ namespace SoftwareInstallationBusinessLogic.BusinessLogic
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.PackageName))
|
||||
{
|
||||
throw new ArgumentNullException("Нет названия изделия", nameof(model.PackageName));
|
||||
throw new ArgumentNullException("Нет названия пакета", nameof(model.PackageName));
|
||||
}
|
||||
if (model.Price <= 0)
|
||||
{
|
||||
throw new ArgumentNullException("Цена изделия должна быть больше 0", nameof(model.Price));
|
||||
throw new ArgumentNullException("Цена пакета должна быть больше 0", nameof(model.Price));
|
||||
}
|
||||
_logger.LogInformation("Package. PackageName:{PackageName}.Price:{Cost}. Id: {Id}", model.PackageName, model.Price, model.Id);
|
||||
if (model.PackageComponents == null || model.PackageComponents.Count == 0)
|
||||
{
|
||||
throw new ArgumentNullException("Перечень компонентов не может быть пустым", nameof(model.PackageComponents));
|
||||
}
|
||||
_logger.LogInformation("Package. PackageName:{PackageName}.Price:{Price}.Id: { Id}", model.PackageName, model.Price, model.Id);
|
||||
var element = _PackageStorage.GetElement(new PackageSearchModel
|
||||
{
|
||||
PackageName = model.PackageName
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Изделие с таким названием уже есть");
|
||||
throw new InvalidOperationException("Пакет с таким названием уже есть");
|
||||
}
|
||||
}
|
||||
}
|
160
SoftwareInstallationBusinessLogic/BusinessLogics/ShopLogic.cs
Normal file
160
SoftwareInstallationBusinessLogic/BusinessLogics/ShopLogic.cs
Normal file
@ -0,0 +1,160 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SoftwareInstallationContracts.BindingModels;
|
||||
using SoftwareInstallationContracts.BusinessLogicsContracts;
|
||||
using SoftwareInstallationContracts.SearchModels;
|
||||
using SoftwareInstallationContracts.StoragesContracts;
|
||||
using SoftwareInstallationContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SoftwareInstallationBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class ShopLogic : IShopLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IShopStorage _shopStorage;
|
||||
private readonly IPackageStorage _packageStorage;
|
||||
|
||||
public ShopLogic(ILogger<ShopLogic> logger, IShopStorage shopStorage, IPackageStorage packageStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_shopStorage = shopStorage;
|
||||
_packageStorage = packageStorage;
|
||||
}
|
||||
|
||||
public List<ShopViewModel>? ReadList(ShopSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. ShopName:{ShopName}.Id:{ Id}", model?.ShopName, model?.Id);
|
||||
var list = model == null ? _shopStorage.GetFullList() : _shopStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
public ShopViewModel? ReadElement(ShopSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. ShopName:{ShopName}.Id:{ Id}", model.ShopName, model.Id);
|
||||
var element = _shopStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
public bool Create(ShopBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_shopStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(ShopBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_shopStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(ShopBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_shopStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool MakeSupply(SupplyBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (model.Count <= 0)
|
||||
{
|
||||
throw new ArgumentException("Количество изделий должно быть больше 0");
|
||||
}
|
||||
var shop = _shopStorage.GetElement(new ShopSearchModel
|
||||
{
|
||||
Id = model.ShopId
|
||||
});
|
||||
if (shop == null)
|
||||
{
|
||||
throw new ArgumentException("Магазина не существует");
|
||||
}
|
||||
if (shop.ShopPackages.ContainsKey(model.PackageId))
|
||||
{
|
||||
var oldValue = shop.ShopPackages[model.PackageId];
|
||||
oldValue.Item2 += model.Count;
|
||||
shop.ShopPackages[model.PackageId] = oldValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
var pizza = _packageStorage.GetElement(new PackageSearchModel
|
||||
{
|
||||
Id = model.PackageId
|
||||
});
|
||||
if (pizza == null)
|
||||
{
|
||||
throw new ArgumentException($"Поставка: Товар с id:{model.PackageId} не найденн");
|
||||
}
|
||||
shop.ShopPackages.Add(model.PackageId, (pizza, model.Count));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckModel(ShopBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Adress))
|
||||
{
|
||||
throw new ArgumentException("Адрес магазина длжен быть заполнен", nameof(model.Adress));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.ShopName))
|
||||
{
|
||||
throw new ArgumentException("Название магазина должно быть заполнено", nameof(model.ShopName));
|
||||
}
|
||||
_logger.LogInformation("Shop. ShopName:{ShopName}.Adres:{Adres}.OpeningDate:{OpeningDate}.Id:{ Id}", model.ShopName, model.Adress, model.OpeningDate, model.Id);
|
||||
var element = _shopStorage.GetElement(new ShopSearchModel
|
||||
{
|
||||
ShopName = model.ShopName
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Магазин с таким названием уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -13,4 +13,4 @@ namespace SoftwareInstallationContracts.BindingModels
|
||||
public string ComponentName { get; set; } = string.Empty;
|
||||
public double Cost { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -13,9 +13,9 @@ namespace SoftwareInstallationContracts.BindingModels
|
||||
public int Id { get; set; }
|
||||
public int PackageId { get; set; }
|
||||
public int Count { get; set; }
|
||||
public double Sum { get; set; }
|
||||
public double Sum { get; set; }
|
||||
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||
public DateTime? DateImplement { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -14,4 +14,4 @@ namespace SoftwareInstallationContracts.BindingModels
|
||||
public double Price { get; set; }
|
||||
public Dictionary<int, (IComponentModel, int)> PackageComponents { get; set; } = new();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using SoftwareInstallationDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SoftwareInstallationContracts.BindingModels
|
||||
{
|
||||
public class ShopBindingModel : IShopModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string ShopName { get; set; } = string.Empty;
|
||||
public string Adress { get; set; } = string.Empty;
|
||||
public DateTime OpeningDate { get; set; } = DateTime.Now;
|
||||
public Dictionary<int, (IPackageModel, int)> ShopPackages { get; set; } = new();
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using SoftwareInstallationDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SoftwareInstallationContracts.BindingModels
|
||||
{
|
||||
public class SupplyBindingModel : ISupplyModel
|
||||
{
|
||||
public int ShopId { get; set; }
|
||||
public int PackageId { get; set; }
|
||||
public int Count { get; set; }
|
||||
}
|
||||
}
|
@ -3,7 +3,6 @@ using SoftwareInstallationContracts.SearchModels;
|
||||
using SoftwareInstallationContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -14,17 +14,7 @@ namespace SoftwareInstallationContracts.BusinessLogicsContracts
|
||||
List<OrderViewModel>? ReadList(OrderSearchModel? model);
|
||||
bool CreateOrder(OrderBindingModel model);
|
||||
bool TakeOrderInWork(OrderBindingModel model);
|
||||
/// <summary>
|
||||
/// Готов
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
bool FinishOrder(OrderBindingModel model);
|
||||
/// <summary>
|
||||
/// Доставлен
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
bool DeliveryOrder(OrderBindingModel model);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
using SoftwareInstallationContracts.BindingModels;
|
||||
using SoftwareInstallationContracts.SearchModels;
|
||||
using SoftwareInstallationContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SoftwareInstallationContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IShopLogic
|
||||
{
|
||||
List<ShopViewModel>? ReadList(ShopSearchModel? model);
|
||||
ShopViewModel? ReadElement(ShopSearchModel model);
|
||||
bool Create(ShopBindingModel model);
|
||||
bool Update(ShopBindingModel model);
|
||||
bool Delete(ShopBindingModel model);
|
||||
bool MakeSupply(SupplyBindingModel model);
|
||||
}
|
||||
}
|
@ -11,4 +11,4 @@ namespace SoftwareInstallationContracts.SearchModels
|
||||
public int? Id { get; set; }
|
||||
public string? ComponentName { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -10,4 +10,4 @@ namespace SoftwareInstallationContracts.SearchModels
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -11,4 +11,4 @@ namespace SoftwareInstallationContracts.SearchModels
|
||||
public int? Id { get; set; }
|
||||
public string? PackageName { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SoftwareInstallationContracts.SearchModels
|
||||
{
|
||||
public class ShopSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? ShopName { get; set; }
|
||||
}
|
||||
}
|
@ -17,6 +17,5 @@ namespace SoftwareInstallationContracts.StoragesContracts
|
||||
ComponentViewModel? Insert(ComponentBindingModel model);
|
||||
ComponentViewModel? Update(ComponentBindingModel model);
|
||||
ComponentViewModel? Delete(ComponentBindingModel model);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
using SoftwareInstallationContracts.BindingModels;
|
||||
using SoftwareInstallationContracts.SearchModels;
|
||||
using SoftwareInstallationContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SoftwareInstallationContracts.StoragesContracts
|
||||
{
|
||||
public interface IShopStorage
|
||||
{
|
||||
List<ShopViewModel> GetFullList();
|
||||
List<ShopViewModel> GetFilteredList(ShopSearchModel model);
|
||||
ShopViewModel? GetElement(ShopSearchModel model);
|
||||
ShopViewModel? Insert(ShopBindingModel model);
|
||||
ShopViewModel? Update(ShopBindingModel model);
|
||||
ShopViewModel? Delete(ShopBindingModel model);
|
||||
}
|
||||
}
|
@ -11,9 +11,11 @@ namespace SoftwareInstallationContracts.ViewModels
|
||||
public class ComponentViewModel : IComponentModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Название компонента")]
|
||||
public string ComponentName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Цена")]
|
||||
public double Cost { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using SoftwareInstallationDataModels.Enums;
|
||||
using SoftwareInstallationDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@ -8,22 +9,29 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace SoftwareInstallationContracts.ViewModels
|
||||
{
|
||||
public class OrderViewModel
|
||||
public class OrderViewModel : IOrderModel
|
||||
{
|
||||
[DisplayName("Номер")]
|
||||
public int Id { get; set; }
|
||||
|
||||
public int PackageId { get; set; }
|
||||
[DisplayName("Изделие")]
|
||||
|
||||
[DisplayName("Пакет")]
|
||||
public string PackageName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Количество")]
|
||||
public int Count { get; set; }
|
||||
|
||||
[DisplayName("Сумма")]
|
||||
public double Sum { get; set; }
|
||||
|
||||
[DisplayName("Статус")]
|
||||
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
||||
|
||||
[DisplayName("Дата создания")]
|
||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||
|
||||
[DisplayName("Дата выполнения")]
|
||||
public DateTime? DateImplement { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -11,11 +11,13 @@ namespace SoftwareInstallationContracts.ViewModels
|
||||
public class PackageViewModel : IPackageModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Название изделия")]
|
||||
public string PackageName { get; set; }
|
||||
|
||||
[DisplayName("Название пакета")]
|
||||
public string PackageName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Цена")]
|
||||
public double Price { get; set; }
|
||||
public Dictionary<int, (IComponentModel, int)> PackageComponents { get; set; } = new();
|
||||
|
||||
public Dictionary<int, (IComponentModel, int)> PackageComponents { get; set; } = new();
|
||||
}
|
||||
}
|
||||
}
|
22
SoftwareInstallationContracts/ViewModels/ShopViewModel.cs
Normal file
22
SoftwareInstallationContracts/ViewModels/ShopViewModel.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using SoftwareInstallationDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SoftwareInstallationContracts.ViewModels
|
||||
{
|
||||
public class ShopViewModel : IShopModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Название")]
|
||||
public string ShopName { get; set; } = string.Empty;
|
||||
[DisplayName("Адрес")]
|
||||
public string Adress { get; set; } = string.Empty;
|
||||
[DisplayName("Дата открытия")]
|
||||
public DateTime OpeningDate { get; set; }
|
||||
public Dictionary<int, (IPackageModel, int)> ShopPackages { get; set; } = new();
|
||||
}
|
||||
}
|
@ -1,4 +1,10 @@
|
||||
namespace SoftwareInstallationDataModels.Enums
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SoftwareInstallationDataModels.Enums
|
||||
{
|
||||
public enum OrderStatus
|
||||
{
|
||||
@ -6,6 +12,6 @@
|
||||
Принят = 0,
|
||||
Выполняется = 1,
|
||||
Готов = 2,
|
||||
Выдан = 3,
|
||||
Выдан = 3
|
||||
}
|
||||
}
|
@ -10,4 +10,4 @@ namespace SoftwareInstallationDataModels
|
||||
{
|
||||
int Id { get; }
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SoftwareInstallationDataModels.Models
|
||||
{
|
||||
public interface IComponentModel : IId
|
||||
@ -5,4 +11,4 @@ namespace SoftwareInstallationDataModels.Models
|
||||
string ComponentName { get; }
|
||||
double Cost { get; }
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,9 @@
|
||||
using SoftwareInstallationDataModels.Enums;
|
||||
using SoftwareInstallationDataModels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SoftwareInstallationDataModels.Models
|
||||
{
|
||||
|
@ -1,9 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SoftwareInstallationDataModels.Models
|
||||
{
|
||||
public interface IPackageModel : IId
|
||||
{
|
||||
string PackageName { get; }
|
||||
double Price { get; }
|
||||
Dictionary<int, (IComponentModel, int)> PackageComponents { get; }
|
||||
}
|
||||
}
|
||||
public interface IPackageModel : IId
|
||||
{
|
||||
string PackageName { get; }
|
||||
double Price { get; }
|
||||
Dictionary<int, (IComponentModel, int)> PackageComponents { get; }
|
||||
}
|
||||
}
|
18
SoftwareInstallationDataModels/Models/IShopModel.cs
Normal file
18
SoftwareInstallationDataModels/Models/IShopModel.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using SoftwareInstallationDataModels;
|
||||
using SoftwareInstallationDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SoftwareInstallationDataModels.Models
|
||||
{
|
||||
public interface IShopModel : IId
|
||||
{
|
||||
string ShopName { get; }
|
||||
string Adress { get; }
|
||||
DateTime OpeningDate { get; }
|
||||
Dictionary<int, (IPackageModel, int)> ShopPackages { get; }
|
||||
}
|
||||
}
|
15
SoftwareInstallationDataModels/Models/ISupplyModel.cs
Normal file
15
SoftwareInstallationDataModels/Models/ISupplyModel.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SoftwareInstallationDataModels.Models
|
||||
{
|
||||
public interface ISupplyModel
|
||||
{
|
||||
int ShopId { get; }
|
||||
int PackageId { get; }
|
||||
int Count { get; }
|
||||
}
|
||||
}
|
@ -7,18 +7,22 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace SoftwareInstallationListImplement
|
||||
{
|
||||
internal class DataListSingleton
|
||||
public class DataListSingleton
|
||||
{
|
||||
private static DataListSingleton? _instance;
|
||||
public List<Component> Components { get; set; }
|
||||
public List<Order> Orders { get; set; }
|
||||
public List<Package> Packages { get; set; }
|
||||
public List<Shop> Shops { get; set; }
|
||||
|
||||
private DataListSingleton()
|
||||
{
|
||||
Components = new List<Component>();
|
||||
Orders = new List<Order>();
|
||||
Packages = new List<Package>();
|
||||
Shops = new List<Shop>();
|
||||
}
|
||||
|
||||
public static DataListSingleton GetInstance()
|
||||
{
|
||||
if (_instance == null)
|
||||
|
@ -1,6 +1,6 @@
|
||||
using SoftwareInstallationContracts.StoragesContracts;
|
||||
using SoftwareInstallationContracts.BindingModels;
|
||||
using SoftwareInstallationContracts.BindingModels;
|
||||
using SoftwareInstallationContracts.SearchModels;
|
||||
using SoftwareInstallationContracts.StoragesContracts;
|
||||
using SoftwareInstallationContracts.ViewModels;
|
||||
using SoftwareInstallationListImplement.Models;
|
||||
using System;
|
||||
@ -14,10 +14,12 @@ namespace SoftwareInstallationListImplement.Implements
|
||||
public class ComponentStorage : IComponentStorage
|
||||
{
|
||||
private readonly DataListSingleton _source;
|
||||
|
||||
public ComponentStorage()
|
||||
{
|
||||
_source = DataListSingleton.GetInstance();
|
||||
}
|
||||
|
||||
public List<ComponentViewModel> GetFullList()
|
||||
{
|
||||
var result = new List<ComponentViewModel>();
|
||||
@ -27,6 +29,7 @@ namespace SoftwareInstallationListImplement.Implements
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<ComponentViewModel> GetFilteredList(ComponentSearchModel model)
|
||||
{
|
||||
var result = new List<ComponentViewModel>();
|
||||
@ -43,6 +46,7 @@ namespace SoftwareInstallationListImplement.Implements
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ComponentViewModel? GetElement(ComponentSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.ComponentName) && !model.Id.HasValue)
|
||||
@ -52,13 +56,14 @@ namespace SoftwareInstallationListImplement.Implements
|
||||
foreach (var component in _source.Components)
|
||||
{
|
||||
if ((!string.IsNullOrEmpty(model.ComponentName) && component.ComponentName == model.ComponentName) ||
|
||||
(model.Id.HasValue && component.Id == model.Id))
|
||||
(model.Id.HasValue && component.Id == model.Id))
|
||||
{
|
||||
return component.GetViewModel;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ComponentViewModel? Insert(ComponentBindingModel model)
|
||||
{
|
||||
model.Id = 1;
|
||||
@ -77,6 +82,7 @@ namespace SoftwareInstallationListImplement.Implements
|
||||
_source.Components.Add(newComponent);
|
||||
return newComponent.GetViewModel;
|
||||
}
|
||||
|
||||
public ComponentViewModel? Update(ComponentBindingModel model)
|
||||
{
|
||||
foreach (var component in _source.Components)
|
||||
@ -89,6 +95,7 @@ namespace SoftwareInstallationListImplement.Implements
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ComponentViewModel? Delete(ComponentBindingModel model)
|
||||
{
|
||||
for (int i = 0; i < _source.Components.Count; ++i)
|
||||
|
@ -111,11 +111,11 @@ namespace SoftwareInstallationListImplement.Implements
|
||||
|
||||
private OrderViewModel AttachPackageName(OrderViewModel model)
|
||||
{
|
||||
foreach (var Package in _source.Packages)
|
||||
foreach (var package in _source.Packages)
|
||||
{
|
||||
if (Package.Id == model.PackageId)
|
||||
if (package.Id == model.PackageId)
|
||||
{
|
||||
model.PackageName = Package.PackageName;
|
||||
model.PackageName = package.PackageName;
|
||||
return model;
|
||||
}
|
||||
}
|
||||
|
@ -11,13 +11,91 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace SoftwareInstallationListImplement.Implements
|
||||
{
|
||||
public class PackageStorage : IPackageStorage {
|
||||
public class PackageStorage : IPackageStorage
|
||||
{
|
||||
private readonly DataListSingleton _source;
|
||||
|
||||
public PackageStorage()
|
||||
{
|
||||
_source = DataListSingleton.GetInstance();
|
||||
}
|
||||
|
||||
public List<PackageViewModel> GetFullList()
|
||||
{
|
||||
var result = new List<PackageViewModel>();
|
||||
foreach (var packages in _source.Packages)
|
||||
{
|
||||
result.Add(packages.GetViewModel);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<PackageViewModel> GetFilteredList(PackageSearchModel model)
|
||||
{
|
||||
var result = new List<PackageViewModel>();
|
||||
if (string.IsNullOrEmpty(model.PackageName))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
foreach (var packages in _source.Packages)
|
||||
{
|
||||
if (packages.PackageName.Contains(model.PackageName))
|
||||
{
|
||||
result.Add(packages.GetViewModel);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public PackageViewModel? GetElement(PackageSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.PackageName) && !model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
foreach (var packages in _source.Packages)
|
||||
{
|
||||
if ((!string.IsNullOrEmpty(model.PackageName) && packages.PackageName == model.PackageName) ||
|
||||
(model.Id.HasValue && packages.Id == model.Id))
|
||||
{
|
||||
return packages.GetViewModel;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public PackageViewModel? Insert(PackageBindingModel model)
|
||||
{
|
||||
model.Id = 1;
|
||||
foreach (var packages in _source.Packages)
|
||||
{
|
||||
if (model.Id <= packages.Id)
|
||||
{
|
||||
model.Id = packages.Id + 1;
|
||||
}
|
||||
}
|
||||
var newPackages = Package.Create(model);
|
||||
if (newPackages == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
_source.Packages.Add(newPackages);
|
||||
return newPackages.GetViewModel;
|
||||
}
|
||||
|
||||
public PackageViewModel? Update(PackageBindingModel model)
|
||||
{
|
||||
foreach (var packages in _source.Packages)
|
||||
{
|
||||
if (packages.Id == model.Id)
|
||||
{
|
||||
packages.Update(model);
|
||||
return packages.GetViewModel;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public PackageViewModel? Delete(PackageBindingModel model)
|
||||
{
|
||||
for (int i = 0; i < _source.Packages.Count; ++i)
|
||||
@ -31,81 +109,5 @@ namespace SoftwareInstallationListImplement.Implements
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public PackageViewModel? GetElement(PackageSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.PackageName) && !model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
foreach (var Package in _source.Packages)
|
||||
{
|
||||
if ((!string.IsNullOrEmpty(model.PackageName) && Package.PackageName == model.PackageName) ||
|
||||
(model.Id.HasValue && Package.Id == model.Id))
|
||||
{
|
||||
return Package.GetViewModel;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<PackageViewModel> GetFilteredList(PackageSearchModel model)
|
||||
{
|
||||
var result = new List<PackageViewModel>();
|
||||
if (string.IsNullOrEmpty(model.PackageName))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
foreach (var Package in _source.Packages)
|
||||
{
|
||||
if (Package.PackageName.Contains(model.PackageName))
|
||||
{
|
||||
result.Add(Package.GetViewModel);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<PackageViewModel> GetFullList()
|
||||
{
|
||||
var result = new List<PackageViewModel>();
|
||||
foreach (var Package in _source.Packages)
|
||||
{
|
||||
result.Add(Package.GetViewModel);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public PackageViewModel? Insert(PackageBindingModel model)
|
||||
{
|
||||
model.Id = 1;
|
||||
foreach (var Package in _source.Packages)
|
||||
{
|
||||
if (model.Id <= Package.Id)
|
||||
{
|
||||
model.Id = Package.Id + 1;
|
||||
}
|
||||
}
|
||||
var newPackage = Package.Create(model);
|
||||
if (newPackage == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
_source.Packages.Add(newPackage);
|
||||
return newPackage.GetViewModel;
|
||||
}
|
||||
|
||||
public PackageViewModel? Update(PackageBindingModel model)
|
||||
{
|
||||
foreach (var Package in _source.Packages)
|
||||
{
|
||||
if (Package.Id == model.Id)
|
||||
{
|
||||
Package.Update(model);
|
||||
return Package.GetViewModel;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
113
SoftwareInstallationListImplement/Implements/ShopStorage.cs
Normal file
113
SoftwareInstallationListImplement/Implements/ShopStorage.cs
Normal file
@ -0,0 +1,113 @@
|
||||
using SoftwareInstallationContracts.BindingModels;
|
||||
using SoftwareInstallationContracts.SearchModels;
|
||||
using SoftwareInstallationContracts.StoragesContracts;
|
||||
using SoftwareInstallationContracts.ViewModels;
|
||||
using SoftwareInstallationListImplement.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SoftwareInstallationListImplement.Implements
|
||||
{
|
||||
public class ShopStorage : IShopStorage
|
||||
{
|
||||
private readonly DataListSingleton _source;
|
||||
|
||||
public ShopStorage()
|
||||
{
|
||||
_source = DataListSingleton.GetInstance();
|
||||
}
|
||||
|
||||
public List<ShopViewModel> GetFullList()
|
||||
{
|
||||
var result = new List<ShopViewModel>();
|
||||
foreach (var shop in _source.Shops)
|
||||
{
|
||||
result.Add(shop.GetViewModel);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<ShopViewModel> GetFilteredList(ShopSearchModel model)
|
||||
{
|
||||
var result = new List<ShopViewModel>();
|
||||
if (string.IsNullOrEmpty(model.ShopName))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
foreach (var shop in _source.Shops)
|
||||
{
|
||||
if (shop.ShopName.Contains(model.ShopName))
|
||||
{
|
||||
result.Add(shop.GetViewModel);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ShopViewModel? GetElement(ShopSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.ShopName) && !model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
foreach (var shop in _source.Shops)
|
||||
{
|
||||
if ((!string.IsNullOrEmpty(model.ShopName) && shop.ShopName == model.ShopName) ||
|
||||
(model.Id.HasValue && shop.Id == model.Id))
|
||||
{
|
||||
return shop.GetViewModel;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ShopViewModel? Insert(ShopBindingModel model)
|
||||
{
|
||||
model.Id = 1;
|
||||
foreach (var shop in _source.Shops)
|
||||
{
|
||||
if (model.Id <= shop.Id)
|
||||
{
|
||||
model.Id = shop.Id + 1;
|
||||
}
|
||||
}
|
||||
var newShop = Shop.Create(model);
|
||||
if (newShop == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
_source.Shops.Add(newShop);
|
||||
return newShop.GetViewModel;
|
||||
}
|
||||
|
||||
public ShopViewModel? Update(ShopBindingModel model)
|
||||
{
|
||||
foreach (var shop in _source.Shops)
|
||||
{
|
||||
if (shop.Id == model.Id)
|
||||
{
|
||||
shop.Update(model);
|
||||
return shop.GetViewModel;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ShopViewModel? Delete(ShopBindingModel model)
|
||||
{
|
||||
for (int i = 0; i < _source.Shops.Count; ++i)
|
||||
{
|
||||
if (_source.Shops[i].Id == model.Id)
|
||||
{
|
||||
var element = _source.Shops[i];
|
||||
_source.Shops.RemoveAt(i);
|
||||
return element.GetViewModel;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,11 @@
|
||||
using SoftwareInstallationContracts.BindingModels;
|
||||
using SoftwareInstallationContracts.ViewModels;
|
||||
using SoftwareInstallationDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SoftwareInstallationListImplement.Models
|
||||
{
|
||||
@ -8,7 +13,8 @@ namespace SoftwareInstallationListImplement.Models
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string ComponentName { get; private set; } = string.Empty;
|
||||
public double Cost { get; set; }
|
||||
public double Cost { get; private set; }
|
||||
|
||||
public static Component? Create(ComponentBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
@ -38,4 +44,4 @@ namespace SoftwareInstallationListImplement.Models
|
||||
Cost = Cost
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ using SoftwareInstallationDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -17,9 +16,10 @@ namespace SoftwareInstallationListImplement.Models
|
||||
public int PackageId { get; private set; }
|
||||
public int Count { get; private set; }
|
||||
public double Sum { get; private set; }
|
||||
public OrderStatus Status { get; private set; }
|
||||
public DateTime DateCreate { get; private set; }
|
||||
public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен;
|
||||
public DateTime DateCreate { get; private set; } = DateTime.Now;
|
||||
public DateTime? DateImplement { get; private set; }
|
||||
|
||||
public static Order? Create(OrderBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
@ -37,19 +37,17 @@ namespace SoftwareInstallationListImplement.Models
|
||||
DateImplement = model.DateImplement,
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(OrderBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
PackageId = model.PackageId;
|
||||
Count = model.Count;
|
||||
Sum = model.Sum;
|
||||
Status = model.Status;
|
||||
DateCreate = model.DateCreate;
|
||||
DateImplement = model.DateImplement;
|
||||
if (model.Status == OrderStatus.Выдан) DateImplement = model.DateImplement;
|
||||
}
|
||||
|
||||
public OrderViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
|
@ -9,16 +9,13 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace SoftwareInstallationListImplement.Models
|
||||
{
|
||||
internal class Package : IPackageModel
|
||||
public class Package : IPackageModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string PackageName { get; private set; } = string.Empty;
|
||||
public double Price { get; private set; }
|
||||
public Dictionary<int, (IComponentModel, int)> PackageComponents
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = new Dictionary<int, (IComponentModel, int)>();
|
||||
public Dictionary<int, (IComponentModel, int)> PackageComponents { get; private set; } = new Dictionary<int, (IComponentModel, int)>();
|
||||
|
||||
public static Package? Create(PackageBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
@ -30,9 +27,10 @@ namespace SoftwareInstallationListImplement.Models
|
||||
Id = model.Id,
|
||||
PackageName = model.PackageName,
|
||||
Price = model.Price,
|
||||
PackageComponents = model.PackageComponents
|
||||
PackageComponents = model.PackageComponents,
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(PackageBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
@ -43,6 +41,7 @@ namespace SoftwareInstallationListImplement.Models
|
||||
Price = model.Price;
|
||||
PackageComponents = model.PackageComponents;
|
||||
}
|
||||
|
||||
public PackageViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
@ -50,6 +49,5 @@ namespace SoftwareInstallationListImplement.Models
|
||||
Price = Price,
|
||||
PackageComponents = PackageComponents
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
55
SoftwareInstallationListImplement/Models/Shop.cs
Normal file
55
SoftwareInstallationListImplement/Models/Shop.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using SoftwareInstallationDataModels.Models;
|
||||
using SoftwareInstallationContracts.BindingModels;
|
||||
using SoftwareInstallationContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SoftwareInstallationListImplement.Models
|
||||
{
|
||||
public class Shop : IShopModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string ShopName { get; private set; } = string.Empty;
|
||||
public string Adress { get; private set; } = string.Empty;
|
||||
public DateTime OpeningDate { get; private set; }
|
||||
public Dictionary<int, (IPackageModel, int)> ShopPackages { get; private set; } = new();
|
||||
|
||||
public static Shop? Create(ShopBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Shop()
|
||||
{
|
||||
Id = model.Id,
|
||||
ShopName = model.ShopName,
|
||||
Adress = model.Adress,
|
||||
OpeningDate = model.OpeningDate
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(ShopBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ShopName = model.ShopName;
|
||||
Adress = model.Adress;
|
||||
OpeningDate = model.OpeningDate;
|
||||
}
|
||||
|
||||
public ShopViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
ShopName = ShopName,
|
||||
Adress = Adress,
|
||||
OpeningDate = OpeningDate,
|
||||
ShopPackages = ShopPackages
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user