Compare commits

...

9 Commits

Author SHA1 Message Date
f29db1718d 12 2024-03-13 11:04:26 +03:00
50dc3f3313 11 2024-03-13 11:03:33 +03:00
264c17ed08 10 2024-03-13 11:02:45 +03:00
7033db0be5 9 2024-03-13 11:01:17 +03:00
03c2cbe8db 6 2024-03-13 10:58:49 +03:00
e749b8c0de 7 2024-03-13 10:57:18 +03:00
96506f5cce 6 2024-03-13 10:55:17 +03:00
b160dcaa36 5 2024-03-13 10:53:18 +03:00
fd70baa849 3 2024-03-13 10:52:15 +03:00
9 changed files with 109 additions and 95 deletions

View File

@ -39,41 +39,44 @@
// labelName
//
labelName.AutoSize = true;
labelName.Location = new Point(12, 21);
labelName.Location = new Point(14, 28);
labelName.Name = "labelName";
labelName.Size = new Size(62, 15);
labelName.Size = new Size(80, 20);
labelName.TabIndex = 0;
labelName.Text = "Название:";
//
// labelPrice
//
labelPrice.AutoSize = true;
labelPrice.Location = new Point(12, 50);
labelPrice.Location = new Point(14, 67);
labelPrice.Name = "labelPrice";
labelPrice.Size = new Size(38, 15);
labelPrice.Size = new Size(48, 20);
labelPrice.TabIndex = 1;
labelPrice.Text = "Цена:";
//
// textBoxName
//
textBoxName.Location = new Point(100, 18);
textBoxName.Location = new Point(114, 24);
textBoxName.Margin = new Padding(3, 4, 3, 4);
textBoxName.Name = "textBoxName";
textBoxName.Size = new Size(233, 23);
textBoxName.Size = new Size(266, 27);
textBoxName.TabIndex = 2;
//
// textBoxCost
//
textBoxCost.Location = new Point(100, 47);
textBoxCost.Location = new Point(114, 63);
textBoxCost.Margin = new Padding(3, 4, 3, 4);
textBoxCost.Name = "textBoxCost";
textBoxCost.Size = new Size(233, 23);
textBoxCost.Size = new Size(266, 27);
textBoxCost.TabIndex = 2;
//
// buttonSave
//
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonSave.Location = new Point(177, 93);
buttonSave.Location = new Point(194, 124);
buttonSave.Margin = new Padding(3, 4, 3, 4);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(75, 23);
buttonSave.Size = new Size(94, 31);
buttonSave.TabIndex = 3;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
@ -82,9 +85,10 @@
// buttonCancel
//
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonCancel.Location = new Point(258, 93);
buttonCancel.Location = new Point(295, 124);
buttonCancel.Margin = new Padding(3, 4, 3, 4);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(75, 23);
buttonCancel.Size = new Size(86, 31);
buttonCancel.TabIndex = 3;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
@ -92,15 +96,16 @@
//
// FormComponent
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(345, 136);
ClientSize = new Size(394, 181);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(textBoxCost);
Controls.Add(textBoxName);
Controls.Add(labelPrice);
Controls.Add(labelName);
Margin = new Padding(3, 4, 3, 4);
Name = "FormComponent";
Text = "Ингредиент";
Load += FormComponent_Load;

View File

