Мелкие правки
This commit is contained in:
parent
966aff265e
commit
2856e9043b
@ -109,7 +109,7 @@
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "ComponentForm";
|
||||
Text = "Компонент";
|
||||
Load += FormComponent_Load;
|
||||
Load += ComponentForm_Load;
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ namespace IceCreamShop
|
||||
_logic = logic;
|
||||
}
|
||||
|
||||
private void FormComponent_Load(object sender, EventArgs e)
|
||||
private void ComponentForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (_id.HasValue)
|
||||
{
|
||||
|
@ -96,7 +96,7 @@
|
||||
Controls.Add(DataGridView);
|
||||
Name = "ComponentsForm";
|
||||
Text = "Компоненты";
|
||||
Load += FormComponents_Load;
|
||||
Load += ComponentsForm_Load;
|
||||
((System.ComponentModel.ISupportInitialize)DataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ namespace IceCreamShop
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
private void FormComponents_Load(object sender, EventArgs e)
|
||||
private void ComponentsForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ namespace IceCreamShop
|
||||
}
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(ComboBox.Text))
|
||||
if (string.IsNullOrEmpty(CountTextBox.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните поле Количество", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
|
66
IceCreamShop/IceCreamShop/IceCreamForm.Designer.cs
generated
66
IceCreamShop/IceCreamShop/IceCreamForm.Designer.cs
generated
@ -50,35 +50,34 @@
|
||||
// NameLabel
|
||||
//
|
||||
NameLabel.AutoSize = true;
|
||||
NameLabel.Location = new Point(14, 12);
|
||||
NameLabel.Location = new Point(12, 9);
|
||||
NameLabel.Name = "NameLabel";
|
||||
NameLabel.Size = new Size(77, 20);
|
||||
NameLabel.Size = new Size(59, 15);
|
||||
NameLabel.TabIndex = 0;
|
||||
NameLabel.Text = "Название";
|
||||
//
|
||||
// PriceLabel
|
||||
//
|
||||
PriceLabel.AutoSize = true;
|
||||
PriceLabel.Location = new Point(14, 47);
|
||||
PriceLabel.Location = new Point(12, 35);
|
||||
PriceLabel.Name = "PriceLabel";
|
||||
PriceLabel.Size = new Size(45, 20);
|
||||
PriceLabel.Size = new Size(35, 15);
|
||||
PriceLabel.TabIndex = 1;
|
||||
PriceLabel.Text = "Цена";
|
||||
//
|
||||
// NameTextBox
|
||||
//
|
||||
NameTextBox.Location = new Point(88, 8);
|
||||
NameTextBox.Margin = new Padding(3, 4, 3, 4);
|
||||
NameTextBox.Location = new Point(77, 6);
|
||||
NameTextBox.Name = "NameTextBox";
|
||||
NameTextBox.Size = new Size(270, 27);
|
||||
NameTextBox.Size = new Size(237, 23);
|
||||
NameTextBox.TabIndex = 2;
|
||||
//
|
||||
// PriceTextBox
|
||||
//
|
||||
PriceTextBox.Location = new Point(88, 43);
|
||||
PriceTextBox.Margin = new Padding(3, 4, 3, 4);
|
||||
PriceTextBox.Location = new Point(77, 32);
|
||||
PriceTextBox.Name = "PriceTextBox";
|
||||
PriceTextBox.Size = new Size(114, 27);
|
||||
PriceTextBox.ReadOnly = true;
|
||||
PriceTextBox.Size = new Size(100, 23);
|
||||
PriceTextBox.TabIndex = 3;
|
||||
//
|
||||
// ComponentsGroupBox
|
||||
@ -88,21 +87,18 @@
|
||||
ComponentsGroupBox.Controls.Add(UpdateButton);
|
||||
ComponentsGroupBox.Controls.Add(AddButton);
|
||||
ComponentsGroupBox.Controls.Add(DataGridView);
|
||||
ComponentsGroupBox.Location = new Point(14, 85);
|
||||
ComponentsGroupBox.Margin = new Padding(3, 4, 3, 4);
|
||||
ComponentsGroupBox.Location = new Point(12, 64);
|
||||
ComponentsGroupBox.Name = "ComponentsGroupBox";
|
||||
ComponentsGroupBox.Padding = new Padding(3, 4, 3, 4);
|
||||
ComponentsGroupBox.Size = new Size(665, 383);
|
||||
ComponentsGroupBox.Size = new Size(582, 287);
|
||||
ComponentsGroupBox.TabIndex = 4;
|
||||
ComponentsGroupBox.TabStop = false;
|
||||
ComponentsGroupBox.Text = "Компоненты";
|
||||
//
|
||||
// RefreshButton
|
||||
//
|
||||
RefreshButton.Location = new Point(550, 145);
|
||||
RefreshButton.Margin = new Padding(3, 4, 3, 4);
|
||||
RefreshButton.Location = new Point(481, 109);
|
||||
RefreshButton.Name = "RefreshButton";
|
||||
RefreshButton.Size = new Size(86, 31);
|
||||
RefreshButton.Size = new Size(75, 23);
|
||||
RefreshButton.TabIndex = 4;
|
||||
RefreshButton.Text = "Обновить";
|
||||
RefreshButton.UseVisualStyleBackColor = true;
|
||||
@ -110,10 +106,9 @@
|
||||
//
|
||||
// DeleteButton
|
||||
//
|
||||
DeleteButton.Location = new Point(550, 107);
|
||||
DeleteButton.Margin = new Padding(3, 4, 3, 4);
|
||||
DeleteButton.Location = new Point(481, 80);
|
||||
DeleteButton.Name = "DeleteButton";
|
||||
DeleteButton.Size = new Size(86, 31);
|
||||
DeleteButton.Size = new Size(75, 23);
|
||||
DeleteButton.TabIndex = 3;
|
||||
DeleteButton.Text = "Удалить";
|
||||
DeleteButton.UseVisualStyleBackColor = true;
|
||||
@ -121,10 +116,9 @@
|
||||
//
|
||||
// UpdateButton
|
||||
//
|
||||
UpdateButton.Location = new Point(550, 68);
|
||||
UpdateButton.Margin = new Padding(3, 4, 3, 4);
|
||||
UpdateButton.Location = new Point(481, 51);
|
||||
UpdateButton.Name = "UpdateButton";
|
||||
UpdateButton.Size = new Size(86, 31);
|
||||
UpdateButton.Size = new Size(75, 23);
|
||||
UpdateButton.TabIndex = 2;
|
||||
UpdateButton.Text = "Изменить";
|
||||
UpdateButton.UseVisualStyleBackColor = true;
|
||||
@ -132,10 +126,9 @@
|
||||
//
|
||||
// AddButton
|
||||
//
|
||||
AddButton.Location = new Point(550, 29);
|
||||
AddButton.Margin = new Padding(3, 4, 3, 4);
|
||||
AddButton.Location = new Point(481, 22);
|
||||
AddButton.Name = "AddButton";
|
||||
AddButton.Size = new Size(86, 31);
|
||||
AddButton.Size = new Size(75, 23);
|
||||
AddButton.TabIndex = 1;
|
||||
AddButton.Text = "Добавить";
|
||||
AddButton.UseVisualStyleBackColor = true;
|
||||
@ -145,11 +138,10 @@
|
||||
//
|
||||
DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
DataGridView.Columns.AddRange(new DataGridViewColumn[] { IdColumn, ComponentNameColumn, CountColumn });
|
||||
DataGridView.Location = new Point(7, 29);
|
||||
DataGridView.Margin = new Padding(3, 4, 3, 4);
|
||||
DataGridView.Location = new Point(6, 22);
|
||||
DataGridView.Name = "DataGridView";
|
||||
DataGridView.RowHeadersWidth = 51;
|
||||
DataGridView.Size = new Size(505, 345);
|
||||
DataGridView.Size = new Size(442, 259);
|
||||
DataGridView.TabIndex = 0;
|
||||
//
|
||||
// IdColumn
|
||||
@ -176,10 +168,9 @@
|
||||
//
|
||||
// SaveButton
|
||||
//
|
||||
SaveButton.Location = new Point(485, 484);
|
||||
SaveButton.Margin = new Padding(3, 4, 3, 4);
|
||||
SaveButton.Location = new Point(424, 363);
|
||||
SaveButton.Name = "SaveButton";
|
||||
SaveButton.Size = new Size(86, 31);
|
||||
SaveButton.Size = new Size(75, 23);
|
||||
SaveButton.TabIndex = 5;
|
||||
SaveButton.Text = "Сохранить";
|
||||
SaveButton.UseVisualStyleBackColor = true;
|
||||
@ -187,19 +178,18 @@
|
||||
//
|
||||
// CancelButton
|
||||
//
|
||||
CancelButton.Location = new Point(577, 484);
|
||||
CancelButton.Margin = new Padding(3, 4, 3, 4);
|
||||
CancelButton.Location = new Point(505, 363);
|
||||
CancelButton.Name = "CancelButton";
|
||||
CancelButton.Size = new Size(86, 31);
|
||||
CancelButton.Size = new Size(75, 23);
|
||||
CancelButton.TabIndex = 6;
|
||||
CancelButton.Text = "Отмена";
|
||||
CancelButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// IceCreamForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(693, 531);
|
||||
ClientSize = new Size(606, 398);
|
||||
Controls.Add(CancelButton);
|
||||
Controls.Add(SaveButton);
|
||||
Controls.Add(ComponentsGroupBox);
|
||||
@ -207,9 +197,9 @@
|
||||
Controls.Add(NameTextBox);
|
||||
Controls.Add(PriceLabel);
|
||||
Controls.Add(NameLabel);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "IceCreamForm";
|
||||
Text = "Мороженное";
|
||||
Load += IceCreamForm_Load;
|
||||
ComponentsGroupBox.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)DataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
|
@ -31,7 +31,7 @@ namespace IceCreamShop
|
||||
_iceCreamComponents = new Dictionary<int, (IComponentModel, int)>();
|
||||
}
|
||||
|
||||
private void FormProduct_Load(object sender, EventArgs e)
|
||||
private void IceCreamForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (_id.HasValue)
|
||||
{
|
||||
|
43
IceCreamShop/IceCreamShop/OrderForm.Designer.cs
generated
43
IceCreamShop/IceCreamShop/OrderForm.Designer.cs
generated
@ -41,37 +41,34 @@
|
||||
// IceCreamComboBox
|
||||
//
|
||||
IceCreamComboBox.FormattingEnabled = true;
|
||||
IceCreamComboBox.Location = new Point(118, 16);
|
||||
IceCreamComboBox.Margin = new Padding(3, 4, 3, 4);
|
||||
IceCreamComboBox.Location = new Point(103, 12);
|
||||
IceCreamComboBox.Name = "IceCreamComboBox";
|
||||
IceCreamComboBox.Size = new Size(265, 28);
|
||||
IceCreamComboBox.Size = new Size(232, 23);
|
||||
IceCreamComboBox.TabIndex = 0;
|
||||
IceCreamComboBox.SelectedIndexChanged += IceCreamComboBox_SelectedIndexChanged;
|
||||
//
|
||||
// CountTextBox
|
||||
//
|
||||
CountTextBox.Location = new Point(118, 55);
|
||||
CountTextBox.Margin = new Padding(3, 4, 3, 4);
|
||||
CountTextBox.Location = new Point(103, 41);
|
||||
CountTextBox.Name = "CountTextBox";
|
||||
CountTextBox.Size = new Size(265, 27);
|
||||
CountTextBox.Size = new Size(232, 23);
|
||||
CountTextBox.TabIndex = 1;
|
||||
CountTextBox.TextChanged += CountTextBox_TextChanged;
|
||||
//
|
||||
// SumTextBox
|
||||
//
|
||||
SumTextBox.Location = new Point(118, 93);
|
||||
SumTextBox.Margin = new Padding(3, 4, 3, 4);
|
||||
SumTextBox.Location = new Point(103, 70);
|
||||
SumTextBox.Name = "SumTextBox";
|
||||
SumTextBox.Size = new Size(265, 27);
|
||||
SumTextBox.ReadOnly = true;
|
||||
SumTextBox.Size = new Size(232, 23);
|
||||
SumTextBox.TabIndex = 2;
|
||||
SumTextBox.TextChanged += SumTextBox_TextChanged;
|
||||
//
|
||||
// SaveButton
|
||||
//
|
||||
SaveButton.Location = new Point(198, 132);
|
||||
SaveButton.Margin = new Padding(3, 4, 3, 4);
|
||||
SaveButton.Location = new Point(173, 99);
|
||||
SaveButton.Name = "SaveButton";
|
||||
SaveButton.Size = new Size(93, 31);
|
||||
SaveButton.Size = new Size(81, 23);
|
||||
SaveButton.TabIndex = 3;
|
||||
SaveButton.Text = "Сохранить";
|
||||
SaveButton.UseVisualStyleBackColor = true;
|
||||
@ -79,10 +76,9 @@
|
||||
//
|
||||
// CancelButton
|
||||
//
|
||||
CancelButton.Location = new Point(297, 132);
|
||||
CancelButton.Margin = new Padding(3, 4, 3, 4);
|
||||
CancelButton.Location = new Point(260, 99);
|
||||
CancelButton.Name = "CancelButton";
|
||||
CancelButton.Size = new Size(86, 31);
|
||||
CancelButton.Size = new Size(75, 23);
|
||||
CancelButton.TabIndex = 4;
|
||||
CancelButton.Text = "Отмена";
|
||||
CancelButton.UseVisualStyleBackColor = true;
|
||||
@ -91,35 +87,35 @@
|
||||
// IceCreamLabel
|
||||
//
|
||||
IceCreamLabel.AutoSize = true;
|
||||
IceCreamLabel.Location = new Point(14, 20);
|
||||
IceCreamLabel.Location = new Point(12, 15);
|
||||
IceCreamLabel.Name = "IceCreamLabel";
|
||||
IceCreamLabel.Size = new Size(103, 20);
|
||||
IceCreamLabel.Size = new Size(81, 15);
|
||||
IceCreamLabel.TabIndex = 5;
|
||||
IceCreamLabel.Text = "Мороженное";
|
||||
//
|
||||
// CountLabel
|
||||
//
|
||||
CountLabel.AutoSize = true;
|
||||
CountLabel.Location = new Point(14, 59);
|
||||
CountLabel.Location = new Point(12, 44);
|
||||
CountLabel.Name = "CountLabel";
|
||||
CountLabel.Size = new Size(90, 20);
|
||||
CountLabel.Size = new Size(72, 15);
|
||||
CountLabel.TabIndex = 6;
|
||||
CountLabel.Text = "Количество";
|
||||
//
|
||||
// SumLabel
|
||||
//
|
||||
SumLabel.AutoSize = true;
|
||||
SumLabel.Location = new Point(14, 97);
|
||||
SumLabel.Location = new Point(12, 73);
|
||||
SumLabel.Name = "SumLabel";
|
||||
SumLabel.Size = new Size(55, 20);
|
||||
SumLabel.Size = new Size(45, 15);
|
||||
SumLabel.TabIndex = 7;
|
||||
SumLabel.Text = "Сумма";
|
||||
//
|
||||
// OrderForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(398, 171);
|
||||
ClientSize = new Size(348, 128);
|
||||
Controls.Add(SumLabel);
|
||||
Controls.Add(CountLabel);
|
||||
Controls.Add(IceCreamLabel);
|
||||
@ -128,7 +124,6 @@
|
||||
Controls.Add(SumTextBox);
|
||||
Controls.Add(CountTextBox);
|
||||
Controls.Add(IceCreamComboBox);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "OrderForm";
|
||||
Text = "OrderForm";
|
||||
Load += OrderForm_Load;
|
||||
|
@ -60,13 +60,13 @@ logicI, IOrderLogic logicO)
|
||||
try
|
||||
{
|
||||
int id = Convert.ToInt32(IceCreamComboBox.SelectedValue);
|
||||
var product = _logicI.ReadElement(new IceCreamSearchModel
|
||||
var iceCream = _logicI.ReadElement(new IceCreamSearchModel
|
||||
{
|
||||
Id
|
||||
= id
|
||||
});
|
||||
int count = Convert.ToInt32(CountTextBox.Text);
|
||||
SumTextBox.Text = Math.Round(count * (product?.Price ?? 0),
|
||||
SumTextBox.Text = Math.Round(count * (iceCream?.Price ?? 0),
|
||||
2).ToString();
|
||||
_logger.LogInformation("Расчет суммы заказа");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user