end 6 lab
This commit is contained in:
parent
33bd12a1cf
commit
8a56f82246
76
Pizzeria/Pizzeria/FormMain.Designer.cs
generated
76
Pizzeria/Pizzeria/FormMain.Designer.cs
generated
@ -33,10 +33,12 @@
|
|||||||
компонентыToolStripMenuItem = new ToolStripMenuItem();
|
компонентыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
изделияToolStripMenuItem = new ToolStripMenuItem();
|
изделияToolStripMenuItem = new ToolStripMenuItem();
|
||||||
клиентыToolStripMenuItem = new ToolStripMenuItem();
|
клиентыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
исполнителиToolStripMenuItem = new ToolStripMenuItem();
|
||||||
отчётыToolStripMenuItem = new ToolStripMenuItem();
|
отчётыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
списокИзделийToolStripMenuItem = new ToolStripMenuItem();
|
списокИзделийToolStripMenuItem = new ToolStripMenuItem();
|
||||||
компонентыПоИзделиямToolStripMenuItem = new ToolStripMenuItem();
|
компонентыПоИзделиямToolStripMenuItem = new ToolStripMenuItem();
|
||||||
списокЗаказовToolStripMenuItem = new ToolStripMenuItem();
|
списокЗаказовToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
запускРаботToolStripMenuItem = new ToolStripMenuItem();
|
||||||
dataGridView = new DataGridView();
|
dataGridView = new DataGridView();
|
||||||
ButtonIssuedOrder = new Button();
|
ButtonIssuedOrder = new Button();
|
||||||
ButtonOrderReady = new Button();
|
ButtonOrderReady = new Button();
|
||||||
@ -50,70 +52,83 @@
|
|||||||
// menuStrip
|
// menuStrip
|
||||||
//
|
//
|
||||||
menuStrip.ImageScalingSize = new Size(20, 20);
|
menuStrip.ImageScalingSize = new Size(20, 20);
|
||||||
menuStrip.Items.AddRange(new ToolStripItem[] { справочкиниToolStripMenuItem, отчётыToolStripMenuItem });
|
menuStrip.Items.AddRange(new ToolStripItem[] { справочкиниToolStripMenuItem, отчётыToolStripMenuItem, запускРаботToolStripMenuItem });
|
||||||
menuStrip.Location = new Point(0, 0);
|
menuStrip.Location = new Point(0, 0);
|
||||||
menuStrip.Name = "menuStrip";
|
menuStrip.Name = "menuStrip";
|
||||||
menuStrip.Padding = new Padding(7, 3, 0, 3);
|
menuStrip.Size = new Size(1200, 24);
|
||||||
menuStrip.Size = new Size(1372, 30);
|
|
||||||
menuStrip.TabIndex = 0;
|
menuStrip.TabIndex = 0;
|
||||||
menuStrip.Text = "Справочники:";
|
menuStrip.Text = "Справочники:";
|
||||||
//
|
//
|
||||||
// справочкиниToolStripMenuItem
|
// справочкиниToolStripMenuItem
|
||||||
//
|
//
|
||||||
справочкиниToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, изделияToolStripMenuItem, клиентыToolStripMenuItem });
|
справочкиниToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, изделияToolStripMenuItem, клиентыToolStripMenuItem, исполнителиToolStripMenuItem });
|
||||||
справочкиниToolStripMenuItem.Name = "справочкиниToolStripMenuItem";
|
справочкиниToolStripMenuItem.Name = "справочкиниToolStripMenuItem";
|
||||||
справочкиниToolStripMenuItem.Size = new Size(120, 24);
|
справочкиниToolStripMenuItem.Size = new Size(97, 20);
|
||||||
справочкиниToolStripMenuItem.Text = "Справочники:";
|
справочкиниToolStripMenuItem.Text = "Справочники:";
|
||||||
//
|
//
|
||||||
// компонентыToolStripMenuItem
|
// компонентыToolStripMenuItem
|
||||||
//
|
//
|
||||||
компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
||||||
компонентыToolStripMenuItem.Size = new Size(186, 26);
|
компонентыToolStripMenuItem.Size = new Size(180, 22);
|
||||||
компонентыToolStripMenuItem.Text = "Ингредиенты";
|
компонентыToolStripMenuItem.Text = "Ингредиенты";
|
||||||
компонентыToolStripMenuItem.Click += ИнгредиентыToolStripMenuItem_Click;
|
компонентыToolStripMenuItem.Click += ИнгредиентыToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// изделияToolStripMenuItem
|
// изделияToolStripMenuItem
|
||||||
//
|
//
|
||||||
изделияToolStripMenuItem.Name = "изделияToolStripMenuItem";
|
изделияToolStripMenuItem.Name = "изделияToolStripMenuItem";
|
||||||
изделияToolStripMenuItem.Size = new Size(186, 26);
|
изделияToolStripMenuItem.Size = new Size(180, 22);
|
||||||
изделияToolStripMenuItem.Text = "Пиццы";
|
изделияToolStripMenuItem.Text = "Пиццы";
|
||||||
изделияToolStripMenuItem.Click += ПиццыToolStripMenuItem_Click;
|
изделияToolStripMenuItem.Click += ПиццыToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// клиентыToolStripMenuItem
|
// клиентыToolStripMenuItem
|
||||||
//
|
//
|
||||||
клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
|
клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
|
||||||
клиентыToolStripMenuItem.Size = new Size(186, 26);
|
клиентыToolStripMenuItem.Size = new Size(180, 22);
|
||||||
клиентыToolStripMenuItem.Text = "Клиенты";
|
клиентыToolStripMenuItem.Text = "Клиенты";
|
||||||
клиентыToolStripMenuItem.Click += клиентыToolStripMenuItem_Click;
|
клиентыToolStripMenuItem.Click += клиентыToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
|
// исполнителиToolStripMenuItem
|
||||||
|
//
|
||||||
|
исполнителиToolStripMenuItem.Name = "исполнителиToolStripMenuItem";
|
||||||
|
исполнителиToolStripMenuItem.Size = new Size(180, 22);
|
||||||
|
исполнителиToolStripMenuItem.Text = "Исполнители";
|
||||||
|
исполнителиToolStripMenuItem.Click += исполнителиToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
// отчётыToolStripMenuItem
|
// отчётыToolStripMenuItem
|
||||||
//
|
//
|
||||||
отчётыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокИзделийToolStripMenuItem, компонентыПоИзделиямToolStripMenuItem, списокЗаказовToolStripMenuItem });
|
отчётыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокИзделийToolStripMenuItem, компонентыПоИзделиямToolStripMenuItem, списокЗаказовToolStripMenuItem });
|
||||||
отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
|
отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
|
||||||
отчётыToolStripMenuItem.Size = new Size(73, 24);
|
отчётыToolStripMenuItem.Size = new Size(60, 20);
|
||||||
отчётыToolStripMenuItem.Text = "Отчёты";
|
отчётыToolStripMenuItem.Text = "Отчёты";
|
||||||
//
|
//
|
||||||
// списокИзделийToolStripMenuItem
|
// списокИзделийToolStripMenuItem
|
||||||
//
|
//
|
||||||
списокИзделийToolStripMenuItem.Name = "списокИзделийToolStripMenuItem";
|
списокИзделийToolStripMenuItem.Name = "списокИзделийToolStripMenuItem";
|
||||||
списокИзделийToolStripMenuItem.Size = new Size(276, 26);
|
списокИзделийToolStripMenuItem.Size = new Size(218, 22);
|
||||||
списокИзделийToolStripMenuItem.Text = "Список изделий";
|
списокИзделийToolStripMenuItem.Text = "Список изделий";
|
||||||
списокИзделийToolStripMenuItem.Click += списокИзделийToolStripMenuItem_Click;
|
списокИзделийToolStripMenuItem.Click += списокИзделийToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// компонентыПоИзделиямToolStripMenuItem
|
// компонентыПоИзделиямToolStripMenuItem
|
||||||
//
|
//
|
||||||
компонентыПоИзделиямToolStripMenuItem.Name = "компонентыПоИзделиямToolStripMenuItem";
|
компонентыПоИзделиямToolStripMenuItem.Name = "компонентыПоИзделиямToolStripMenuItem";
|
||||||
компонентыПоИзделиямToolStripMenuItem.Size = new Size(276, 26);
|
компонентыПоИзделиямToolStripMenuItem.Size = new Size(218, 22);
|
||||||
компонентыПоИзделиямToolStripMenuItem.Text = "Компоненты по изделиям";
|
компонентыПоИзделиямToolStripMenuItem.Text = "Компоненты по изделиям";
|
||||||
компонентыПоИзделиямToolStripMenuItem.Click += компонентыПоИзделиямToolStripMenuItem_Click;
|
компонентыПоИзделиямToolStripMenuItem.Click += компонентыПоИзделиямToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// списокЗаказовToolStripMenuItem
|
// списокЗаказовToolStripMenuItem
|
||||||
//
|
//
|
||||||
списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
|
списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
|
||||||
списокЗаказовToolStripMenuItem.Size = new Size(276, 26);
|
списокЗаказовToolStripMenuItem.Size = new Size(218, 22);
|
||||||
списокЗаказовToolStripMenuItem.Text = "Список заказов";
|
списокЗаказовToolStripMenuItem.Text = "Список заказов";
|
||||||
списокЗаказовToolStripMenuItem.Click += списокЗаказовToolStripMenuItem_Click;
|
списокЗаказовToolStripMenuItem.Click += списокЗаказовToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
|
// запускРаботToolStripMenuItem
|
||||||
|
//
|
||||||
|
запускРаботToolStripMenuItem.Name = "запускРаботToolStripMenuItem";
|
||||||
|
запускРаботToolStripMenuItem.Size = new Size(92, 20);
|
||||||
|
запускРаботToolStripMenuItem.Text = "Запуск работ";
|
||||||
|
запускРаботToolStripMenuItem.Click += запускРаботToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
// dataGridView
|
// dataGridView
|
||||||
//
|
//
|
||||||
dataGridView.AllowUserToAddRows = false;
|
dataGridView.AllowUserToAddRows = false;
|
||||||
@ -121,8 +136,7 @@
|
|||||||
dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
dataGridView.BackgroundColor = SystemColors.ControlLightLight;
|
dataGridView.BackgroundColor = SystemColors.ControlLightLight;
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
dataGridView.Location = new Point(0, 36);
|
dataGridView.Location = new Point(0, 27);
|
||||||
dataGridView.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
dataGridView.MultiSelect = false;
|
dataGridView.MultiSelect = false;
|
||||||
dataGridView.Name = "dataGridView";
|
dataGridView.Name = "dataGridView";
|
||||||
dataGridView.ReadOnly = true;
|
dataGridView.ReadOnly = true;
|
||||||
@ -130,15 +144,16 @@
|
|||||||
dataGridView.RowHeadersWidth = 51;
|
dataGridView.RowHeadersWidth = 51;
|
||||||
dataGridView.RowTemplate.Height = 25;
|
dataGridView.RowTemplate.Height = 25;
|
||||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
dataGridView.Size = new Size(1113, 483);
|
dataGridView.Size = new Size(974, 362);
|
||||||
dataGridView.TabIndex = 0;
|
dataGridView.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// ButtonIssuedOrder
|
// ButtonIssuedOrder
|
||||||
//
|
//
|
||||||
ButtonIssuedOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
ButtonIssuedOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
ButtonIssuedOrder.Location = new Point(1143, 247);
|
ButtonIssuedOrder.Location = new Point(1000, 185);
|
||||||
|
ButtonIssuedOrder.Margin = new Padding(3, 2, 3, 2);
|
||||||
ButtonIssuedOrder.Name = "ButtonIssuedOrder";
|
ButtonIssuedOrder.Name = "ButtonIssuedOrder";
|
||||||
ButtonIssuedOrder.Size = new Size(205, 43);
|
ButtonIssuedOrder.Size = new Size(179, 32);
|
||||||
ButtonIssuedOrder.TabIndex = 8;
|
ButtonIssuedOrder.TabIndex = 8;
|
||||||
ButtonIssuedOrder.Text = "Заказ выдан";
|
ButtonIssuedOrder.Text = "Заказ выдан";
|
||||||
ButtonIssuedOrder.UseVisualStyleBackColor = true;
|
ButtonIssuedOrder.UseVisualStyleBackColor = true;
|
||||||
@ -147,9 +162,10 @@
|
|||||||
// ButtonOrderReady
|
// ButtonOrderReady
|
||||||
//
|
//
|
||||||
ButtonOrderReady.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
ButtonOrderReady.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
ButtonOrderReady.Location = new Point(1143, 185);
|
ButtonOrderReady.Location = new Point(1000, 139);
|
||||||
|
ButtonOrderReady.Margin = new Padding(3, 2, 3, 2);
|
||||||
ButtonOrderReady.Name = "ButtonOrderReady";
|
ButtonOrderReady.Name = "ButtonOrderReady";
|
||||||
ButtonOrderReady.Size = new Size(205, 43);
|
ButtonOrderReady.Size = new Size(179, 32);
|
||||||
ButtonOrderReady.TabIndex = 7;
|
ButtonOrderReady.TabIndex = 7;
|
||||||
ButtonOrderReady.Text = "Заказ готов";
|
ButtonOrderReady.Text = "Заказ готов";
|
||||||
ButtonOrderReady.UseVisualStyleBackColor = true;
|
ButtonOrderReady.UseVisualStyleBackColor = true;
|
||||||
@ -158,9 +174,10 @@
|
|||||||
// ButtonnTakeOrderInWork
|
// ButtonnTakeOrderInWork
|
||||||
//
|
//
|
||||||
ButtonnTakeOrderInWork.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
ButtonnTakeOrderInWork.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
ButtonnTakeOrderInWork.Location = new Point(1143, 124);
|
ButtonnTakeOrderInWork.Location = new Point(1000, 93);
|
||||||
|
ButtonnTakeOrderInWork.Margin = new Padding(3, 2, 3, 2);
|
||||||
ButtonnTakeOrderInWork.Name = "ButtonnTakeOrderInWork";
|
ButtonnTakeOrderInWork.Name = "ButtonnTakeOrderInWork";
|
||||||
ButtonnTakeOrderInWork.Size = new Size(205, 43);
|
ButtonnTakeOrderInWork.Size = new Size(179, 32);
|
||||||
ButtonnTakeOrderInWork.TabIndex = 6;
|
ButtonnTakeOrderInWork.TabIndex = 6;
|
||||||
ButtonnTakeOrderInWork.Text = "Отдать на выполнение";
|
ButtonnTakeOrderInWork.Text = "Отдать на выполнение";
|
||||||
ButtonnTakeOrderInWork.UseVisualStyleBackColor = true;
|
ButtonnTakeOrderInWork.UseVisualStyleBackColor = true;
|
||||||
@ -169,9 +186,10 @@
|
|||||||
// ButtonCreateOrder
|
// ButtonCreateOrder
|
||||||
//
|
//
|
||||||
ButtonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
ButtonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
ButtonCreateOrder.Location = new Point(1143, 63);
|
ButtonCreateOrder.Location = new Point(1000, 47);
|
||||||
|
ButtonCreateOrder.Margin = new Padding(3, 2, 3, 2);
|
||||||
ButtonCreateOrder.Name = "ButtonCreateOrder";
|
ButtonCreateOrder.Name = "ButtonCreateOrder";
|
||||||
ButtonCreateOrder.Size = new Size(205, 43);
|
ButtonCreateOrder.Size = new Size(179, 32);
|
||||||
ButtonCreateOrder.TabIndex = 5;
|
ButtonCreateOrder.TabIndex = 5;
|
||||||
ButtonCreateOrder.Text = "Создать заказ";
|
ButtonCreateOrder.Text = "Создать заказ";
|
||||||
ButtonCreateOrder.UseVisualStyleBackColor = true;
|
ButtonCreateOrder.UseVisualStyleBackColor = true;
|
||||||
@ -180,9 +198,10 @@
|
|||||||
// buttonRef_Click
|
// buttonRef_Click
|
||||||
//
|
//
|
||||||
buttonRef_Click.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
buttonRef_Click.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
buttonRef_Click.Location = new Point(1143, 308);
|
buttonRef_Click.Location = new Point(1000, 231);
|
||||||
|
buttonRef_Click.Margin = new Padding(3, 2, 3, 2);
|
||||||
buttonRef_Click.Name = "buttonRef_Click";
|
buttonRef_Click.Name = "buttonRef_Click";
|
||||||
buttonRef_Click.Size = new Size(205, 43);
|
buttonRef_Click.Size = new Size(179, 32);
|
||||||
buttonRef_Click.TabIndex = 8;
|
buttonRef_Click.TabIndex = 8;
|
||||||
buttonRef_Click.Text = "Обновить список";
|
buttonRef_Click.Text = "Обновить список";
|
||||||
buttonRef_Click.UseVisualStyleBackColor = true;
|
buttonRef_Click.UseVisualStyleBackColor = true;
|
||||||
@ -190,9 +209,9 @@
|
|||||||
//
|
//
|
||||||
// FormMain
|
// FormMain
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(1372, 520);
|
ClientSize = new Size(1200, 390);
|
||||||
Controls.Add(buttonRef_Click);
|
Controls.Add(buttonRef_Click);
|
||||||
Controls.Add(ButtonIssuedOrder);
|
Controls.Add(ButtonIssuedOrder);
|
||||||
Controls.Add(ButtonOrderReady);
|
Controls.Add(ButtonOrderReady);
|
||||||
@ -201,7 +220,6 @@
|
|||||||
Controls.Add(dataGridView);
|
Controls.Add(dataGridView);
|
||||||
Controls.Add(menuStrip);
|
Controls.Add(menuStrip);
|
||||||
MainMenuStrip = menuStrip;
|
MainMenuStrip = menuStrip;
|
||||||
Margin = new Padding(3, 4, 3, 4);
|
|
||||||
Name = "FormMain";
|
Name = "FormMain";
|
||||||
Text = "Пиццерия";
|
Text = "Пиццерия";
|
||||||
Load += FormMain_Load;
|
Load += FormMain_Load;
|
||||||
@ -229,5 +247,7 @@
|
|||||||
private ToolStripMenuItem компонентыПоИзделиямToolStripMenuItem;
|
private ToolStripMenuItem компонентыПоИзделиямToolStripMenuItem;
|
||||||
private ToolStripMenuItem списокЗаказовToolStripMenuItem;
|
private ToolStripMenuItem списокЗаказовToolStripMenuItem;
|
||||||
private ToolStripMenuItem клиентыToolStripMenuItem;
|
private ToolStripMenuItem клиентыToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem исполнителиToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem запускРаботToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,12 +8,14 @@ namespace Pizzeria
|
|||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IOrderLogic _orderLogic;
|
private readonly IOrderLogic _orderLogic;
|
||||||
private readonly IReportLogic _reportLogic;
|
private readonly IReportLogic _reportLogic;
|
||||||
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic)
|
private readonly IWorkProcess _workProcess;
|
||||||
|
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_orderLogic = orderLogic;
|
_orderLogic = orderLogic;
|
||||||
_reportLogic = reportLogic;
|
_reportLogic = reportLogic;
|
||||||
|
_workProcess = workProcess;
|
||||||
}
|
}
|
||||||
private void FormMain_Load(object sender, EventArgs e)
|
private void FormMain_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -29,6 +31,7 @@ namespace Pizzeria
|
|||||||
dataGridView.DataSource = list;
|
dataGridView.DataSource = list;
|
||||||
dataGridView.Columns["PizzaId"].Visible = false;
|
dataGridView.Columns["PizzaId"].Visible = false;
|
||||||
dataGridView.Columns["ClientId"].Visible = false;
|
dataGridView.Columns["ClientId"].Visible = false;
|
||||||
|
dataGridView.Columns["ImplementerId"].Visible = false;
|
||||||
dataGridView.Columns["PizzaName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
dataGridView.Columns["PizzaName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Загрузка заказов");
|
_logger.LogInformation("Загрузка заказов");
|
||||||
@ -173,6 +176,21 @@ namespace Pizzeria
|
|||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void исполнителиToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormImplementers));
|
||||||
|
if (service is FormImplementers form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void запускРаботToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic);
|
||||||
|
MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ using PizzeriaContracts.SearchModels;
|
|||||||
using PizzeriaContracts.StorageContracts;
|
using PizzeriaContracts.StorageContracts;
|
||||||
using PizzeriaContracts.ViewModels;
|
using PizzeriaContracts.ViewModels;
|
||||||
using PizzeriaDataModels.Enums;
|
using PizzeriaDataModels.Enums;
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace PizzeriaBusinessLogic.BusinessLogic
|
namespace PizzeriaBusinessLogic.BusinessLogic
|
||||||
{
|
{
|
||||||
@ -73,7 +72,10 @@ namespace PizzeriaBusinessLogic.BusinessLogic
|
|||||||
|
|
||||||
public bool TakeOrderInWork(OrderBindingModel model)
|
public bool TakeOrderInWork(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
return ChangeStatus(model, OrderStatus.Выполняется);
|
lock (_locker)
|
||||||
|
{
|
||||||
|
return ChangeStatus(model, OrderStatus.Выполняется);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool FinishOrder(OrderBindingModel model)
|
public bool FinishOrder(OrderBindingModel model)
|
||||||
@ -85,56 +87,47 @@ namespace PizzeriaBusinessLogic.BusinessLogic
|
|||||||
{
|
{
|
||||||
return ChangeStatus(model, OrderStatus.Выдан);
|
return ChangeStatus(model, OrderStatus.Выдан);
|
||||||
}
|
}
|
||||||
public bool ChangeStatus(OrderBindingModel model, OrderStatus status)
|
private bool ChangeStatus(OrderBindingModel model, OrderStatus requiredStatus)
|
||||||
{
|
{
|
||||||
CheckModel(model, false);
|
CheckModel(model, false);
|
||||||
|
var element = _orderStorage.GetElement(new OrderSearchModel()
|
||||||
var searchOrder = new OrderSearchModel { Id = model.Id };
|
|
||||||
var order = _orderStorage.GetElement(searchOrder);
|
|
||||||
|
|
||||||
if (order == null)
|
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(order));
|
Id = model.Id
|
||||||
}
|
});
|
||||||
model.PizzaId = order.PizzaId;
|
if (element == null)
|
||||||
model.Count = order.Count;
|
|
||||||
model.Sum = order.Count;
|
|
||||||
model.DateCreate = order.DateCreate;
|
|
||||||
model.DateImplement = order.DateImplement;
|
|
||||||
model.Status = order.Status;
|
|
||||||
|
|
||||||
if (model.Status != status - 1)
|
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Status update to " + status + " operation failed");
|
throw new InvalidOperationException(nameof(element));
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
model.Status = status;
|
model.DateCreate = element.DateCreate;
|
||||||
|
model.PizzaId = element.PizzaId;
|
||||||
if (order.ImplementerId.HasValue)
|
model.DateImplement = element.DateImplement;
|
||||||
|
model.ClientId = element.ClientId;
|
||||||
|
if (!model.ImplementerId.HasValue)
|
||||||
{
|
{
|
||||||
model.ImplementerId = order.ImplementerId;
|
model.ImplementerId = element.ImplementerId;
|
||||||
}
|
}
|
||||||
if (model.Status == OrderStatus.Выдан)
|
model.Status = element.Status;
|
||||||
|
model.Count = element.Count;
|
||||||
|
model.Sum = element.Sum;
|
||||||
|
if (requiredStatus - model.Status == 1)
|
||||||
{
|
{
|
||||||
model.DateImplement = DateTime.Now;
|
model.Status = requiredStatus;
|
||||||
|
if (model.Status == OrderStatus.Готов)
|
||||||
|
{
|
||||||
|
model.DateImplement = DateTime.Now;
|
||||||
|
}
|
||||||
|
if (_orderStorage.Update(model) == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Update operation failed");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
_logger.LogWarning("Changing status operation faled: Current-{Status}:required-{requiredStatus}.", model.Status, requiredStatus);
|
||||||
if (model.Status == OrderStatus.Готов)
|
throw new InvalidOperationException($"Невозможно приствоить статус {requiredStatus} заказу с текущим статусом {model.Status}");
|
||||||
{
|
|
||||||
model.DateImplement = DateTime.Now;
|
|
||||||
}
|
|
||||||
if (_orderStorage.Update(model) == null)
|
|
||||||
{
|
|
||||||
model.Status--;
|
|
||||||
_logger.LogWarning("Changing status operation faled");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
private void CheckModel(OrderBindingModel model, bool withParams = true)
|
private void CheckModel(OrderBindingModel model, bool withParams = true)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(model));
|
throw new ArgumentNullException(nameof(model));
|
||||||
@ -143,23 +136,20 @@ namespace PizzeriaBusinessLogic.BusinessLogic
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (model.ClientId <= 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Некорректный идентификатор клиента", nameof(model.ClientId));
|
|
||||||
}
|
|
||||||
if (model.PizzaId <= 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Некорректный идентификатор пиццы", nameof(model.PizzaId));
|
|
||||||
}
|
|
||||||
if (model.Count <= 0)
|
if (model.Count <= 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("В заказе должно быть хотя бы одно пицца", nameof(model.Count));
|
throw new ArgumentException("Колличество пиццы в заказе не может быть меньше 1", nameof(model.Count));
|
||||||
}
|
}
|
||||||
if (model.Sum <= 0)
|
if (model.Sum <= 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Стоимость заказа должна быть больше 0", nameof(model.Sum));
|
throw new ArgumentException("Стоимость заказа на может быть меньше 1", nameof(model.Sum));
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Order. Id: {Id}. Sum: {Sum}. PizzaId: {PizzaId}. PizzaCount: {Count}", model.Id, model.Sum, model.PizzaId, model.Count);
|
if (model.DateImplement.HasValue && model.DateImplement < model.DateCreate)
|
||||||
|
{
|
||||||
|
throw new ArithmeticException($"Дата выдачи заказа {model.DateImplement} не может быть раньше даты его создания {model.DateCreate}");
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Pizza. PizzaId:{PizzaId}.Count:{Count}.Sum:{Sum}Id:{Id}",
|
||||||
|
model.PizzaId, model.Count, model.Sum, model.Id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using PizzeriaContracts.BindingModels;
|
/*using PizzeriaContracts.BindingModels;
|
||||||
using PizzeriaContracts.SearchModels;
|
using PizzeriaContracts.SearchModels;
|
||||||
using PizzeriaContracts.ViewModels;
|
using PizzeriaContracts.ViewModels;
|
||||||
using PizzeriaDatabaseImplement.Models;
|
using PizzeriaDatabaseImplement.Models;
|
||||||
@ -137,4 +137,92 @@ namespace PizzeriaDatabaseImplement.Implements
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
using PizzeriaContracts.BindingModels;
|
||||||
|
using PizzeriaContracts.SearchModels;
|
||||||
|
using PizzeriaContracts.ViewModels;
|
||||||
|
using PizzeriaDatabaseImplement.Models;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PizzeriaContracts.StorageContracts;
|
||||||
|
|
||||||
|
namespace PizzeriaDatabaseImplement.Implements
|
||||||
|
{
|
||||||
|
public class OrderStorage : IOrderStorage
|
||||||
|
{
|
||||||
|
public List<OrderViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
using var context = new PizzeriaDatabase();
|
||||||
|
return context.Orders.Include(x => x.Pizza).Include(x => x.Client).Include(y => y.Implementer).Select(x => x.GetViewModel).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
|
{
|
||||||
|
using var context = new PizzeriaDatabase();
|
||||||
|
if ((!model.DateFrom.HasValue || !model.DateTo.HasValue) && !model.ClientId.HasValue && !model.Status.HasValue)
|
||||||
|
{
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
return context.Orders.Include(x => x.Pizza).Include(x => x.Client).Include(x => x.Implementer).Where(x =>
|
||||||
|
(model.DateFrom.HasValue && model.DateTo.HasValue && x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo) ||
|
||||||
|
(model.ClientId.HasValue && x.ClientId == model.ClientId) ||
|
||||||
|
(model.Status.HasValue && x.Status == model.Status))
|
||||||
|
.Select(x => x.GetViewModel).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||||
|
{
|
||||||
|
if (!model.Id.HasValue && (!model.ImplementerId.HasValue || !model.Status.HasValue))
|
||||||
|
{
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
using var context = new PizzeriaDatabase();
|
||||||
|
return context.Orders.Include(x => x.Pizza).Include(x => x.Client).Include(x => x.Implementer).FirstOrDefault(x =>
|
||||||
|
(model.Id.HasValue && x.Id == model.Id) ||
|
||||||
|
(model.ImplementerId.HasValue && x.ImplementerId == model.ImplementerId && x.Status == model.Status))
|
||||||
|
?.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderViewModel? Insert(OrderBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new PizzeriaDatabase();
|
||||||
|
if (model == null)
|
||||||
|
return null;
|
||||||
|
var newOrder = Order.Create(context, model);
|
||||||
|
if (newOrder == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
context.Orders.Add(newOrder);
|
||||||
|
context.SaveChanges();
|
||||||
|
return newOrder.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderViewModel? Update(OrderBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new PizzeriaDatabase();
|
||||||
|
var order = context.Orders.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
if (order == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
order.Update(context, model);
|
||||||
|
context.SaveChanges();
|
||||||
|
return order.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderViewModel? Delete(OrderBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new PizzeriaDatabase();
|
||||||
|
var order = context.Orders.FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
|
if (order != null)
|
||||||
|
{
|
||||||
|
context.Orders.Remove(order);
|
||||||
|
context.SaveChanges();
|
||||||
|
return order.GetViewModel;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
257
Pizzeria/PizzeriaDatabaseImplement/Migrations/20240621122250_ImplementorAdd.Designer.cs
generated
Normal file
257
Pizzeria/PizzeriaDatabaseImplement/Migrations/20240621122250_ImplementorAdd.Designer.cs
generated
Normal file
@ -0,0 +1,257 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using PizzeriaDatabaseImplement;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace PizzeriaDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(PizzeriaDatabase))]
|
||||||
|
[Migration("20240621122250_ImplementorAdd")]
|
||||||
|
partial class ImplementorAdd
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "7.0.17")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Client", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ClientFIO")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Clients");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ComponentName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<double>("Cost")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Components");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Implementer", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ImplementerFIO")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("Qualification")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("WorkExperience")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Implementers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int?>("ImplementerId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("PizzaId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<double>("Sum")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.HasIndex("ImplementerId");
|
||||||
|
|
||||||
|
b.HasIndex("PizzaId");
|
||||||
|
|
||||||
|
b.ToTable("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Pizza", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("PizzaName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<double>("Price")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Pizzas");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.PizzaComponent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ComponentId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("PizzaId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.HasIndex("PizzaId");
|
||||||
|
|
||||||
|
b.ToTable("PizzaComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("PizzeriaDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("PizzeriaDatabaseImplement.Models.Implementer", "Implementer")
|
||||||
|
.WithMany("Order")
|
||||||
|
.HasForeignKey("ImplementerId");
|
||||||
|
|
||||||
|
b.HasOne("PizzeriaDatabaseImplement.Models.Pizza", "Pizza")
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("PizzaId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
|
||||||
|
b.Navigation("Implementer");
|
||||||
|
|
||||||
|
b.Navigation("Pizza");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.PizzaComponent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("PizzeriaDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany("PizzaComponents")
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("PizzeriaDatabaseImplement.Models.Pizza", "Pizza")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("PizzaId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
|
||||||
|
b.Navigation("Pizza");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Client", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("PizzaComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Implementer", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Order");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Pizza", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
|
||||||
|
b.Navigation("Orders");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,67 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace PizzeriaDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class ImplementorAdd : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "ImplementerId",
|
||||||
|
table: "Orders",
|
||||||
|
type: "int",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Implementers",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ImplementerFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
WorkExperience = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Qualification = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Implementers", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Orders_ImplementerId",
|
||||||
|
table: "Orders",
|
||||||
|
column: "ImplementerId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Orders_Implementers_ImplementerId",
|
||||||
|
table: "Orders",
|
||||||
|
column: "ImplementerId",
|
||||||
|
principalTable: "Implementers",
|
||||||
|
principalColumn: "Id");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Orders_Implementers_ImplementerId",
|
||||||
|
table: "Orders");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Implementers");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Orders_ImplementerId",
|
||||||
|
table: "Orders");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ImplementerId",
|
||||||
|
table: "Orders");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -67,6 +67,33 @@ namespace PizzeriaDatabaseImplement.Migrations
|
|||||||
b.ToTable("Components");
|
b.ToTable("Components");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Implementer", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ImplementerFIO")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("Qualification")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("WorkExperience")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Implementers");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Order", b =>
|
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Order", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@ -87,6 +114,9 @@ namespace PizzeriaDatabaseImplement.Migrations
|
|||||||
b.Property<DateTime?>("DateImplement")
|
b.Property<DateTime?>("DateImplement")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int?>("ImplementerId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("PizzaId")
|
b.Property<int>("PizzaId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
@ -100,6 +130,8 @@ namespace PizzeriaDatabaseImplement.Migrations
|
|||||||
|
|
||||||
b.HasIndex("ClientId");
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.HasIndex("ImplementerId");
|
||||||
|
|
||||||
b.HasIndex("PizzaId");
|
b.HasIndex("PizzaId");
|
||||||
|
|
||||||
b.ToTable("Orders");
|
b.ToTable("Orders");
|
||||||
@ -159,6 +191,10 @@ namespace PizzeriaDatabaseImplement.Migrations
|
|||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("PizzeriaDatabaseImplement.Models.Implementer", "Implementer")
|
||||||
|
.WithMany("Order")
|
||||||
|
.HasForeignKey("ImplementerId");
|
||||||
|
|
||||||
b.HasOne("PizzeriaDatabaseImplement.Models.Pizza", "Pizza")
|
b.HasOne("PizzeriaDatabaseImplement.Models.Pizza", "Pizza")
|
||||||
.WithMany("Orders")
|
.WithMany("Orders")
|
||||||
.HasForeignKey("PizzaId")
|
.HasForeignKey("PizzaId")
|
||||||
@ -167,6 +203,8 @@ namespace PizzeriaDatabaseImplement.Migrations
|
|||||||
|
|
||||||
b.Navigation("Client");
|
b.Navigation("Client");
|
||||||
|
|
||||||
|
b.Navigation("Implementer");
|
||||||
|
|
||||||
b.Navigation("Pizza");
|
b.Navigation("Pizza");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -199,6 +237,11 @@ namespace PizzeriaDatabaseImplement.Migrations
|
|||||||
b.Navigation("PizzaComponents");
|
b.Navigation("PizzaComponents");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Implementer", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Order");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Pizza", b =>
|
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Pizza", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Components");
|
b.Navigation("Components");
|
||||||
|
Loading…
Reference in New Issue
Block a user