@ -40,36 +40,38 @@
//
// textBoxCount
//
textBoxCount.Location = new Point(99, 41);
textBoxCount.Location = new Point(113, 55);
textBoxCount.Margin = new Padding(3, 4, 3, 4);
textBoxCount.Name = "textBoxCount";
textBoxCount.Size = new Size(233, 23);
textBoxCount.Size = new Size(266, 27);
textBoxCount.TabIndex = 13;
textBoxCount.TextChanged += textBoxCount_TextChanged;
//
// labelCount
//
labelCount.AutoSize = true;
labelCount.Location = new Point(11, 44);
labelCount.Location = new Point(13, 59);
labelCount.Name = "labelCount";
labelCount.Size = new Size(75, 15);
labelCount.Size = new Size(93, 20);
labelCount.TabIndex = 12;
labelCount.Text = "Количество:";
//
// labelPizza
//
labelPizza.AutoSize = true;
labelPizza.Location = new Point(11, 15);
labelPizza.Location = new Point(13, 20);
labelPizza.Name = "labelPizza";
labelPizza.Size = new Size(43, 15);
labelPizza.Size = new Size(55, 20);
labelPizza.TabIndex = 11;
labelPizza.Text = "Пицца";
//
// buttonCancel
//
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonCancel.Location = new Point(257, 109);
buttonCancel.Location = new Point(294, 145);
buttonCancel.Margin = new Padding(3, 4, 3, 4);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(75, 23);
buttonCancel.Size = new Size(86, 31);
buttonCancel.TabIndex = 15;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
@ -78,9 +80,10 @@
// buttonSave
//
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonSave.Location = new Point(176, 109);
buttonSave.Location = new Point(193, 145);
buttonSave.Margin = new Padding(3, 4, 3, 4);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(75, 23);
buttonSave.Size = new Size(94, 31);
buttonSave.TabIndex = 16;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
@ -89,34 +92,36 @@
// labelSum
//
labelSum.AutoSize = true;
labelSum.Location = new Point(11, 73);
labelSum.Location = new Point(13, 97);
labelSum.Name = "labelSum";
labelSum.Size = new Size(48, 15);
labelSum.Size = new Size(58, 20);
labelSum.TabIndex = 12;
labelSum.Text = "Сумма:";
//
// textBoxSum
//
textBoxSum.Location = new Point(99, 70);
textBoxSum.Location = new Point(113, 93);
textBoxSum.Margin = new Padding(3, 4, 3, 4);
textBoxSum.Name = "textBoxSum";
textBoxSum.ReadOnly = true;
textBoxSum.Size = new Size(233, 23);
textBoxSum.Size = new Size(266, 27);
textBoxSum.TabIndex = 13;
//
// comboBoxPizza
//
comboBoxPizza.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxPizza.FormattingEnabled = true;
comboBoxPizza.Location = new Point(99, 12);
comboBoxPizza.Location = new Point(113, 16);
comboBoxPizza.Margin = new Padding(3, 4, 3, 4);
comboBoxPizza.Name = "comboBoxPizza";
comboBoxPizza.Size = new Size(233, 23);
comboBoxPizza.Size = new Size(266, 28);
comboBoxPizza.TabIndex = 17;
//
// FormCreateOrder
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(351, 150);
ClientSize = new Size(401, 200);
Controls.Add(comboBoxPizza);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
@ -125,6 +130,7 @@
Controls.Add(textBoxCount);
Controls.Add(labelCount);
Controls.Add(labelPizza);
Margin = new Padding(3, 4, 3, 4);
Name = "FormCreateOrder";
Text = "Заказ";
Load += FormCreateOrder_Load;

View File

@ -1,12 +1,8 @@

