Есть ошибки в работе
This commit is contained in:
parent
bcabf20534
commit
f58a583b13
67
PlumbingRepair/PlumbingRepair/FormMain.Designer.cs
generated
67
PlumbingRepair/PlumbingRepair/FormMain.Designer.cs
generated
@ -40,6 +40,7 @@
|
|||||||
buttonIssuedOrder = new Button();
|
buttonIssuedOrder = new Button();
|
||||||
buttonUpdateList = new Button();
|
buttonUpdateList = new Button();
|
||||||
StoreReplenishment = new Button();
|
StoreReplenishment = new Button();
|
||||||
|
SellWorkButton = new Button();
|
||||||
menuStrip1.SuspendLayout();
|
menuStrip1.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
@ -50,7 +51,8 @@
|
|||||||
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem });
|
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem });
|
||||||
menuStrip1.Location = new Point(0, 0);
|
menuStrip1.Location = new Point(0, 0);
|
||||||
menuStrip1.Name = "menuStrip1";
|
menuStrip1.Name = "menuStrip1";
|
||||||
menuStrip1.Size = new Size(1053, 28);
|
menuStrip1.Padding = new Padding(8, 2, 0, 2);
|
||||||
|
menuStrip1.Size = new Size(1316, 33);
|
||||||
menuStrip1.TabIndex = 0;
|
menuStrip1.TabIndex = 0;
|
||||||
menuStrip1.Text = "menuStrip1";
|
menuStrip1.Text = "menuStrip1";
|
||||||
//
|
//
|
||||||
@ -58,45 +60,47 @@
|
|||||||
//
|
//
|
||||||
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, работыToolStripMenuItem, магазинToolStripMenuItem });
|
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, работыToolStripMenuItem, магазинToolStripMenuItem });
|
||||||
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||||
справочникиToolStripMenuItem.Size = new Size(117, 24);
|
справочникиToolStripMenuItem.Size = new Size(139, 29);
|
||||||
справочникиToolStripMenuItem.Text = "Справочники";
|
справочникиToolStripMenuItem.Text = "Справочники";
|
||||||
//
|
//
|
||||||
// компонентыToolStripMenuItem
|
// компонентыToolStripMenuItem
|
||||||
//
|
//
|
||||||
компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
||||||
компонентыToolStripMenuItem.Size = new Size(182, 26);
|
компонентыToolStripMenuItem.Size = new Size(218, 34);
|
||||||
компонентыToolStripMenuItem.Text = "Компоненты";
|
компонентыToolStripMenuItem.Text = "Компоненты";
|
||||||
компонентыToolStripMenuItem.Click += компонентыToolStripMenuItem_Click;
|
компонентыToolStripMenuItem.Click += компонентыToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// работыToolStripMenuItem
|
// работыToolStripMenuItem
|
||||||
//
|
//
|
||||||
работыToolStripMenuItem.Name = "работыToolStripMenuItem";
|
работыToolStripMenuItem.Name = "работыToolStripMenuItem";
|
||||||
работыToolStripMenuItem.Size = new Size(182, 26);
|
работыToolStripMenuItem.Size = new Size(218, 34);
|
||||||
работыToolStripMenuItem.Text = "Работы";
|
работыToolStripMenuItem.Text = "Работы";
|
||||||
работыToolStripMenuItem.Click += работыToolStripMenuItem_Click;
|
работыToolStripMenuItem.Click += работыToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// магазинToolStripMenuItem
|
// магазинToolStripMenuItem
|
||||||
//
|
//
|
||||||
магазинToolStripMenuItem.Name = "магазинToolStripMenuItem";
|
магазинToolStripMenuItem.Name = "магазинToolStripMenuItem";
|
||||||
магазинToolStripMenuItem.Size = new Size(32, 19);
|
магазинToolStripMenuItem.Size = new Size(218, 34);
|
||||||
магазинToolStripMenuItem.Text = "Магазины";
|
магазинToolStripMenuItem.Text = "Магазины";
|
||||||
магазинToolStripMenuItem.Click += new System.EventHandler(this.магазинToolStripMenuItem_Click);
|
магазинToolStripMenuItem.Click += магазинToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// dataGridView
|
// dataGridView
|
||||||
//
|
//
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
dataGridView.Location = new Point(0, 31);
|
dataGridView.Location = new Point(0, 39);
|
||||||
|
dataGridView.Margin = new Padding(4, 4, 4, 4);
|
||||||
dataGridView.Name = "dataGridView";
|
dataGridView.Name = "dataGridView";
|
||||||
dataGridView.RowHeadersWidth = 51;
|
dataGridView.RowHeadersWidth = 51;
|
||||||
dataGridView.RowTemplate.Height = 29;
|
dataGridView.RowTemplate.Height = 29;
|
||||||
dataGridView.Size = new Size(832, 420);
|
dataGridView.Size = new Size(1040, 525);
|
||||||
dataGridView.TabIndex = 1;
|
dataGridView.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// buttonCreateOrder
|
// buttonCreateOrder
|
||||||
//
|
//
|
||||||
buttonCreateOrder.Location = new Point(850, 54);
|
buttonCreateOrder.Location = new Point(1062, 68);
|
||||||
|
buttonCreateOrder.Margin = new Padding(4, 4, 4, 4);
|
||||||
buttonCreateOrder.Name = "buttonCreateOrder";
|
buttonCreateOrder.Name = "buttonCreateOrder";
|
||||||
buttonCreateOrder.Size = new Size(170, 29);
|
buttonCreateOrder.Size = new Size(212, 36);
|
||||||
buttonCreateOrder.TabIndex = 2;
|
buttonCreateOrder.TabIndex = 2;
|
||||||
buttonCreateOrder.Text = "Создать заказ";
|
buttonCreateOrder.Text = "Создать заказ";
|
||||||
buttonCreateOrder.UseVisualStyleBackColor = true;
|
buttonCreateOrder.UseVisualStyleBackColor = true;
|
||||||
@ -104,9 +108,10 @@
|
|||||||
//
|
//
|
||||||
// buttonTakeOrderInWork
|
// buttonTakeOrderInWork
|
||||||
//
|
//
|
||||||
buttonTakeOrderInWork.Location = new Point(850, 135);
|
buttonTakeOrderInWork.Location = new Point(1062, 138);
|
||||||
|
buttonTakeOrderInWork.Margin = new Padding(4, 4, 4, 4);
|
||||||
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
||||||
buttonTakeOrderInWork.Size = new Size(170, 50);
|
buttonTakeOrderInWork.Size = new Size(212, 62);
|
||||||
buttonTakeOrderInWork.TabIndex = 3;
|
buttonTakeOrderInWork.TabIndex = 3;
|
||||||
buttonTakeOrderInWork.Text = "Отдать на выполнение";
|
buttonTakeOrderInWork.Text = "Отдать на выполнение";
|
||||||
buttonTakeOrderInWork.UseVisualStyleBackColor = true;
|
buttonTakeOrderInWork.UseVisualStyleBackColor = true;
|
||||||
@ -114,9 +119,10 @@
|
|||||||
//
|
//
|
||||||
// buttonOrderReady
|
// buttonOrderReady
|
||||||
//
|
//
|
||||||
buttonOrderReady.Location = new Point(850, 206);
|
buttonOrderReady.Location = new Point(1062, 239);
|
||||||
|
buttonOrderReady.Margin = new Padding(4, 4, 4, 4);
|
||||||
buttonOrderReady.Name = "buttonOrderReady";
|
buttonOrderReady.Name = "buttonOrderReady";
|
||||||
buttonOrderReady.Size = new Size(170, 29);
|
buttonOrderReady.Size = new Size(212, 36);
|
||||||
buttonOrderReady.TabIndex = 4;
|
buttonOrderReady.TabIndex = 4;
|
||||||
buttonOrderReady.Text = "Заказ готов";
|
buttonOrderReady.Text = "Заказ готов";
|
||||||
buttonOrderReady.UseVisualStyleBackColor = true;
|
buttonOrderReady.UseVisualStyleBackColor = true;
|
||||||
@ -124,9 +130,10 @@
|
|||||||
//
|
//
|
||||||
// buttonIssuedOrder
|
// buttonIssuedOrder
|
||||||
//
|
//
|
||||||
buttonIssuedOrder.Location = new Point(850, 279);
|
buttonIssuedOrder.Location = new Point(1062, 313);
|
||||||
|
buttonIssuedOrder.Margin = new Padding(4, 4, 4, 4);
|
||||||
buttonIssuedOrder.Name = "buttonIssuedOrder";
|
buttonIssuedOrder.Name = "buttonIssuedOrder";
|
||||||
buttonIssuedOrder.Size = new Size(170, 29);
|
buttonIssuedOrder.Size = new Size(212, 36);
|
||||||
buttonIssuedOrder.TabIndex = 5;
|
buttonIssuedOrder.TabIndex = 5;
|
||||||
buttonIssuedOrder.Text = "Заказ выдан";
|
buttonIssuedOrder.Text = "Заказ выдан";
|
||||||
buttonIssuedOrder.UseVisualStyleBackColor = true;
|
buttonIssuedOrder.UseVisualStyleBackColor = true;
|
||||||
@ -134,9 +141,10 @@
|
|||||||
//
|
//
|
||||||
// buttonUpdateList
|
// buttonUpdateList
|
||||||
//
|
//
|
||||||
buttonUpdateList.Location = new Point(850, 394);
|
buttonUpdateList.Location = new Point(1062, 528);
|
||||||
|
buttonUpdateList.Margin = new Padding(4, 4, 4, 4);
|
||||||
buttonUpdateList.Name = "buttonUpdateList";
|
buttonUpdateList.Name = "buttonUpdateList";
|
||||||
buttonUpdateList.Size = new Size(170, 29);
|
buttonUpdateList.Size = new Size(212, 36);
|
||||||
buttonUpdateList.TabIndex = 6;
|
buttonUpdateList.TabIndex = 6;
|
||||||
buttonUpdateList.Text = "Обновить список";
|
buttonUpdateList.Text = "Обновить список";
|
||||||
buttonUpdateList.UseVisualStyleBackColor = true;
|
buttonUpdateList.UseVisualStyleBackColor = true;
|
||||||
@ -144,20 +152,33 @@
|
|||||||
//
|
//
|
||||||
// StoreReplenishment
|
// StoreReplenishment
|
||||||
//
|
//
|
||||||
StoreReplenishment.Location = new Point(879, 327);
|
StoreReplenishment.Location = new Point(1099, 381);
|
||||||
|
StoreReplenishment.Margin = new Padding(4, 4, 4, 4);
|
||||||
StoreReplenishment.Name = "StoreReplenishment";
|
StoreReplenishment.Name = "StoreReplenishment";
|
||||||
StoreReplenishment.Size = new Size(125, 50);
|
StoreReplenishment.Size = new Size(156, 62);
|
||||||
StoreReplenishment.TabIndex = 7;
|
StoreReplenishment.TabIndex = 7;
|
||||||
StoreReplenishment.Text = "Пополнение магазина";
|
StoreReplenishment.Text = "Пополнение магазина";
|
||||||
StoreReplenishment.UseVisualStyleBackColor = true;
|
StoreReplenishment.UseVisualStyleBackColor = true;
|
||||||
StoreReplenishment.Click += StoreReplenishment_Click;
|
StoreReplenishment.Click += StoreReplenishment_Click;
|
||||||
//
|
//
|
||||||
|
// SellWorkButton
|
||||||
|
//
|
||||||
|
SellWorkButton.Location = new Point(1099, 463);
|
||||||
|
SellWorkButton.Margin = new Padding(4, 4, 4, 4);
|
||||||
|
SellWorkButton.Name = "SellWorkButton";
|
||||||
|
SellWorkButton.Size = new Size(156, 39);
|
||||||
|
SellWorkButton.TabIndex = 8;
|
||||||
|
SellWorkButton.Text = "Продать изделие";
|
||||||
|
SellWorkButton.UseVisualStyleBackColor = true;
|
||||||
|
SellWorkButton.Click += SellWorkButton_Click;
|
||||||
|
//
|
||||||
// FormMain
|
// FormMain
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(1053, 474);
|
ClientSize = new Size(1316, 592);
|
||||||
Controls.Add(StoreReplenishment);
|
Controls.Add(StoreReplenishment);
|
||||||
|
Controls.Add(SellWorkButton);
|
||||||
Controls.Add(buttonUpdateList);
|
Controls.Add(buttonUpdateList);
|
||||||
Controls.Add(buttonIssuedOrder);
|
Controls.Add(buttonIssuedOrder);
|
||||||
Controls.Add(buttonOrderReady);
|
Controls.Add(buttonOrderReady);
|
||||||
@ -166,6 +187,7 @@
|
|||||||
Controls.Add(dataGridView);
|
Controls.Add(dataGridView);
|
||||||
Controls.Add(menuStrip1);
|
Controls.Add(menuStrip1);
|
||||||
MainMenuStrip = menuStrip1;
|
MainMenuStrip = menuStrip1;
|
||||||
|
Margin = new Padding(4, 4, 4, 4);
|
||||||
Name = "FormMain";
|
Name = "FormMain";
|
||||||
Text = "Ремонт сантехники";
|
Text = "Ремонт сантехники";
|
||||||
Load += FormMain_Load;
|
Load += FormMain_Load;
|
||||||
@ -190,5 +212,6 @@
|
|||||||
private Button StoreReplenishment;
|
private Button StoreReplenishment;
|
||||||
private ToolStripMenuItem компонентыToolStripMenuItem;
|
private ToolStripMenuItem компонентыToolStripMenuItem;
|
||||||
private ToolStripMenuItem работыToolStripMenuItem;
|
private ToolStripMenuItem работыToolStripMenuItem;
|
||||||
|
private Button SellWorkButton;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -24,6 +24,7 @@ namespace PlumbingRepairView
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_orderLogic = orderLogic;
|
_orderLogic = orderLogic;
|
||||||
|
LoadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormMain_Load(object sender, EventArgs e)
|
private void FormMain_Load(object sender, EventArgs e)
|
||||||
@ -215,5 +216,14 @@ namespace PlumbingRepairView
|
|||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void SellWorkButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormSellWork));
|
||||||
|
|
||||||
|
if (service is FormSellWork form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
124
PlumbingRepair/PlumbingRepair/FormSellWork.Designer.cs
generated
Normal file
124
PlumbingRepair/PlumbingRepair/FormSellWork.Designer.cs
generated
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
namespace PlumbingRepairView
|
||||||
|
{
|
||||||
|
partial class FormSellWork
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
WorkLabel = new Label();
|
||||||
|
QuantityLabel = new Label();
|
||||||
|
WorkСomboBox = new ComboBox();
|
||||||
|
QuantityTextBox = new TextBox();
|
||||||
|
SaveButton = new Button();
|
||||||
|
ButtonCancel = new Button();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// WorkLabel
|
||||||
|
//
|
||||||
|
WorkLabel.AutoSize = true;
|
||||||
|
WorkLabel.Location = new Point(14, 24);
|
||||||
|
WorkLabel.Name = "WorkLabel";
|
||||||
|
WorkLabel.Size = new Size(71, 20);
|
||||||
|
WorkLabel.TabIndex = 0;
|
||||||
|
WorkLabel.Text = "Изделие:";
|
||||||
|
//
|
||||||
|
// QuantityLabel
|
||||||
|
//
|
||||||
|
QuantityLabel.AutoSize = true;
|
||||||
|
QuantityLabel.Location = new Point(14, 68);
|
||||||
|
QuantityLabel.Name = "QuantityLabel";
|
||||||
|
QuantityLabel.Size = new Size(93, 20);
|
||||||
|
QuantityLabel.TabIndex = 1;
|
||||||
|
QuantityLabel.Text = "Количество:";
|
||||||
|
//
|
||||||
|
// WorkСomboBox
|
||||||
|
//
|
||||||
|
WorkСomboBox.FormattingEnabled = true;
|
||||||
|
WorkСomboBox.Location = new Point(101, 20);
|
||||||
|
WorkСomboBox.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
WorkСomboBox.Name = "WorkСomboBox";
|
||||||
|
WorkСomboBox.Size = new Size(210, 28);
|
||||||
|
WorkСomboBox.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// QuantityTextBox
|
||||||
|
//
|
||||||
|
QuantityTextBox.Location = new Point(101, 64);
|
||||||
|
QuantityTextBox.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
QuantityTextBox.Name = "QuantityTextBox";
|
||||||
|
QuantityTextBox.Size = new Size(210, 27);
|
||||||
|
QuantityTextBox.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// SaveButton
|
||||||
|
//
|
||||||
|
SaveButton.Location = new Point(82, 133);
|
||||||
|
SaveButton.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
SaveButton.Name = "SaveButton";
|
||||||
|
SaveButton.Size = new Size(111, 39);
|
||||||
|
SaveButton.TabIndex = 4;
|
||||||
|
SaveButton.Text = "Сохранить";
|
||||||
|
SaveButton.UseVisualStyleBackColor = true;
|
||||||
|
SaveButton.Click += SaveButton_Click;
|
||||||
|
//
|
||||||
|
// ButtonCancel
|
||||||
|
//
|
||||||
|
ButtonCancel.Location = new Point(200, 133);
|
||||||
|
ButtonCancel.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
ButtonCancel.Name = "ButtonCancel";
|
||||||
|
ButtonCancel.Size = new Size(111, 39);
|
||||||
|
ButtonCancel.TabIndex = 5;
|
||||||
|
ButtonCancel.Text = "Отмена";
|
||||||
|
ButtonCancel.UseVisualStyleBackColor = true;
|
||||||
|
ButtonCancel.Click += ButtonCancel_Click;
|
||||||
|
//
|
||||||
|
// FormSellWork
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(325, 188);
|
||||||
|
Controls.Add(ButtonCancel);
|
||||||
|
Controls.Add(SaveButton);
|
||||||
|
Controls.Add(QuantityTextBox);
|
||||||
|
Controls.Add(WorkСomboBox);
|
||||||
|
Controls.Add(QuantityLabel);
|
||||||
|
Controls.Add(WorkLabel);
|
||||||
|
Margin = new Padding(3, 4, 3, 4);
|
||||||
|
Name = "FormSellWork";
|
||||||
|
Text = "Продать Изделие";
|
||||||
|
Load += FormSellWork_Load;
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label WorkLabel;
|
||||||
|
private Label QuantityLabel;
|
||||||
|
private ComboBox WorkСomboBox;
|
||||||
|
private TextBox QuantityTextBox;
|
||||||
|
private Button SaveButton;
|
||||||
|
private Button ButtonCancel;
|
||||||
|
}
|
||||||
|
}
|
103
PlumbingRepair/PlumbingRepair/FormSellWork.cs
Normal file
103
PlumbingRepair/PlumbingRepair/FormSellWork.cs
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using PlumbingRepairContracts.BusinessLogicsContracts;
|
||||||
|
using PlumbingRepairContracts.SearchModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace PlumbingRepairView
|
||||||
|
{
|
||||||
|
public partial class FormSellWork : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IWorkLogic _logicWork;
|
||||||
|
private readonly IStoreLogic _logicStore;
|
||||||
|
public FormSellWork(ILogger<FormSellWork> logger, IWorkLogic logicPackage, IStoreLogic logicStore)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logicWork = logicPackage;
|
||||||
|
_logicStore = logicStore;
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormSellWork_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Loading works for sale.");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var list = _logicWork.ReadList(null);
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
WorkСomboBox.DisplayMember = "WorkName";
|
||||||
|
WorkСomboBox.ValueMember = "Id";
|
||||||
|
WorkСomboBox.DataSource = list;
|
||||||
|
WorkСomboBox.SelectedItem = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "List loading error.");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(QuantityTextBox.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Укажите количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (WorkСomboBox.SelectedValue == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Work sale.");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var operationResult = _logicStore.SellWork(_logicWork.ReadElement(new WorkSearchModel()
|
||||||
|
{
|
||||||
|
Id = Convert.ToInt32(WorkСomboBox.SelectedValue)
|
||||||
|
})!, Convert.ToInt32(QuantityTextBox.Text));
|
||||||
|
|
||||||
|
if (!operationResult)
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при продаже изделия. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Work sale error.");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = DialogResult.Cancel;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
PlumbingRepair/PlumbingRepair/FormSellWork.resx
Normal file
120
PlumbingRepair/PlumbingRepair/FormSellWork.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
230
PlumbingRepair/PlumbingRepair/FormStore.Designer.cs
generated
230
PlumbingRepair/PlumbingRepair/FormStore.Designer.cs
generated
@ -28,139 +28,171 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.StoreNameLabel = new System.Windows.Forms.Label();
|
StoreNameLabel = new Label();
|
||||||
this.StoreAdressLabel = new System.Windows.Forms.Label();
|
StoreAdressLabel = new Label();
|
||||||
this.OpeningDateLabel = new System.Windows.Forms.Label();
|
OpeningDateLabel = new Label();
|
||||||
this.NameTextBox = new System.Windows.Forms.TextBox();
|
NameTextBox = new TextBox();
|
||||||
this.AdressTextBox = new System.Windows.Forms.TextBox();
|
AdressTextBox = new TextBox();
|
||||||
this.DataGridView = new System.Windows.Forms.DataGridView();
|
DataGridView = new DataGridView();
|
||||||
this.WorkName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
WorkName = new DataGridViewTextBoxColumn();
|
||||||
this.WorkPrice = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
WorkPrice = new DataGridViewTextBoxColumn();
|
||||||
this.WorkCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
WorkCount = new DataGridViewTextBoxColumn();
|
||||||
this.SaveButton = new System.Windows.Forms.Button();
|
SaveButton = new Button();
|
||||||
this.ButtonCancel = new System.Windows.Forms.Button();
|
ButtonCancel = new Button();
|
||||||
this.OpeningDatePicker = new System.Windows.Forms.DateTimePicker();
|
OpeningDatePicker = new DateTimePicker();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
|
VolumeNumericUpDown = new NumericUpDown();
|
||||||
this.SuspendLayout();
|
WorkMaxCountLable = new Label();
|
||||||
|
((System.ComponentModel.ISupportInitialize)DataGridView).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)VolumeNumericUpDown).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// StoreNameLabel
|
// StoreNameLabel
|
||||||
//
|
//
|
||||||
this.StoreNameLabel.AutoSize = true;
|
StoreNameLabel.AutoSize = true;
|
||||||
this.StoreNameLabel.Location = new System.Drawing.Point(12, 9);
|
StoreNameLabel.Location = new Point(14, 12);
|
||||||
this.StoreNameLabel.Name = "StoreNameLabel";
|
StoreNameLabel.Name = "StoreNameLabel";
|
||||||
this.StoreNameLabel.Size = new System.Drawing.Size(119, 15);
|
StoreNameLabel.Size = new Size(154, 20);
|
||||||
this.StoreNameLabel.TabIndex = 0;
|
StoreNameLabel.TabIndex = 0;
|
||||||
this.StoreNameLabel.Text = "Название магазина: ";
|
StoreNameLabel.Text = "Название магазина: ";
|
||||||
//
|
//
|
||||||
// StoreAdressLabel
|
// StoreAdressLabel
|
||||||
//
|
//
|
||||||
this.StoreAdressLabel.AutoSize = true;
|
StoreAdressLabel.AutoSize = true;
|
||||||
this.StoreAdressLabel.Location = new System.Drawing.Point(12, 40);
|
StoreAdressLabel.Location = new Point(14, 53);
|
||||||
this.StoreAdressLabel.Name = "StoreAdressLabel";
|
StoreAdressLabel.Name = "StoreAdressLabel";
|
||||||
this.StoreAdressLabel.Size = new System.Drawing.Size(100, 15);
|
StoreAdressLabel.Size = new Size(128, 20);
|
||||||
this.StoreAdressLabel.TabIndex = 1;
|
StoreAdressLabel.TabIndex = 1;
|
||||||
this.StoreAdressLabel.Text = "Адрес магазина: ";
|
StoreAdressLabel.Text = "Адрес магазина: ";
|
||||||
//
|
//
|
||||||
// OpeningDateLabel
|
// OpeningDateLabel
|
||||||
//
|
//
|
||||||
this.OpeningDateLabel.AutoSize = true;
|
OpeningDateLabel.AutoSize = true;
|
||||||
this.OpeningDateLabel.Location = new System.Drawing.Point(12, 72);
|
OpeningDateLabel.Location = new Point(14, 96);
|
||||||
this.OpeningDateLabel.Name = "OpeningDateLabel";
|
OpeningDateLabel.Name = "OpeningDateLabel";
|
||||||
this.OpeningDateLabel.Size = new System.Drawing.Size(93, 15);
|
OpeningDateLabel.Size = new Size(117, 20);
|
||||||
this.OpeningDateLabel.TabIndex = 2;
|
OpeningDateLabel.TabIndex = 2;
|
||||||
this.OpeningDateLabel.Text = "Дата открытия: ";
|
OpeningDateLabel.Text = "Дата открытия: ";
|
||||||
//
|
//
|
||||||
// NameComboBox
|
// NameTextBox
|
||||||
//
|
//
|
||||||
this.NameTextBox.Location = new System.Drawing.Point(137, 6);
|
NameTextBox.Location = new Point(157, 8);
|
||||||
this.NameTextBox.Name = "NameComboBox";
|
NameTextBox.Margin = new Padding(3, 4, 3, 4);
|
||||||
this.NameTextBox.Size = new System.Drawing.Size(174, 23);
|
NameTextBox.Name = "NameTextBox";
|
||||||
this.NameTextBox.TabIndex = 3;
|
NameTextBox.Size = new Size(198, 27);
|
||||||
|
NameTextBox.TabIndex = 3;
|
||||||
//
|
//
|
||||||
// AdressTextBox
|
// AdressTextBox
|
||||||
//
|
//
|
||||||
this.AdressTextBox.Location = new System.Drawing.Point(137, 37);
|
AdressTextBox.Location = new Point(157, 49);
|
||||||
this.AdressTextBox.Name = "AdressTextBox";
|
AdressTextBox.Margin = new Padding(3, 4, 3, 4);
|
||||||
this.AdressTextBox.Size = new System.Drawing.Size(174, 23);
|
AdressTextBox.Name = "AdressTextBox";
|
||||||
this.AdressTextBox.TabIndex = 4;
|
AdressTextBox.Size = new Size(198, 27);
|
||||||
|
AdressTextBox.TabIndex = 4;
|
||||||
//
|
//
|
||||||
// DataGridView
|
// DataGridView
|
||||||
//
|
//
|
||||||
this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
this.DataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
DataGridView.Columns.AddRange(new DataGridViewColumn[] { WorkName, WorkPrice, WorkCount });
|
||||||
this.WorkName,
|
DataGridView.Location = new Point(14, 145);
|
||||||
this.WorkPrice,
|
DataGridView.Margin = new Padding(3, 4, 3, 4);
|
||||||
this.WorkCount});
|
DataGridView.Name = "DataGridView";
|
||||||
this.DataGridView.Location = new System.Drawing.Point(12, 109);
|
DataGridView.RowHeadersWidth = 51;
|
||||||
this.DataGridView.Name = "DataGridView";
|
DataGridView.RowTemplate.Height = 25;
|
||||||
this.DataGridView.RowTemplate.Height = 25;
|
DataGridView.Size = new Size(887, 384);
|
||||||
this.DataGridView.Size = new System.Drawing.Size(776, 288);
|
DataGridView.TabIndex = 6;
|
||||||
this.DataGridView.TabIndex = 6;
|
|
||||||
//
|
//
|
||||||
// PackageName
|
// WorkName
|
||||||
//
|
//
|
||||||
this.WorkName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
WorkName.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
this.WorkName.HeaderText = "Название изделия";
|
WorkName.HeaderText = "Название изделия";
|
||||||
this.WorkName.Name = "PackageName";
|
WorkName.MinimumWidth = 6;
|
||||||
|
WorkName.Name = "WorkName";
|
||||||
//
|
//
|
||||||
// PackagePrice
|
// WorkPrice
|
||||||
//
|
//
|
||||||
this.WorkPrice.HeaderText = "Цена";
|
WorkPrice.HeaderText = "Цена";
|
||||||
this.WorkPrice.Name = "PackagePrice";
|
WorkPrice.MinimumWidth = 6;
|
||||||
|
WorkPrice.Name = "WorkPrice";
|
||||||
|
WorkPrice.Width = 125;
|
||||||
//
|
//
|
||||||
// PackageCount
|
// WorkCount
|
||||||
//
|
//
|
||||||
this.WorkCount.HeaderText = "Количество";
|
WorkCount.HeaderText = "Количество";
|
||||||
this.WorkCount.Name = "PackageCount";
|
WorkCount.MinimumWidth = 6;
|
||||||
|
WorkCount.Name = "WorkCount";
|
||||||
|
WorkCount.Width = 125;
|
||||||
//
|
//
|
||||||
// SaveButton
|
// SaveButton
|
||||||
//
|
//
|
||||||
this.SaveButton.Location = new System.Drawing.Point(552, 403);
|
SaveButton.Location = new Point(631, 537);
|
||||||
this.SaveButton.Name = "SaveButton";
|
SaveButton.Margin = new Padding(3, 4, 3, 4);
|
||||||
this.SaveButton.Size = new System.Drawing.Size(115, 35);
|
SaveButton.Name = "SaveButton";
|
||||||
this.SaveButton.TabIndex = 7;
|
SaveButton.Size = new Size(131, 47);
|
||||||
this.SaveButton.Text = "Сохранить";
|
SaveButton.TabIndex = 7;
|
||||||
this.SaveButton.UseVisualStyleBackColor = true;
|
SaveButton.Text = "Сохранить";
|
||||||
this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click);
|
SaveButton.UseVisualStyleBackColor = true;
|
||||||
|
SaveButton.Click += SaveButton_Click;
|
||||||
//
|
//
|
||||||
// ButtonCancel
|
// ButtonCancel
|
||||||
//
|
//
|
||||||
this.ButtonCancel.Location = new System.Drawing.Point(673, 403);
|
ButtonCancel.Location = new Point(769, 537);
|
||||||
this.ButtonCancel.Name = "ButtonCancel";
|
ButtonCancel.Margin = new Padding(3, 4, 3, 4);
|
||||||
this.ButtonCancel.Size = new System.Drawing.Size(115, 35);
|
ButtonCancel.Name = "ButtonCancel";
|
||||||
this.ButtonCancel.TabIndex = 8;
|
ButtonCancel.Size = new Size(131, 47);
|
||||||
this.ButtonCancel.Text = "Отменить";
|
ButtonCancel.TabIndex = 8;
|
||||||
this.ButtonCancel.UseVisualStyleBackColor = true;
|
ButtonCancel.Text = "Отменить";
|
||||||
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
ButtonCancel.UseVisualStyleBackColor = true;
|
||||||
|
ButtonCancel.Click += ButtonCancel_Click;
|
||||||
//
|
//
|
||||||
// OpeningDatePicker
|
// OpeningDatePicker
|
||||||
//
|
//
|
||||||
this.OpeningDatePicker.Location = new System.Drawing.Point(137, 66);
|
OpeningDatePicker.Location = new Point(157, 88);
|
||||||
this.OpeningDatePicker.Name = "OpeningDatePicker";
|
OpeningDatePicker.Margin = new Padding(3, 4, 3, 4);
|
||||||
this.OpeningDatePicker.Size = new System.Drawing.Size(174, 23);
|
OpeningDatePicker.Name = "OpeningDatePicker";
|
||||||
this.OpeningDatePicker.TabIndex = 9;
|
OpeningDatePicker.Size = new Size(198, 27);
|
||||||
|
OpeningDatePicker.TabIndex = 9;
|
||||||
|
//
|
||||||
|
// VolumeNumericUpDown
|
||||||
|
//
|
||||||
|
VolumeNumericUpDown.Location = new Point(570, 10);
|
||||||
|
VolumeNumericUpDown.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
VolumeNumericUpDown.Name = "VolumeNumericUpDown";
|
||||||
|
VolumeNumericUpDown.Size = new Size(192, 27);
|
||||||
|
VolumeNumericUpDown.TabIndex = 10;
|
||||||
|
//
|
||||||
|
// WorkMaxCountLable
|
||||||
|
//
|
||||||
|
WorkMaxCountLable.AutoSize = true;
|
||||||
|
WorkMaxCountLable.Location = new Point(389, 12);
|
||||||
|
WorkMaxCountLable.Name = "WorkMaxCountLable";
|
||||||
|
WorkMaxCountLable.Size = new Size(177, 20);
|
||||||
|
WorkMaxCountLable.TabIndex = 11;
|
||||||
|
WorkMaxCountLable.Text = "Вместимость магазина: ";
|
||||||
//
|
//
|
||||||
// FormStore
|
// FormStore
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
ClientSize = new Size(914, 600);
|
||||||
this.Controls.Add(this.OpeningDatePicker);
|
Controls.Add(WorkMaxCountLable);
|
||||||
this.Controls.Add(this.ButtonCancel);
|
Controls.Add(VolumeNumericUpDown);
|
||||||
this.Controls.Add(this.SaveButton);
|
Controls.Add(OpeningDatePicker);
|
||||||
this.Controls.Add(this.DataGridView);
|
Controls.Add(ButtonCancel);
|
||||||
this.Controls.Add(this.AdressTextBox);
|
Controls.Add(SaveButton);
|
||||||
this.Controls.Add(this.NameTextBox);
|
Controls.Add(DataGridView);
|
||||||
this.Controls.Add(this.OpeningDateLabel);
|
Controls.Add(AdressTextBox);
|
||||||
this.Controls.Add(this.StoreAdressLabel);
|
Controls.Add(NameTextBox);
|
||||||
this.Controls.Add(this.StoreNameLabel);
|
Controls.Add(OpeningDateLabel);
|
||||||
this.Name = "FormStore";
|
Controls.Add(StoreAdressLabel);
|
||||||
this.Text = "Изделия магазина";
|
Controls.Add(StoreNameLabel);
|
||||||
this.Load += new System.EventHandler(this.FormStore_Load);
|
Margin = new Padding(3, 4, 3, 4);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit();
|
Name = "FormStore";
|
||||||
this.ResumeLayout(false);
|
Text = "Изделия магазина";
|
||||||
this.PerformLayout();
|
Load += FormStore_Load;
|
||||||
|
((System.ComponentModel.ISupportInitialize)DataGridView).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)VolumeNumericUpDown).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -177,5 +209,7 @@
|
|||||||
private DataGridViewTextBoxColumn WorkPrice;
|
private DataGridViewTextBoxColumn WorkPrice;
|
||||||
private DataGridViewTextBoxColumn WorkCount;
|
private DataGridViewTextBoxColumn WorkCount;
|
||||||
private DateTimePicker OpeningDatePicker;
|
private DateTimePicker OpeningDatePicker;
|
||||||
|
private NumericUpDown VolumeNumericUpDown;
|
||||||
|
private Label WorkMaxCountLable;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,9 +1,10 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using PlumbingRepairContracts.BindingModels;
|
using PlumbingRepairContracts.BindingModels;
|
||||||
using PlumbingRepairContracts.BusinessLogicsContracts;
|
using PlumbingRepairContracts.BusinessLogicsContracts;
|
||||||
|
using PlumbingRepairContracts.SearchModels;
|
||||||
using PlumbingRepairContracts.ViewModels;
|
using PlumbingRepairContracts.ViewModels;
|
||||||
using PlumbingRepairDataModels.Models;
|
using PlumbingRepairDataModels.Models;
|
||||||
using System;
|
using System.Reflection;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
@ -17,35 +18,21 @@ namespace PlumbingRepairView
|
|||||||
{
|
{
|
||||||
public partial class FormStore : Form
|
public partial class FormStore : Form
|
||||||
{
|
{
|
||||||
private readonly List<StoreViewModel>? _listStores;
|
|
||||||
private readonly IStoreLogic _logic;
|
private readonly IStoreLogic _logic;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
public int Id { get; set; }
|
|
||||||
|
private int? _id;
|
||||||
|
private Dictionary<int, (IWorkModel, int)> _listStores;
|
||||||
|
public int Id { set { _id = value; } }
|
||||||
|
|
||||||
public FormStore(ILogger<FormStore> logger, IStoreLogic logic)
|
public FormStore(ILogger<FormStore> logger, IStoreLogic logic)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_listStores = logic.ReadList(null);
|
_listStores = new();
|
||||||
_logic = logic;
|
_logic = logic;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IStoreModel? GetStore(int id)
|
|
||||||
{
|
|
||||||
if (_listStores == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
foreach (var elem in _listStores)
|
|
||||||
{
|
|
||||||
if (elem.Id == id)
|
|
||||||
{
|
|
||||||
return elem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SaveButton_Click(object sender, EventArgs e)
|
private void SaveButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(NameTextBox.Text))
|
if (string.IsNullOrEmpty(NameTextBox.Text))
|
||||||
@ -60,29 +47,20 @@ namespace PlumbingRepairView
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogInformation("Сохранение изделия");
|
_logger.LogInformation("Сохранение магазина");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DateTime.TryParse(OpeningDatePicker.Text, out var dateTime);
|
var model = new StoreBindingModel
|
||||||
StoreBindingModel model = new()
|
|
||||||
{
|
{
|
||||||
|
Id = _id ?? 0,
|
||||||
StoreName = NameTextBox.Text,
|
StoreName = NameTextBox.Text,
|
||||||
StoreAdress = AdressTextBox.Text,
|
StoreAdress = AdressTextBox.Text,
|
||||||
OpeningDate = dateTime
|
OpeningDate = OpeningDatePicker.Value.Date,
|
||||||
|
WorkMaxCount = (int)VolumeNumericUpDown.Value,
|
||||||
|
StoreWorks = _listStores
|
||||||
};
|
};
|
||||||
var vmodel = GetStore(Id);
|
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||||
bool operationResult = false;
|
|
||||||
|
|
||||||
if (vmodel != null)
|
|
||||||
{
|
|
||||||
model.Id = vmodel.Id;
|
|
||||||
operationResult = _logic.Update(model);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
operationResult = _logic.Create(model);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!operationResult)
|
if (!operationResult)
|
||||||
{
|
{
|
||||||
@ -95,7 +73,7 @@ namespace PlumbingRepairView
|
|||||||
}
|
}
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -108,37 +86,52 @@ namespace PlumbingRepairView
|
|||||||
|
|
||||||
private void FormStore_Load(object sender, EventArgs e)
|
private void FormStore_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
LoadData();
|
if (_id.HasValue)
|
||||||
}
|
|
||||||
private void LoadData(bool extendDate = true)
|
|
||||||
{
|
{
|
||||||
|
_logger.LogInformation("Загрузка магазина");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var model = GetStore(extendDate ? Id : Convert.ToInt32(NameTextBox.Text));
|
var view = _logic.ReadElement(new StoreSearchModel
|
||||||
if (model != null)
|
|
||||||
{
|
{
|
||||||
NameTextBox.Text = model.StoreName;
|
Id = _id.Value
|
||||||
AdressTextBox.Text = model.StoreAdress;
|
});
|
||||||
OpeningDatePicker.Text = Convert.ToString(model.OpeningDate);
|
if (view != null)
|
||||||
DataGridView.Rows.Clear();
|
|
||||||
foreach (var el in model.Works.Values)
|
|
||||||
{
|
{
|
||||||
DataGridView.Rows.Add(new object[] { el.Item1.WorkName, el.Item1.Price, el.Item2 });
|
NameTextBox.Text = view.StoreName;
|
||||||
|
AdressTextBox.Text = view.StoreAdress;
|
||||||
|
OpeningDatePicker.Text = view.OpeningDate.ToString();
|
||||||
|
VolumeNumericUpDown.Value = view.WorkMaxCount;
|
||||||
|
_listStores = view.StoreWorks ?? new Dictionary<int, (IWorkModel, int)>();
|
||||||
|
LoadData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Загрузка магазинов");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка загрузки магазинов");
|
_logger.LogError(ex, "Ошибка загрузки магазина");
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||||
MessageBoxIcon.Error);
|
MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
private void NameComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
private void LoadData(bool extendDate = true)
|
||||||
{
|
{
|
||||||
LoadData(false);
|
_logger.LogInformation("Загрузка изделий магазина");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_listStores != null)
|
||||||
|
{
|
||||||
|
DataGridView.Rows.Clear();
|
||||||
|
foreach (var elem in _listStores)
|
||||||
|
{
|
||||||
|
DataGridView.Rows.Add(new object[] { elem.Value.Item1.WorkName, elem.Value.Item1.Price, elem.Value.Item2 });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки изделий магазина");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ namespace PlumbingRepairView
|
|||||||
DataGridView.DataSource = list;
|
DataGridView.DataSource = list;
|
||||||
DataGridView.Columns["Id"].Visible = false;
|
DataGridView.Columns["Id"].Visible = false;
|
||||||
DataGridView.Columns["StoreName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
DataGridView.Columns["StoreName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
DataGridView.Columns["Works"].Visible = false;
|
DataGridView.Columns["StoreWorks"].Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogInformation("Загрузка магазинов");
|
_logger.LogInformation("Загрузка магазинов");
|
||||||
|
25
PlumbingRepair/PlumbingRepair/FormWork.Designer.cs
generated
25
PlumbingRepair/PlumbingRepair/FormWork.Designer.cs
generated
@ -75,9 +75,9 @@
|
|||||||
groupBox1.Controls.Add(buttonAdd);
|
groupBox1.Controls.Add(buttonAdd);
|
||||||
groupBox1.Controls.Add(dataGridView);
|
groupBox1.Controls.Add(dataGridView);
|
||||||
groupBox1.Location = new Point(40, 108);
|
groupBox1.Location = new Point(40, 108);
|
||||||
groupBox1.Margin = new Padding(4, 4, 4, 4);
|
groupBox1.Margin = new Padding(4);
|
||||||
groupBox1.Name = "groupBox1";
|
groupBox1.Name = "groupBox1";
|
||||||
groupBox1.Padding = new Padding(4, 4, 4, 4);
|
groupBox1.Padding = new Padding(4);
|
||||||
groupBox1.Size = new Size(945, 384);
|
groupBox1.Size = new Size(945, 384);
|
||||||
groupBox1.TabIndex = 2;
|
groupBox1.TabIndex = 2;
|
||||||
groupBox1.TabStop = false;
|
groupBox1.TabStop = false;
|
||||||
@ -86,7 +86,7 @@
|
|||||||
// buttonRef
|
// buttonRef
|
||||||
//
|
//
|
||||||
buttonRef.Location = new Point(752, 258);
|
buttonRef.Location = new Point(752, 258);
|
||||||
buttonRef.Margin = new Padding(4, 4, 4, 4);
|
buttonRef.Margin = new Padding(4);
|
||||||
buttonRef.Name = "buttonRef";
|
buttonRef.Name = "buttonRef";
|
||||||
buttonRef.Size = new Size(118, 36);
|
buttonRef.Size = new Size(118, 36);
|
||||||
buttonRef.TabIndex = 4;
|
buttonRef.TabIndex = 4;
|
||||||
@ -97,7 +97,7 @@
|
|||||||
// buttonDel
|
// buttonDel
|
||||||
//
|
//
|
||||||
buttonDel.Location = new Point(752, 190);
|
buttonDel.Location = new Point(752, 190);
|
||||||
buttonDel.Margin = new Padding(4, 4, 4, 4);
|
buttonDel.Margin = new Padding(4);
|
||||||
buttonDel.Name = "buttonDel";
|
buttonDel.Name = "buttonDel";
|
||||||
buttonDel.Size = new Size(118, 36);
|
buttonDel.Size = new Size(118, 36);
|
||||||
buttonDel.TabIndex = 3;
|
buttonDel.TabIndex = 3;
|
||||||
@ -108,7 +108,7 @@
|
|||||||
// buttonUpd
|
// buttonUpd
|
||||||
//
|
//
|
||||||
buttonUpd.Location = new Point(752, 122);
|
buttonUpd.Location = new Point(752, 122);
|
||||||
buttonUpd.Margin = new Padding(4, 4, 4, 4);
|
buttonUpd.Margin = new Padding(4);
|
||||||
buttonUpd.Name = "buttonUpd";
|
buttonUpd.Name = "buttonUpd";
|
||||||
buttonUpd.Size = new Size(118, 36);
|
buttonUpd.Size = new Size(118, 36);
|
||||||
buttonUpd.TabIndex = 2;
|
buttonUpd.TabIndex = 2;
|
||||||
@ -119,7 +119,7 @@
|
|||||||
// buttonAdd
|
// buttonAdd
|
||||||
//
|
//
|
||||||
buttonAdd.Location = new Point(752, 55);
|
buttonAdd.Location = new Point(752, 55);
|
||||||
buttonAdd.Margin = new Padding(4, 4, 4, 4);
|
buttonAdd.Margin = new Padding(4);
|
||||||
buttonAdd.Name = "buttonAdd";
|
buttonAdd.Name = "buttonAdd";
|
||||||
buttonAdd.Size = new Size(118, 36);
|
buttonAdd.Size = new Size(118, 36);
|
||||||
buttonAdd.TabIndex = 1;
|
buttonAdd.TabIndex = 1;
|
||||||
@ -132,7 +132,7 @@
|
|||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ComponentId, ComponentName, Count });
|
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ComponentId, ComponentName, Count });
|
||||||
dataGridView.Location = new Point(0, 32);
|
dataGridView.Location = new Point(0, 32);
|
||||||
dataGridView.Margin = new Padding(4, 4, 4, 4);
|
dataGridView.Margin = new Padding(4);
|
||||||
dataGridView.Name = "dataGridView";
|
dataGridView.Name = "dataGridView";
|
||||||
dataGridView.RowHeadersWidth = 51;
|
dataGridView.RowHeadersWidth = 51;
|
||||||
dataGridView.RowTemplate.Height = 29;
|
dataGridView.RowTemplate.Height = 29;
|
||||||
@ -164,7 +164,7 @@
|
|||||||
// textBoxName
|
// textBoxName
|
||||||
//
|
//
|
||||||
textBoxName.Location = new Point(188, 12);
|
textBoxName.Location = new Point(188, 12);
|
||||||
textBoxName.Margin = new Padding(4, 4, 4, 4);
|
textBoxName.Margin = new Padding(4);
|
||||||
textBoxName.Name = "textBoxName";
|
textBoxName.Name = "textBoxName";
|
||||||
textBoxName.Size = new Size(373, 31);
|
textBoxName.Size = new Size(373, 31);
|
||||||
textBoxName.TabIndex = 3;
|
textBoxName.TabIndex = 3;
|
||||||
@ -172,7 +172,7 @@
|
|||||||
// textBoxCost
|
// textBoxCost
|
||||||
//
|
//
|
||||||
textBoxCost.Location = new Point(188, 61);
|
textBoxCost.Location = new Point(188, 61);
|
||||||
textBoxCost.Margin = new Padding(4, 4, 4, 4);
|
textBoxCost.Margin = new Padding(4);
|
||||||
textBoxCost.Name = "textBoxCost";
|
textBoxCost.Name = "textBoxCost";
|
||||||
textBoxCost.Size = new Size(256, 31);
|
textBoxCost.Size = new Size(256, 31);
|
||||||
textBoxCost.TabIndex = 4;
|
textBoxCost.TabIndex = 4;
|
||||||
@ -180,7 +180,7 @@
|
|||||||
// buttonCancel
|
// buttonCancel
|
||||||
//
|
//
|
||||||
buttonCancel.Location = new Point(857, 511);
|
buttonCancel.Location = new Point(857, 511);
|
||||||
buttonCancel.Margin = new Padding(4, 4, 4, 4);
|
buttonCancel.Margin = new Padding(4);
|
||||||
buttonCancel.Name = "buttonCancel";
|
buttonCancel.Name = "buttonCancel";
|
||||||
buttonCancel.Size = new Size(118, 36);
|
buttonCancel.Size = new Size(118, 36);
|
||||||
buttonCancel.TabIndex = 5;
|
buttonCancel.TabIndex = 5;
|
||||||
@ -191,7 +191,7 @@
|
|||||||
// buttonSave
|
// buttonSave
|
||||||
//
|
//
|
||||||
buttonSave.Location = new Point(731, 511);
|
buttonSave.Location = new Point(731, 511);
|
||||||
buttonSave.Margin = new Padding(4, 4, 4, 4);
|
buttonSave.Margin = new Padding(4);
|
||||||
buttonSave.Name = "buttonSave";
|
buttonSave.Name = "buttonSave";
|
||||||
buttonSave.Size = new Size(118, 36);
|
buttonSave.Size = new Size(118, 36);
|
||||||
buttonSave.TabIndex = 6;
|
buttonSave.TabIndex = 6;
|
||||||
@ -211,9 +211,10 @@
|
|||||||
Controls.Add(groupBox1);
|
Controls.Add(groupBox1);
|
||||||
Controls.Add(label2);
|
Controls.Add(label2);
|
||||||
Controls.Add(label1);
|
Controls.Add(label1);
|
||||||
Margin = new Padding(4, 4, 4, 4);
|
Margin = new Padding(4);
|
||||||
Name = "FormWork";
|
Name = "FormWork";
|
||||||
Text = "Работа";
|
Text = "Работа";
|
||||||
|
Load += FormWork_Load;
|
||||||
groupBox1.ResumeLayout(false);
|
groupBox1.ResumeLayout(false);
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
</data>
|
</data>
|
||||||
|
@ -23,6 +23,7 @@ namespace PlumbingRepairView
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_logic = logic;
|
_logic = logic;
|
||||||
|
LoadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormComponents_Load(object sender, EventArgs e)
|
private void FormComponents_Load(object sender, EventArgs e)
|
||||||
|
@ -53,6 +53,7 @@ namespace PlumbingRepairView
|
|||||||
services.AddTransient<FormStores>();
|
services.AddTransient<FormStores>();
|
||||||
services.AddTransient<FormStore>();
|
services.AddTransient<FormStore>();
|
||||||
services.AddTransient<FormStoreReplenishment>();
|
services.AddTransient<FormStoreReplenishment>();
|
||||||
|
services.AddTransient<FormSellWork>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user