This commit is contained in:
ker73rus 2023-05-04 12:05:23 +04:00
parent a3391fbfec
commit 506bf098cf
14 changed files with 474 additions and 395 deletions

View File

@ -1,152 +1,176 @@
namespace SecureShopView
{
partial class FormCreateOrder
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
partial class FormCreateOrder
{
/// <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);
}
/// <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
#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.labelName = new System.Windows.Forms.Label();
this.labelCount = new System.Windows.Forms.Label();
this.labelSum = new System.Windows.Forms.Label();
this.comboBoxSecure = new System.Windows.Forms.ComboBox();
this.textBoxCount = new System.Windows.Forms.TextBox();
this.textBoxSum = new System.Windows.Forms.TextBox();
this.buttonSave = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// labelName
//
this.labelName.AutoSize = true;
this.labelName.Location = new System.Drawing.Point(12, 18);
this.labelName.Name = "labelName";
this.labelName.Size = new System.Drawing.Size(136, 15);
this.labelName.TabIndex = 0;
this.labelName.Text = "Система безопасности:";
//
// labelCount
//
this.labelCount.AutoSize = true;
this.labelCount.Location = new System.Drawing.Point(12, 53);
this.labelCount.Name = "labelCount";
this.labelCount.Size = new System.Drawing.Size(75, 15);
this.labelCount.TabIndex = 1;
this.labelCount.Text = "Количество:";
//
// labelSum
//
this.labelSum.AutoSize = true;
this.labelSum.Location = new System.Drawing.Point(12, 87);
this.labelSum.Name = "labelSum";
this.labelSum.Size = new System.Drawing.Size(48, 15);
this.labelSum.TabIndex = 2;
this.labelSum.Text = "Сумма:";
//
// comboBoxSecure
//
this.comboBoxSecure.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxSecure.FormattingEnabled = true;
this.comboBoxSecure.Location = new System.Drawing.Point(150, 15);
this.comboBoxSecure.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.comboBoxSecure.Name = "comboBoxSecure";
this.comboBoxSecure.Size = new System.Drawing.Size(230, 23);
this.comboBoxSecure.TabIndex = 3;
this.comboBoxSecure.SelectedIndexChanged += new System.EventHandler(this.ComboBoxSecure_SelectedIndexChanged);
//
// textBoxCount
//
this.textBoxCount.Location = new System.Drawing.Point(150, 50);
this.textBoxCount.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.textBoxCount.Name = "textBoxCount";
this.textBoxCount.Size = new System.Drawing.Size(230, 23);
this.textBoxCount.TabIndex = 4;
this.textBoxCount.TextChanged += new System.EventHandler(this.TextBoxCount_TextChanged);
//
// textBoxSum
//
this.textBoxSum.Enabled = false;
this.textBoxSum.Location = new System.Drawing.Point(150, 84);
this.textBoxSum.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.textBoxSum.Name = "textBoxSum";
this.textBoxSum.Size = new System.Drawing.Size(230, 23);
this.textBoxSum.TabIndex = 5;
//
// buttonSave
//
this.buttonSave.Location = new System.Drawing.Point(209, 123);
this.buttonSave.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonSave.Name = "buttonSave";
this.buttonSave.Size = new System.Drawing.Size(82, 22);
this.buttonSave.TabIndex = 6;
this.buttonSave.Text = "Сохранить";
this.buttonSave.UseVisualStyleBackColor = true;
this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
//
// buttonCancel
//
this.buttonCancel.Location = new System.Drawing.Point(297, 123);
this.buttonCancel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(82, 22);
this.buttonCancel.TabIndex = 7;
this.buttonCancel.Text = "Отмена";
this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
//
// FormCreateOrder
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(394, 159);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonSave);
this.Controls.Add(this.textBoxSum);
this.Controls.Add(this.textBoxCount);
this.Controls.Add(this.comboBoxSecure);
this.Controls.Add(this.labelSum);
this.Controls.Add(this.labelCount);
this.Controls.Add(this.labelName);
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.Name = "FormCreateOrder";
this.Text = "Заказ";
this.Load += new System.EventHandler(this.FormCreateOrder_Load);
this.ResumeLayout(false);
this.PerformLayout();
/// <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();
labelCount = new Label();
labelSum = new Label();
comboBoxSecure = new ComboBox();
textBoxCount = new TextBox();
textBoxSum = new TextBox();
buttonSave = new Button();
buttonCancel = new Button();
labelClient = new Label();
comboBoxClient = new ComboBox();
SuspendLayout();
//
// labelName
//
labelName.AutoSize = true;
labelName.Location = new Point(26, 15);
labelName.Name = "labelName";
labelName.Size = new Size(77, 15);
labelName.TabIndex = 0;
labelName.Text = "Мороженое:";
//
// labelCount
//
labelCount.AutoSize = true;
labelCount.Location = new Point(26, 52);
labelCount.Name = "labelCount";
labelCount.Size = new Size(75, 15);
labelCount.TabIndex = 1;
labelCount.Text = "Количество:";
//
// labelSum
//
labelSum.AutoSize = true;
labelSum.Location = new Point(26, 89);
labelSum.Name = "labelSum";
labelSum.Size = new Size(48, 15);
labelSum.TabIndex = 2;
labelSum.Text = "Сумма:";
//
// comboBoxSecure
//
comboBoxSecure.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxSecure.FormattingEnabled = true;
comboBoxSecure.Location = new Point(150, 15);
comboBoxSecure.Margin = new Padding(3, 2, 3, 2);
comboBoxSecure.Name = "comboBoxSecure";
comboBoxSecure.Size = new Size(230, 23);
comboBoxSecure.TabIndex = 3;
comboBoxSecure.SelectedIndexChanged += ComboBoxSecure_SelectedIndexChanged;
//
// textBoxCount
//
textBoxCount.Location = new Point(150, 50);
textBoxCount.Margin = new Padding(3, 2, 3, 2);
textBoxCount.Name = "textBoxCount";
textBoxCount.Size = new Size(230, 23);
textBoxCount.TabIndex = 4;
textBoxCount.TextChanged += TextBoxCount_TextChanged;
//
// textBoxSum
//
textBoxSum.Enabled = false;
textBoxSum.Location = new Point(150, 84);
textBoxSum.Margin = new Padding(3, 2, 3, 2);
textBoxSum.Name = "textBoxSum";
textBoxSum.Size = new Size(230, 23);
textBoxSum.TabIndex = 5;
//
// buttonSave
//
buttonSave.Location = new Point(212, 159);
buttonSave.Margin = new Padding(3, 2, 3, 2);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(82, 22);
buttonSave.TabIndex = 6;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// buttonCancel
//
buttonCancel.Location = new Point(300, 159);
buttonCancel.Margin = new Padding(3, 2, 3, 2);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(82, 22);
buttonCancel.TabIndex = 7;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click;
//
// labelClient
//
labelClient.AutoSize = true;
labelClient.Location = new Point(26, 129);
labelClient.Name = "labelClient";
labelClient.Size = new Size(49, 15);
labelClient.TabIndex = 8;
labelClient.Text = "Клиент:";
//
// comboBoxClient
//
comboBoxClient.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxClient.FormattingEnabled = true;
comboBoxClient.Location = new Point(150, 121);
comboBoxClient.Margin = new Padding(3, 2, 3, 2);
comboBoxClient.Name = "comboBoxClient";
comboBoxClient.Size = new Size(230, 23);
comboBoxClient.TabIndex = 9;
//
// FormCreateOrder
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(394, 192);
Controls.Add(comboBoxClient);
Controls.Add(labelClient);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(textBoxSum);
Controls.Add(textBoxCount);
Controls.Add(comboBoxSecure);
Controls.Add(labelSum);
Controls.Add(labelCount);
Controls.Add(labelName);
Margin = new Padding(3, 2, 3, 2);
Name = "FormCreateOrder";
Text = "Заказ";
Load += FormCreateOrder_Load;
ResumeLayout(false);
PerformLayout();
}
}
#endregion
#endregion
private Label labelName;
private Label labelCount;
private Label labelSum;
private ComboBox comboBoxSecure;
private TextBox textBoxCount;
private TextBox textBoxSum;
private Button buttonSave;
private Button buttonCancel;
}
private Label labelName;
private Label labelCount;
private Label labelSum;
private ComboBox comboBoxSecure;
private TextBox textBoxCount;
private TextBox textBoxSum;
private Button buttonSave;
private Button buttonCancel;
private Label labelClient;
private ComboBox comboBoxClient;
}
}