using Microsoft.Extensions.Logging;
using Microsoft.VisualBasic.Logging;
using PizzeriaContracts.BindingModels;
using PizzeriaContracts.BusinessLogicsContracts;
using PizzeriaContracts.SearchModels;
using PizzeriaContracts.ViewModels;
using PizzeriaDataModels.Models;
using System.Windows.Forms;
namespace Pizzeria
{

View File

@ -50,43 +50,44 @@
// textBoxPrice
//
textBoxPrice.Enabled = false;
textBoxPrice.Location = new Point(99, 41);
textBoxPrice.Location = new Point(113, 55);
textBoxPrice.Margin = new Padding(3, 4, 3, 4);
textBoxPrice.Name = "textBoxPrice";
textBoxPrice.Size = new Size(233, 23);
textBoxPrice.Size = new Size(266, 27);
textBoxPrice.TabIndex = 5;
//
// textBoxName
//
textBoxName.Location = new Point(99, 12);
textBoxName.Location = new Point(113, 16);
textBoxName.Margin = new Padding(3, 4, 3, 4);
textBoxName.Name = "textBoxName";
textBoxName.Size = new Size(233, 23);
textBoxName.Size = new Size(266, 27);
textBoxName.TabIndex = 6;
//
// labelPrice
//
labelPrice.AutoSize = true;
labelPrice.Location = new Point(11, 44);
labelPrice.Location = new Point(13, 59);
labelPrice.Name = "labelPrice";
labelPrice.Size = new Size(70, 15);
labelPrice.Size = new Size(86, 20);
labelPrice.TabIndex = 4;
labelPrice.Text = "Стоимость:";
//
// labelName
//
labelName.AutoSize = true;
labelName.Location = new Point(11, 15);
labelName.Location = new Point(13, 20);
labelName.Name = "labelName";
labelName.Size = new Size(62, 15);
labelName.Size = new Size(80, 20);
labelName.TabIndex = 3;
labelName.Text = "Название:";
//
// ButtonUpd
//
ButtonUpd.Anchor = AnchorStyles.Top | AnchorStyles.Right;
ButtonUpd.Location = new Point(467, 135);
ButtonUpd.Margin = new Padding(3, 2, 3, 2);
ButtonUpd.Location = new Point(534, 180);
ButtonUpd.Name = "ButtonUpd";
ButtonUpd.Size = new Size(82, 22);
ButtonUpd.Size = new Size(94, 29);
ButtonUpd.TabIndex = 10;
ButtonUpd.Text = "Обновить";
ButtonUpd.UseVisualStyleBackColor = true;
@ -95,10 +96,9 @@
// ButtonDel
//
ButtonDel.Anchor = AnchorStyles.Top | AnchorStyles.Right;
ButtonDel.Location = new Point(467, 100);
ButtonDel.Margin = new Padding(3, 2, 3, 2);
ButtonDel.Location = new Point(534, 133);
ButtonDel.Name = "ButtonDel";
ButtonDel.Size = new Size(82, 22);
ButtonDel.Size = new Size(94, 29);
ButtonDel.TabIndex = 9;
ButtonDel.Text = "Удалить";
ButtonDel.UseVisualStyleBackColor = true;
@ -107,10 +107,9 @@
// ButtonRef
//
ButtonRef.Anchor = AnchorStyles.Top | AnchorStyles.Right;
ButtonRef.Location = new Point(467, 62);
ButtonRef.Margin = new Padding(3, 2, 3, 2);
ButtonRef.Location = new Point(534, 83);
ButtonRef.Name = "ButtonRef";
ButtonRef.Size = new Size(82, 22);
ButtonRef.Size = new Size(94, 29);
ButtonRef.TabIndex = 8;
ButtonRef.Text = "Изменить";
ButtonRef.UseVisualStyleBackColor = true;
@ -119,10 +118,9 @@
// ButtonAdd
//
ButtonAdd.Anchor = AnchorStyles.Top | AnchorStyles.Right;
ButtonAdd.Location = new Point(467, 27);
ButtonAdd.Margin = new Padding(3, 2, 3, 2);
ButtonAdd.Location = new Point(534, 36);
ButtonAdd.Name = "ButtonAdd";
ButtonAdd.Size = new Size(82, 22);
ButtonAdd.Size = new Size(94, 29);
ButtonAdd.TabIndex = 7;
ButtonAdd.Text = "Добавить";
ButtonAdd.UseVisualStyleBackColor = true;
@ -135,38 +133,49 @@
dataGridView.BackgroundColor = SystemColors.ControlLightLight;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnId, ColumnComponent, ColumnCount });
dataGridView.Location = new Point(6, 22);
dataGridView.Location = new Point(7, 29);
dataGridView.Margin = new Padding(3, 4, 3, 4);
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 51;
dataGridView.RowTemplate.Height = 25;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(429, 262);
dataGridView.Size = new Size(490, 349);
dataGridView.TabIndex = 11;
//
// ColumnId
//
ColumnId.HeaderText = "Id";
ColumnId.MinimumWidth = 6;
ColumnId.Name = "ColumnId";
ColumnId.ReadOnly = true;
ColumnId.Visible = false;
ColumnId.Width = 125;
//
// ColumnComponent
//
ColumnComponent.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
ColumnComponent.HeaderText = "Ингредиент";
ColumnComponent.MinimumWidth = 6;
ColumnComponent.Name = "ColumnComponent";
ColumnComponent.ReadOnly = true;
//
// ColumnCount
//
ColumnCount.HeaderText = "Количество";
ColumnCount.MinimumWidth = 6;
ColumnCount.Name = "ColumnCount";
ColumnCount.ReadOnly = true;
ColumnCount.Width = 125;
//
// buttonCancel
//
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonCancel.Location = new Point(486, 386);
buttonCancel.Location = new Point(555, 515);
buttonCancel.Margin = new Padding(3, 4, 3, 4);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(75, 23);
buttonCancel.Size = new Size(86, 31);
buttonCancel.TabIndex = 12;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
@ -175,9 +184,10 @@
// buttonSave
//
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonSave.Location = new Point(405, 386);
buttonSave.Location = new Point(455, 515);
buttonSave.Margin = new Padding(3, 4, 3, 4);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(75, 23);
buttonSave.Size = new Size(94, 31);
buttonSave.TabIndex = 13;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
@ -191,18 +201,20 @@
groupBoxComponents.Controls.Add(ButtonRef);
groupBoxComponents.Controls.Add(dataGridView);
groupBoxComponents.Controls.Add(ButtonAdd);
groupBoxComponents.Location = new Point(12, 81);
groupBoxComponents.Location = new Point(14, 108);
groupBoxComponents.Margin = new Padding(3, 4, 3, 4);
groupBoxComponents.Name = "groupBoxComponents";
groupBoxComponents.Size = new Size(579, 287);
groupBoxComponents.Padding = new Padding(3, 4, 3, 4);
groupBoxComponents.Size = new Size(662, 383);
groupBoxComponents.TabIndex = 14;
groupBoxComponents.TabStop = false;
groupBoxComponents.Text = "Ингредиенты";
//
// FormPizza
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(612, 430);
ClientSize = new Size(699, 573);
Controls.Add(groupBoxComponents);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
@ -210,6 +222,7 @@
Controls.Add(textBoxName);
Controls.Add(labelPrice);
Controls.Add(labelName);
Margin = new Padding(3, 4, 3, 4);
Name = "FormPizza";
Text = "Пицца";
Load += FormPizza_Load;

