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

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

View File

@ -10,13 +10,15 @@ namespace SecureShopView
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)
@ -38,6 +40,23 @@ namespace SecureShopView
_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()
@ -47,12 +66,12 @@ namespace SecureShopView
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)
@ -85,12 +104,18 @@ namespace SecureShopView
MessageBox.Show("Выберите мороженое", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Выберите мороженое", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return; return;
} }
if (comboBoxClient.SelectedValue == null)
{
MessageBox.Show("Выберите клиента", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
_logger.LogInformation("Создание заказа"); _logger.LogInformation("Создание заказа");
try try
{ {
var operationResult = _logicO.CreateOrder(new OrderBindingModel var operationResult = _logicO.CreateOrder(new OrderBindingModel
{ {
SecureId = Convert.ToInt32(comboBoxSecure.SelectedValue), SecureId = Convert.ToInt32(comboBoxSecure.SelectedValue),
ClientId = Convert.ToInt32(comboBoxClient.SelectedValue),
Count = Convert.ToInt32(textBoxCount.Text), Count = Convert.ToInt32(textBoxCount.Text),
Sum = Convert.ToDouble(textBoxSum.Text) Sum = Convert.ToDouble(textBoxSum.Text)
}); });

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; }