View File

@ -5,114 +5,139 @@ using Microsoft.Extensions.Logging;
namespace SecureShopView
{
public partial class FormCreateOrder : Form
{
private readonly ILogger _logger;
private readonly ISecureLogic _logicI;
private readonly IOrderLogic _logicO;
public partial class FormCreateOrder : Form
{
private readonly ILogger _logger;
private readonly ISecureLogic _logicI;
private readonly IOrderLogic _logicO;
private readonly IClientLogic _logicC;
public FormCreateOrder(ILogger<FormCreateOrder> logger, ISecureLogic logicI, IOrderLogic logicO)
{
InitializeComponent();
_logger = logger;
_logicI = logicI;
_logicO = logicO;
}
public FormCreateOrder(ILogger<FormCreateOrder> logger, ISecureLogic logicI, IOrderLogic logicO, IClientLogic logicC)
{
InitializeComponent();
_logger = logger;
_logicI = logicI;
_logicO = logicO;
_logicC = logicC;
}
private void FormCreateOrder_Load(object sender, EventArgs e)
{
_logger.LogInformation("Загрузка списка мороженого для заказа");
try
{
var list = _logicI.ReadList(null);
if (list != null)
{
comboBoxSecure.DisplayMember = "SecureName";
comboBoxSecure.ValueMember = "Id";
comboBoxSecure.DataSource = list;
comboBoxSecure.SelectedItem = null;
}
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка загрузки списка мороженого");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void FormCreateOrder_Load(object sender, EventArgs e)
{
_logger.LogInformation("Загрузка списка мороженого для заказа");
try
{
var list = _logicI.ReadList(null);
if (list != null)
{
comboBoxSecure.DisplayMember = "SecureName";
comboBoxSecure.ValueMember = "Id";
comboBoxSecure.DataSource = list;
comboBoxSecure.SelectedItem = null;
}
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка загрузки списка мороженого");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
_logger.LogInformation("Загрузка списка клиентов для заказа");
try
{
var list = _logicC.ReadList(null);
if (list != null)
{
comboBoxClient.DisplayMember = "ClientFIO";
comboBoxClient.ValueMember = "Id";
comboBoxClient.DataSource = list;
comboBoxClient.SelectedItem = null;
}
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка загрузки списка клиентов");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void CalcSum()
{
if (comboBoxSecure.SelectedValue != null && !string.IsNullOrEmpty(textBoxCount.Text))
{
try
{
int id = Convert.ToInt32(comboBoxSecure.SelectedValue);
var Secure = _logicI.ReadElement(new SecureSearchModel
{
Id = id
});
int count = Convert.ToInt32(textBoxCount.Text);
textBoxSum.Text = Math.Round(count * (Secure?.Price ?? 0), 2).ToString();
_logger.LogInformation("Расчет суммы заказа");
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка расчета суммы заказа");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void CalcSum()
{
if (comboBoxSecure.SelectedValue != null && !string.IsNullOrEmpty(textBoxCount.Text))
{
try
{
int id = Convert.ToInt32(comboBoxSecure.SelectedValue);
var secure = _logicI.ReadElement(new SecureSearchModel
{
Id = id
});
int count = Convert.ToInt32(textBoxCount.Text);
textBoxSum.Text = Math.Round(count * (secure?.Price ?? 0), 2).ToString();
_logger.LogInformation("Расчет суммы заказа");
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка расчета суммы заказа");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void TextBoxCount_TextChanged(object sender, EventArgs e)
{
CalcSum();
}
private void TextBoxCount_TextChanged(object sender, EventArgs e)
{
CalcSum();
}
private void ComboBoxSecure_SelectedIndexChanged(object sender, EventArgs e)
{
CalcSum();
}
private void ComboBoxSecure_SelectedIndexChanged(object sender, EventArgs e)
{
CalcSum();
}
private void ButtonSave_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(textBoxCount.Text))
{
MessageBox.Show("Заполните поле Количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (comboBoxSecure.SelectedValue == null)
{
MessageBox.Show("Выберите мороженое", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
_logger.LogInformation("Создание заказа");
try
{
var operationResult = _logicO.CreateOrder(new OrderBindingModel
{
SecureId = Convert.ToInt32(comboBoxSecure.SelectedValue),
Count = Convert.ToInt32(textBoxCount.Text),
Sum = Convert.ToDouble(textBoxSum.Text)
});
if (!operationResult)
{
throw new Exception("Ошибка при создании заказа. Дополнительная информация в логах.");
}
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
DialogResult = DialogResult.OK;
Close();
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка создания заказа");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonSave_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(textBoxCount.Text))
{
MessageBox.Show("Заполните поле Количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (comboBoxSecure.SelectedValue == null)
{
MessageBox.Show("Выберите мороженое", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (comboBoxClient.SelectedValue == null)
{
MessageBox.Show("Выберите клиента", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
_logger.LogInformation("Создание заказа");
try
{
var operationResult = _logicO.CreateOrder(new OrderBindingModel
{
SecureId = Convert.ToInt32(comboBoxSecure.SelectedValue),
ClientId = Convert.ToInt32(comboBoxClient.SelectedValue),
Count = Convert.ToInt32(textBoxCount.Text),
Sum = Convert.ToDouble(textBoxSum.Text)
});
if (!operationResult)
{
throw new Exception("Ошибка при создании заказа. Дополнительная информация в логах.");
}
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
DialogResult = DialogResult.OK;
Close();
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка создания заказа");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
}
private void ButtonCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
}
}

View File

@ -28,180 +28,180 @@
/// </summary>
private void InitializeComponent()
{
this.menuStrip = new System.Windows.Forms.MenuStrip();
this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.FacilitiesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SecuresToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.отчётыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SecuresReportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SecureFacilitiesReportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.OrdersReportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.dataGridView = new System.Windows.Forms.DataGridView();
this.buttonCreateOrder = new System.Windows.Forms.Button();
this.buttonTakeOrderInWork = new System.Windows.Forms.Button();
this.buttonOrderReady = new System.Windows.Forms.Button();
this.buttonIssuedOrder = new System.Windows.Forms.Button();
this.buttonRef = new System.Windows.Forms.Button();
this.menuStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.SuspendLayout();
menuStrip = new MenuStrip();
справочникиToolStripMenuItem = new ToolStripMenuItem();
FacilitiesToolStripMenuItem = new ToolStripMenuItem();
SecuresToolStripMenuItem = new ToolStripMenuItem();
ClientsToolStripMenuItem = new ToolStripMenuItem();
отчётыToolStripMenuItem = new ToolStripMenuItem();
SecuresReportToolStripMenuItem = new ToolStripMenuItem();
SecureFacilitiesReportToolStripMenuItem = new ToolStripMenuItem();
OrdersReportToolStripMenuItem = new ToolStripMenuItem();
dataGridView = new DataGridView();
buttonCreateOrder = new Button();
buttonTakeOrderInWork = new Button();
buttonOrderReady = new Button();
buttonIssuedOrder = new Button();
buttonRef = new Button();
menuStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// menuStrip
//
this.menuStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.справочникиToolStripMenuItem,
this.отчётыToolStripMenuItem});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
this.menuStrip.Padding = new System.Windows.Forms.Padding(5, 2, 0, 2);
this.menuStrip.Size = new System.Drawing.Size(997, 24);
this.menuStrip.TabIndex = 0;
this.menuStrip.Text = "Справочники";
menuStrip.ImageScalingSize = new Size(20, 20);
menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, отчётыToolStripMenuItem });
menuStrip.Location = new Point(0, 0);
menuStrip.Name = "menuStrip";
menuStrip.Padding = new Padding(5, 2, 0, 2);
menuStrip.Size = new Size(997, 24);
menuStrip.TabIndex = 0;
menuStrip.Text = "Справочники";
//
// справочникиToolStripMenuItem
//
this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.FacilitiesToolStripMenuItem,
this.SecuresToolStripMenuItem});
this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(94, 20);
this.справочникиToolStripMenuItem.Text = "Справочники";
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { FacilitiesToolStripMenuItem, SecuresToolStripMenuItem, ClientsToolStripMenuItem });
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
справочникиToolStripMenuItem.Size = new Size(94, 20);
справочникиToolStripMenuItem.Text = "Справочники";
//
// FacilitiesToolStripMenuItem
//
this.FacilitiesToolStripMenuItem.Name = "FacilitiesToolStripMenuItem";
this.FacilitiesToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
this.FacilitiesToolStripMenuItem.Text = "Оборудование";
this.FacilitiesToolStripMenuItem.Click += new System.EventHandler(this.FacilitiesToolStripMenuItem_Click);
FacilitiesToolStripMenuItem.Name = "FacilitiesToolStripMenuItem";
FacilitiesToolStripMenuItem.Size = new Size(203, 22);
FacilitiesToolStripMenuItem.Text = "Оборудование";
FacilitiesToolStripMenuItem.Click += FacilitiesToolStripMenuItem_Click;
//
// SecuresToolStripMenuItem
//
this.SecuresToolStripMenuItem.Name = "SecuresToolStripMenuItem";
this.SecuresToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
this.SecuresToolStripMenuItem.Text = "Системы безопасности";
this.SecuresToolStripMenuItem.Click += new System.EventHandler(this.SecuresToolStripMenuItem_Click);
SecuresToolStripMenuItem.Name = "SecuresToolStripMenuItem";
SecuresToolStripMenuItem.Size = new Size(203, 22);
SecuresToolStripMenuItem.Text = "Системы безопасности";
SecuresToolStripMenuItem.Click += SecuresToolStripMenuItem_Click;
//
// ClientsToolStripMenuItem
//
ClientsToolStripMenuItem.Name = "ClientsToolStripMenuItem";
ClientsToolStripMenuItem.Size = new Size(203, 22);
ClientsToolStripMenuItem.Text = "Клиенты";
ClientsToolStripMenuItem.Click += ClientsToolStripMenuItem_Click;
//
// отчётыToolStripMenuItem
//
this.отчётыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.SecuresReportToolStripMenuItem,
this.SecureFacilitiesReportToolStripMenuItem,
this.OrdersReportToolStripMenuItem});
this.отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
this.отчётыToolStripMenuItem.Size = new System.Drawing.Size(60, 20);
this.отчётыToolStripMenuItem.Text = "Отчёты";
отчётыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { SecuresReportToolStripMenuItem, SecureFacilitiesReportToolStripMenuItem, OrdersReportToolStripMenuItem });
отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
отчётыToolStripMenuItem.Size = new Size(60, 20);
отчётыToolStripMenuItem.Text = "Отчёты";
//
// SecuresReportToolStripMenuItem
//
this.SecuresReportToolStripMenuItem.Name = "SecuresReportToolStripMenuItem";
this.SecuresReportToolStripMenuItem.Size = new System.Drawing.Size(236, 22);
this.SecuresReportToolStripMenuItem.Text = "Список систем безопасности";
this.SecuresReportToolStripMenuItem.Click += new System.EventHandler(this.SecuresReportToolStripMenuItem_Click);
SecuresReportToolStripMenuItem.Name = "SecuresReportToolStripMenuItem";
SecuresReportToolStripMenuItem.Size = new Size(236, 22);
SecuresReportToolStripMenuItem.Text = "Список систем безопасности";
SecuresReportToolStripMenuItem.Click += SecuresReportToolStripMenuItem_Click;
//
// SecureFacilitiesReportToolStripMenuItem
//
this.SecureFacilitiesReportToolStripMenuItem.Name = "SecureFacilitiesReportToolStripMenuItem";
this.SecureFacilitiesReportToolStripMenuItem.Size = new System.Drawing.Size(236, 22);
this.SecureFacilitiesReportToolStripMenuItem.Text = "Оборудование по СБ";
this.SecureFacilitiesReportToolStripMenuItem.Click += new System.EventHandler(this.SecureFacilitiesReportToolStripMenuItem_Click);
SecureFacilitiesReportToolStripMenuItem.Name = "SecureFacilitiesReportToolStripMenuItem";
SecureFacilitiesReportToolStripMenuItem.Size = new Size(236, 22);
SecureFacilitiesReportToolStripMenuItem.Text = "Оборудование по СБ";
SecureFacilitiesReportToolStripMenuItem.Click += SecureFacilitiesReportToolStripMenuItem_Click;
//
// OrdersReportToolStripMenuItem
//
this.OrdersReportToolStripMenuItem.Name = "OrdersReportToolStripMenuItem";
this.OrdersReportToolStripMenuItem.Size = new System.Drawing.Size(236, 22);
this.OrdersReportToolStripMenuItem.Text = "Список заказов";
this.OrdersReportToolStripMenuItem.Click += new System.EventHandler(this.OrdersReportToolStripMenuItem_Click);
OrdersReportToolStripMenuItem.Name = "OrdersReportToolStripMenuItem";
OrdersReportToolStripMenuItem.Size = new Size(236, 22);
OrdersReportToolStripMenuItem.Text = "Список заказов";
OrdersReportToolStripMenuItem.Click += OrdersReportToolStripMenuItem_Click;
//
// dataGridView
//
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView.Location = new System.Drawing.Point(10, 23);
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(801, 305);
this.dataGridView.TabIndex = 1;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Location = new Point(10, 23);
dataGridView.Margin = new Padding(3, 2, 3, 2);
dataGridView.Name = "dataGridView";
dataGridView.RowHeadersWidth = 51;
dataGridView.RowTemplate.Height = 29;
dataGridView.Size = new Size(801, 305);
dataGridView.TabIndex = 1;
//
// buttonCreateOrder
//
this.buttonCreateOrder.Location = new System.Drawing.Point(816, 34);
this.buttonCreateOrder.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonCreateOrder.Name = "buttonCreateOrder";
this.buttonCreateOrder.Size = new System.Drawing.Size(170, 22);
this.buttonCreateOrder.TabIndex = 2;
this.buttonCreateOrder.Text = "Создать заказ";
this.buttonCreateOrder.UseVisualStyleBackColor = true;
this.buttonCreateOrder.Click += new System.EventHandler(this.ButtonCreateOrder_Click);
buttonCreateOrder.Location = new Point(816, 34);
buttonCreateOrder.Margin = new Padding(3, 2, 3, 2);
buttonCreateOrder.Name = "buttonCreateOrder";
buttonCreateOrder.Size = new Size(170, 22);
buttonCreateOrder.TabIndex = 2;
buttonCreateOrder.Text = "Создать заказ";
buttonCreateOrder.UseVisualStyleBackColor = true;
buttonCreateOrder.Click += ButtonCreateOrder_Click;
//
// buttonTakeOrderInWork
//
this.buttonTakeOrderInWork.Location = new System.Drawing.Point(816, 60);
this.buttonTakeOrderInWork.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
this.buttonTakeOrderInWork.Size = new System.Drawing.Size(170, 22);
this.buttonTakeOrderInWork.TabIndex = 3;
this.buttonTakeOrderInWork.Text = "Отдать на выполнение";
this.buttonTakeOrderInWork.UseVisualStyleBackColor = true;
this.buttonTakeOrderInWork.Click += new System.EventHandler(this.ButtonTakeOrderInWork_Click);
buttonTakeOrderInWork.Location = new Point(816, 60);
buttonTakeOrderInWork.Margin = new Padding(3, 2, 3, 2);
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
buttonTakeOrderInWork.Size = new Size(170, 22);
buttonTakeOrderInWork.TabIndex = 3;
buttonTakeOrderInWork.Text = "Отдать на выполнение";
buttonTakeOrderInWork.UseVisualStyleBackColor = true;
buttonTakeOrderInWork.Click += ButtonTakeOrderInWork_Click;
//
// buttonOrderReady
//
this.buttonOrderReady.Location = new System.Drawing.Point(816, 86);
this.buttonOrderReady.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonOrderReady.Name = "buttonOrderReady";
this.buttonOrderReady.Size = new System.Drawing.Size(170, 22);
this.buttonOrderReady.TabIndex = 4;
this.buttonOrderReady.Text = "Заказ готов";
this.buttonOrderReady.UseVisualStyleBackColor = true;
this.buttonOrderReady.Click += new System.EventHandler(this.ButtonOrderReady_Click);
buttonOrderReady.Location = new Point(816, 86);
buttonOrderReady.Margin = new Padding(3, 2, 3, 2);
buttonOrderReady.Name = "buttonOrderReady";
buttonOrderReady.Size = new Size(170, 22);
buttonOrderReady.TabIndex = 4;
buttonOrderReady.Text = "Заказ готов";
buttonOrderReady.UseVisualStyleBackColor = true;
buttonOrderReady.Click += ButtonOrderReady_Click;
//
// buttonIssuedOrder
//
this.buttonIssuedOrder.Location = new System.Drawing.Point(816, 112);
this.buttonIssuedOrder.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonIssuedOrder.Name = "buttonIssuedOrder";
this.buttonIssuedOrder.Size = new System.Drawing.Size(170, 22);
this.buttonIssuedOrder.TabIndex = 5;
this.buttonIssuedOrder.Text = "Заказ выдан";
this.buttonIssuedOrder.UseVisualStyleBackColor = true;
this.buttonIssuedOrder.Click += new System.EventHandler(this.ButtonIssuedOrder_Click);
buttonIssuedOrder.Location = new Point(816, 112);
buttonIssuedOrder.Margin = new Padding(3, 2, 3, 2);
buttonIssuedOrder.Name = "buttonIssuedOrder";
buttonIssuedOrder.Size = new Size(170, 22);
buttonIssuedOrder.TabIndex = 5;
buttonIssuedOrder.Text = "Заказ выдан";
buttonIssuedOrder.UseVisualStyleBackColor = true;
buttonIssuedOrder.Click += ButtonIssuedOrder_Click;
//
// buttonRef
//
this.buttonRef.Location = new System.Drawing.Point(816, 138);
this.buttonRef.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonRef.Name = "buttonRef";
this.buttonRef.Size = new System.Drawing.Size(170, 22);
this.buttonRef.TabIndex = 6;
this.buttonRef.Text = "Обновить";
this.buttonRef.UseVisualStyleBackColor = true;
this.buttonRef.Click += new System.EventHandler(this.ButtonRef_Click);
buttonRef.Location = new Point(816, 138);
buttonRef.Margin = new Padding(3, 2, 3, 2);
buttonRef.Name = "buttonRef";
buttonRef.Size = new Size(170, 22);
buttonRef.TabIndex = 6;
buttonRef.Text = "Обновить";
buttonRef.UseVisualStyleBackColor = true;
buttonRef.Click += ButtonRef_Click;
//
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(997, 338);
this.Controls.Add(this.buttonRef);
this.Controls.Add(this.buttonIssuedOrder);
this.Controls.Add(this.buttonOrderReady);
this.Controls.Add(this.buttonTakeOrderInWork);
this.Controls.Add(this.buttonCreateOrder);
this.Controls.Add(this.dataGridView);
this.Controls.Add(this.menuStrip);
this.MainMenuStrip = this.menuStrip;
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.Name = "FormMain";
this.Text = "Магазин систем безопасности";
this.Load += new System.EventHandler(this.FormMain_Load);
this.menuStrip.ResumeLayout(false);
this.menuStrip.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(997, 338);
Controls.Add(buttonRef);
Controls.Add(buttonIssuedOrder);
Controls.Add(buttonOrderReady);
Controls.Add(buttonTakeOrderInWork);
Controls.Add(buttonCreateOrder);
Controls.Add(dataGridView);
Controls.Add(menuStrip);
MainMenuStrip = menuStrip;
Margin = new Padding(3, 2, 3, 2);
Name = "FormMain";
Text = "Магазин систем безопасности";
Load += FormMain_Load;
menuStrip.ResumeLayout(false);
menuStrip.PerformLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
@ -220,5 +220,6 @@
private ToolStripMenuItem SecuresReportToolStripMenuItem;
private ToolStripMenuItem SecureFacilitiesReportToolStripMenuItem;
private ToolStripMenuItem OrdersReportToolStripMenuItem;
private ToolStripMenuItem ClientsToolStripMenuItem;
}
}

View File

@ -33,6 +33,7 @@ namespace SecureShopView
{
dataGridView.DataSource = list;
dataGridView.Columns["SecureId"].Visible = false;
dataGridView.Columns["ClientId"].Visible = false;
dataGridView.Columns["SecureName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
}
_logger.LogInformation("Загрузка заказов");
@ -184,5 +185,14 @@ namespace SecureShopView
form.ShowDialog();
}
}
private void ClientsToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormClients));
if (service is FormClients form)
{
form.ShowDialog();
}
}
}
}

View File

@ -60,7 +60,4 @@
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value>
</metadata>
</root>

View File

@ -49,10 +49,10 @@ namespace SecureShopBusinessLogic.BusinessLogics
Facilities = new List<(string, int)>(),
TotalCount = 0
};
foreach (var additive in secure.SecureFacilitiess)
foreach (var facilitie in secure.SecureFacilitiess)
{
record.Facilities.Add(new(additive.Value.Item1.FacilitiesName, additive.Value.Item2));
record.TotalCount += additive.Value.Item2;
record.Facilities.Add(new(facilitie.Value.Item1.FacilitiesName, facilitie.Value.Item2));
record.TotalCount += facilitie.Value.Item2;
}
list.Add(record);
}

View File

@ -3252,7 +3252,7 @@
var offset = popperOffsets[mainAxis];
var min$1 = popperOffsets[mainAxis] + overflow[mainSide];
var max$1 = popperOffsets[mainAxis] - overflow[altSide];
var additive = tether ? -popperRect[len] / 2 : 0;
var facilitie = tether ? -popperRect[len] / 2 : 0;
var minLen = variation === start ? referenceRect[len] : popperRect[len];
var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
// outside the reference bounds
@ -3271,8 +3271,8 @@
// width or height)
var arrowLen = within(0, referenceRect[len], arrowRect[len]);
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue;
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue;
var minOffset = isBasePlacement ? referenceRect[len] / 2 - facilitie - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue;
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + facilitie + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue;
var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -72,14 +72,14 @@ namespace SecureShopDatabaseImplement.Implements
public ClientViewModel? Update(ClientBindingModel model)
{
using var context = new SecureShopDatabase();
var additive = context.Clients.FirstOrDefault(x => x.Id == model.Id);
if (additive == null)
var facilitie = context.Clients.FirstOrDefault(x => x.Id == model.Id);
if (facilitie == null)
{
return null;
}
additive.Update(model);
facilitie.Update(model);
context.SaveChanges();
return additive.GetViewModel;
return facilitie.GetViewModel;
}
public ClientViewModel? Delete(ClientBindingModel model)

View File

@ -73,14 +73,14 @@ namespace SecureShopFileImplement.Implements
public ClientViewModel? Update(ClientBindingModel model)
{
var additive = _source.Clients.FirstOrDefault(x => x.Id == model.Id);
if (additive == null)
var facilitie = _source.Clients.FirstOrDefault(x => x.Id == model.Id);
if (facilitie == null)
{
return null;
}
additive.Update(model);
facilitie.Update(model);
_source.SaveClients();
return additive.GetViewModel;
return facilitie.GetViewModel;
}
public ClientViewModel? Delete(ClientBindingModel model)

View File

@ -8,12 +8,14 @@ namespace SecureShopListImplement
public List<Facilities> Facilitiess { get; set; }
public List<Order> Orders { get; set; }
public List<Secure> Secures { get; set; }
public List<Client> Clients { get; set; }
private DataListSingleton()
{
Facilitiess = new List<Facilities>();
Orders = new List<Order>();
Secures = new List<Secure>();
Clients = new List<Client>();
}
public static DataListSingleton GetInstance()

View File

@ -28,6 +28,17 @@ namespace SecureShopListImplement.Implements
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{
var result = new List<OrderViewModel>();
if (model.ClientId.HasValue)
{
foreach (var order in _source.Orders)
{
if (order.ClientId == model.ClientId)
{
result.Add(GetViewModel(order));
}
}
return result;
}
if (!model.Id.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue)
{
foreach (var order in _source.Orders)
@ -76,6 +87,14 @@ namespace SecureShopListImplement.Implements
break;
}
}
foreach (var client in _source.Clients)
{
if (client.Id == order.ClientId)
{
viewModel.ClientFIO = client.ClientFIO;
break;
}
}
return viewModel;
}

View File

@ -9,6 +9,7 @@ namespace SecureShopListImplement.Models
{
public int Id { get; private set; }
public int SecureId { get; private set; }
public int ClientId { get; private set; }
public int Count { get; private set; }
public double Sum { get; private set; }
public OrderStatus Status { get; private set; }