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 namespace SecureShopView
{ {
partial class FormCreateOrder partial class FormCreateOrder
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private System.ComponentModel.IContainer components = null;
/// <summary> /// <summary>
/// Clean up any resources being used. /// Clean up any resources being used.
/// </summary> /// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
} }
base.Dispose(disposing); base.Dispose(disposing);
} }
#region Windows Form Designer generated code #region Windows Form Designer generated code
/// <summary> /// <summary>
/// Required method for Designer support - do not modify /// Required method for Designer support - do not modify
/// the contents of this method with the code editor. /// the contents of this method with the code editor.
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.labelName = new System.Windows.Forms.Label(); labelName = new Label();
this.labelCount = new System.Windows.Forms.Label(); labelCount = new Label();
this.labelSum = new System.Windows.Forms.Label(); labelSum = new Label();
this.comboBoxSecure = new System.Windows.Forms.ComboBox(); comboBoxSecure = new ComboBox();
this.textBoxCount = new System.Windows.Forms.TextBox(); textBoxCount = new TextBox();
this.textBoxSum = new System.Windows.Forms.TextBox(); textBoxSum = new TextBox();
this.buttonSave = new System.Windows.Forms.Button(); buttonSave = new Button();
this.buttonCancel = new System.Windows.Forms.Button(); buttonCancel = new Button();
this.SuspendLayout(); labelClient = new Label();
// comboBoxClient = new ComboBox();
// labelName SuspendLayout();
// //
this.labelName.AutoSize = true; // labelName
this.labelName.Location = new System.Drawing.Point(12, 18); //
this.labelName.Name = "labelName"; labelName.AutoSize = true;
this.labelName.Size = new System.Drawing.Size(136, 15); labelName.Location = new Point(26, 15);
this.labelName.TabIndex = 0; labelName.Name = "labelName";
this.labelName.Text = "Система безопасности:"; labelName.Size = new Size(77, 15);
// labelName.TabIndex = 0;
// labelCount labelName.Text = "Мороженое:";
// //
this.labelCount.AutoSize = true; // labelCount
this.labelCount.Location = new System.Drawing.Point(12, 53); //
this.labelCount.Name = "labelCount"; labelCount.AutoSize = true;
this.labelCount.Size = new System.Drawing.Size(75, 15); labelCount.Location = new Point(26, 52);
this.labelCount.TabIndex = 1; labelCount.Name = "labelCount";
this.labelCount.Text = "Количество:"; labelCount.Size = new Size(75, 15);
// labelCount.TabIndex = 1;
// labelSum labelCount.Text = "Количество:";
// //
this.labelSum.AutoSize = true; // labelSum
this.labelSum.Location = new System.Drawing.Point(12, 87); //
this.labelSum.Name = "labelSum"; labelSum.AutoSize = true;
this.labelSum.Size = new System.Drawing.Size(48, 15); labelSum.Location = new Point(26, 89);
this.labelSum.TabIndex = 2; labelSum.Name = "labelSum";
this.labelSum.Text = "Сумма:"; labelSum.Size = new Size(48, 15);
// labelSum.TabIndex = 2;
// comboBoxSecure labelSum.Text = "Сумма:";
// //
this.comboBoxSecure.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; // comboBoxSecure
this.comboBoxSecure.FormattingEnabled = true; //
this.comboBoxSecure.Location = new System.Drawing.Point(150, 15); comboBoxSecure.DropDownStyle = ComboBoxStyle.DropDownList;
this.comboBoxSecure.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); comboBoxSecure.FormattingEnabled = true;
this.comboBoxSecure.Name = "comboBoxSecure"; comboBoxSecure.Location = new Point(150, 15);
this.comboBoxSecure.Size = new System.Drawing.Size(230, 23); comboBoxSecure.Margin = new Padding(3, 2, 3, 2);
this.comboBoxSecure.TabIndex = 3; comboBoxSecure.Name = "comboBoxSecure";
this.comboBoxSecure.SelectedIndexChanged += new System.EventHandler(this.ComboBoxSecure_SelectedIndexChanged); comboBoxSecure.Size = new Size(230, 23);
// comboBoxSecure.TabIndex = 3;
// textBoxCount comboBoxSecure.SelectedIndexChanged += ComboBoxSecure_SelectedIndexChanged;
// //
this.textBoxCount.Location = new System.Drawing.Point(150, 50); // textBoxCount
this.textBoxCount.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); //
this.textBoxCount.Name = "textBoxCount"; textBoxCount.Location = new Point(150, 50);
this.textBoxCount.Size = new System.Drawing.Size(230, 23); textBoxCount.Margin = new Padding(3, 2, 3, 2);
this.textBoxCount.TabIndex = 4; textBoxCount.Name = "textBoxCount";
this.textBoxCount.TextChanged += new System.EventHandler(this.TextBoxCount_TextChanged); textBoxCount.Size = new Size(230, 23);
// textBoxCount.TabIndex = 4;
// textBoxSum textBoxCount.TextChanged += TextBoxCount_TextChanged;
// //
this.textBoxSum.Enabled = false; // textBoxSum
this.textBoxSum.Location = new System.Drawing.Point(150, 84); //
this.textBoxSum.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); textBoxSum.Enabled = false;
this.textBoxSum.Name = "textBoxSum"; textBoxSum.Location = new Point(150, 84);
this.textBoxSum.Size = new System.Drawing.Size(230, 23); textBoxSum.Margin = new Padding(3, 2, 3, 2);
this.textBoxSum.TabIndex = 5; textBoxSum.Name = "textBoxSum";
// textBoxSum.Size = new Size(230, 23);
// buttonSave textBoxSum.TabIndex = 5;
// //
this.buttonSave.Location = new System.Drawing.Point(209, 123); // buttonSave
this.buttonSave.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); //
this.buttonSave.Name = "buttonSave"; buttonSave.Location = new Point(212, 159);
this.buttonSave.Size = new System.Drawing.Size(82, 22); buttonSave.Margin = new Padding(3, 2, 3, 2);
this.buttonSave.TabIndex = 6; buttonSave.Name = "buttonSave";
this.buttonSave.Text = "Сохранить"; buttonSave.Size = new Size(82, 22);
this.buttonSave.UseVisualStyleBackColor = true; buttonSave.TabIndex = 6;
this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click); buttonSave.Text = "Сохранить";
// buttonSave.UseVisualStyleBackColor = true;
// buttonCancel buttonSave.Click += ButtonSave_Click;
// //
this.buttonCancel.Location = new System.Drawing.Point(297, 123); // buttonCancel
this.buttonCancel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); //
this.buttonCancel.Name = "buttonCancel"; buttonCancel.Location = new Point(300, 159);
this.buttonCancel.Size = new System.Drawing.Size(82, 22); buttonCancel.Margin = new Padding(3, 2, 3, 2);
this.buttonCancel.TabIndex = 7; buttonCancel.Name = "buttonCancel";
this.buttonCancel.Text = "Отмена"; buttonCancel.Size = new Size(82, 22);
this.buttonCancel.UseVisualStyleBackColor = true; buttonCancel.TabIndex = 7;
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click); buttonCancel.Text = "Отмена";
// buttonCancel.UseVisualStyleBackColor = true;
// FormCreateOrder buttonCancel.Click += ButtonCancel_Click;
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); // labelClient
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; //
this.ClientSize = new System.Drawing.Size(394, 159); labelClient.AutoSize = true;
this.Controls.Add(this.buttonCancel); labelClient.Location = new Point(26, 129);
this.Controls.Add(this.buttonSave); labelClient.Name = "labelClient";
this.Controls.Add(this.textBoxSum); labelClient.Size = new Size(49, 15);
this.Controls.Add(this.textBoxCount); labelClient.TabIndex = 8;
this.Controls.Add(this.comboBoxSecure); labelClient.Text = "Клиент:";
this.Controls.Add(this.labelSum); //
this.Controls.Add(this.labelCount); // comboBoxClient
this.Controls.Add(this.labelName); //
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); comboBoxClient.DropDownStyle = ComboBoxStyle.DropDownList;
this.Name = "FormCreateOrder"; comboBoxClient.FormattingEnabled = true;
this.Text = "Заказ"; comboBoxClient.Location = new Point(150, 121);
this.Load += new System.EventHandler(this.FormCreateOrder_Load); comboBoxClient.Margin = new Padding(3, 2, 3, 2);
this.ResumeLayout(false); comboBoxClient.Name = "comboBoxClient";
this.PerformLayout(); 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 labelName; private Label labelSum;
private Label labelCount; private ComboBox comboBoxSecure;
private Label labelSum; private TextBox textBoxCount;
private ComboBox comboBoxSecure; private TextBox textBoxSum;
private TextBox textBoxCount; private Button buttonSave;
private TextBox textBoxSum; private Button buttonCancel;
private Button buttonSave; private Label labelClient;
private Button buttonCancel; private ComboBox comboBoxClient;
} }
} }

