Реализованы формы для работы с мгазинами
This commit is contained in:
parent
1ec3a79493
commit
671b74d99b
@ -140,6 +140,7 @@
|
||||
buttonSave.TabIndex = 7;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
@ -150,6 +151,7 @@
|
||||
buttonCancel.TabIndex = 8;
|
||||
buttonCancel.Text = "Закрыть";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// FormShop
|
||||
//
|
||||
@ -167,6 +169,7 @@
|
||||
Controls.Add(labelName);
|
||||
Name = "FormShop";
|
||||
Text = "Магазин";
|
||||
Load += FormShop_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
|
@ -28,12 +28,119 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "FormShopSupply";
|
||||
comboBoxShop = new ComboBox();
|
||||
comboBoxSecure = new ComboBox();
|
||||
labelShop = new Label();
|
||||
label2 = new Label();
|
||||
label3 = new Label();
|
||||
buttonSupply = new Button();
|
||||
buttonCancel = new Button();
|
||||
textBoxCount = new TextBox();
|
||||
SuspendLayout();
|
||||
//
|
||||
// comboBoxShop
|
||||
//
|
||||
comboBoxShop.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
comboBoxShop.FormattingEnabled = true;
|
||||
comboBoxShop.Location = new Point(125, 6);
|
||||
comboBoxShop.Name = "comboBoxShop";
|
||||
comboBoxShop.Size = new Size(432, 28);
|
||||
comboBoxShop.TabIndex = 0;
|
||||
//
|
||||
// comboBoxSecure
|
||||
//
|
||||
comboBoxSecure.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
comboBoxSecure.FormattingEnabled = true;
|
||||
comboBoxSecure.Location = new Point(125, 47);
|
||||
comboBoxSecure.Name = "comboBoxSecure";
|
||||
comboBoxSecure.Size = new Size(432, 28);
|
||||
comboBoxSecure.TabIndex = 1;
|
||||
//
|
||||
// labelShop
|
||||
//
|
||||
labelShop.AutoSize = true;
|
||||
labelShop.Location = new Point(12, 9);
|
||||
labelShop.Name = "labelShop";
|
||||
labelShop.Size = new Size(72, 20);
|
||||
labelShop.TabIndex = 3;
|
||||
labelShop.Text = "Магазин:";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(12, 50);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(71, 20);
|
||||
label2.TabIndex = 4;
|
||||
label2.Text = "Изделие:";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(12, 89);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(93, 20);
|
||||
label3.TabIndex = 5;
|
||||
label3.Text = "Количество:";
|
||||
//
|
||||
// buttonSupply
|
||||
//
|
||||
buttonSupply.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonSupply.Location = new Point(342, 130);
|
||||
buttonSupply.Name = "buttonSupply";
|
||||
buttonSupply.Size = new Size(94, 29);
|
||||
buttonSupply.TabIndex = 6;
|
||||
buttonSupply.Text = "Поставить";
|
||||
buttonSupply.UseVisualStyleBackColor = true;
|
||||
buttonSupply.Click += buttonSupply_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonCancel.Location = new Point(463, 130);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(94, 29);
|
||||
buttonCancel.TabIndex = 7;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// textBoxCount
|
||||
//
|
||||
textBoxCount.Location = new Point(125, 89);
|
||||
textBoxCount.Name = "textBoxCount";
|
||||
textBoxCount.Size = new Size(167, 27);
|
||||
textBoxCount.TabIndex = 8;
|
||||
//
|
||||
// FormShopSupply
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(569, 169);
|
||||
Controls.Add(textBoxCount);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSupply);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(labelShop);
|
||||
Controls.Add(comboBoxSecure);
|
||||
Controls.Add(comboBoxShop);
|
||||
Name = "FormShopSupply";
|
||||
Text = "Поставка изделия";
|
||||
Load += FormShopSupply_Load;
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ComboBox comboBoxShop;
|
||||
private ComboBox comboBoxSecure;
|
||||
private Label labelShop;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private Button buttonSupply;
|
||||
private Button buttonCancel;
|
||||
private TextBox textBoxCount;
|
||||
}
|
||||
}
|
@ -1,20 +1,117 @@
|
||||
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;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SecuritySystemContracts.BindingModels;
|
||||
using SecuritySystemContracts.BusinessLogicsContracts;
|
||||
using SecuritySystemContracts.SearchModels;
|
||||
|
||||
namespace SecuritySystemView
|
||||
{
|
||||
public partial class FormShopSupply : Form
|
||||
{
|
||||
public FormShopSupply()
|
||||
private readonly ILogger _logger;
|
||||
private readonly ISecureLogic _logicSecure;
|
||||
private readonly IShopLogic _logicShop;
|
||||
|
||||
public FormShopSupply(ILogger<FormShopSupply> logger, ISecureLogic logicSecure, IShopLogic logicShop)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logicSecure = logicSecure;
|
||||
_logicShop = logicShop;
|
||||
}
|
||||
|
||||
private void FormShopSupply_Load(object sender, EventArgs e)
|
||||
{
|
||||
_logger.LogInformation("Загрузка secure для пополнения");
|
||||
|
||||
try
|
||||
{
|
||||
var list = _logicSecure.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
comboBoxSecure.DisplayMember = "SecureName";
|
||||
comboBoxSecure.ValueMember = "Id";
|
||||
comboBoxSecure.DataSource = list;
|
||||
comboBoxSecure.SelectedItem = null;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки списка secure");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
_logger.LogInformation("Загрузка магазинов для пополнения");
|
||||
|
||||
try
|
||||
{
|
||||
var list = _logicShop.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
comboBoxShop.DisplayMember = "Name";
|
||||
comboBoxShop.ValueMember = "Id";
|
||||
comboBoxShop.DataSource = list;
|
||||
comboBoxShop.SelectedItem = null;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки списка магазинов");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonSupply_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxCount.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните поле Количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (comboBoxSecure.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите secure", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (comboBoxShop.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите магазин", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
_logger.LogInformation("Создание поставки");
|
||||
|
||||
try
|
||||
{
|
||||
var operationResult = _logicShop.SupplySecures(
|
||||
new ShopSearchModel { Id = Convert.ToInt32(comboBoxShop.SelectedValue), Name = comboBoxShop.Text },
|
||||
new SecureBindingModel { Id = Convert.ToInt32(comboBoxSecure.SelectedValue), SecureName = comboBoxSecure.Text },
|
||||
Convert.ToInt32(textBoxCount.Text)
|
||||
);
|
||||
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при создании поставки. Дополнительная информация в логах.");
|
||||
}
|
||||
|
||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания поставки");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,24 +1,24 @@
|
||||
<?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>
|
||||
<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="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>
|
||||
@ -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.
|
||||
-->
|
||||
|
Loading…
x
Reference in New Issue
Block a user