done Forms/Shop
This commit is contained in:
parent
57d43005e6
commit
b4d4b6d0f4
177
AutoWorkshopView/Forms/Shop/FormCreateSupply.Designer.cs
generated
177
AutoWorkshopView/Forms/Shop/FormCreateSupply.Designer.cs
generated
@ -20,118 +20,127 @@
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
comboBoxShop = new System.Windows.Forms.ComboBox();
|
||||
labelShop = new System.Windows.Forms.Label();
|
||||
labelRepair = new System.Windows.Forms.Label();
|
||||
comboBoxRepair = new System.Windows.Forms.ComboBox();
|
||||
labelCount = new System.Windows.Forms.Label();
|
||||
textBoxCount = new System.Windows.Forms.TextBox();
|
||||
buttonCancel = new System.Windows.Forms.Button();
|
||||
buttonSave = new System.Windows.Forms.Button();
|
||||
ShopComboBox = new ComboBox();
|
||||
ShopLabel = new Label();
|
||||
RepairLabel = new Label();
|
||||
RepairComboBox = new ComboBox();
|
||||
CountLabel = new Label();
|
||||
CountTextbox = new TextBox();
|
||||
CancelButton = new Button();
|
||||
SaveButton = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// comboBoxShop
|
||||
// ShopComboBox
|
||||
//
|
||||
comboBoxShop.FormattingEnabled = true;
|
||||
comboBoxShop.Location = new System.Drawing.Point(115, 12);
|
||||
comboBoxShop.Name = "comboBoxShop";
|
||||
comboBoxShop.Size = new System.Drawing.Size(344, 28);
|
||||
comboBoxShop.TabIndex = 0;
|
||||
ShopComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
ShopComboBox.FormattingEnabled = true;
|
||||
ShopComboBox.Location = new Point(101, 9);
|
||||
ShopComboBox.Margin = new Padding(3, 2, 3, 2);
|
||||
ShopComboBox.Name = "ShopComboBox";
|
||||
ShopComboBox.Size = new Size(302, 23);
|
||||
ShopComboBox.TabIndex = 0;
|
||||
//
|
||||
// labelShop
|
||||
// ShopLabel
|
||||
//
|
||||
labelShop.AutoSize = true;
|
||||
labelShop.Location = new System.Drawing.Point(12, 15);
|
||||
labelShop.Name = "labelShop";
|
||||
labelShop.Size = new System.Drawing.Size(76, 20);
|
||||
labelShop.TabIndex = 1;
|
||||
labelShop.Text = "Магазин: ";
|
||||
ShopLabel.AutoSize = true;
|
||||
ShopLabel.Location = new Point(10, 12);
|
||||
ShopLabel.Name = "ShopLabel";
|
||||
ShopLabel.Size = new Size(60, 15);
|
||||
ShopLabel.TabIndex = 1;
|
||||
ShopLabel.Text = "Магазин: ";
|
||||
//
|
||||
// labelRepair
|
||||
// RepairLabel
|
||||
//
|
||||
labelRepair.AutoSize = true;
|
||||
labelRepair.Location = new System.Drawing.Point(12, 49);
|
||||
labelRepair.Name = "labelRepair";
|
||||
labelRepair.Size = new System.Drawing.Size(75, 20);
|
||||
labelRepair.TabIndex = 2;
|
||||
labelRepair.Text = "Изделие: ";
|
||||
RepairLabel.AutoSize = true;
|
||||
RepairLabel.Location = new Point(11, 39);
|
||||
RepairLabel.Name = "RepairLabel";
|
||||
RepairLabel.Size = new Size(51, 15);
|
||||
RepairLabel.TabIndex = 2;
|
||||
RepairLabel.Text = "Ремонт:";
|
||||
//
|
||||
// comboBoxRepair
|
||||
// RepairComboBox
|
||||
//
|
||||
comboBoxRepair.FormattingEnabled = true;
|
||||
comboBoxRepair.Location = new System.Drawing.Point(115, 46);
|
||||
comboBoxRepair.Name = "comboBoxRepair";
|
||||
comboBoxRepair.Size = new System.Drawing.Size(344, 28);
|
||||
comboBoxRepair.TabIndex = 3;
|
||||
RepairComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
RepairComboBox.FormattingEnabled = true;
|
||||
RepairComboBox.Location = new Point(101, 36);
|
||||
RepairComboBox.Margin = new Padding(3, 2, 3, 2);
|
||||
RepairComboBox.Name = "RepairComboBox";
|
||||
RepairComboBox.Size = new Size(302, 23);
|
||||
RepairComboBox.TabIndex = 3;
|
||||
//
|
||||
// labelCount
|
||||
// CountLabel
|
||||
//
|
||||
labelCount.AutoSize = true;
|
||||
labelCount.Location = new System.Drawing.Point(12, 83);
|
||||
labelCount.Name = "labelCount";
|
||||
labelCount.Size = new System.Drawing.Size(97, 20);
|
||||
labelCount.TabIndex = 4;
|
||||
labelCount.Text = "Количество: ";
|
||||
CountLabel.AutoSize = true;
|
||||
CountLabel.Location = new Point(11, 66);
|
||||
CountLabel.Name = "CountLabel";
|
||||
CountLabel.Size = new Size(78, 15);
|
||||
CountLabel.TabIndex = 4;
|
||||
CountLabel.Text = "Количество: ";
|
||||
//
|
||||
// textBoxCount
|
||||
// CountTextbox
|
||||
//
|
||||
textBoxCount.Location = new System.Drawing.Point(115, 80);
|
||||
textBoxCount.Name = "textBoxCount";
|
||||
textBoxCount.Size = new System.Drawing.Size(344, 27);
|
||||
textBoxCount.TabIndex = 5;
|
||||
CountTextbox.Location = new Point(101, 63);
|
||||
CountTextbox.Margin = new Padding(3, 2, 3, 2);
|
||||
CountTextbox.Name = "CountTextbox";
|
||||
CountTextbox.Size = new Size(302, 23);
|
||||
CountTextbox.TabIndex = 5;
|
||||
//
|
||||
// buttonCancel
|
||||
// CancelButton
|
||||
//
|
||||
buttonCancel.Location = new System.Drawing.Point(300, 113);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new System.Drawing.Size(116, 39);
|
||||
buttonCancel.TabIndex = 6;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += new System.EventHandler(ButtonCancel_Click);
|
||||
CancelButton.Location = new Point(301, 100);
|
||||
CancelButton.Margin = new Padding(3, 2, 3, 2);
|
||||
CancelButton.Name = "CancelButton";
|
||||
CancelButton.Size = new Size(102, 29);
|
||||
CancelButton.TabIndex = 6;
|
||||
CancelButton.Text = "Отмена";
|
||||
CancelButton.UseVisualStyleBackColor = true;
|
||||
CancelButton.Click += CancelButton_Click;
|
||||
//
|
||||
// buttonSave
|
||||
// SaveButton
|
||||
//
|
||||
buttonSave.Location = new System.Drawing.Point(168, 113);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new System.Drawing.Size(116, 39);
|
||||
buttonSave.TabIndex = 7;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += new System.EventHandler(ButtonSave_Click);
|
||||
SaveButton.Location = new Point(183, 100);
|
||||
SaveButton.Margin = new Padding(3, 2, 3, 2);
|
||||
SaveButton.Name = "SaveButton";
|
||||
SaveButton.Size = new Size(102, 29);
|
||||
SaveButton.TabIndex = 7;
|
||||
SaveButton.Text = "Сохранить";
|
||||
SaveButton.UseVisualStyleBackColor = true;
|
||||
SaveButton.Click += SaveButton_Click;
|
||||
//
|
||||
// FormCreateSupply
|
||||
//
|
||||
AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
ClientSize = new System.Drawing.Size(471, 164);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(textBoxCount);
|
||||
Controls.Add(labelCount);
|
||||
Controls.Add(comboBoxRepair);
|
||||
Controls.Add(labelRepair);
|
||||
Controls.Add(labelShop);
|
||||
Controls.Add(comboBoxShop);
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(417, 143);
|
||||
Controls.Add(SaveButton);
|
||||
Controls.Add(CancelButton);
|
||||
Controls.Add(CountTextbox);
|
||||
Controls.Add(CountLabel);
|
||||
Controls.Add(RepairComboBox);
|
||||
Controls.Add(RepairLabel);
|
||||
Controls.Add(ShopLabel);
|
||||
Controls.Add(ShopComboBox);
|
||||
Margin = new Padding(3, 2, 3, 2);
|
||||
Name = "FormCreateSupply";
|
||||
Text = "Создание поставки";
|
||||
Load += new System.EventHandler(FormCreateSupply_Load);
|
||||
Load += FormCreateSupply_Load;
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
private ComboBox comboBoxShop;
|
||||
private Label labelShop;
|
||||
private Label labelRepair;
|
||||
private ComboBox comboBoxRepair;
|
||||
private Label labelCount;
|
||||
private TextBox textBoxCount;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
private ComboBox ShopComboBox;
|
||||
private Label ShopLabel;
|
||||
private Label RepairLabel;
|
||||
private ComboBox RepairComboBox;
|
||||
private Label CountLabel;
|
||||
private TextBox CountTextbox;
|
||||
private Button CancelButton;
|
||||
private Button SaveButton;
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using AutoWorkshopContracts.BindingModels;
|
||||
using AutoWorkshopContracts.BusinessLogicContracts;
|
||||
using AutoWorkshopContracts.BusinessLogicsContracts;
|
||||
using AutoWorkshopContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@ -8,68 +9,77 @@ namespace AutoWorkshopView.Forms.Shop
|
||||
public partial class FormCreateSupply : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IRepairLogic _logicP;
|
||||
private readonly IShopLogic _logicS;
|
||||
private readonly IRepairLogic _repairLogic;
|
||||
private readonly IShopLogic _shopLogic;
|
||||
|
||||
private List<ShopViewModel> _shopList = new List<ShopViewModel>();
|
||||
private List<RepairViewModel> _RepairList = new List<RepairViewModel>();
|
||||
|
||||
public FormCreateSupply(ILogger<FormCreateSupply> logger, IRepairLogic logicP, IShopLogic logicS)
|
||||
public FormCreateSupply(ILogger<FormCreateSupply> Logger, IRepairLogic RepairLogic, IShopLogic ShopLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logicP = logicP;
|
||||
_logicS = logicS;
|
||||
|
||||
_logger = Logger;
|
||||
_repairLogic = RepairLogic;
|
||||
_shopLogic = ShopLogic;
|
||||
}
|
||||
|
||||
private void FormCreateSupply_Load(object sender, EventArgs e)
|
||||
{
|
||||
_shopList = _logicS.ReadList(null);
|
||||
_RepairList = _logicP.ReadList(null);
|
||||
_shopList = _shopLogic.ReadList(null);
|
||||
_RepairList = _repairLogic.ReadList(null);
|
||||
|
||||
if (_shopList != null)
|
||||
{
|
||||
comboBoxShop.DisplayMember = "ShopName";
|
||||
comboBoxShop.ValueMember = "Id";
|
||||
comboBoxShop.DataSource = _shopList;
|
||||
comboBoxShop.SelectedItem = null;
|
||||
ShopComboBox.DisplayMember = "ShopName";
|
||||
ShopComboBox.ValueMember = "Id";
|
||||
ShopComboBox.DataSource = _shopList;
|
||||
ShopComboBox.SelectedItem = null;
|
||||
_logger.LogInformation("Загрузка магазинов для поставок");
|
||||
}
|
||||
|
||||
if (_RepairList != null)
|
||||
{
|
||||
comboBoxRepair.DisplayMember = "RepairName";
|
||||
comboBoxRepair.ValueMember = "Id";
|
||||
comboBoxRepair.DataSource = _RepairList;
|
||||
comboBoxRepair.SelectedItem = null;
|
||||
RepairComboBox.DisplayMember = "RepairName";
|
||||
RepairComboBox.ValueMember = "Id";
|
||||
RepairComboBox.DataSource = _RepairList;
|
||||
RepairComboBox.SelectedItem = null;
|
||||
_logger.LogInformation("Загрузка ремонтов для поставок");
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
private void SaveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (comboBoxShop.SelectedValue == null)
|
||||
if (ShopComboBox.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите магазин", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (comboBoxRepair.SelectedValue == null)
|
||||
|
||||
if (RepairComboBox.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
_logger.LogInformation("Создание поставки");
|
||||
|
||||
try
|
||||
{
|
||||
var operationResult = _logicS.MakeSupply(new SupplyBindingModel
|
||||
var OperationResult = _shopLogic.MakeSupply(new SupplyBindingModel
|
||||
{
|
||||
ShopId = Convert.ToInt32(comboBoxShop.SelectedValue),
|
||||
RepairId = Convert.ToInt32(comboBoxRepair.SelectedValue),
|
||||
Count = Convert.ToInt32(textBoxCount.Text)
|
||||
ShopId = Convert.ToInt32(ShopComboBox.SelectedValue),
|
||||
RepairId = Convert.ToInt32(RepairComboBox.SelectedValue),
|
||||
Count = Convert.ToInt32(CountTextbox.Text)
|
||||
});
|
||||
if (!operationResult)
|
||||
|
||||
if (!OperationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при создании поставки. Дополнительная информация в логах.");
|
||||
}
|
||||
|
||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
@ -80,7 +90,7 @@ namespace AutoWorkshopView.Forms.Shop
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
private void CancelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
|
@ -1,17 +1,17 @@
|
||||
<?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
|
||||
|
||||
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>
|
||||
@ -26,36 +26,36 @@
|
||||
<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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
|
253
AutoWorkshopView/Forms/Shop/FormShop.Designer.cs
generated
253
AutoWorkshopView/Forms/Shop/FormShop.Designer.cs
generated
@ -28,166 +28,169 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
labelName = new System.Windows.Forms.Label();
|
||||
textBoxName = new System.Windows.Forms.TextBox();
|
||||
textBoxAdress = new System.Windows.Forms.TextBox();
|
||||
labelAdress = new System.Windows.Forms.Label();
|
||||
buttonCancel = new System.Windows.Forms.Button();
|
||||
buttonSave = new System.Windows.Forms.Button();
|
||||
dataGridView = new System.Windows.Forms.DataGridView();
|
||||
id = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
RepairName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
Count = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
label1 = new System.Windows.Forms.Label();
|
||||
dateTimeOpen = new System.Windows.Forms.DateTimePicker();
|
||||
((System.ComponentModel.ISupportInitialize)(dataGridView)).BeginInit();
|
||||
NameLabel = new Label();
|
||||
NameTextBox = new TextBox();
|
||||
AddressTextBox = new TextBox();
|
||||
AddressLabel = new Label();
|
||||
CancelButton = new Button();
|
||||
SaveButton = new Button();
|
||||
ViewDataGrid = new DataGridView();
|
||||
IdColumn = new DataGridViewTextBoxColumn();
|
||||
RepairNameColumn = new DataGridViewTextBoxColumn();
|
||||
CountColumn = new DataGridViewTextBoxColumn();
|
||||
OpeningDateLabel = new Label();
|
||||
OpenDateTimePicker = new DateTimePicker();
|
||||
((System.ComponentModel.ISupportInitialize)ViewDataGrid).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelName
|
||||
// NameLabel
|
||||
//
|
||||
labelName.AutoSize = true;
|
||||
labelName.Location = new System.Drawing.Point(11, 15);
|
||||
labelName.Name = "labelName";
|
||||
labelName.Size = new System.Drawing.Size(84, 20);
|
||||
labelName.TabIndex = 0;
|
||||
labelName.Text = "Название: ";
|
||||
NameLabel.AutoSize = true;
|
||||
NameLabel.Location = new Point(10, 12);
|
||||
NameLabel.Name = "NameLabel";
|
||||
NameLabel.Size = new Size(65, 15);
|
||||
NameLabel.TabIndex = 0;
|
||||
NameLabel.Text = "Название: ";
|
||||
//
|
||||
// textBoxName
|
||||
// NameTextBox
|
||||
//
|
||||
textBoxName.Location = new System.Drawing.Point(102, 12);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new System.Drawing.Size(276, 27);
|
||||
textBoxName.TabIndex = 1;
|
||||
NameTextBox.Location = new Point(112, 9);
|
||||
NameTextBox.Margin = new Padding(3, 2, 3, 2);
|
||||
NameTextBox.Name = "NameTextBox";
|
||||
NameTextBox.Size = new Size(240, 23);
|
||||
NameTextBox.TabIndex = 1;
|
||||
//
|
||||
// textBoxAdress
|
||||
// AddressTextBox
|
||||
//
|
||||
textBoxAdress.Location = new System.Drawing.Point(102, 59);
|
||||
textBoxAdress.Name = "textBoxAdress";
|
||||
textBoxAdress.Size = new System.Drawing.Size(427, 27);
|
||||
textBoxAdress.TabIndex = 3;
|
||||
AddressTextBox.Location = new Point(112, 36);
|
||||
AddressTextBox.Margin = new Padding(3, 2, 3, 2);
|
||||
AddressTextBox.Name = "AddressTextBox";
|
||||
AddressTextBox.Size = new Size(240, 23);
|
||||
AddressTextBox.TabIndex = 3;
|
||||
//
|
||||
// labelAdress
|
||||
// AddressLabel
|
||||
//
|
||||
labelAdress.AutoSize = true;
|
||||
labelAdress.Location = new System.Drawing.Point(11, 61);
|
||||
labelAdress.Name = "labelAdress";
|
||||
labelAdress.Size = new System.Drawing.Size(58, 20);
|
||||
labelAdress.TabIndex = 2;
|
||||
labelAdress.Text = "Адрес: ";
|
||||
AddressLabel.AutoSize = true;
|
||||
AddressLabel.Location = new Point(12, 39);
|
||||
AddressLabel.Name = "AddressLabel";
|
||||
AddressLabel.Size = new Size(46, 15);
|
||||
AddressLabel.TabIndex = 2;
|
||||
AddressLabel.Text = "Адрес: ";
|
||||
//
|
||||
// buttonCancel
|
||||
// CancelButton
|
||||
//
|
||||
buttonCancel.Location = new System.Drawing.Point(451, 457);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new System.Drawing.Size(130, 44);
|
||||
buttonCancel.TabIndex = 5;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += new System.EventHandler(buttonCancel_Click);
|
||||
CancelButton.Location = new Point(395, 343);
|
||||
CancelButton.Margin = new Padding(3, 2, 3, 2);
|
||||
CancelButton.Name = "CancelButton";
|
||||
CancelButton.Size = new Size(114, 33);
|
||||
CancelButton.TabIndex = 5;
|
||||
CancelButton.Text = "Отмена";
|
||||
CancelButton.UseVisualStyleBackColor = true;
|
||||
CancelButton.Click += CancelButton_Click;
|
||||
//
|
||||
// buttonSave
|
||||
// SaveButton
|
||||
//
|
||||
buttonSave.Location = new System.Drawing.Point(315, 457);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new System.Drawing.Size(130, 44);
|
||||
buttonSave.TabIndex = 6;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += new System.EventHandler(buttonSave_Click);
|
||||
SaveButton.Location = new Point(276, 343);
|
||||
SaveButton.Margin = new Padding(3, 2, 3, 2);
|
||||
SaveButton.Name = "SaveButton";
|
||||
SaveButton.Size = new Size(114, 33);
|
||||
SaveButton.TabIndex = 6;
|
||||
SaveButton.Text = "Сохранить";
|
||||
SaveButton.UseVisualStyleBackColor = true;
|
||||
SaveButton.Click += SaveButton_Click;
|
||||
//
|
||||
// dataGridView
|
||||
// ViewDataGrid
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
id,
|
||||
RepairName,
|
||||
Count});
|
||||
dataGridView.Location = new System.Drawing.Point(12, 144);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
|
||||
dataGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders;
|
||||
dataGridView.RowTemplate.Height = 29;
|
||||
dataGridView.Size = new System.Drawing.Size(569, 307);
|
||||
dataGridView.TabIndex = 7;
|
||||
ViewDataGrid.AllowUserToAddRows = false;
|
||||
ViewDataGrid.AllowUserToDeleteRows = false;
|
||||
ViewDataGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
ViewDataGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
ViewDataGrid.Columns.AddRange(new DataGridViewColumn[] { IdColumn, RepairNameColumn, CountColumn });
|
||||
ViewDataGrid.Location = new Point(10, 108);
|
||||
ViewDataGrid.Margin = new Padding(3, 2, 3, 2);
|
||||
ViewDataGrid.Name = "ViewDataGrid";
|
||||
ViewDataGrid.ReadOnly = true;
|
||||
ViewDataGrid.RowHeadersBorderStyle = DataGridViewHeaderBorderStyle.None;
|
||||
ViewDataGrid.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders;
|
||||
ViewDataGrid.RowTemplate.Height = 29;
|
||||
ViewDataGrid.Size = new Size(498, 230);
|
||||
ViewDataGrid.TabIndex = 7;
|
||||
//
|
||||
// id
|
||||
// IdColumn
|
||||
//
|
||||
id.HeaderText = "id";
|
||||
id.MinimumWidth = 6;
|
||||
id.Name = "id";
|
||||
id.ReadOnly = true;
|
||||
id.Visible = false;
|
||||
IdColumn.HeaderText = "Id";
|
||||
IdColumn.MinimumWidth = 6;
|
||||
IdColumn.Name = "IdColumn";
|
||||
IdColumn.ReadOnly = true;
|
||||
IdColumn.Visible = false;
|
||||
//
|
||||
// RepairName
|
||||
// RepairNameColumn
|
||||
//
|
||||
RepairName.HeaderText = "Ремонт";
|
||||
RepairName.MinimumWidth = 6;
|
||||
RepairName.Name = "RepairName";
|
||||
RepairName.ReadOnly = true;
|
||||
RepairNameColumn.HeaderText = "Ремонт";
|
||||
RepairNameColumn.MinimumWidth = 6;
|
||||
RepairNameColumn.Name = "RepairNameColumn";
|
||||
RepairNameColumn.ReadOnly = true;
|
||||
//
|
||||
// Count
|
||||
// CountColumn
|
||||
//
|
||||
Count.HeaderText = "Количество";
|
||||
Count.MinimumWidth = 6;
|
||||
Count.Name = "Count";
|
||||
Count.ReadOnly = true;
|
||||
CountColumn.HeaderText = "Количество";
|
||||
CountColumn.MinimumWidth = 6;
|
||||
CountColumn.Name = "CountColumn";
|
||||
CountColumn.ReadOnly = true;
|
||||
//
|
||||
// label1
|
||||
// OpeningDateLabel
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new System.Drawing.Point(12, 103);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new System.Drawing.Size(110, 20);
|
||||
label1.TabIndex = 8;
|
||||
label1.Text = "Дата открытия";
|
||||
OpeningDateLabel.AutoSize = true;
|
||||
OpeningDateLabel.Location = new Point(10, 69);
|
||||
OpeningDateLabel.Name = "OpeningDateLabel";
|
||||
OpeningDateLabel.Size = new Size(87, 15);
|
||||
OpeningDateLabel.TabIndex = 8;
|
||||
OpeningDateLabel.Text = "Дата открытия";
|
||||
//
|
||||
// dateTimeOpen
|
||||
// OpenDateTimePicker
|
||||
//
|
||||
dateTimeOpen.Location = new System.Drawing.Point(128, 103);
|
||||
dateTimeOpen.Name = "dateTimeOpen";
|
||||
dateTimeOpen.Size = new System.Drawing.Size(401, 27);
|
||||
dateTimeOpen.TabIndex = 9;
|
||||
OpenDateTimePicker.Location = new Point(112, 63);
|
||||
OpenDateTimePicker.Margin = new Padding(3, 2, 3, 2);
|
||||
OpenDateTimePicker.Name = "OpenDateTimePicker";
|
||||
OpenDateTimePicker.Size = new Size(240, 23);
|
||||
OpenDateTimePicker.TabIndex = 9;
|
||||
//
|
||||
// FormShop
|
||||
//
|
||||
AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
ClientSize = new System.Drawing.Size(593, 513);
|
||||
Controls.Add(dateTimeOpen);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(textBoxAdress);
|
||||
Controls.Add(labelAdress);
|
||||
Controls.Add(textBoxName);
|
||||
Controls.Add(labelName);
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(519, 385);
|
||||
Controls.Add(OpenDateTimePicker);
|
||||
Controls.Add(OpeningDateLabel);
|
||||
Controls.Add(ViewDataGrid);
|
||||
Controls.Add(SaveButton);
|
||||
Controls.Add(CancelButton);
|
||||
Controls.Add(AddressTextBox);
|
||||
Controls.Add(AddressLabel);
|
||||
Controls.Add(NameTextBox);
|
||||
Controls.Add(NameLabel);
|
||||
Margin = new Padding(3, 2, 3, 2);
|
||||
Name = "FormShop";
|
||||
Text = "Магазин";
|
||||
Load += new System.EventHandler(FormShop_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(dataGridView)).EndInit();
|
||||
Load += FormShop_Load;
|
||||
((System.ComponentModel.ISupportInitialize)ViewDataGrid).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelName;
|
||||
private TextBox textBoxName;
|
||||
private TextBox textBoxAdress;
|
||||
private Label labelAdress;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
private DataGridView dataGridView;
|
||||
private DataGridViewTextBoxColumn id;
|
||||
private DataGridViewTextBoxColumn RepairName;
|
||||
private DataGridViewTextBoxColumn Count;
|
||||
private Label label1;
|
||||
private DateTimePicker dateTimeOpen;
|
||||
private Label NameLabel;
|
||||
private TextBox NameTextBox;
|
||||
private TextBox AddressTextBox;
|
||||
private Label AddressLabel;
|
||||
private Button CancelButton;
|
||||
private Button SaveButton;
|
||||
private DataGridView ViewDataGrid;
|
||||
private DataGridViewTextBoxColumn IdColumn;
|
||||
private DataGridViewTextBoxColumn RepairNameColumn;
|
||||
private DataGridViewTextBoxColumn CountColumn;
|
||||
private Label OpeningDateLabel;
|
||||
private DateTimePicker OpenDateTimePicker;
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
using AutoWorkshopContracts.BindingModels;
|
||||
using AutoWorkshopContracts.BusinessLogicsContracts;
|
||||
using AutoWorkshopContracts.SearchModels;
|
||||
using AutoWorkshopDataModels.Models;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace AutoWorkshopView.Forms.Shop
|
||||
@ -9,17 +10,21 @@ namespace AutoWorkshopView.Forms.Shop
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IShopLogic _logic;
|
||||
|
||||
private int? _id;
|
||||
|
||||
public int Id { set { _id = value; } }
|
||||
private Dictionary<int, (IRepairModel, int)> _ShopRepairs;
|
||||
|
||||
private Dictionary<int, (IRepairModel, int)> _shopRepairs;
|
||||
private DateTime? _openingDate = null;
|
||||
|
||||
public FormShop(ILogger<FormShop> logger, IShopLogic logic)
|
||||
public FormShop(ILogger<FormShop> Logger, IShopLogic Logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
_ShopRepairs = new Dictionary<int, (IRepairModel, int)>();
|
||||
|
||||
_logger = Logger;
|
||||
_logic = Logic;
|
||||
_shopRepairs = new Dictionary<int, (IRepairModel, int)>();
|
||||
}
|
||||
|
||||
private void FormShop_Load(object sender, EventArgs e)
|
||||
@ -27,18 +32,21 @@ namespace AutoWorkshopView.Forms.Shop
|
||||
if (_id.HasValue)
|
||||
{
|
||||
_logger.LogInformation("Загрузка магазина");
|
||||
|
||||
try
|
||||
{
|
||||
var view = _logic.ReadElement(new ShopSearchModel
|
||||
var View = _logic.ReadElement(new ShopSearchModel
|
||||
{
|
||||
Id = _id.Value
|
||||
});
|
||||
if (view != null)
|
||||
|
||||
if (View != null)
|
||||
{
|
||||
textBoxName.Text = view.ShopName;
|
||||
textBoxAdress.Text = view.Adress;
|
||||
dateTimeOpen.Value = view.OpeningDate;
|
||||
_ShopRepairs = view.ShopRepairs ?? new Dictionary<int, (IRepairModel, int)>();
|
||||
NameTextBox.Text = View.ShopName;
|
||||
AddressTextBox.Text = View.Address;
|
||||
OpenDateTimePicker.Value = View.OpeningDate;
|
||||
_shopRepairs = View.ShopRepairs ?? new Dictionary<int, (IRepairModel, int)>();
|
||||
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
@ -52,15 +60,16 @@ namespace AutoWorkshopView.Forms.Shop
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
_logger.LogInformation("Загрузка изделий в магазине");
|
||||
_logger.LogInformation("Загрузка ремонтов в магазине");
|
||||
|
||||
try
|
||||
{
|
||||
if (_ShopRepairs != null)
|
||||
if (_shopRepairs != null)
|
||||
{
|
||||
dataGridView.Rows.Clear();
|
||||
foreach (var sr in _ShopRepairs)
|
||||
ViewDataGrid.Rows.Clear();
|
||||
foreach (var ShopRepair in _shopRepairs)
|
||||
{
|
||||
dataGridView.Rows.Add(new object[] { sr.Key, sr.Value.Item1.RepairName, sr.Value.Item2 });
|
||||
ViewDataGrid.Rows.Add(new object[] { ShopRepair.Key, ShopRepair.Value.Item1.RepairName, ShopRepair.Value.Item2 });
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -71,35 +80,41 @@ namespace AutoWorkshopView.Forms.Shop
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
private void SaveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxName.Text))
|
||||
if (string.IsNullOrEmpty(NameTextBox.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(textBoxAdress.Text))
|
||||
|
||||
if (string.IsNullOrEmpty(AddressTextBox.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните адрес", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
_logger.LogInformation("Сохранение магазина");
|
||||
|
||||
try
|
||||
{
|
||||
var model = new ShopBindingModel
|
||||
var Model = new ShopBindingModel
|
||||
{
|
||||
Id = _id ?? 0,
|
||||
ShopName = textBoxName.Text,
|
||||
Adress = textBoxAdress.Text,
|
||||
OpeningDate = dateTimeOpen.Value
|
||||
ShopName = NameTextBox.Text,
|
||||
Address = AddressTextBox.Text,
|
||||
OpeningDate = OpenDateTimePicker.Value
|
||||
};
|
||||
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||
if (!operationResult)
|
||||
|
||||
var OperationResult = _id.HasValue ? _logic.Update(Model) : _logic.Create(Model);
|
||||
if (!OperationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
|
||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -109,7 +124,7 @@ namespace AutoWorkshopView.Forms.Shop
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e)
|
||||
private void CancelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
|
@ -1,17 +1,17 @@
|
||||
<?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
|
||||
|
||||
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>
|
||||
@ -26,36 +26,36 @@
|
||||
<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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
|
142
AutoWorkshopView/Forms/Shop/FormShops.Designer.cs
generated
142
AutoWorkshopView/Forms/Shop/FormShops.Designer.cs
generated
@ -28,103 +28,109 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
ToolsPanel = new System.Windows.Forms.Panel();
|
||||
buttonRef = new System.Windows.Forms.Button();
|
||||
buttonDel = new System.Windows.Forms.Button();
|
||||
buttonUpd = new System.Windows.Forms.Button();
|
||||
buttonAdd = new System.Windows.Forms.Button();
|
||||
dataGridView = new System.Windows.Forms.DataGridView();
|
||||
ToolsPanel = new Panel();
|
||||
RefreshButton = new Button();
|
||||
DeleteButton = new Button();
|
||||
UpdateButton = new Button();
|
||||
AddButton = new Button();
|
||||
ViewDataGrid = new DataGridView();
|
||||
ToolsPanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(dataGridView)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)ViewDataGrid).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// ToolsPanel
|
||||
//
|
||||
ToolsPanel.Controls.Add(buttonRef);
|
||||
ToolsPanel.Controls.Add(buttonDel);
|
||||
ToolsPanel.Controls.Add(buttonUpd);
|
||||
ToolsPanel.Controls.Add(buttonAdd);
|
||||
ToolsPanel.Location = new System.Drawing.Point(608, 12);
|
||||
ToolsPanel.Controls.Add(RefreshButton);
|
||||
ToolsPanel.Controls.Add(DeleteButton);
|
||||
ToolsPanel.Controls.Add(UpdateButton);
|
||||
ToolsPanel.Controls.Add(AddButton);
|
||||
ToolsPanel.Location = new Point(532, 9);
|
||||
ToolsPanel.Margin = new Padding(3, 2, 3, 2);
|
||||
ToolsPanel.Name = "ToolsPanel";
|
||||
ToolsPanel.Size = new System.Drawing.Size(180, 426);
|
||||
ToolsPanel.Size = new Size(117, 320);
|
||||
ToolsPanel.TabIndex = 3;
|
||||
//
|
||||
// buttonRef
|
||||
// RefreshButton
|
||||
//
|
||||
buttonRef.Location = new System.Drawing.Point(31, 206);
|
||||
buttonRef.Name = "buttonRef";
|
||||
buttonRef.Size = new System.Drawing.Size(126, 36);
|
||||
buttonRef.TabIndex = 3;
|
||||
buttonRef.Text = "Обновить";
|
||||
buttonRef.UseVisualStyleBackColor = true;
|
||||
buttonRef.Click += new System.EventHandler(ButtonRef_Click);
|
||||
RefreshButton.Location = new Point(3, 105);
|
||||
RefreshButton.Margin = new Padding(3, 2, 3, 2);
|
||||
RefreshButton.Name = "RefreshButton";
|
||||
RefreshButton.Size = new Size(110, 27);
|
||||
RefreshButton.TabIndex = 3;
|
||||
RefreshButton.Text = "Обновить";
|
||||
RefreshButton.UseVisualStyleBackColor = true;
|
||||
RefreshButton.Click += RefreshButton_Click;
|
||||
//
|
||||
// buttonDel
|
||||
// DeleteButton
|
||||
//
|
||||
buttonDel.Location = new System.Drawing.Point(31, 142);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new System.Drawing.Size(126, 36);
|
||||
buttonDel.TabIndex = 2;
|
||||
buttonDel.Text = "Удалить";
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += new System.EventHandler(ButtonDel_Click);
|
||||
DeleteButton.Location = new Point(3, 74);
|
||||
DeleteButton.Margin = new Padding(3, 2, 3, 2);
|
||||
DeleteButton.Name = "DeleteButton";
|
||||
DeleteButton.Size = new Size(110, 27);
|
||||
DeleteButton.TabIndex = 2;
|
||||
DeleteButton.Text = "Удалить";
|
||||
DeleteButton.UseVisualStyleBackColor = true;
|
||||
DeleteButton.Click += DeleteButton_Click;
|
||||
//
|
||||
// buttonUpd
|
||||
// UpdateButton
|
||||
//
|
||||
buttonUpd.Location = new System.Drawing.Point(31, 76);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new System.Drawing.Size(126, 36);
|
||||
buttonUpd.TabIndex = 1;
|
||||
buttonUpd.Text = "Изменить";
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
buttonUpd.Click += new System.EventHandler(ButtonUpd_Click);
|
||||
UpdateButton.Location = new Point(3, 43);
|
||||
UpdateButton.Margin = new Padding(3, 2, 3, 2);
|
||||
UpdateButton.Name = "UpdateButton";
|
||||
UpdateButton.Size = new Size(110, 27);
|
||||
UpdateButton.TabIndex = 1;
|
||||
UpdateButton.Text = "Изменить";
|
||||
UpdateButton.UseVisualStyleBackColor = true;
|
||||
UpdateButton.Click += UpdateButton_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
// AddButton
|
||||
//
|
||||
buttonAdd.Location = new System.Drawing.Point(31, 16);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new System.Drawing.Size(126, 36);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.Text = "Добавить";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += new System.EventHandler(ButtonAdd_Click);
|
||||
AddButton.Location = new Point(3, 12);
|
||||
AddButton.Margin = new Padding(3, 2, 3, 2);
|
||||
AddButton.Name = "AddButton";
|
||||
AddButton.Size = new Size(110, 27);
|
||||
AddButton.TabIndex = 0;
|
||||
AddButton.Text = "Добавить";
|
||||
AddButton.UseVisualStyleBackColor = true;
|
||||
AddButton.Click += AddButton_Click;
|
||||
//
|
||||
// dataGridView
|
||||
// ViewDataGrid
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Location = new System.Drawing.Point(12, 12);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.RowTemplate.Height = 29;
|
||||
dataGridView.Size = new System.Drawing.Size(590, 426);
|
||||
dataGridView.TabIndex = 2;
|
||||
ViewDataGrid.AllowUserToAddRows = false;
|
||||
ViewDataGrid.AllowUserToDeleteRows = false;
|
||||
ViewDataGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
ViewDataGrid.Location = new Point(10, 9);
|
||||
ViewDataGrid.Margin = new Padding(3, 2, 3, 2);
|
||||
ViewDataGrid.Name = "ViewDataGrid";
|
||||
ViewDataGrid.ReadOnly = true;
|
||||
ViewDataGrid.RowHeadersWidth = 51;
|
||||
ViewDataGrid.RowTemplate.Height = 29;
|
||||
ViewDataGrid.Size = new Size(516, 320);
|
||||
ViewDataGrid.TabIndex = 2;
|
||||
//
|
||||
// FormShops
|
||||
//
|
||||
AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
ClientSize = new System.Drawing.Size(800, 450);
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(660, 338);
|
||||
Controls.Add(ToolsPanel);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(ViewDataGrid);
|
||||
Margin = new Padding(3, 2, 3, 2);
|
||||
Name = "FormShops";
|
||||
Text = "Магазины";
|
||||
Load += new System.EventHandler(FormShops_Load);
|
||||
Load += FormShops_Load;
|
||||
ToolsPanel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(dataGridView)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)ViewDataGrid).EndInit();
|
||||
ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel ToolsPanel;
|
||||
private Button buttonRef;
|
||||
private Button buttonDel;
|
||||
private Button buttonUpd;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridView;
|
||||
private Button RefreshButton;
|
||||
private Button DeleteButton;
|
||||
private Button UpdateButton;
|
||||
private Button AddButton;
|
||||
private DataGridView ViewDataGrid;
|
||||
}
|
||||
}
|
@ -9,11 +9,12 @@ namespace AutoWorkshopView.Forms.Shop
|
||||
private readonly ILogger _logger;
|
||||
private readonly IShopLogic _logic;
|
||||
|
||||
public FormShops(ILogger<FormShops> logger, IShopLogic logic)
|
||||
public FormShops(ILogger<FormShops> Logger, IShopLogic Logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
|
||||
_logger = Logger;
|
||||
_logic = Logic;
|
||||
}
|
||||
|
||||
private void FormShops_Load(object sender, EventArgs e)
|
||||
@ -25,15 +26,16 @@ namespace AutoWorkshopView.Forms.Shop
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _logic.ReadList(null);
|
||||
if (list != null)
|
||||
var List = _logic.ReadList(null);
|
||||
|
||||
if (List != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["Id"].Visible = false;
|
||||
dataGridView.Columns["ShopRepairs"].Visible = false;
|
||||
dataGridView.Columns["ShopName"].AutoSizeMode =
|
||||
DataGridViewAutoSizeColumnMode.Fill;
|
||||
ViewDataGrid.DataSource = List;
|
||||
ViewDataGrid.Columns["Id"].Visible = false;
|
||||
ViewDataGrid.Columns["ShopRepairs"].Visible = false;
|
||||
ViewDataGrid.Columns["ShopName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
|
||||
_logger.LogInformation("Загрузка магазинов");
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -43,27 +45,29 @@ namespace AutoWorkshopView.Forms.Shop
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
private void AddButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormShop));
|
||||
if (service is FormShop form)
|
||||
var Service = Program.ServiceProvider?.GetService(typeof(FormShop));
|
||||
|
||||
if (Service is FormShop Form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
if (Form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
||||
private void UpdateButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
if (ViewDataGrid.SelectedRows.Count == 1)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormShop));
|
||||
if (service is FormShop form)
|
||||
var Service = Program.ServiceProvider?.GetService(typeof(FormShop));
|
||||
if (Service is FormShop Form)
|
||||
{
|
||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
Form.Id = Convert.ToInt32(ViewDataGrid.SelectedRows[0].Cells["Id"].Value);
|
||||
|
||||
if (Form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
@ -71,23 +75,25 @@ namespace AutoWorkshopView.Forms.Shop
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonDel_Click(object sender, EventArgs e)
|
||||
private void DeleteButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
if (ViewDataGrid.SelectedRows.Count == 1)
|
||||
{
|
||||
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
int Id = Convert.ToInt32(ViewDataGrid.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Удаление магазина");
|
||||
|
||||
try
|
||||
{
|
||||
if (!_logic.Delete(new ShopBindingModel
|
||||
{
|
||||
Id = id
|
||||
}))
|
||||
{
|
||||
Id = Id
|
||||
}))
|
||||
{
|
||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||
}
|
||||
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -99,7 +105,7 @@ namespace AutoWorkshopView.Forms.Shop
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonRef_Click(object sender, EventArgs e)
|
||||
private void RefreshButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
@ -1,17 +1,17 @@
|
||||
<?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
|
||||
|
||||
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>
|
||||
@ -26,36 +26,36 @@
|
||||
<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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
|
33
AutoWorkshopView/MainForm.Designer.cs
generated
33
AutoWorkshopView/MainForm.Designer.cs
generated
@ -32,6 +32,9 @@
|
||||
ToolStripMenu = new ToolStripMenuItem();
|
||||
ComponentsStripMenuItem = new ToolStripMenuItem();
|
||||
RepairStripMenuItem = new ToolStripMenuItem();
|
||||
ShopsToolStripMenuItem = new ToolStripMenuItem();
|
||||
OperationToolStripMenuItem = new ToolStripMenuItem();
|
||||
TransactionToolStripMenuItem = new ToolStripMenuItem();
|
||||
DataGridView = new DataGridView();
|
||||
CreateOrderButton = new Button();
|
||||
TakeInWorkButton = new Button();
|
||||
@ -45,7 +48,7 @@
|
||||
// MenuStrip
|
||||
//
|
||||
MenuStrip.ImageScalingSize = new Size(20, 20);
|
||||
MenuStrip.Items.AddRange(new ToolStripItem[] { ToolStripMenu });
|
||||
MenuStrip.Items.AddRange(new ToolStripItem[] { ToolStripMenu, OperationToolStripMenuItem });
|
||||
MenuStrip.Location = new Point(0, 0);
|
||||
MenuStrip.Name = "MenuStrip";
|
||||
MenuStrip.Padding = new Padding(5, 2, 0, 2);
|
||||
@ -55,7 +58,7 @@
|
||||
//
|
||||
// ToolStripMenu
|
||||
//
|
||||
ToolStripMenu.DropDownItems.AddRange(new ToolStripItem[] { ComponentsStripMenuItem, RepairStripMenuItem });
|
||||
ToolStripMenu.DropDownItems.AddRange(new ToolStripItem[] { ComponentsStripMenuItem, RepairStripMenuItem, ShopsToolStripMenuItem });
|
||||
ToolStripMenu.Name = "ToolStripMenu";
|
||||
ToolStripMenu.Size = new Size(94, 20);
|
||||
ToolStripMenu.Text = "Справочники";
|
||||
@ -74,8 +77,31 @@
|
||||
RepairStripMenuItem.Text = "Ремонты";
|
||||
RepairStripMenuItem.Click += RepairsStripMenuItem_Click;
|
||||
//
|
||||
// ShopsToolStripMenuItem
|
||||
//
|
||||
ShopsToolStripMenuItem.Name = "ShopsToolStripMenuItem";
|
||||
ShopsToolStripMenuItem.Size = new Size(145, 22);
|
||||
ShopsToolStripMenuItem.Text = "Магазины";
|
||||
ShopsToolStripMenuItem.Click += ShopsToolStripMenuItem_Click;
|
||||
//
|
||||
// OperationToolStripMenuItem
|
||||
//
|
||||
OperationToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { TransactionToolStripMenuItem });
|
||||
OperationToolStripMenuItem.Name = "OperationToolStripMenuItem";
|
||||
OperationToolStripMenuItem.Size = new Size(75, 20);
|
||||
OperationToolStripMenuItem.Text = "Операции";
|
||||
//
|
||||
// TransactionToolStripMenuItem
|
||||
//
|
||||
TransactionToolStripMenuItem.Name = "TransactionToolStripMenuItem";
|
||||
TransactionToolStripMenuItem.Size = new Size(125, 22);
|
||||
TransactionToolStripMenuItem.Text = "Поставка";
|
||||
TransactionToolStripMenuItem.Click += TransactionToolStripMenuItem_Click;
|
||||
//
|
||||
// DataGridView
|
||||
//
|
||||
DataGridView.AllowUserToAddRows = false;
|
||||
DataGridView.AllowUserToDeleteRows = false;
|
||||
DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
DataGridView.Location = new Point(10, 23);
|
||||
DataGridView.Margin = new Padding(3, 2, 3, 2);
|
||||
@ -175,5 +201,8 @@
|
||||
private Button ReadyButton;
|
||||
private Button IssuedButton;
|
||||
private Button RefreshButton;
|
||||
private ToolStripMenuItem ShopsToolStripMenuItem;
|
||||
private ToolStripMenuItem OperationToolStripMenuItem;
|
||||
private ToolStripMenuItem TransactionToolStripMenuItem;
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
using AutoWorkshopContracts.BindingModels;
|
||||
using AutoWorkshopContracts.BusinessLogicContracts;
|
||||
using AutoWorkshopView.Forms;
|
||||
using AutoWorkshopView.Forms.Shop;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace AutoWorkshopView
|
||||
@ -164,5 +165,25 @@ namespace AutoWorkshopView
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void ShopsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var Service = Program.ServiceProvider?.GetService(typeof(FormShops));
|
||||
|
||||
if (Service is FormShops Form)
|
||||
{
|
||||
Form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void TransactionToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var Service = Program.ServiceProvider?.GetService(typeof(FormCreateSupply));
|
||||
|
||||
if (Service is FormCreateSupply Form)
|
||||
{
|
||||
Form.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
using AutoWorkshopBusinessLogic.BusinessLogics;
|
||||
using AutoWorkshopContracts.BusinessLogicContracts;
|
||||
using AutoWorkshopContracts.BusinessLogicsContracts;
|
||||
using AutoWorkshopContracts.StoragesContracts;
|
||||
using AutoWorkshopListImplement.Implements;
|
||||
using AutoWorkshopView.Forms;
|
||||
using AutoWorkshopView.Forms.Shop;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NLog.Extensions.Logging;
|
||||
@ -37,9 +39,12 @@ namespace AutoWorkshopView
|
||||
Services.AddTransient<IComponentStorage, ComponentStorage>();
|
||||
Services.AddTransient<IOrderStorage, OrderStorage>();
|
||||
Services.AddTransient<IRepairStorage, RepairStorage>();
|
||||
Services.AddTransient<IShopStorage, ShopStorage>();
|
||||
|
||||
Services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||
Services.AddTransient<IOrderLogic, OrderLogic>();
|
||||
Services.AddTransient<IRepairLogic, RepairLogic>();
|
||||
Services.AddTransient<IShopLogic, ShopLogic>();
|
||||
|
||||
Services.AddTransient<MainForm>();
|
||||
Services.AddTransient<FormComponent>();
|
||||
@ -48,6 +53,9 @@ namespace AutoWorkshopView
|
||||
Services.AddTransient<FormRepair>();
|
||||
Services.AddTransient<FormRepairComponent>();
|
||||
Services.AddTransient<FormRepairs>();
|
||||
Services.AddTransient<FormShop>();
|
||||
Services.AddTransient<FormShops>();
|
||||
Services.AddTransient<FormCreateSupply>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user