View File

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

View File

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

View File

@ -33,6 +33,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["SecureName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView.Columns["SecureName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
} }
_logger.LogInformation("Загрузка заказов"); _logger.LogInformation("Загрузка заказов");
@ -184,5 +185,14 @@ namespace SecureShopView
form.ShowDialog(); 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"> <metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value>
</metadata>
</root> </root>

View File

@ -49,10 +49,10 @@ namespace SecureShopBusinessLogic.BusinessLogics
Facilities = new List<(string, int)>(), Facilities = new List<(string, int)>(),
TotalCount = 0 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.Facilities.Add(new(facilitie.Value.Item1.FacilitiesName, facilitie.Value.Item2));
record.TotalCount += additive.Value.Item2; record.TotalCount += facilitie.Value.Item2;
} }
list.Add(record); list.Add(record);
} }

View File

@ -3252,7 +3252,7 @@
var offset = popperOffsets[mainAxis]; var offset = popperOffsets[mainAxis];
var min$1 = popperOffsets[mainAxis] + overflow[mainSide]; var min$1 = popperOffsets[mainAxis] + overflow[mainSide];
var max$1 = popperOffsets[mainAxis] - overflow[altSide]; 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 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 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 // outside the reference bounds
@ -3271,8 +3271,8 @@
// width or height) // width or height)
var arrowLen = within(0, referenceRect[len], arrowRect[len]); var arrowLen = within(0, referenceRect[len], arrowRect[len]);
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue; var minOffset = isBasePlacement ? referenceRect[len] / 2 - facilitie - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue;
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + 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 arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0; var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 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) public ClientViewModel? Update(ClientBindingModel model)
{ {
using var context = new SecureShopDatabase(); using var context = new SecureShopDatabase();
var additive = context.Clients.FirstOrDefault(x => x.Id == model.Id); var facilitie = context.Clients.FirstOrDefault(x => x.Id == model.Id);
if (additive == null) if (facilitie == null)
{ {
return null; return null;
} }
additive.Update(model); facilitie.Update(model);
context.SaveChanges(); context.SaveChanges();
return additive.GetViewModel; return facilitie.GetViewModel;
} }
public ClientViewModel? Delete(ClientBindingModel model) public ClientViewModel? Delete(ClientBindingModel model)

View File

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

View File

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

View File

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

View File

@ -9,6 +9,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 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; }