View File

@ -39,9 +39,10 @@
// buttonCancel
//
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonCancel.Location = new Point(259, 87);
buttonCancel.Location = new Point(296, 116);
buttonCancel.Margin = new Padding(3, 4, 3, 4);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(75, 23);
buttonCancel.Size = new Size(86, 31);
buttonCancel.TabIndex = 8;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
@ -50,9 +51,10 @@
// buttonSave
//
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonSave.Location = new Point(178, 87);
buttonSave.Location = new Point(195, 116);
buttonSave.Margin = new Padding(3, 4, 3, 4);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(75, 23);
buttonSave.Size = new Size(94, 31);
buttonSave.TabIndex = 9;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
@ -60,26 +62,27 @@
//
// textBoxCount
//
textBoxCount.Location = new Point(101, 41);
textBoxCount.Location = new Point(115, 55);
textBoxCount.Margin = new Padding(3, 4, 3, 4);
textBoxCount.Name = "textBoxCount";
textBoxCount.Size = new Size(233, 23);
textBoxCount.Size = new Size(266, 27);
textBoxCount.TabIndex = 6;
//
// labelCount
//
labelCount.AutoSize = true;
labelCount.Location = new Point(13, 44);
labelCount.Location = new Point(15, 59);
labelCount.Name = "labelCount";
labelCount.Size = new Size(75, 15);
labelCount.Size = new Size(93, 20);
labelCount.TabIndex = 5;
labelCount.Text = "Количество:";
//
// labelComponent
//
labelComponent.AutoSize = true;
labelComponent.Location = new Point(13, 15);
labelComponent.Location = new Point(15, 20);
labelComponent.Name = "labelComponent";
labelComponent.Size = new Size(75, 15);
labelComponent.Size = new Size(95, 20);
labelComponent.TabIndex = 4;
labelComponent.Text = "Ингредиент:";
//
@ -87,22 +90,24 @@
//
comboBoxComponent.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxComponent.FormattingEnabled = true;
comboBoxComponent.Location = new Point(101, 12);
comboBoxComponent.Location = new Point(115, 16);
comboBoxComponent.Margin = new Padding(3, 4, 3, 4);
comboBoxComponent.Name = "comboBoxComponent";
comboBoxComponent.Size = new Size(233, 23);
comboBoxComponent.Size = new Size(266, 28);
comboBoxComponent.TabIndex = 10;
//
// FormPizzaComponent
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(355, 125);
ClientSize = new Size(406, 167);
Controls.Add(comboBoxComponent);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(textBoxCount);
Controls.Add(labelCount);
Controls.Add(labelComponent);
Margin = new Padding(3, 4, 3, 4);
Name = "FormPizzaComponent";
Text = "Ингредиент пиццы";
ResumeLayout(false);

