изменение логики FormCreateOrder
This commit is contained in:
parent
b0b29a366d
commit
6de7a2ed01
@ -36,12 +36,14 @@
|
|||||||
textBoxSum = new TextBox();
|
textBoxSum = new TextBox();
|
||||||
buttonSave = new Button();
|
buttonSave = new Button();
|
||||||
buttonCancel = new Button();
|
buttonCancel = new Button();
|
||||||
|
labelClient = new Label();
|
||||||
|
comboBoxClient = new ComboBox();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// labelName
|
// labelName
|
||||||
//
|
//
|
||||||
labelName.AutoSize = true;
|
labelName.AutoSize = true;
|
||||||
labelName.Location = new Point(90, 35);
|
labelName.Location = new Point(90, 77);
|
||||||
labelName.Name = "labelName";
|
labelName.Name = "labelName";
|
||||||
labelName.Size = new Size(84, 25);
|
labelName.Size = new Size(84, 25);
|
||||||
labelName.TabIndex = 0;
|
labelName.TabIndex = 0;
|
||||||
@ -50,7 +52,7 @@
|
|||||||
// labelCount
|
// labelCount
|
||||||
//
|
//
|
||||||
labelCount.AutoSize = true;
|
labelCount.AutoSize = true;
|
||||||
labelCount.Location = new Point(63, 92);
|
labelCount.Location = new Point(63, 134);
|
||||||
labelCount.Name = "labelCount";
|
labelCount.Name = "labelCount";
|
||||||
labelCount.Size = new Size(111, 25);
|
labelCount.Size = new Size(111, 25);
|
||||||
labelCount.TabIndex = 1;
|
labelCount.TabIndex = 1;
|
||||||
@ -59,7 +61,7 @@
|
|||||||
// labelSum
|
// labelSum
|
||||||
//
|
//
|
||||||
labelSum.AutoSize = true;
|
labelSum.AutoSize = true;
|
||||||
labelSum.Location = new Point(90, 155);
|
labelSum.Location = new Point(103, 197);
|
||||||
labelSum.Name = "labelSum";
|
labelSum.Name = "labelSum";
|
||||||
labelSum.Size = new Size(71, 25);
|
labelSum.Size = new Size(71, 25);
|
||||||
labelSum.TabIndex = 2;
|
labelSum.TabIndex = 2;
|
||||||
@ -68,7 +70,7 @@
|
|||||||
// comboBoxPastry
|
// comboBoxPastry
|
||||||
//
|
//
|
||||||
comboBoxPastry.FormattingEnabled = true;
|
comboBoxPastry.FormattingEnabled = true;
|
||||||
comboBoxPastry.Location = new Point(192, 32);
|
comboBoxPastry.Location = new Point(192, 74);
|
||||||
comboBoxPastry.Name = "comboBoxPastry";
|
comboBoxPastry.Name = "comboBoxPastry";
|
||||||
comboBoxPastry.Size = new Size(434, 33);
|
comboBoxPastry.Size = new Size(434, 33);
|
||||||
comboBoxPastry.TabIndex = 3;
|
comboBoxPastry.TabIndex = 3;
|
||||||
@ -76,7 +78,7 @@
|
|||||||
//
|
//
|
||||||
// textBoxCount
|
// textBoxCount
|
||||||
//
|
//
|
||||||
textBoxCount.Location = new Point(192, 92);
|
textBoxCount.Location = new Point(192, 134);
|
||||||
textBoxCount.Name = "textBoxCount";
|
textBoxCount.Name = "textBoxCount";
|
||||||
textBoxCount.Size = new Size(434, 31);
|
textBoxCount.Size = new Size(434, 31);
|
||||||
textBoxCount.TabIndex = 4;
|
textBoxCount.TabIndex = 4;
|
||||||
@ -84,7 +86,7 @@
|
|||||||
//
|
//
|
||||||
// textBoxSum
|
// textBoxSum
|
||||||
//
|
//
|
||||||
textBoxSum.Location = new Point(192, 155);
|
textBoxSum.Location = new Point(192, 197);
|
||||||
textBoxSum.Name = "textBoxSum";
|
textBoxSum.Name = "textBoxSum";
|
||||||
textBoxSum.ReadOnly = true;
|
textBoxSum.ReadOnly = true;
|
||||||
textBoxSum.Size = new Size(434, 31);
|
textBoxSum.Size = new Size(434, 31);
|
||||||
@ -110,11 +112,30 @@
|
|||||||
buttonCancel.UseVisualStyleBackColor = true;
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
buttonCancel.Click += buttonCancel_Click;
|
buttonCancel.Click += buttonCancel_Click;
|
||||||
//
|
//
|
||||||
|
// labelClient
|
||||||
|
//
|
||||||
|
labelClient.AutoSize = true;
|
||||||
|
labelClient.Location = new Point(103, 20);
|
||||||
|
labelClient.Name = "labelClient";
|
||||||
|
labelClient.Size = new Size(71, 25);
|
||||||
|
labelClient.TabIndex = 8;
|
||||||
|
labelClient.Text = "Клиент:";
|
||||||
|
//
|
||||||
|
// comboBoxClient
|
||||||
|
//
|
||||||
|
comboBoxClient.FormattingEnabled = true;
|
||||||
|
comboBoxClient.Location = new Point(192, 12);
|
||||||
|
comboBoxClient.Name = "comboBoxClient";
|
||||||
|
comboBoxClient.Size = new Size(434, 33);
|
||||||
|
comboBoxClient.TabIndex = 9;
|
||||||
|
//
|
||||||
// FormCreateOrder
|
// FormCreateOrder
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(10F, 25F);
|
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(779, 333);
|
ClientSize = new Size(779, 333);
|
||||||
|
Controls.Add(comboBoxClient);
|
||||||
|
Controls.Add(labelClient);
|
||||||
Controls.Add(buttonCancel);
|
Controls.Add(buttonCancel);
|
||||||
Controls.Add(buttonSave);
|
Controls.Add(buttonSave);
|
||||||
Controls.Add(textBoxSum);
|
Controls.Add(textBoxSum);
|
||||||
@ -140,5 +161,7 @@
|
|||||||
private TextBox textBoxSum;
|
private TextBox textBoxSum;
|
||||||
private Button buttonSave;
|
private Button buttonSave;
|
||||||
private Button buttonCancel;
|
private Button buttonCancel;
|
||||||
|
private Label labelClient;
|
||||||
|
private ComboBox comboBoxClient;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -21,13 +21,16 @@ namespace ConfectioneryView
|
|||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IPastryLogic _logicP;
|
private readonly IPastryLogic _logicP;
|
||||||
private readonly IOrderLogic _logicO;
|
private readonly IOrderLogic _logicO;
|
||||||
|
private readonly IClientLogic _logicC;
|
||||||
private List<PastryViewModel>? _list;
|
private List<PastryViewModel>? _list;
|
||||||
public FormCreateOrder(ILogger<FormCreateOrder> logger, IPastryLogic logicP, IOrderLogic logicO)
|
private List<ClientViewModel>? _listClients;
|
||||||
|
public FormCreateOrder(ILogger<FormCreateOrder> logger, IPastryLogic logicP, IOrderLogic logicO, IClientLogic logicC)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_logicP = logicP;
|
_logicP = logicP;
|
||||||
_logicO = logicO;
|
_logicO = logicO;
|
||||||
|
_logicC = logicC;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonSave_Click(object sender, EventArgs e)
|
private void buttonSave_Click(object sender, EventArgs e)
|
||||||
@ -44,11 +47,17 @@ namespace ConfectioneryView
|
|||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (comboBoxClient.SelectedValue == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Выберите клиента", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
_logger.LogInformation("Создание заказа");
|
_logger.LogInformation("Создание заказа");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var operationResult = _logicO.CreateOrder(new OrderBindingModel
|
var operationResult = _logicO.CreateOrder(new OrderBindingModel
|
||||||
{
|
{
|
||||||
|
ClientId = Convert.ToInt32(comboBoxClient.SelectedValue),
|
||||||
PastryId = Convert.ToInt32(comboBoxPastry.SelectedValue),
|
PastryId = Convert.ToInt32(comboBoxPastry.SelectedValue),
|
||||||
Count = Convert.ToInt32(textBoxCount.Text),
|
Count = Convert.ToInt32(textBoxCount.Text),
|
||||||
Sum = Convert.ToDouble(textBoxSum.Text)
|
Sum = Convert.ToDouble(textBoxSum.Text)
|
||||||
@ -83,6 +92,15 @@ namespace ConfectioneryView
|
|||||||
comboBoxPastry.SelectedItem = null;
|
comboBoxPastry.SelectedItem = null;
|
||||||
_logger.LogInformation("Загрузка кондитерского изделия для заказа");
|
_logger.LogInformation("Загрузка кондитерского изделия для заказа");
|
||||||
}
|
}
|
||||||
|
_listClients = _logicC.ReadList(null);
|
||||||
|
if (_listClients != null)
|
||||||
|
{
|
||||||
|
comboBoxClient.DisplayMember = "ClientFIO";
|
||||||
|
comboBoxClient.ValueMember = "Id";
|
||||||
|
comboBoxClient.DataSource = _listClients;
|
||||||
|
comboBoxClient.SelectedItem = null;
|
||||||
|
_logger.LogInformation("Загрузка клиентов для заказа");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private void CalcSum()
|
private void CalcSum()
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,64 @@
|
|||||||
<root>
|
<?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: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:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
Loading…
Reference in New Issue
Block a user