вроде готово
This commit is contained in:
parent
506bf098cf
commit
767f27cd3c
169
Secure/SecureShop/FormImplementer.Designer.cs
generated
Normal file
169
Secure/SecureShop/FormImplementer.Designer.cs
generated
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
namespace SecureShopView
|
||||||
|
{
|
||||||
|
partial class FormImplementer
|
||||||
|
{
|
||||||
|
/// <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();
|
||||||
|
labelWorkExperience = new Label();
|
||||||
|
textBoxName = new TextBox();
|
||||||
|
textBoxWorkExperience = new TextBox();
|
||||||
|
buttonSave = new Button();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
textBoxPassword = new TextBox();
|
||||||
|
labelPassword = new Label();
|
||||||
|
textBoxQualification = new TextBox();
|
||||||
|
labelQualification = new Label();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// labelName
|
||||||
|
//
|
||||||
|
labelName.AutoSize = true;
|
||||||
|
labelName.Location = new Point(27, 14);
|
||||||
|
labelName.Name = "labelName";
|
||||||
|
labelName.Size = new Size(37, 15);
|
||||||
|
labelName.TabIndex = 0;
|
||||||
|
labelName.Text = "ФИО:";
|
||||||
|
//
|
||||||
|
// labelWorkExperience
|
||||||
|
//
|
||||||
|
labelWorkExperience.AutoSize = true;
|
||||||
|
labelWorkExperience.Location = new Point(27, 73);
|
||||||
|
labelWorkExperience.Name = "labelWorkExperience";
|
||||||
|
labelWorkExperience.Size = new Size(82, 15);
|
||||||
|
labelWorkExperience.TabIndex = 1;
|
||||||
|
labelWorkExperience.Text = "Стаж работы:";
|
||||||
|
//
|
||||||
|
// textBoxName
|
||||||
|
//
|
||||||
|
textBoxName.Location = new Point(127, 12);
|
||||||
|
textBoxName.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
textBoxName.Name = "textBoxName";
|
||||||
|
textBoxName.Size = new Size(263, 23);
|
||||||
|
textBoxName.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// textBoxWorkExperience
|
||||||
|
//
|
||||||
|
textBoxWorkExperience.Location = new Point(127, 70);
|
||||||
|
textBoxWorkExperience.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
textBoxWorkExperience.Name = "textBoxWorkExperience";
|
||||||
|
textBoxWorkExperience.Size = new Size(82, 23);
|
||||||
|
textBoxWorkExperience.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(127, 116);
|
||||||
|
buttonSave.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(82, 22);
|
||||||
|
buttonSave.TabIndex = 4;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += ButtonSave_Click;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(254, 116);
|
||||||
|
buttonCancel.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(82, 22);
|
||||||
|
buttonCancel.TabIndex = 5;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += ButtonCancel_Click;
|
||||||
|
//
|
||||||
|
// textBoxPassword
|
||||||
|
//
|
||||||
|
textBoxPassword.Location = new Point(127, 43);
|
||||||
|
textBoxPassword.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
textBoxPassword.Name = "textBoxPassword";
|
||||||
|
textBoxPassword.Size = new Size(263, 23);
|
||||||
|
textBoxPassword.TabIndex = 7;
|
||||||
|
//
|
||||||
|
// labelPassword
|
||||||
|
//
|
||||||
|
labelPassword.AutoSize = true;
|
||||||
|
labelPassword.Location = new Point(27, 45);
|
||||||
|
labelPassword.Name = "labelPassword";
|
||||||
|
labelPassword.Size = new Size(37, 15);
|
||||||
|
labelPassword.TabIndex = 6;
|
||||||
|
labelPassword.Text = "ФИО:";
|
||||||
|
//
|
||||||
|
// textBoxQualification
|
||||||
|
//
|
||||||
|
textBoxQualification.Location = new Point(322, 73);
|
||||||
|
textBoxQualification.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
textBoxQualification.Name = "textBoxQualification";
|
||||||
|
textBoxQualification.Size = new Size(68, 23);
|
||||||
|
textBoxQualification.TabIndex = 9;
|
||||||
|
//
|
||||||
|
// labelQualification
|
||||||
|
//
|
||||||
|
labelQualification.AutoSize = true;
|
||||||
|
labelQualification.Location = new Point(222, 76);
|
||||||
|
labelQualification.Name = "labelQualification";
|
||||||
|
labelQualification.Size = new Size(91, 15);
|
||||||
|
labelQualification.TabIndex = 8;
|
||||||
|
labelQualification.Text = "Квалификация:";
|
||||||
|
//
|
||||||
|
// FormImplementer
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(400, 155);
|
||||||
|
Controls.Add(textBoxQualification);
|
||||||
|
Controls.Add(labelQualification);
|
||||||
|
Controls.Add(textBoxPassword);
|
||||||
|
Controls.Add(labelPassword);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(textBoxWorkExperience);
|
||||||
|
Controls.Add(textBoxName);
|
||||||
|
Controls.Add(labelWorkExperience);
|
||||||
|
Controls.Add(labelName);
|
||||||
|
Margin = new Padding(3, 2, 3, 2);
|
||||||
|
Name = "FormImplementer";
|
||||||
|
Text = "Исполнитель";
|
||||||
|
Load += FormImplementer_Load;
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label labelName;
|
||||||
|
private Label labelWorkExperience;
|
||||||
|
private TextBox textBoxName;
|
||||||
|
private TextBox textBoxWorkExperience;
|
||||||
|
private Button buttonSave;
|
||||||
|
private Button buttonCancel;
|
||||||
|
private TextBox textBoxPassword;
|
||||||
|
private Label labelPassword;
|
||||||
|
private TextBox textBoxQualification;
|
||||||
|
private Label labelQualification;
|
||||||
|
}
|
||||||
|
}
|
104
Secure/SecureShop/FormImplementer.cs
Normal file
104
Secure/SecureShop/FormImplementer.cs
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
using SecureShopContracts.BindingModels;
|
||||||
|
using SecureShopContracts.BusinessLogicsContracts;
|
||||||
|
using SecureShopContracts.SearchModels;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace SecureShopView
|
||||||
|
{
|
||||||
|
public partial class FormImplementer : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IImplementerLogic _logic;
|
||||||
|
private int? _id;
|
||||||
|
public int Id { set { _id = value; } }
|
||||||
|
|
||||||
|
public FormImplementer(ILogger<FormImplementer> logger, IImplementerLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormImplementer_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_id.HasValue)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Получение исполнителя");
|
||||||
|
var view = _logic.ReadElement(new ImplementerSearchModel
|
||||||
|
{
|
||||||
|
Id = _id.Value
|
||||||
|
});
|
||||||
|
if (view != null)
|
||||||
|
{
|
||||||
|
textBoxName.Text = view.ImplementerFIO;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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(textBoxPassword.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните пароль", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(textBoxQualification.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните квалификацию", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(textBoxWorkExperience.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Заполните опыт работы", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Сохранение ");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var model = new ImplementerBindingModel
|
||||||
|
{
|
||||||
|
Id = _id ?? 0,
|
||||||
|
ImplementerFIO = textBoxName.Text,
|
||||||
|
Password = textBoxPassword.Text,
|
||||||
|
Qualification = int.Parse(textBoxQualification.Text),
|
||||||
|
WorkExperience = int.Parse(textBoxWorkExperience.Text)
|
||||||
|
|
||||||
|
};
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
Secure/SecureShop/FormImplementer.resx
Normal file
60
Secure/SecureShop/FormImplementer.resx
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<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>
|
121
Secure/SecureShop/FormImplementers.Designer.cs
generated
Normal file
121
Secure/SecureShop/FormImplementers.Designer.cs
generated
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
namespace SecureShopView
|
||||||
|
{
|
||||||
|
partial class FormImplementers
|
||||||
|
{
|
||||||
|
/// <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.dataGridView = new System.Windows.Forms.DataGridView();
|
||||||
|
this.buttonAdd = new System.Windows.Forms.Button();
|
||||||
|
this.buttonUpd = new System.Windows.Forms.Button();
|
||||||
|
this.buttonDel = new System.Windows.Forms.Button();
|
||||||
|
this.buttonRef = new System.Windows.Forms.Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
this.dataGridView.Location = new System.Drawing.Point(10, 9);
|
||||||
|
this.dataGridView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||||
|
this.dataGridView.Name = "dataGridView";
|
||||||
|
this.dataGridView.RowHeadersWidth = 51;
|
||||||
|
this.dataGridView.RowTemplate.Height = 29;
|
||||||
|
this.dataGridView.Size = new System.Drawing.Size(444, 320);
|
||||||
|
this.dataGridView.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
this.buttonAdd.Location = new System.Drawing.Point(471, 9);
|
||||||
|
this.buttonAdd.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||||
|
this.buttonAdd.Name = "buttonAdd";
|
||||||
|
this.buttonAdd.Size = new System.Drawing.Size(133, 22);
|
||||||
|
this.buttonAdd.TabIndex = 1;
|
||||||
|
this.buttonAdd.Text = "Добавить";
|
||||||
|
this.buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
|
||||||
|
//
|
||||||
|
// buttonUpd
|
||||||
|
//
|
||||||
|
this.buttonUpd.Location = new System.Drawing.Point(471, 35);
|
||||||
|
this.buttonUpd.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||||
|
this.buttonUpd.Name = "buttonUpd";
|
||||||
|
this.buttonUpd.Size = new System.Drawing.Size(133, 22);
|
||||||
|
this.buttonUpd.TabIndex = 2;
|
||||||
|
this.buttonUpd.Text = "Изменить";
|
||||||
|
this.buttonUpd.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonUpd.Click += new System.EventHandler(this.ButtonUpd_Click);
|
||||||
|
//
|
||||||
|
// buttonDel
|
||||||
|
//
|
||||||
|
this.buttonDel.Location = new System.Drawing.Point(471, 62);
|
||||||
|
this.buttonDel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||||
|
this.buttonDel.Name = "buttonDel";
|
||||||
|
this.buttonDel.Size = new System.Drawing.Size(133, 22);
|
||||||
|
this.buttonDel.TabIndex = 3;
|
||||||
|
this.buttonDel.Text = "Удалить";
|
||||||
|
this.buttonDel.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonDel.Click += new System.EventHandler(this.ButtonDel_Click);
|
||||||
|
//
|
||||||
|
// buttonRef
|
||||||
|
//
|
||||||
|
this.buttonRef.Location = new System.Drawing.Point(471, 88);
|
||||||
|
this.buttonRef.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||||
|
this.buttonRef.Name = "buttonRef";
|
||||||
|
this.buttonRef.Size = new System.Drawing.Size(133, 22);
|
||||||
|
this.buttonRef.TabIndex = 4;
|
||||||
|
this.buttonRef.Text = "Обновить";
|
||||||
|
this.buttonRef.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonRef.Click += new System.EventHandler(this.ButtonRef_Click);
|
||||||
|
//
|
||||||
|
// FormImplementers
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(614, 338);
|
||||||
|
this.Controls.Add(this.buttonRef);
|
||||||
|
this.Controls.Add(this.buttonDel);
|
||||||
|
this.Controls.Add(this.buttonUpd);
|
||||||
|
this.Controls.Add(this.buttonAdd);
|
||||||
|
this.Controls.Add(this.dataGridView);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||||
|
this.Name = "FormImplementers";
|
||||||
|
this.Text = "Исполнители";
|
||||||
|
this.Load += new System.EventHandler(this.FormImplementers_Load);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private Button buttonUpd;
|
||||||
|
private Button buttonDel;
|
||||||
|
private Button buttonRef;
|
||||||
|
}
|
||||||
|
}
|
105
Secure/SecureShop/FormImplementers.cs
Normal file
105
Secure/SecureShop/FormImplementers.cs
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
using SecureShopContracts.BindingModels;
|
||||||
|
using SecureShopContracts.BusinessLogicsContracts;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace SecureShopView
|
||||||
|
{
|
||||||
|
public partial class FormImplementers : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IImplementerLogic _logic;
|
||||||
|
|
||||||
|
public FormImplementers(ILogger<FormImplementers> logger, IImplementerLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormImplementers_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["ImplementerFIO"].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(FormImplementer));
|
||||||
|
if (service is FormImplementer 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(FormImplementer));
|
||||||
|
if (service is FormImplementer 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 ImplementerBindingModel
|
||||||
|
{
|
||||||
|
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
Secure/SecureShop/FormImplementers.resx
Normal file
120
Secure/SecureShop/FormImplementers.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>
|
78
Secure/SecureShop/FormMain.Designer.cs
generated
78
Secure/SecureShop/FormMain.Designer.cs
generated
@ -30,13 +30,15 @@
|
|||||||
{
|
{
|
||||||
menuStrip = new MenuStrip();
|
menuStrip = new MenuStrip();
|
||||||
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||||
FacilitiesToolStripMenuItem = new ToolStripMenuItem();
|
FacilitiessToolStripMenuItem = new ToolStripMenuItem();
|
||||||
SecuresToolStripMenuItem = new ToolStripMenuItem();
|
SecuresToolStripMenuItem = new ToolStripMenuItem();
|
||||||
ClientsToolStripMenuItem = new ToolStripMenuItem();
|
ClientsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
ImplementersToolStripMenuItem = new ToolStripMenuItem();
|
||||||
отчётыToolStripMenuItem = new ToolStripMenuItem();
|
отчётыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
SecuresReportToolStripMenuItem = new ToolStripMenuItem();
|
SecuresReportToolStripMenuItem = new ToolStripMenuItem();
|
||||||
SecureFacilitiesReportToolStripMenuItem = new ToolStripMenuItem();
|
SecureFacilitiessReportToolStripMenuItem = new ToolStripMenuItem();
|
||||||
OrdersReportToolStripMenuItem = new ToolStripMenuItem();
|
OrdersReportToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
StartWorkingToolStripMenuItem = new ToolStripMenuItem();
|
||||||
dataGridView = new DataGridView();
|
dataGridView = new DataGridView();
|
||||||
buttonCreateOrder = new Button();
|
buttonCreateOrder = new Button();
|
||||||
buttonTakeOrderInWork = new Button();
|
buttonTakeOrderInWork = new Button();
|
||||||
@ -50,45 +52,52 @@
|
|||||||
// menuStrip
|
// menuStrip
|
||||||
//
|
//
|
||||||
menuStrip.ImageScalingSize = new Size(20, 20);
|
menuStrip.ImageScalingSize = new Size(20, 20);
|
||||||
menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, отчётыToolStripMenuItem });
|
menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, отчётыToolStripMenuItem, StartWorkingToolStripMenuItem });
|
||||||
menuStrip.Location = new Point(0, 0);
|
menuStrip.Location = new Point(0, 0);
|
||||||
menuStrip.Name = "menuStrip";
|
menuStrip.Name = "menuStrip";
|
||||||
menuStrip.Padding = new Padding(5, 2, 0, 2);
|
menuStrip.Padding = new Padding(5, 2, 0, 2);
|
||||||
menuStrip.Size = new Size(997, 24);
|
menuStrip.Size = new Size(1149, 24);
|
||||||
menuStrip.TabIndex = 0;
|
menuStrip.TabIndex = 0;
|
||||||
menuStrip.Text = "Справочники";
|
menuStrip.Text = "Справочники";
|
||||||
//
|
//
|
||||||
// справочникиToolStripMenuItem
|
// справочникиToolStripMenuItem
|
||||||
//
|
//
|
||||||
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { FacilitiesToolStripMenuItem, SecuresToolStripMenuItem, ClientsToolStripMenuItem });
|
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { FacilitiessToolStripMenuItem, SecuresToolStripMenuItem, ClientsToolStripMenuItem, ImplementersToolStripMenuItem });
|
||||||
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||||
справочникиToolStripMenuItem.Size = new Size(94, 20);
|
справочникиToolStripMenuItem.Size = new Size(94, 20);
|
||||||
справочникиToolStripMenuItem.Text = "Справочники";
|
справочникиToolStripMenuItem.Text = "Справочники";
|
||||||
//
|
//
|
||||||
// FacilitiesToolStripMenuItem
|
// FacilitiessToolStripMenuItem
|
||||||
//
|
//
|
||||||
FacilitiesToolStripMenuItem.Name = "FacilitiesToolStripMenuItem";
|
FacilitiessToolStripMenuItem.Name = "FacilitiessToolStripMenuItem";
|
||||||
FacilitiesToolStripMenuItem.Size = new Size(203, 22);
|
FacilitiessToolStripMenuItem.Size = new Size(200, 22);
|
||||||
FacilitiesToolStripMenuItem.Text = "Оборудование";
|
FacilitiessToolStripMenuItem.Text = "Оборудование";
|
||||||
FacilitiesToolStripMenuItem.Click += FacilitiesToolStripMenuItem_Click;
|
FacilitiessToolStripMenuItem.Click += FacilitiessToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// SecuresToolStripMenuItem
|
// SecuresToolStripMenuItem
|
||||||
//
|
//
|
||||||
SecuresToolStripMenuItem.Name = "SecuresToolStripMenuItem";
|
SecuresToolStripMenuItem.Name = "SecuresToolStripMenuItem";
|
||||||
SecuresToolStripMenuItem.Size = new Size(203, 22);
|
SecuresToolStripMenuItem.Size = new Size(200, 22);
|
||||||
SecuresToolStripMenuItem.Text = "Системы безопасности";
|
SecuresToolStripMenuItem.Text = "Система безопасности";
|
||||||
SecuresToolStripMenuItem.Click += SecuresToolStripMenuItem_Click;
|
SecuresToolStripMenuItem.Click += SecuresToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// ClientsToolStripMenuItem
|
// ClientsToolStripMenuItem
|
||||||
//
|
//
|
||||||
ClientsToolStripMenuItem.Name = "ClientsToolStripMenuItem";
|
ClientsToolStripMenuItem.Name = "ClientsToolStripMenuItem";
|
||||||
ClientsToolStripMenuItem.Size = new Size(203, 22);
|
ClientsToolStripMenuItem.Size = new Size(200, 22);
|
||||||
ClientsToolStripMenuItem.Text = "Клиенты";
|
ClientsToolStripMenuItem.Text = "Клиенты";
|
||||||
ClientsToolStripMenuItem.Click += ClientsToolStripMenuItem_Click;
|
ClientsToolStripMenuItem.Click += ClientsToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
|
// ImplementersToolStripMenuItem
|
||||||
|
//
|
||||||
|
ImplementersToolStripMenuItem.Name = "ImplementersToolStripMenuItem";
|
||||||
|
ImplementersToolStripMenuItem.Size = new Size(200, 22);
|
||||||
|
ImplementersToolStripMenuItem.Text = "Исполнители";
|
||||||
|
ImplementersToolStripMenuItem.Click += ImplementersToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
// отчётыToolStripMenuItem
|
// отчётыToolStripMenuItem
|
||||||
//
|
//
|
||||||
отчётыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { SecuresReportToolStripMenuItem, SecureFacilitiesReportToolStripMenuItem, OrdersReportToolStripMenuItem });
|
отчётыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { SecuresReportToolStripMenuItem, SecureFacilitiessReportToolStripMenuItem, OrdersReportToolStripMenuItem });
|
||||||
отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
|
отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
|
||||||
отчётыToolStripMenuItem.Size = new Size(60, 20);
|
отчётыToolStripMenuItem.Size = new Size(60, 20);
|
||||||
отчётыToolStripMenuItem.Text = "Отчёты";
|
отчётыToolStripMenuItem.Text = "Отчёты";
|
||||||
@ -100,12 +109,12 @@
|
|||||||
SecuresReportToolStripMenuItem.Text = "Список систем безопасности";
|
SecuresReportToolStripMenuItem.Text = "Список систем безопасности";
|
||||||
SecuresReportToolStripMenuItem.Click += SecuresReportToolStripMenuItem_Click;
|
SecuresReportToolStripMenuItem.Click += SecuresReportToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// SecureFacilitiesReportToolStripMenuItem
|
// SecureFacilitiessReportToolStripMenuItem
|
||||||
//
|
//
|
||||||
SecureFacilitiesReportToolStripMenuItem.Name = "SecureFacilitiesReportToolStripMenuItem";
|
SecureFacilitiessReportToolStripMenuItem.Name = "SecureFacilitiessReportToolStripMenuItem";
|
||||||
SecureFacilitiesReportToolStripMenuItem.Size = new Size(236, 22);
|
SecureFacilitiessReportToolStripMenuItem.Size = new Size(236, 22);
|
||||||
SecureFacilitiesReportToolStripMenuItem.Text = "Оборудование по СБ";
|
SecureFacilitiessReportToolStripMenuItem.Text = "Оборудование по СБ";
|
||||||
SecureFacilitiesReportToolStripMenuItem.Click += SecureFacilitiesReportToolStripMenuItem_Click;
|
SecureFacilitiessReportToolStripMenuItem.Click += SecureFacilitiessReportToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// OrdersReportToolStripMenuItem
|
// OrdersReportToolStripMenuItem
|
||||||
//
|
//
|
||||||
@ -114,20 +123,27 @@
|
|||||||
OrdersReportToolStripMenuItem.Text = "Список заказов";
|
OrdersReportToolStripMenuItem.Text = "Список заказов";
|
||||||
OrdersReportToolStripMenuItem.Click += OrdersReportToolStripMenuItem_Click;
|
OrdersReportToolStripMenuItem.Click += OrdersReportToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
|
// StartWorkingToolStripMenuItem
|
||||||
|
//
|
||||||
|
StartWorkingToolStripMenuItem.Name = "StartWorkingToolStripMenuItem";
|
||||||
|
StartWorkingToolStripMenuItem.Size = new Size(92, 20);
|
||||||
|
StartWorkingToolStripMenuItem.Text = "Запуск работ";
|
||||||
|
StartWorkingToolStripMenuItem.Click += StartWorkingToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
// dataGridView
|
// dataGridView
|
||||||
//
|
//
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
dataGridView.Location = new Point(10, 23);
|
dataGridView.Location = new Point(12, 26);
|
||||||
dataGridView.Margin = new Padding(3, 2, 3, 2);
|
dataGridView.Margin = new Padding(3, 2, 3, 2);
|
||||||
dataGridView.Name = "dataGridView";
|
dataGridView.Name = "dataGridView";
|
||||||
dataGridView.RowHeadersWidth = 51;
|
dataGridView.RowHeadersWidth = 51;
|
||||||
dataGridView.RowTemplate.Height = 29;
|
dataGridView.RowTemplate.Height = 29;
|
||||||
dataGridView.Size = new Size(801, 305);
|
dataGridView.Size = new Size(957, 305);
|
||||||
dataGridView.TabIndex = 1;
|
dataGridView.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// buttonCreateOrder
|
// buttonCreateOrder
|
||||||
//
|
//
|
||||||
buttonCreateOrder.Location = new Point(816, 34);
|
buttonCreateOrder.Location = new Point(975, 34);
|
||||||
buttonCreateOrder.Margin = new Padding(3, 2, 3, 2);
|
buttonCreateOrder.Margin = new Padding(3, 2, 3, 2);
|
||||||
buttonCreateOrder.Name = "buttonCreateOrder";
|
buttonCreateOrder.Name = "buttonCreateOrder";
|
||||||
buttonCreateOrder.Size = new Size(170, 22);
|
buttonCreateOrder.Size = new Size(170, 22);
|
||||||
@ -138,7 +154,7 @@
|
|||||||
//
|
//
|
||||||
// buttonTakeOrderInWork
|
// buttonTakeOrderInWork
|
||||||
//
|
//
|
||||||
buttonTakeOrderInWork.Location = new Point(816, 60);
|
buttonTakeOrderInWork.Location = new Point(975, 60);
|
||||||
buttonTakeOrderInWork.Margin = new Padding(3, 2, 3, 2);
|
buttonTakeOrderInWork.Margin = new Padding(3, 2, 3, 2);
|
||||||
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
||||||
buttonTakeOrderInWork.Size = new Size(170, 22);
|
buttonTakeOrderInWork.Size = new Size(170, 22);
|
||||||
@ -149,7 +165,7 @@
|
|||||||
//
|
//
|
||||||
// buttonOrderReady
|
// buttonOrderReady
|
||||||
//
|
//
|
||||||
buttonOrderReady.Location = new Point(816, 86);
|
buttonOrderReady.Location = new Point(975, 86);
|
||||||
buttonOrderReady.Margin = new Padding(3, 2, 3, 2);
|
buttonOrderReady.Margin = new Padding(3, 2, 3, 2);
|
||||||
buttonOrderReady.Name = "buttonOrderReady";
|
buttonOrderReady.Name = "buttonOrderReady";
|
||||||
buttonOrderReady.Size = new Size(170, 22);
|
buttonOrderReady.Size = new Size(170, 22);
|
||||||
@ -160,7 +176,7 @@
|
|||||||
//
|
//
|
||||||
// buttonIssuedOrder
|
// buttonIssuedOrder
|
||||||
//
|
//
|
||||||
buttonIssuedOrder.Location = new Point(816, 112);
|
buttonIssuedOrder.Location = new Point(975, 112);
|
||||||
buttonIssuedOrder.Margin = new Padding(3, 2, 3, 2);
|
buttonIssuedOrder.Margin = new Padding(3, 2, 3, 2);
|
||||||
buttonIssuedOrder.Name = "buttonIssuedOrder";
|
buttonIssuedOrder.Name = "buttonIssuedOrder";
|
||||||
buttonIssuedOrder.Size = new Size(170, 22);
|
buttonIssuedOrder.Size = new Size(170, 22);
|
||||||
@ -171,7 +187,7 @@
|
|||||||
//
|
//
|
||||||
// buttonRef
|
// buttonRef
|
||||||
//
|
//
|
||||||
buttonRef.Location = new Point(816, 138);
|
buttonRef.Location = new Point(975, 138);
|
||||||
buttonRef.Margin = new Padding(3, 2, 3, 2);
|
buttonRef.Margin = new Padding(3, 2, 3, 2);
|
||||||
buttonRef.Name = "buttonRef";
|
buttonRef.Name = "buttonRef";
|
||||||
buttonRef.Size = new Size(170, 22);
|
buttonRef.Size = new Size(170, 22);
|
||||||
@ -184,7 +200,7 @@
|
|||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(997, 338);
|
ClientSize = new Size(1149, 338);
|
||||||
Controls.Add(buttonRef);
|
Controls.Add(buttonRef);
|
||||||
Controls.Add(buttonIssuedOrder);
|
Controls.Add(buttonIssuedOrder);
|
||||||
Controls.Add(buttonOrderReady);
|
Controls.Add(buttonOrderReady);
|
||||||
@ -195,7 +211,7 @@
|
|||||||
MainMenuStrip = menuStrip;
|
MainMenuStrip = menuStrip;
|
||||||
Margin = new Padding(3, 2, 3, 2);
|
Margin = new Padding(3, 2, 3, 2);
|
||||||
Name = "FormMain";
|
Name = "FormMain";
|
||||||
Text = "Магазин систем безопасности";
|
Text = "Лавка с мороженым";
|
||||||
Load += FormMain_Load;
|
Load += FormMain_Load;
|
||||||
menuStrip.ResumeLayout(false);
|
menuStrip.ResumeLayout(false);
|
||||||
menuStrip.PerformLayout();
|
menuStrip.PerformLayout();
|
||||||
@ -208,7 +224,7 @@
|
|||||||
|
|
||||||
private MenuStrip menuStrip;
|
private MenuStrip menuStrip;
|
||||||
private ToolStripMenuItem справочникиToolStripMenuItem;
|
private ToolStripMenuItem справочникиToolStripMenuItem;
|
||||||
private ToolStripMenuItem FacilitiesToolStripMenuItem;
|
private ToolStripMenuItem FacilitiessToolStripMenuItem;
|
||||||
private ToolStripMenuItem SecuresToolStripMenuItem;
|
private ToolStripMenuItem SecuresToolStripMenuItem;
|
||||||
private DataGridView dataGridView;
|
private DataGridView dataGridView;
|
||||||
private Button buttonCreateOrder;
|
private Button buttonCreateOrder;
|
||||||
@ -218,8 +234,10 @@
|
|||||||
private Button buttonRef;
|
private Button buttonRef;
|
||||||
private ToolStripMenuItem отчётыToolStripMenuItem;
|
private ToolStripMenuItem отчётыToolStripMenuItem;
|
||||||
private ToolStripMenuItem SecuresReportToolStripMenuItem;
|
private ToolStripMenuItem SecuresReportToolStripMenuItem;
|
||||||
private ToolStripMenuItem SecureFacilitiesReportToolStripMenuItem;
|
private ToolStripMenuItem SecureFacilitiessReportToolStripMenuItem;
|
||||||
private ToolStripMenuItem OrdersReportToolStripMenuItem;
|
private ToolStripMenuItem OrdersReportToolStripMenuItem;
|
||||||
private ToolStripMenuItem ClientsToolStripMenuItem;
|
private ToolStripMenuItem ClientsToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem ImplementersToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem StartWorkingToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
using SecureShopContracts.BindingModels;
|
using SecureShopBusinessLogic.BusinessLogics;
|
||||||
|
using SecureShopContracts.BindingModels;
|
||||||
using SecureShopContracts.BusinessLogicsContracts;
|
using SecureShopContracts.BusinessLogicsContracts;
|
||||||
using SecureShopDataModels.Enums;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace SecureShopView
|
namespace SecureShopView
|
||||||
@ -10,13 +10,17 @@ namespace SecureShopView
|
|||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IOrderLogic _orderLogic;
|
private readonly IOrderLogic _orderLogic;
|
||||||
private readonly IReportLogic _reportLogic;
|
private readonly IReportLogic _reportLogic;
|
||||||
|
private readonly IWorkProcess _workProcessLogic;
|
||||||
|
private readonly IImplementerLogic _implementerLogic;
|
||||||
|
|
||||||
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic)
|
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess, IImplementerLogic implementerLogic)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_orderLogic = orderLogic;
|
_orderLogic = orderLogic;
|
||||||
_reportLogic = reportLogic;
|
_reportLogic = reportLogic;
|
||||||
|
_workProcessLogic = workProcess;
|
||||||
|
_implementerLogic = implementerLogic;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormMain_Load(object sender, EventArgs e)
|
private void FormMain_Load(object sender, EventArgs e)
|
||||||
@ -34,6 +38,7 @@ namespace SecureShopView
|
|||||||
dataGridView.DataSource = list;
|
dataGridView.DataSource = list;
|
||||||
dataGridView.Columns["SecureId"].Visible = false;
|
dataGridView.Columns["SecureId"].Visible = false;
|
||||||
dataGridView.Columns["ClientId"].Visible = false;
|
dataGridView.Columns["ClientId"].Visible = false;
|
||||||
|
dataGridView.Columns["ImplementerId"].Visible = false;
|
||||||
dataGridView.Columns["SecureName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
dataGridView.Columns["SecureName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Загрузка заказов");
|
_logger.LogInformation("Загрузка заказов");
|
||||||
@ -45,7 +50,7 @@ namespace SecureShopView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FacilitiesToolStripMenuItem_Click(object sender, EventArgs e)
|
private void FacilitiessToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormFacilitiess));
|
var service = Program.ServiceProvider?.GetService(typeof(FormFacilitiess));
|
||||||
if (service is FormFacilitiess form)
|
if (service is FormFacilitiess form)
|
||||||
@ -168,7 +173,7 @@ namespace SecureShopView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SecureFacilitiesReportToolStripMenuItem_Click(object sender, EventArgs e)
|
private void SecureFacilitiessReportToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportSecureFacilities));
|
var service = Program.ServiceProvider?.GetService(typeof(FormReportSecureFacilities));
|
||||||
if (service is FormReportSecureFacilities form)
|
if (service is FormReportSecureFacilities form)
|
||||||
@ -194,5 +199,20 @@ namespace SecureShopView
|
|||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ImplementersToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormImplementers));
|
||||||
|
if (service is FormImplementers form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StartWorkingToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_workProcessLogic.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic);
|
||||||
|
MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -7,6 +7,7 @@ using NLog.Extensions.Logging;
|
|||||||
using SecureShopBusinessLogic.OfficePackage;
|
using SecureShopBusinessLogic.OfficePackage;
|
||||||
using SecureShopBusinessLogic.OfficePackage.Implements;
|
using SecureShopBusinessLogic.OfficePackage.Implements;
|
||||||
using SecureShopDatabaseImplement.Implements;
|
using SecureShopDatabaseImplement.Implements;
|
||||||
|
using SecureShopView;
|
||||||
|
|
||||||
namespace SecureShopView
|
namespace SecureShopView
|
||||||
{
|
{
|
||||||
@ -43,14 +44,19 @@ namespace SecureShopView
|
|||||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||||
services.AddTransient<ISecureLogic, SecureLogic>();
|
services.AddTransient<ISecureLogic, SecureLogic>();
|
||||||
services.AddTransient<IClientLogic, ClientLogic>();
|
services.AddTransient<IClientLogic, ClientLogic>();
|
||||||
|
services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
||||||
services.AddTransient<FormMain>();
|
services.AddTransient<FormMain>();
|
||||||
|
services.AddTransient<IImplementerStorage, ImplementerStorage>();
|
||||||
services.AddTransient<IReportLogic, ReportLogic>();
|
services.AddTransient<IReportLogic, ReportLogic>();
|
||||||
|
services.AddTransient<IWorkProcess, WorkModeling>();
|
||||||
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
||||||
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
||||||
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
||||||
services.AddTransient<FormFacilitie>();
|
services.AddTransient<FormFacilitie>();
|
||||||
services.AddTransient<FormReportSecureFacilities>();
|
services.AddTransient<FormReportSecureFacilities>();
|
||||||
services.AddTransient<FormReportOrders>();
|
services.AddTransient<FormReportOrders>();
|
||||||
|
services.AddTransient<FormImplementers>();
|
||||||
|
services.AddTransient<FormImplementer>();
|
||||||
services.AddTransient<FormFacilitiess>();
|
services.AddTransient<FormFacilitiess>();
|
||||||
services.AddTransient<FormCreateOrder>();
|
services.AddTransient<FormCreateOrder>();
|
||||||
services.AddTransient<FormSecure>();
|
services.AddTransient<FormSecure>();
|
||||||
|
@ -0,0 +1,117 @@
|
|||||||
|
using SecureShopContracts.BindingModels;
|
||||||
|
using SecureShopContracts.BusinessLogicsContracts;
|
||||||
|
using SecureShopContracts.SearchModels;
|
||||||
|
using SecureShopContracts.StoragesContracts;
|
||||||
|
using SecureShopContracts.ViewModels;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace SecureShopBusinessLogic.BusinessLogics
|
||||||
|
{
|
||||||
|
public class ImplementerLogic : IImplementerLogic
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IImplementerStorage _implementerStorage;
|
||||||
|
|
||||||
|
public ImplementerLogic(ILogger<ImplementerLogic> logger, IImplementerStorage implementerStorage)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_implementerStorage = implementerStorage;
|
||||||
|
}
|
||||||
|
public bool Create(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model);
|
||||||
|
if (_implementerStorage.Insert(model) == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Insert operation failed");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Delete(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model, false);
|
||||||
|
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||||
|
if (_implementerStorage.Delete(model) == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Delete operation failed");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel? ReadElement(ImplementerSearchModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(model));
|
||||||
|
}
|
||||||
|
_logger.LogInformation("ReadElement. ImplementerFIO:{ImplementerFIO}. Id:{Id}", model.ImplementerFIO, model.Id);
|
||||||
|
var element = _implementerStorage.GetElement(model);
|
||||||
|
if (element == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("ReadElement element not found");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ImplementerViewModel>? ReadList(ImplementerSearchModel? model)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("ReadList. ImplementerFIO:{ImplementerFIO}. Id:{Id}", model?.ImplementerFIO, model?.Id);
|
||||||
|
var list = model == null ? _implementerStorage.GetFullList() : _implementerStorage.GetFilteredList(model);
|
||||||
|
if (list == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("ReadList return null list");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Update(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
CheckModel(model);
|
||||||
|
if (_implementerStorage.Update(model) == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Update operation failed");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckModel(ImplementerBindingModel model, bool withParams = true)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(model));
|
||||||
|
}
|
||||||
|
if (!withParams)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(model.ImplementerFIO))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Нет ФИО исполнителя", nameof(model.ImplementerFIO));
|
||||||
|
}
|
||||||
|
if (model.WorkExperience < 0)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Опыт работы должен быть больше 0", nameof(model.WorkExperience));
|
||||||
|
}
|
||||||
|
if (model.Qualification < 0)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Квалификация должна быть больше 0", nameof(model.Qualification));
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Implementer. ImplementerFIO:{ImplementerFIO}. Id: {Id}", model.ImplementerFIO, model.Id);
|
||||||
|
var element = _implementerStorage.GetElement(new ImplementerSearchModel
|
||||||
|
{
|
||||||
|
ImplementerFIO = model.ImplementerFIO
|
||||||
|
});
|
||||||
|
if (element != null && element.Id != model.Id)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("Исполнитель с таким ФИО уже есть");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -86,6 +86,10 @@ namespace SecureShopBusinessLogic.BusinessLogics
|
|||||||
_logger.LogWarning("Change status operation failed");
|
_logger.LogWarning("Change status operation failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (viewModel.ImplementerId.HasValue)
|
||||||
|
{
|
||||||
|
model.ImplementerId = viewModel.ImplementerId;
|
||||||
|
}
|
||||||
model.Status = newStatus;
|
model.Status = newStatus;
|
||||||
model.SecureId = viewModel.SecureId;
|
model.SecureId = viewModel.SecureId;
|
||||||
model.Count = viewModel.Count;
|
model.Count = viewModel.Count;
|
||||||
@ -108,6 +112,23 @@ namespace SecureShopBusinessLogic.BusinessLogics
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OrderViewModel? ReadElement(OrderSearchModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(model));
|
||||||
|
}
|
||||||
|
_logger.LogInformation("ReadElement. Id:{Id}", model.Id);
|
||||||
|
var element = _orderStorage.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 TakeOrderInWork(OrderBindingModel model)
|
public bool TakeOrderInWork(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
return ChangeStatus(model, OrderStatus.Выполняется);
|
return ChangeStatus(model, OrderStatus.Выполняется);
|
||||||
|
144
Secure/SecureShopBusinessLogic/BusinessLogics/WorkModeling.cs
Normal file
144
Secure/SecureShopBusinessLogic/BusinessLogics/WorkModeling.cs
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
using SecureShopContracts.BindingModels;
|
||||||
|
using SecureShopContracts.BusinessLogicsContracts;
|
||||||
|
using SecureShopContracts.SearchModels;
|
||||||
|
using SecureShopContracts.ViewModels;
|
||||||
|
using SecureShopDataModels.Enums;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace SecureShopBusinessLogic.BusinessLogics
|
||||||
|
{
|
||||||
|
public class WorkModeling : IWorkProcess
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
|
private readonly Random _rnd;
|
||||||
|
|
||||||
|
private IOrderLogic? _orderLogic;
|
||||||
|
|
||||||
|
public WorkModeling(ILogger<WorkModeling> logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_rnd = new Random(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DoWork(IImplementerLogic implementerLogic, IOrderLogic orderLogic)
|
||||||
|
{
|
||||||
|
_orderLogic = orderLogic;
|
||||||
|
var implementers = implementerLogic.ReadList(null);
|
||||||
|
if (implementers == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("DoWork. Implementers is null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var orders = _orderLogic.ReadList(new OrderSearchModel { Status = OrderStatus.Принят });
|
||||||
|
if (orders == null || orders.Count == 0)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("DoWork. Orders is null or empty");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_logger.LogDebug("DoWork for {Count} orders", orders.Count);
|
||||||
|
foreach (var implementer in implementers)
|
||||||
|
{
|
||||||
|
Task.Run(() => WorkerWorkAsync(implementer, orders));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Иммитация работы исполнителя
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="implementer"></param>
|
||||||
|
/// <param name="orders"></param>
|
||||||
|
private async Task WorkerWorkAsync(ImplementerViewModel implementer, List<OrderViewModel> orders)
|
||||||
|
{
|
||||||
|
if (_orderLogic == null || implementer == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await RunOrderInWork(implementer);
|
||||||
|
|
||||||
|
await Task.Run(() =>
|
||||||
|
{
|
||||||
|
foreach (var order in orders)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_logger.LogDebug("DoWork. Worker {Id} try get order {Order}", implementer.Id, order.Id);
|
||||||
|
// пытаемся назначить заказ на исполнителя
|
||||||
|
_orderLogic.TakeOrderInWork(new OrderBindingModel
|
||||||
|
{
|
||||||
|
Id = order.Id,
|
||||||
|
ImplementerId = implementer.Id
|
||||||
|
});
|
||||||
|
// делаем работу
|
||||||
|
Thread.Sleep(implementer.WorkExperience * _rnd.Next(100, 1000) * order.Count);
|
||||||
|
_logger.LogDebug("DoWork. Worker {Id} finish order {Order}", implementer.Id, order.Id);
|
||||||
|
_orderLogic.OrderReady(new OrderBindingModel
|
||||||
|
{
|
||||||
|
Id = order.Id
|
||||||
|
});
|
||||||
|
// отдыхаем
|
||||||
|
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
|
||||||
|
}
|
||||||
|
// кто-то мог уже перехватить заказ, игнорируем ошибку
|
||||||
|
catch (InvalidOperationException ex)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(ex, "Error try get work");
|
||||||
|
}
|
||||||
|
// заканчиваем выполнение имитации в случае иной ошибки
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Error while do work");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ищем заказ, которые уже в работе (вдруг исполнителя прервали)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="implementer"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private async Task RunOrderInWork(ImplementerViewModel implementer)
|
||||||
|
{
|
||||||
|
if (_orderLogic == null || implementer == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var runOrder = await Task.Run(() => _orderLogic.ReadElement(new OrderSearchModel
|
||||||
|
{
|
||||||
|
ImplementerId = implementer.Id,
|
||||||
|
Status = OrderStatus.Выполняется
|
||||||
|
}));
|
||||||
|
if (runOrder == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogDebug("DoWork. Worker {Id} back to order {Order}", implementer.Id, runOrder.Id);
|
||||||
|
// доделываем работу
|
||||||
|
Thread.Sleep(implementer.WorkExperience * _rnd.Next(100, 300) * runOrder.Count);
|
||||||
|
_logger.LogDebug("DoWork. Worker {Id} finish order {Order}", implementer.Id, runOrder.Id);
|
||||||
|
_orderLogic.OrderReady(new OrderBindingModel
|
||||||
|
{
|
||||||
|
Id = runOrder.Id
|
||||||
|
});
|
||||||
|
// отдыхаем
|
||||||
|
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
|
||||||
|
}
|
||||||
|
// заказа может не быть, просто игнорируем ошибку
|
||||||
|
catch (InvalidOperationException ex)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(ex, "Error try get work");
|
||||||
|
}
|
||||||
|
// а может возникнуть иная ошибка, тогда просто заканчиваем выполнение имитации
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Error while do work");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
using SecureShopDataModels.Models;
|
||||||
|
|
||||||
|
namespace SecureShopContracts.BindingModels
|
||||||
|
{
|
||||||
|
public class ImplementerBindingModel : IImplementerModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string ImplementerFIO { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Password { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int WorkExperience { get; set; }
|
||||||
|
|
||||||
|
public int Qualification { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,7 @@ namespace SecureShopContracts.BindingModels
|
|||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int SecureId { get; set; }
|
public int SecureId { get; set; }
|
||||||
|
public int? ImplementerId { get; set; }
|
||||||
public int Count { get; set; }
|
public int Count { get; set; }
|
||||||
public int ClientId { get; set; }
|
public int ClientId { get; set; }
|
||||||
public double Sum { get; set; }
|
public double Sum { get; set; }
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
using SecureShopContracts.BindingModels;
|
||||||
|
using SecureShopContracts.SearchModels;
|
||||||
|
using SecureShopContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace SecureShopContracts.BusinessLogicsContracts
|
||||||
|
{
|
||||||
|
public interface IImplementerLogic
|
||||||
|
{
|
||||||
|
List<ImplementerViewModel>? ReadList(ImplementerSearchModel? model);
|
||||||
|
|
||||||
|
ImplementerViewModel? ReadElement(ImplementerSearchModel model);
|
||||||
|
|
||||||
|
bool Create(ImplementerBindingModel model);
|
||||||
|
|
||||||
|
bool Update(ImplementerBindingModel model);
|
||||||
|
|
||||||
|
bool Delete(ImplementerBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
@ -11,5 +11,6 @@ namespace SecureShopContracts.BusinessLogicsContracts
|
|||||||
bool TakeOrderInWork(OrderBindingModel model);
|
bool TakeOrderInWork(OrderBindingModel model);
|
||||||
bool OrderReady(OrderBindingModel model);
|
bool OrderReady(OrderBindingModel model);
|
||||||
bool IssuedOrder(OrderBindingModel model);
|
bool IssuedOrder(OrderBindingModel model);
|
||||||
|
OrderViewModel? ReadElement(OrderSearchModel orderSearchModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
namespace SecureShopContracts.BusinessLogicsContracts
|
||||||
|
{
|
||||||
|
public interface IWorkProcess
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Запуск работ
|
||||||
|
/// </summary>
|
||||||
|
void DoWork(IImplementerLogic implementerLogic, IOrderLogic orderLogic);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
namespace SecureShopContracts.SearchModels
|
||||||
|
{
|
||||||
|
public class ImplementerSearchModel
|
||||||
|
{
|
||||||
|
public int? Id { get; set; }
|
||||||
|
|
||||||
|
public string? ImplementerFIO { get; set; }
|
||||||
|
|
||||||
|
public string? Password { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,13 @@
|
|||||||
namespace SecureShopContracts.SearchModels
|
using SecureShopDataModels.Enums;
|
||||||
|
|
||||||
|
namespace SecureShopContracts.SearchModels
|
||||||
{
|
{
|
||||||
public class OrderSearchModel
|
public class OrderSearchModel
|
||||||
{
|
{
|
||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
public int? ClientId { get; set; }
|
public int? ClientId { get; set; }
|
||||||
|
public int? ImplementerId { get; set; }
|
||||||
|
public OrderStatus? Status { get; set; }
|
||||||
public DateTime? DateFrom { get; set; }
|
public DateTime? DateFrom { get; set; }
|
||||||
public DateTime? DateTo { get; set; }
|
public DateTime? DateTo { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
using SecureShopContracts.BindingModels;
|
||||||
|
using SecureShopContracts.SearchModels;
|
||||||
|
using SecureShopContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace SecureShopContracts.StoragesContracts
|
||||||
|
{
|
||||||
|
public interface IImplementerStorage
|
||||||
|
{
|
||||||
|
List<ImplementerViewModel> GetFullList();
|
||||||
|
|
||||||
|
List<ImplementerViewModel> GetFilteredList(ImplementerSearchModel model);
|
||||||
|
|
||||||
|
ImplementerViewModel? GetElement(ImplementerSearchModel model);
|
||||||
|
|
||||||
|
ImplementerViewModel? Insert(ImplementerBindingModel model);
|
||||||
|
|
||||||
|
ImplementerViewModel? Update(ImplementerBindingModel model);
|
||||||
|
|
||||||
|
ImplementerViewModel? Delete(ImplementerBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
using SecureShopDataModels.Models;
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace SecureShopContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class ImplementerViewModel : IImplementerModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("ФИО исполнителя")]
|
||||||
|
public string ImplementerFIO { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Пароль")]
|
||||||
|
public string Password { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Стаж работы")]
|
||||||
|
public int WorkExperience { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Квалификация")]
|
||||||
|
public int Qualification { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -14,6 +14,10 @@ namespace SecureShopContracts.ViewModels
|
|||||||
[DisplayName("Система безопасности")]
|
[DisplayName("Система безопасности")]
|
||||||
public string SecureName { get; set; } = string.Empty;
|
public string SecureName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int? ImplementerId { get; set; }
|
||||||
|
[DisplayName("Исполнитель")]
|
||||||
|
public string ImplementerFIO { get; set; } = string.Empty;
|
||||||
|
|
||||||
[DisplayName("Количество")]
|
[DisplayName("Количество")]
|
||||||
public int Count { get; set; }
|
public int Count { get; set; }
|
||||||
|
|
||||||
|
13
Secure/SecureShopDataModels/Models/IImplementerModel.cs
Normal file
13
Secure/SecureShopDataModels/Models/IImplementerModel.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
namespace SecureShopDataModels.Models
|
||||||
|
{
|
||||||
|
public interface IImplementerModel : IId
|
||||||
|
{
|
||||||
|
string ImplementerFIO { get; }
|
||||||
|
|
||||||
|
string Password { get; }
|
||||||
|
|
||||||
|
int WorkExperience { get; }
|
||||||
|
|
||||||
|
int Qualification { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -6,6 +6,7 @@ namespace SecureShopDataModels.Models
|
|||||||
{
|
{
|
||||||
int SecureId { get; }
|
int SecureId { get; }
|
||||||
int ClientId { get; }
|
int ClientId { get; }
|
||||||
|
int? ImplementerId { get; }
|
||||||
int Count { get; }
|
int Count { get; }
|
||||||
double Sum { get; }
|
double Sum { get; }
|
||||||
OrderStatus Status { get; }
|
OrderStatus Status { get; }
|
||||||
|
@ -0,0 +1,98 @@
|
|||||||
|
using SecureShopContracts.BindingModels;
|
||||||
|
using SecureShopContracts.SearchModels;
|
||||||
|
using SecureShopContracts.StoragesContracts;
|
||||||
|
using SecureShopContracts.ViewModels;
|
||||||
|
using SecureShopDatabaseImplement.Models;
|
||||||
|
|
||||||
|
namespace SecureShopDatabaseImplement.Implements
|
||||||
|
{
|
||||||
|
public class ImplementerStorage : IImplementerStorage
|
||||||
|
{
|
||||||
|
public List<ImplementerViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
using var context = new SecureShopDatabase();
|
||||||
|
return context.Implementers
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ImplementerViewModel> GetFilteredList(ImplementerSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.ImplementerFIO) && !model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
if (model.Id.HasValue)
|
||||||
|
{
|
||||||
|
var Implementer = GetElement(model);
|
||||||
|
return Implementer == null ? new() : new() { Implementer };
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(model.ImplementerFIO))
|
||||||
|
{
|
||||||
|
using var context = new SecureShopDatabase();
|
||||||
|
return context.Implementers
|
||||||
|
.Where(x => x.ImplementerFIO.Contains(model.ImplementerFIO))
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel? GetElement(ImplementerSearchModel model)
|
||||||
|
{
|
||||||
|
using var context = new SecureShopDatabase();
|
||||||
|
if (model.Id.HasValue)
|
||||||
|
return context.Implementers
|
||||||
|
.FirstOrDefault(x => x.Id == model.Id)
|
||||||
|
?.GetViewModel;
|
||||||
|
if (!string.IsNullOrEmpty(model.ImplementerFIO) && !string.IsNullOrEmpty(model.Password))
|
||||||
|
return context.Implementers
|
||||||
|
.FirstOrDefault(x => x.ImplementerFIO == model.ImplementerFIO && x.Password == model.Password)
|
||||||
|
?.GetViewModel;
|
||||||
|
if (!string.IsNullOrEmpty(model.ImplementerFIO))
|
||||||
|
return context.Implementers
|
||||||
|
.FirstOrDefault(x => x.ImplementerFIO == model.ImplementerFIO)
|
||||||
|
?.GetViewModel;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel? Insert(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
var newImplementer = Implementer.Create(model);
|
||||||
|
if (newImplementer == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
using var context = new SecureShopDatabase();
|
||||||
|
context.Implementers.Add(newImplementer);
|
||||||
|
context.SaveChanges();
|
||||||
|
return newImplementer.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel? Update(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new SecureShopDatabase();
|
||||||
|
var additive = context.Implementers.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
if (additive == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
additive.Update(model);
|
||||||
|
context.SaveChanges();
|
||||||
|
return additive.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel? Delete(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new SecureShopDatabase();
|
||||||
|
var element = context.Implementers.FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
|
if (element != null)
|
||||||
|
{
|
||||||
|
context.Implementers.Remove(element);
|
||||||
|
context.SaveChanges();
|
||||||
|
return element.GetViewModel;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -20,6 +20,7 @@ namespace SecureShopDatabaseImplement.Implements
|
|||||||
var deletedElement = context.Orders
|
var deletedElement = context.Orders
|
||||||
.Include(x => x.Secure)
|
.Include(x => x.Secure)
|
||||||
.Include(x => x.Client)
|
.Include(x => x.Client)
|
||||||
|
.Include(x => x.Implementer)
|
||||||
.FirstOrDefault(x => x.Id == model.Id)
|
.FirstOrDefault(x => x.Id == model.Id)
|
||||||
?.GetViewModel;
|
?.GetViewModel;
|
||||||
context.Orders.Remove(element);
|
context.Orders.Remove(element);
|
||||||
@ -31,15 +32,34 @@ namespace SecureShopDatabaseImplement.Implements
|
|||||||
|
|
||||||
public OrderViewModel? GetElement(OrderSearchModel model)
|
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.Id.HasValue)
|
using var context = new SecureShopDatabase();
|
||||||
|
if (model.ImplementerId.HasValue && model.Status.HasValue)
|
||||||
|
{
|
||||||
|
return context.Orders
|
||||||
|
.Include(x => x.Secure)
|
||||||
|
.Include(x => x.Client)
|
||||||
|
.Include(x => x.Implementer)
|
||||||
|
.FirstOrDefault(x => x.ImplementerId == model.ImplementerId && x.Status == model.Status)
|
||||||
|
?.GetViewModel;
|
||||||
|
}
|
||||||
|
if (model.ImplementerId.HasValue)
|
||||||
|
{
|
||||||
|
return context.Orders
|
||||||
|
.Include(x => x.Secure)
|
||||||
|
.Include(x => x.Client)
|
||||||
|
.Include(x => x.Implementer)
|
||||||
|
.FirstOrDefault(x => x.ImplementerId == model.ImplementerId)
|
||||||
|
?.GetViewModel;
|
||||||
|
}
|
||||||
|
if (!model.Id.HasValue)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
using var context = new SecureShopDatabase();
|
|
||||||
return context.Orders
|
return context.Orders
|
||||||
.Include(x => x.Secure)
|
.Include(x => x.Secure)
|
||||||
.Include(x => x.Client)
|
.Include(x => x.Client)
|
||||||
.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)
|
.Include(x => x.Implementer)
|
||||||
|
.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)
|
||||||
?.GetViewModel;
|
?.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,11 +71,22 @@ namespace SecureShopDatabaseImplement.Implements
|
|||||||
{
|
{
|
||||||
return context.Orders.Include(x => x.Secure)
|
return context.Orders.Include(x => x.Secure)
|
||||||
.Include(x => x.Client)
|
.Include(x => x.Client)
|
||||||
|
.Include(x => x.Implementer)
|
||||||
.Where(x => x.ClientId == model.ClientId)
|
.Where(x => x.ClientId == model.ClientId)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue)
|
if (model.Status.HasValue)
|
||||||
|
{
|
||||||
|
return context.Orders
|
||||||
|
.Include(x => x.Secure)
|
||||||
|
.Include(x => x.Client)
|
||||||
|
.Include(x => x.Implementer)
|
||||||
|
.Where(x => x.Status == model.Status)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue)
|
||||||
return new();
|
return new();
|
||||||
if (!model.Id.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue)
|
if (!model.Id.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||||
{
|
{
|
||||||
@ -69,7 +100,8 @@ namespace SecureShopDatabaseImplement.Implements
|
|||||||
return context.Orders
|
return context.Orders
|
||||||
.Include(x => x.Secure)
|
.Include(x => x.Secure)
|
||||||
.Include(x => x.Client)
|
.Include(x => x.Client)
|
||||||
.Where(x => x.Id == model.Id)
|
.Include(x => x.Implementer)
|
||||||
|
.Where(x => x.Id == model.Id)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
@ -80,7 +112,8 @@ namespace SecureShopDatabaseImplement.Implements
|
|||||||
return context.Orders
|
return context.Orders
|
||||||
.Include(x => x.Secure)
|
.Include(x => x.Secure)
|
||||||
.Include(x => x.Client)
|
.Include(x => x.Client)
|
||||||
.Select(x => x.GetViewModel)
|
.Include(x => x.Implementer)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +130,8 @@ namespace SecureShopDatabaseImplement.Implements
|
|||||||
return context.Orders
|
return context.Orders
|
||||||
.Include(x => x.Secure)
|
.Include(x => x.Secure)
|
||||||
.Include(x => x.Client)
|
.Include(x => x.Client)
|
||||||
.FirstOrDefault(x => x.Id == newOrder.Id)
|
.Include(x => x.Implementer)
|
||||||
|
.FirstOrDefault(x => x.Id == newOrder.Id)
|
||||||
?.GetViewModel;
|
?.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +148,8 @@ namespace SecureShopDatabaseImplement.Implements
|
|||||||
return context.Orders
|
return context.Orders
|
||||||
.Include(x => x.Secure)
|
.Include(x => x.Secure)
|
||||||
.Include(x => x.Client)
|
.Include(x => x.Client)
|
||||||
.FirstOrDefault(x => x.Id == model.Id)
|
.Include(x => x.Implementer)
|
||||||
|
.FirstOrDefault(x => x.Id == model.Id)
|
||||||
?.GetViewModel;
|
?.GetViewModel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
72
Secure/SecureShopDatabaseImplement/Models/Implementer.cs
Normal file
72
Secure/SecureShopDatabaseImplement/Models/Implementer.cs
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
using SecureShopContracts.BindingModels;
|
||||||
|
using SecureShopContracts.ViewModels;
|
||||||
|
using SecureShopDataModels.Models;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace SecureShopDatabaseImplement.Models
|
||||||
|
{
|
||||||
|
public class Implementer : IImplementerModel
|
||||||
|
{
|
||||||
|
[Required]
|
||||||
|
public string ImplementerFIO { get; private set; } = string.Empty;
|
||||||
|
[Required]
|
||||||
|
public string Password { get; private set; } = string.Empty;
|
||||||
|
[Required]
|
||||||
|
public int WorkExperience { get; private set; }
|
||||||
|
[Required]
|
||||||
|
public int Qualification { get; private set; }
|
||||||
|
[Required]
|
||||||
|
public int Id { get; private set; }
|
||||||
|
[ForeignKey("ImplementerId")]
|
||||||
|
public virtual List<Order> Orders { get; set; } = new();
|
||||||
|
public static Implementer? Create(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Implementer()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
ImplementerFIO = model.ImplementerFIO,
|
||||||
|
Qualification = model.Qualification,
|
||||||
|
WorkExperience = model.WorkExperience,
|
||||||
|
Password = model.Password
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Implementer Create(ImplementerViewModel model)
|
||||||
|
{
|
||||||
|
return new Implementer
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
ImplementerFIO = model.ImplementerFIO,
|
||||||
|
Qualification = model.Qualification,
|
||||||
|
WorkExperience = model.WorkExperience,
|
||||||
|
Password = model.Password
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ImplementerFIO = model.ImplementerFIO;
|
||||||
|
Password = model.Password;
|
||||||
|
Qualification = model.Qualification;
|
||||||
|
WorkExperience = model.WorkExperience;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
ImplementerFIO = ImplementerFIO,
|
||||||
|
Qualification = Qualification,
|
||||||
|
WorkExperience = WorkExperience,
|
||||||
|
Password = Password
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
using SecureShopContracts.BindingModels;
|
using SecureShopDatabaseImplement.Models;
|
||||||
|
using SecureShopContracts.BindingModels;
|
||||||
using SecureShopContracts.ViewModels;
|
using SecureShopContracts.ViewModels;
|
||||||
using SecureShopDataModels.Enums;
|
using SecureShopDataModels.Enums;
|
||||||
using SecureShopDataModels.Models;
|
using SecureShopDataModels.Models;
|
||||||
@ -14,6 +15,8 @@ namespace SecureShopDatabaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public int ClientId { get; set; }
|
public int ClientId { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
|
public int? ImplementerId { get; set; }
|
||||||
|
[Required]
|
||||||
public int Count { get; set; }
|
public int Count { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public double Sum { get; set; }
|
public double Sum { get; set; }
|
||||||
@ -27,6 +30,8 @@ namespace SecureShopDatabaseImplement.Models
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public virtual Secure Secure { get; set; }
|
public virtual Secure Secure { get; set; }
|
||||||
public virtual Client Client { get; set; }
|
public virtual Client Client { get; set; }
|
||||||
|
public virtual Implementer? Implementer { get; set; }
|
||||||
|
|
||||||
public static Order? Create(OrderBindingModel? model)
|
public static Order? Create(OrderBindingModel? model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
@ -38,6 +43,7 @@ namespace SecureShopDatabaseImplement.Models
|
|||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
SecureId = model.SecureId,
|
SecureId = model.SecureId,
|
||||||
ClientId = model.ClientId,
|
ClientId = model.ClientId,
|
||||||
|
ImplementerId = model.ImplementerId,
|
||||||
Count = model.Count,
|
Count = model.Count,
|
||||||
Sum = model.Sum,
|
Sum = model.Sum,
|
||||||
Status = model.Status,
|
Status = model.Status,
|
||||||
@ -54,6 +60,7 @@ namespace SecureShopDatabaseImplement.Models
|
|||||||
}
|
}
|
||||||
Status = model.Status;
|
Status = model.Status;
|
||||||
DateImplement = model.DateImplement;
|
DateImplement = model.DateImplement;
|
||||||
|
ImplementerId = model.ImplementerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel GetViewModel => new()
|
public OrderViewModel GetViewModel => new()
|
||||||
@ -61,6 +68,7 @@ namespace SecureShopDatabaseImplement.Models
|
|||||||
Id = Id,
|
Id = Id,
|
||||||
SecureId = SecureId,
|
SecureId = SecureId,
|
||||||
ClientId = ClientId,
|
ClientId = ClientId,
|
||||||
|
ImplementerId = ImplementerId,
|
||||||
Count = Count,
|
Count = Count,
|
||||||
Sum = Sum,
|
Sum = Sum,
|
||||||
Status = Status,
|
Status = Status,
|
||||||
|
@ -23,5 +23,7 @@ namespace SecureShopDatabaseImplement
|
|||||||
public virtual DbSet<Order> Orders { set; get; }
|
public virtual DbSet<Order> Orders { set; get; }
|
||||||
|
|
||||||
public virtual DbSet<Client> Clients { set; get; }
|
public virtual DbSet<Client> Clients { set; get; }
|
||||||
|
|
||||||
|
public virtual DbSet<Implementer> Implementers { set; get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ namespace SecureShopFileImplement.Models
|
|||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
public int SecureId { get; private set; }
|
public int SecureId { get; private set; }
|
||||||
public int ClientId { get; private set; }
|
public int ClientId { get; private set; }
|
||||||
|
public int? ImplementerId { get; private set; }
|
||||||
public int Count { get; private set; }
|
public int Count { get; private set; }
|
||||||
public double Sum { get; private set; }
|
public double Sum { get; private set; }
|
||||||
public OrderStatus Status { get; private set; }
|
public OrderStatus Status { get; private set; }
|
||||||
@ -88,5 +89,7 @@ namespace SecureShopFileImplement.Models
|
|||||||
|
|
||||||
public XElement GetXElement => new("Order", new XAttribute("Id", Id), new XElement("SecureId", SecureId.ToString()), new XElement("ClientId", ClientId.ToString()), new XElement("Count", Count.ToString()), new XElement("Sum", Sum.ToString()), new XElement("Status", Status.ToString()), new XElement("DateCreate", DateCreate.ToString()), new XElement("DateImplement", DateImplement.ToString())
|
public XElement GetXElement => new("Order", new XAttribute("Id", Id), new XElement("SecureId", SecureId.ToString()), new XElement("ClientId", ClientId.ToString()), new XElement("Count", Count.ToString()), new XElement("Sum", Sum.ToString()), new XElement("Status", Status.ToString()), new XElement("DateCreate", DateCreate.ToString()), new XElement("DateImplement", DateImplement.ToString())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,6 +9,7 @@ namespace SecureShopListImplement
|
|||||||
public List<Order> Orders { get; set; }
|
public List<Order> Orders { get; set; }
|
||||||
public List<Secure> Secures { get; set; }
|
public List<Secure> Secures { get; set; }
|
||||||
public List<Client> Clients { get; set; }
|
public List<Client> Clients { get; set; }
|
||||||
|
public List<Implementer> Implementers { get; set; }
|
||||||
|
|
||||||
private DataListSingleton()
|
private DataListSingleton()
|
||||||
{
|
{
|
||||||
@ -16,6 +17,7 @@ namespace SecureShopListImplement
|
|||||||
Orders = new List<Order>();
|
Orders = new List<Order>();
|
||||||
Secures = new List<Secure>();
|
Secures = new List<Secure>();
|
||||||
Clients = new List<Client>();
|
Clients = new List<Client>();
|
||||||
|
Implementers = new();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DataListSingleton GetInstance()
|
public static DataListSingleton GetInstance()
|
||||||
|
113
Secure/SecureShopListImplement/Implements/ImplementerStorage.cs
Normal file
113
Secure/SecureShopListImplement/Implements/ImplementerStorage.cs
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
using SecureShopContracts.BindingModels;
|
||||||
|
using SecureShopContracts.SearchModels;
|
||||||
|
using SecureShopContracts.StoragesContracts;
|
||||||
|
using SecureShopContracts.ViewModels;
|
||||||
|
using SecureShopListImplement.Models;
|
||||||
|
|
||||||
|
namespace SecureShopListImplement.Implements
|
||||||
|
{
|
||||||
|
internal class ImplementerStorage : IImplementerStorage
|
||||||
|
{
|
||||||
|
private readonly DataListSingleton _source;
|
||||||
|
|
||||||
|
public ImplementerStorage()
|
||||||
|
{
|
||||||
|
_source = DataListSingleton.GetInstance();
|
||||||
|
}
|
||||||
|
public ImplementerViewModel? Delete(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _source.Implementers.Count; ++i)
|
||||||
|
{
|
||||||
|
if (_source.Implementers[i].Id == model.Id)
|
||||||
|
{
|
||||||
|
var element = _source.Implementers[i];
|
||||||
|
_source.Implementers.RemoveAt(i);
|
||||||
|
return element.GetViewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel? GetElement(ImplementerSearchModel model)
|
||||||
|
{
|
||||||
|
foreach (var elem in _source.Implementers)
|
||||||
|
{
|
||||||
|
if (model.Id.HasValue && model.Id == elem.Id)
|
||||||
|
return elem.GetViewModel;
|
||||||
|
if (!string.IsNullOrEmpty(model.ImplementerFIO) && !string.IsNullOrEmpty(model.Password) && elem.ImplementerFIO == model.ImplementerFIO && elem.Password == model.Password)
|
||||||
|
return elem.GetViewModel;
|
||||||
|
if (!string.IsNullOrEmpty(model.ImplementerFIO) && model.ImplementerFIO == elem.ImplementerFIO)
|
||||||
|
return elem.GetViewModel;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ImplementerViewModel> GetFilteredList(ImplementerSearchModel model)
|
||||||
|
{
|
||||||
|
var result = new List<ImplementerViewModel>();
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(model.ImplementerFIO) && !model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if (model.Id.HasValue)
|
||||||
|
{
|
||||||
|
var implementer = GetElement(model);
|
||||||
|
return implementer == null ? result : new() { implementer };
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(model.ImplementerFIO))
|
||||||
|
{
|
||||||
|
foreach (var implementer in _source.Implementers)
|
||||||
|
{
|
||||||
|
if (implementer.ImplementerFIO.Contains(model.ImplementerFIO))
|
||||||
|
{
|
||||||
|
result.Add(implementer.GetViewModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ImplementerViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
var result = new List<ImplementerViewModel>();
|
||||||
|
foreach (var implementer in _source.Implementers)
|
||||||
|
{
|
||||||
|
result.Add(implementer.GetViewModel);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel? Insert(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
model.Id = 1;
|
||||||
|
foreach (var implementer in _source.Implementers)
|
||||||
|
{
|
||||||
|
if (model.Id <= implementer.Id)
|
||||||
|
{
|
||||||
|
model.Id = implementer.Id + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var newImplementer = Implementer.Create(model);
|
||||||
|
if (newImplementer == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
_source.Implementers.Add(newImplementer);
|
||||||
|
return newImplementer.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel? Update(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
foreach (var implementer in _source.Implementers)
|
||||||
|
{
|
||||||
|
if (implementer.Id == model.Id)
|
||||||
|
{
|
||||||
|
implementer.Update(model);
|
||||||
|
return implementer.GetViewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
55
Secure/SecureShopListImplement/Models/Implementer.cs
Normal file
55
Secure/SecureShopListImplement/Models/Implementer.cs
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
using SecureShopContracts.BindingModels;
|
||||||
|
using SecureShopContracts.ViewModels;
|
||||||
|
using SecureShopDataModels.Models;
|
||||||
|
|
||||||
|
namespace SecureShopListImplement.Models
|
||||||
|
{
|
||||||
|
public class Implementer : IImplementerModel
|
||||||
|
{
|
||||||
|
public string ImplementerFIO { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Password { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
public int WorkExperience { get; private set; }
|
||||||
|
|
||||||
|
public int Qualification { get; private set; }
|
||||||
|
|
||||||
|
public int Id { get; private set; }
|
||||||
|
public static Implementer? Create(ImplementerBindingModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Implementer()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
ImplementerFIO = model.ImplementerFIO,
|
||||||
|
Qualification = model.Qualification,
|
||||||
|
WorkExperience = model.WorkExperience,
|
||||||
|
Password = model.Password
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(ImplementerBindingModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ImplementerFIO = model.ImplementerFIO;
|
||||||
|
Password = model.Password;
|
||||||
|
WorkExperience = model.WorkExperience;
|
||||||
|
Qualification = model.Qualification;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
ImplementerFIO = ImplementerFIO,
|
||||||
|
Password = Password,
|
||||||
|
Qualification = Qualification,
|
||||||
|
WorkExperience = WorkExperience
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -10,6 +10,7 @@ namespace SecureShopListImplement.Models
|
|||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
public int SecureId { get; private set; }
|
public int SecureId { get; private set; }
|
||||||
public int ClientId { get; private set; }
|
public int ClientId { get; private set; }
|
||||||
|
public int? ImplementerId { get; private set; }
|
||||||
public int Count { get; private set; }
|
public int Count { get; private set; }
|
||||||
public double Sum { get; private set; }
|
public double Sum { get; private set; }
|
||||||
public OrderStatus Status { get; private set; }
|
public OrderStatus Status { get; private set; }
|
||||||
@ -27,6 +28,7 @@ namespace SecureShopListImplement.Models
|
|||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
SecureId = model.SecureId,
|
SecureId = model.SecureId,
|
||||||
Count = model.Count,
|
Count = model.Count,
|
||||||
|
ImplementerId = model.ImplementerId,
|
||||||
Sum = model.Sum,
|
Sum = model.Sum,
|
||||||
Status = model.Status,
|
Status = model.Status,
|
||||||
DateCreate = model.DateCreate,
|
DateCreate = model.DateCreate,
|
||||||
@ -42,6 +44,7 @@ namespace SecureShopListImplement.Models
|
|||||||
}
|
}
|
||||||
SecureId = model.SecureId;
|
SecureId = model.SecureId;
|
||||||
Count = model.Count;
|
Count = model.Count;
|
||||||
|
ImplementerId = model.ImplementerId;
|
||||||
Sum = model.Sum;
|
Sum = model.Sum;
|
||||||
Status = model.Status;
|
Status = model.Status;
|
||||||
DateCreate = model.DateCreate;
|
DateCreate = model.DateCreate;
|
||||||
@ -52,6 +55,7 @@ namespace SecureShopListImplement.Models
|
|||||||
{
|
{
|
||||||
Id = Id,
|
Id = Id,
|
||||||
SecureId = SecureId,
|
SecureId = SecureId,
|
||||||
|
ImplementerId = ImplementerId,
|
||||||
Count = Count,
|
Count = Count,
|
||||||
Sum = Sum,
|
Sum = Sum,
|
||||||
Status = Status,
|
Status = Status,
|
||||||
|
@ -0,0 +1,99 @@
|
|||||||
|
using SecureShopContracts.BindingModels;
|
||||||
|
using SecureShopContracts.BusinessLogicsContracts;
|
||||||
|
using SecureShopContracts.SearchModels;
|
||||||
|
using SecureShopContracts.ViewModels;
|
||||||
|
using SecureShopDataModels.Enums;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace SecureShopRestApi.Controllers
|
||||||
|
{
|
||||||
|
[Route("api/[controller]/[action]")]
|
||||||
|
[ApiController]
|
||||||
|
public class ImplementerController : Controller
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IOrderLogic _order;
|
||||||
|
private readonly IImplementerLogic _logic;
|
||||||
|
public ImplementerController(IOrderLogic order, IImplementerLogic logic, ILogger<ImplementerController> logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_order = order;
|
||||||
|
_logic = logic;
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public ImplementerViewModel? Login(string login, string password)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return _logic.ReadElement(new ImplementerSearchModel
|
||||||
|
{
|
||||||
|
ImplementerFIO = login,
|
||||||
|
Password = password
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка авторизации сотрудника");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public List<OrderViewModel>? GetNewOrders()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return _order.ReadList(new OrderSearchModel
|
||||||
|
{
|
||||||
|
Status = OrderStatus.Принят
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка получения новых заказов");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public OrderViewModel? GetImplementerOrder(int implementerId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return _order.ReadElement(new OrderSearchModel
|
||||||
|
{
|
||||||
|
ImplementerId = implementerId
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка получения текущего заказа исполнителя");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void TakeOrderInWork(OrderBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_order.TakeOrderInWork(model);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка перевода заказа с №{Id} в работу", model.Id);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void FinishOrder(OrderBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_order.OrderReady(model);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка отметки о готовности заказа с №{ Id}", model.Id);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,7 +3,6 @@ using SecureShopContracts.BusinessLogicsContracts;
|
|||||||
using SecureShopContracts.StoragesContracts;
|
using SecureShopContracts.StoragesContracts;
|
||||||
using SecureShopDatabaseImplement.Implements;
|
using SecureShopDatabaseImplement.Implements;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
||||||
@ -13,10 +12,12 @@ builder.Logging.AddLog4Net("log4net.config");
|
|||||||
builder.Services.AddTransient<IClientStorage, ClientStorage>();
|
builder.Services.AddTransient<IClientStorage, ClientStorage>();
|
||||||
builder.Services.AddTransient<IOrderStorage, OrderStorage>();
|
builder.Services.AddTransient<IOrderStorage, OrderStorage>();
|
||||||
builder.Services.AddTransient<ISecureStorage, SecureStorage>();
|
builder.Services.AddTransient<ISecureStorage, SecureStorage>();
|
||||||
|
builder.Services.AddTransient<IImplementerStorage, ImplementerStorage>();
|
||||||
|
|
||||||
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
|
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
|
||||||
builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
||||||
builder.Services.AddTransient<ISecureLogic, SecureLogic>();
|
builder.Services.AddTransient<ISecureLogic, SecureLogic>();
|
||||||
|
builder.Services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
||||||
|
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||||
|
Loading…
x
Reference in New Issue
Block a user