View File

@ -38,7 +38,6 @@ namespace Pizzeria
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonAdd_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormPizza));
@ -49,14 +48,11 @@ namespace Pizzeria
LoadData();
}
}
}
private void ButtonRef_Click(object sender, EventArgs e)
{
LoadData();
}
private void ButtonDel_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
@ -83,9 +79,7 @@ namespace Pizzeria
}
}
}
}
private void ButtonUpd_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
@ -101,7 +95,5 @@ namespace Pizzeria
}
}
}
}
}

View File

@ -99,7 +99,7 @@ namespace PizzeriaBusinessLogic.BusinessLogic
var element = _componentStorage.GetElement(new ComponentSearchModel{ ComponentName = model.ComponentName });
if (element != null && element.Id != model.Id)
{
throw new InvalidOperationException("ингредиент с таким названием уже есть");
throw new InvalidOperationException("Ингредиент с таким названием уже есть");
}
}
}

View File

@ -130,8 +130,5 @@ namespace PizzeriaBusinessLogic.BusinessLogic
}
_logger.LogInformation("Order. Id: {Id}. Sum: {Sum}. PizzaId: {PizzaId}. ReinforcedCount: {Count}", model.Id, model.Sum, model.PizzaId, model.Count);
}
}
}

View File

@ -88,17 +88,17 @@ namespace PizzeriaBusinessLogic.BusinessLogic
}
if (string.IsNullOrEmpty(model.PizzaName))
{
throw new ArgumentNullException("Нет названия продукта", nameof(model.PizzaName));
throw new ArgumentNullException("Нет названия пиццы", nameof(model.PizzaName));
}
if (model.Price <= 0)
{
throw new ArgumentNullException("Цена продукта должна быть больше 0", nameof(model.Price));
throw new ArgumentNullException("Цена пиццы должна быть больше 0", nameof(model.Price));
}
_logger.LogInformation("Pizza. PizzaName:{PizzaName}.Price:{ Price}. Id: { Id}", model.PizzaName, model.Price, model.Id);
var element = _PizzaStorage.GetElement(new PizzaSearchModel { PizzaName = model.PizzaName });
if (element != null && element.Id != model.Id)
{
throw new InvalidOperationException(родукт с таким названием уже есть");
throw new InvalidOperationException(ицца с таким названием уже есть");
}
}
}