diff --git a/IceCreamShop/IceCreamShop/MainForm.Designer.cs b/IceCreamShop/IceCreamShop/MainForm.Designer.cs index c9227bf..50a9495 100644 --- a/IceCreamShop/IceCreamShop/MainForm.Designer.cs +++ b/IceCreamShop/IceCreamShop/MainForm.Designer.cs @@ -1,24 +1,24 @@ namespace IceCreamShop { - partial class MainForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; + partial class MainForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } #region Windows Form Designer generated code @@ -33,25 +33,22 @@ КомпонентыStripMenuItem = new ToolStripMenuItem(); МороженноеStripMenuItem = new ToolStripMenuItem(); клиентыToolStripMenuItem = new ToolStripMenuItem(); - магазиныToolStripMenuItem1 = new ToolStripMenuItem(); - поставкиToolStripMenuItem1 = 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(); + CreateOrderButton = new Button(); + IssuedButton = new Button(); + RefreshButton = new Button(); + магазины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(); - CreateOrderButton = new Button(); - TakeInWorkButton = new Button(); - ReadyButton = new Button(); - IssuedButton = new Button(); - RefreshButton = new Button(); menuStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)DataGridView).BeginInit(); SuspendLayout(); @@ -59,7 +56,7 @@ // menuStrip1 // menuStrip1.ImageScalingSize = new Size(20, 20); - menuStrip1.Items.AddRange(new ToolStripItem[] { ToolStripMenu, отчетыToolStripMenuItem }); + menuStrip1.Items.AddRange(new ToolStripItem[] { ToolStripMenu, отчетыToolStripMenuItem, запускРаботToolStripMenuItem }); menuStrip1.Location = new Point(0, 0); menuStrip1.Name = "menuStrip1"; menuStrip1.Padding = new Padding(6, 3, 0, 3); @@ -69,7 +66,7 @@ // // ToolStripMenu // - ToolStripMenu.DropDownItems.AddRange(new ToolStripItem[] { КомпонентыStripMenuItem, МороженноеStripMenuItem, клиентыToolStripMenuItem, магазиныToolStripMenuItem1, поставкиToolStripMenuItem1, товарыToolStripMenuItem }); + ToolStripMenu.DropDownItems.AddRange(new ToolStripItem[] { КомпонентыStripMenuItem, МороженноеStripMenuItem, клиентыToolStripMenuItem, исполнителиToolStripMenuItem, магазиныToolStripMenuItem, поставкиToolStripMenuItem, товарыToolStripMenuItem }); ToolStripMenu.Name = "ToolStripMenu"; ToolStripMenu.Size = new Size(117, 24); ToolStripMenu.Text = "Справочники"; @@ -95,26 +92,12 @@ клиентыToolStripMenuItem.Text = "Клиенты"; клиентыToolStripMenuItem.Click += клиентыToolStripMenuItem_Click; // - // магазиныToolStripMenuItem1 + // исполнителиToolStripMenuItem // - магазиныToolStripMenuItem1.Name = "магазиныToolStripMenuItem1"; - магазиныToolStripMenuItem1.Size = new Size(224, 26); - магазиныToolStripMenuItem1.Text = "Магазины"; - магазиныToolStripMenuItem1.Click += магазиныToolStripMenuItem_Click; - // - // поставкиToolStripMenuItem1 - // - поставкиToolStripMenuItem1.Name = "поставкиToolStripMenuItem1"; - поставкиToolStripMenuItem1.Size = new Size(224, 26); - поставкиToolStripMenuItem1.Text = "Поставки"; - поставкиToolStripMenuItem1.Click += поставкиToolStripMenuItem_Click; - // - // товарыToolStripMenuItem - // - товарыToolStripMenuItem.Name = "товарыToolStripMenuItem"; - товарыToolStripMenuItem.Size = new Size(224, 26); - товарыToolStripMenuItem.Text = "Товары"; - товарыToolStripMenuItem.Click += продажиToolStripMenuItem_Click; + исполнителиToolStripMenuItem.Name = "исполнителиToolStripMenuItem"; + исполнителиToolStripMenuItem.Size = new Size(224, 26); + исполнителиToolStripMenuItem.Text = "Исполнители"; + исполнителиToolStripMenuItem.Click += исполнителиToolStripMenuItem_Click; // // отчетыToolStripMenuItem // @@ -144,227 +127,12 @@ списокЗаказовToolStripMenuItem.Text = "Список заказов"; списокЗаказовToolStripMenuItem.Click += списокЗаказовToolStripMenuItem_Click; // - // списокМагазиновToolStripMenuItem + // запускРаботToolStripMenuItem // - списокМагазиновToolStripMenuItem.Name = "списокМагазиновToolStripMenuItem"; - списокМагазиновToolStripMenuItem.Size = new Size(305, 26); - списокМагазиновToolStripMenuItem.Text = "Список магазинов"; - списокМагазиновToolStripMenuItem.Click += списокМагазиновToolStripMenuItem_Click; - // - // мороженноеПоМагазинамToolStripMenuItem - // - мороженноеПоМагазинамToolStripMenuItem.Name = "мороженноеПоМагазинамToolStripMenuItem"; - мороженноеПоМагазинамToolStripMenuItem.Size = new Size(305, 26); - мороженноеПоМагазинамToolStripMenuItem.Text = "Мороженное по магазинам"; - мороженноеПоМагазинамToolStripMenuItem.Click += мороженноеПоМагазинамToolStripMenuItem_Click; - // - // заказыПоДатамToolStripMenuItem - // - заказыПоДатамToolStripMenuItem.Name = "заказыПоДатамToolStripMenuItem"; - заказыПоДатамToolStripMenuItem.Size = new Size(305, 26); - заказыПоДатамToolStripMenuItem.Text = "Заказы по датам"; - заказыПоДатамToolStripMenuItem.Click += заказыПоДатамToolStripMenuItem_Click; - // - // магазиныToolStripMenuItem - // - магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem"; - магазиныToolStripMenuItem.Size = new Size(186, 26); - магазиныToolStripMenuItem.Text = "Магазины"; - магазиныToolStripMenuItem.Click += магазиныToolStripMenuItem_Click; - // - // поставкиToolStripMenuItem - // - поставкиToolStripMenuItem.Name = "поставкиToolStripMenuItem"; - поставкиToolStripMenuItem.Size = new Size(186, 26); - поставкиToolStripMenuItem.Text = "Поставки"; - поставкиToolStripMenuItem.Click += поставкиToolStripMenuItem_Click; - // - // продажиToolStripMenuItem - // - продажиToolStripMenuItem.Name = "продажиToolStripMenuItem"; - продажиToolStripMenuItem.Size = new Size(186, 26); - продажиToolStripMenuItem.Text = "Продажи"; - продажиToolStripMenuItem.Click += продажиToolStripMenuItem_Click; - // - // DataGridView - // - DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - DataGridView.Location = new Point(11, 31); - DataGridView.Name = "DataGridView"; - DataGridView.RowHeadersWidth = 51; - DataGridView.Size = new Size(1007, 407); - DataGridView.TabIndex = 1; - // - // CreateOrderButton - // - CreateOrderButton.Location = new Point(1025, 31); - CreateOrderButton.Name = "CreateOrderButton"; - CreateOrderButton.Size = new Size(259, 29); - CreateOrderButton.TabIndex = 2; - CreateOrderButton.Text = "Создать заказ"; - CreateOrderButton.UseVisualStyleBackColor = true; - CreateOrderButton.Click += CreateOrderButton_Click; - // - // TakeInWorkButton - // - TakeInWorkButton.Location = new Point(1025, 67); - TakeInWorkButton.Name = "TakeInWorkButton"; - TakeInWorkButton.Size = new Size(259, 29); - TakeInWorkButton.TabIndex = 3; - TakeInWorkButton.Text = "Отдать заказ в работу"; - TakeInWorkButton.UseVisualStyleBackColor = true; - TakeInWorkButton.Click += TakeInWorkButton_Click; - // - // ReadyButton - // - ReadyButton.Location = new Point(1025, 101); - ReadyButton.Name = "ReadyButton"; - ReadyButton.Size = new Size(259, 29); - ReadyButton.TabIndex = 4; - ReadyButton.Text = "Заказ готов"; - ReadyButton.UseVisualStyleBackColor = true; - ReadyButton.Click += ReadyButton_Click; - // - // IssuedButton - // - IssuedButton.Location = new Point(1025, 136); - IssuedButton.Name = "IssuedButton"; - IssuedButton.Size = new Size(259, 29); - IssuedButton.TabIndex = 5; - IssuedButton.Text = "Заказ выдан"; - IssuedButton.UseVisualStyleBackColor = true; - IssuedButton.Click += IssuedButton_Click; - // - // RefreshButton - // - RefreshButton.Location = new Point(1025, 171); - RefreshButton.Name = "RefreshButton"; - RefreshButton.Size = new Size(259, 29); - RefreshButton.TabIndex = 6; - RefreshButton.Text = "Обновить"; - RefreshButton.UseVisualStyleBackColor = true; - RefreshButton.Click += RefreshButton_Click; - // - // MainForm - // - AutoScaleDimensions = new SizeF(8F, 20F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1296, 451); - Controls.Add(RefreshButton); - Controls.Add(IssuedButton); - Controls.Add(ReadyButton); - Controls.Add(TakeInWorkButton); - Controls.Add(CreateOrderButton); - Controls.Add(DataGridView); - Controls.Add(menuStrip1); - MainMenuStrip = menuStrip1; - Name = "MainForm"; - Text = "Форма главная"; - Load += MainForm_Load; - menuStrip1.ResumeLayout(false); - menuStrip1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)DataGridView).EndInit(); - ResumeLayout(false); - PerformLayout(); - } - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - menuStrip1 = new MenuStrip(); - ToolStripMenu = new ToolStripMenuItem(); - КомпонентыStripMenuItem = new ToolStripMenuItem(); - МороженноеStripMenuItem = new ToolStripMenuItem(); - клиентыToolStripMenuItem = new ToolStripMenuItem(); - исполнителиToolStripMenuItem = new ToolStripMenuItem(); - отчетыToolStripMenuItem = new ToolStripMenuItem(); - списокМороженногоToolStripMenuItem = new ToolStripMenuItem(); - компонентыПоМороженнымToolStripMenuItem = new ToolStripMenuItem(); - списокЗаказовToolStripMenuItem = new ToolStripMenuItem(); - DataGridView = new DataGridView(); - CreateOrderButton = new Button(); - IssuedButton = new Button(); - RefreshButton = new Button(); - запускРаботToolStripMenuItem = new ToolStripMenuItem(); - menuStrip1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)DataGridView).BeginInit(); - SuspendLayout(); - // - // menuStrip1 - // - menuStrip1.ImageScalingSize = new Size(20, 20); - menuStrip1.Items.AddRange(new ToolStripItem[] { ToolStripMenu, отчетыToolStripMenuItem, запускРаботToolStripMenuItem }); - menuStrip1.Location = new Point(0, 0); - menuStrip1.Name = "menuStrip1"; - menuStrip1.Padding = new Padding(6, 3, 0, 3); - menuStrip1.Size = new Size(1296, 30); - menuStrip1.TabIndex = 0; - menuStrip1.Text = "menuStrip1"; - // - // ToolStripMenu - // - ToolStripMenu.DropDownItems.AddRange(new ToolStripItem[] { КомпонентыStripMenuItem, МороженноеStripMenuItem, клиентыToolStripMenuItem, исполнителиToolStripMenuItem }); - ToolStripMenu.Name = "ToolStripMenu"; - ToolStripMenu.Size = new Size(117, 24); - ToolStripMenu.Text = "Справочники"; - // - // КомпонентыStripMenuItem - // - КомпонентыStripMenuItem.Name = "КомпонентыStripMenuItem"; - КомпонентыStripMenuItem.Size = new Size(186, 26); - КомпонентыStripMenuItem.Text = "Компоненты"; - КомпонентыStripMenuItem.Click += КомпонентыStripMenuItem_Click; - // - // МороженноеStripMenuItem - // - МороженноеStripMenuItem.Name = "МороженноеStripMenuItem"; - МороженноеStripMenuItem.Size = new Size(186, 26); - МороженноеStripMenuItem.Text = "Мороженное"; - МороженноеStripMenuItem.Click += МороженноеStripMenuItem_Click; - // - // клиентыToolStripMenuItem - // - клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem"; - клиентыToolStripMenuItem.Size = new Size(186, 26); - клиентыToolStripMenuItem.Text = "Клиенты"; - клиентыToolStripMenuItem.Click += клиентыToolStripMenuItem_Click; - // - // исполнителиToolStripMenuItem - // - исполнителиToolStripMenuItem.Name = "исполнителиToolStripMenuItem"; - исполнителиToolStripMenuItem.Size = new Size(186, 26); - исполнителиToolStripMenuItem.Text = "Исполнители"; - исполнителиToolStripMenuItem.Click += исполнителиToolStripMenuItem_Click; - // - // отчетыToolStripMenuItem - // - отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокМороженногоToolStripMenuItem, компонентыПоМороженнымToolStripMenuItem, списокЗаказовToolStripMenuItem }); - отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem"; - отчетыToolStripMenuItem.Size = new Size(73, 24); - отчетыToolStripMenuItem.Text = "Отчеты"; - // - // списокМороженногоToolStripMenuItem - // - списокМороженногоToolStripMenuItem.Name = "списокМороженногоToolStripMenuItem"; - списокМороженногоToolStripMenuItem.Size = new Size(305, 26); - списокМороженногоToolStripMenuItem.Text = "Список мороженного"; - списокМороженногоToolStripMenuItem.Click += списокМороженногоToolStripMenuItem_Click; - // - // компонентыПоМороженнымToolStripMenuItem - // - компонентыПоМороженнымToolStripMenuItem.Name = "компонентыПоМороженнымToolStripMenuItem"; - компонентыПоМороженнымToolStripMenuItem.Size = new Size(305, 26); - компонентыПоМороженнымToolStripMenuItem.Text = "Компоненты по мороженным"; - компонентыПоМороженнымToolStripMenuItem.Click += компонентыПоМороженнымToolStripMenuItem_Click; - // - // списокЗаказовToolStripMenuItem - // - списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem"; - списокЗаказовToolStripMenuItem.Size = new Size(305, 26); - списокЗаказовToolStripMenuItem.Text = "Список заказов"; - списокЗаказовToolStripMenuItem.Click += списокЗаказовToolStripMenuItem_Click; + запускРаботToolStripMenuItem.Name = "запускРаботToolStripMenuItem"; + запускРаботToolStripMenuItem.Size = new Size(114, 24); + запускРаботToolStripMenuItem.Text = "Запуск работ"; + запускРаботToolStripMenuItem.Click += запускРаботToolStripMenuItem_Click; // // DataGridView // @@ -405,12 +173,47 @@ RefreshButton.UseVisualStyleBackColor = true; RefreshButton.Click += RefreshButton_Click; // - // запускРаботToolStripMenuItem + // магазиныToolStripMenuItem // - запускРаботToolStripMenuItem.Name = "запускРаботToolStripMenuItem"; - запускРаботToolStripMenuItem.Size = new Size(114, 24); - запускРаботToolStripMenuItem.Text = "Запуск работ"; - запускРаботToolStripMenuItem.Click += запускРаботToolStripMenuItem_Click; + магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem"; + магазиныToolStripMenuItem.Size = new Size(224, 26); + магазиныToolStripMenuItem.Text = "Магазины"; + магазиныToolStripMenuItem.Click += магазиныToolStripMenuItem_Click; + // + // поставкиToolStripMenuItem + // + поставкиToolStripMenuItem.Name = "поставкиToolStripMenuItem"; + поставкиToolStripMenuItem.Size = new Size(224, 26); + поставкиToolStripMenuItem.Text = "Поставки"; + поставкиToolStripMenuItem.Click += поставкиToolStripMenuItem_Click; + // + // товарыToolStripMenuItem + // + товарыToolStripMenuItem.Name = "товарыToolStripMenuItem"; + товарыToolStripMenuItem.Size = new Size(224, 26); + товарыToolStripMenuItem.Text = "Товары"; + товарыToolStripMenuItem.Click += продажиToolStripMenuItem_Click; + // + // списокМагазиновToolStripMenuItem + // + списокМагазиновToolStripMenuItem.Name = "списокМагазиновToolStripMenuItem"; + списокМагазиновToolStripMenuItem.Size = new Size(305, 26); + списокМагазиновToolStripMenuItem.Text = "Список магазинов"; + списокМагазиновToolStripMenuItem.Click += списокМагазиновToolStripMenuItem_Click; + // + // мороженноеПоМагазинамToolStripMenuItem + // + мороженноеПоМагазинамToolStripMenuItem.Name = "мороженноеПоМагазинамToolStripMenuItem"; + мороженноеПоМагазинамToolStripMenuItem.Size = new Size(305, 26); + мороженноеПоМагазинамToolStripMenuItem.Text = "Мороженное по магазинам"; + мороженноеПоМагазинамToolStripMenuItem.Click += списокМороженногоToolStripMenuItem_Click; + // + // заказыПоДатамToolStripMenuItem + // + заказыПоДатамToolStripMenuItem.Name = "заказыПоДатамToolStripMenuItem"; + заказыПоДатамToolStripMenuItem.Size = new Size(305, 26); + заказыПоДатамToolStripMenuItem.Text = "Заказы по датам"; + заказыПоДатамToolStripMenuItem.Click += заказыПоДатамToolStripMenuItem_Click; // // MainForm // @@ -436,29 +239,25 @@ #endregion private MenuStrip menuStrip1; - private ToolStripMenuItem ToolStripMenu; - private ToolStripMenuItem КомпонентыStripMenuItem; - private ToolStripMenuItem МороженноеStripMenuItem; - private DataGridView DataGridView; - private Button CreateOrderButton; - private Button IssuedButton; - private Button RefreshButton; - private ToolStripMenuItem отчетыToolStripMenuItem; - private ToolStripMenuItem списокМороженногоToolStripMenuItem; - private ToolStripMenuItem компонентыПоМороженнымToolStripMenuItem; - private ToolStripMenuItem списокЗаказовToolStripMenuItem; - private ToolStripMenuItem магазиныToolStripMenuItem; - private ToolStripMenuItem поставкиToolStripMenuItem; - private ToolStripMenuItem продажиToolStripMenuItem; - private ToolStripMenuItem списокМагазиновToolStripMenuItem; - private ToolStripMenuItem мороженноеПоМагазинамToolStripMenuItem; - private ToolStripMenuItem заказыПоДатамToolStripMenuItem; - private ToolStripMenuItem клиентыToolStripMenuItem; - private ToolStripMenuItem магазиныToolStripMenuItem1; - private ToolStripMenuItem поставкиToolStripMenuItem1; - private ToolStripMenuItem товарыToolStripMenuItem; - } + private ToolStripMenuItem ToolStripMenu; + private ToolStripMenuItem КомпонентыStripMenuItem; + private ToolStripMenuItem МороженноеStripMenuItem; + private DataGridView DataGridView; + private Button CreateOrderButton; + private Button IssuedButton; + private Button RefreshButton; + private ToolStripMenuItem отчетыToolStripMenuItem; + private ToolStripMenuItem списокМороженногоToolStripMenuItem; + private ToolStripMenuItem компонентыПоМороженнымToolStripMenuItem; + private ToolStripMenuItem списокЗаказовToolStripMenuItem; + private ToolStripMenuItem клиентыToolStripMenuItem; private ToolStripMenuItem исполнителиToolStripMenuItem; private ToolStripMenuItem запускРаботToolStripMenuItem; + private ToolStripMenuItem магазиныToolStripMenuItem; + private ToolStripMenuItem поставкиToolStripMenuItem; + private ToolStripMenuItem товарыToolStripMenuItem; + private ToolStripMenuItem списокМагазиновToolStripMenuItem; + private ToolStripMenuItem мороженноеПоМагазинамToolStripMenuItem; + private ToolStripMenuItem заказыПоДатамToolStripMenuItem; } } \ No newline at end of file diff --git a/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/OrderLogic.cs b/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/OrderLogic.cs index 6810897..cfd154a 100644 --- a/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/OrderLogic.cs +++ b/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/OrderLogic.cs @@ -144,12 +144,12 @@ namespace IceCreamShopBusinessLogic.BusinessLogic _logger.LogWarning("Read operation failed"); return false; } - if (element.Status != status - 1) + if (element.Status != status - 1 && status != OrderStatus.Ожидается) { _logger.LogWarning("Status change operation failed"); throw new InvalidOperationException("Текущий статус заказа не может быть переведен в выбранный"); } - if(element.Status == OrderStatus.Готов) + if(element.Status == OrderStatus.Выполняется) { var icecream = _iceCreamStorage.GetElement(new IceCreamSearchModel() { Id = model.IceCreamId }); if (icecream == null) @@ -159,8 +159,9 @@ namespace IceCreamShopBusinessLogic.BusinessLogic } if (CheckSupply(icecream, model.Count) == false) { - _logger.LogWarning("Status update to " + status.ToString() + " operation failed. Shop supply error."); - return false; + model.Status = OrderStatus.Ожидается; + _orderStorage.Update(model); + return false; } } model.Status = status; @@ -181,10 +182,18 @@ namespace IceCreamShopBusinessLogic.BusinessLogic public bool FinishOrder(OrderBindingModel model) { - return ChangeStatus(model, OrderStatus.Готов); - } + lock (locker) + { + return ChangeStatus(model, OrderStatus.Готов); - public bool DeliveryOrder(OrderBindingModel model) + } + } + public bool TakeOrderInWaiting(OrderBindingModel model) + { + return ChangeStatus(model, OrderStatus.Ожидается); + } + + public bool DeliveryOrder(OrderBindingModel model) { return ChangeStatus(model, OrderStatus.Выдан); } diff --git a/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/WorkModeling.cs b/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/WorkModeling.cs index 3387330..0582aa9 100644 --- a/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/WorkModeling.cs +++ b/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/WorkModeling.cs @@ -56,6 +56,7 @@ namespace IceCreamShopBusinessLogic.BusinessLogic { return; } + await RunWaitingOrder(implementer); await RunOrderInWork(implementer); await Task.Run(() => { @@ -141,5 +142,41 @@ namespace IceCreamShopBusinessLogic.BusinessLogic throw; } } + + private async Task RunWaitingOrder(ImplementerViewModel implementer) + { + if (_orderLogic == null || implementer == null) + { + return; + } + try + { + var order = await Task.Run(() => _orderLogic.ReadElement(new OrderSearchModel + { + ImplementerId = implementer.Id, + Status = OrderStatus.Ожидается, + })); + if (order == null) + { + return; + } + _logger.LogDebug("DoWork. Worker {Id} finish order {Order}", implementer.Id, order.Id); + _orderLogic.DeliveryOrder(new OrderBindingModel + { + Id = order.Id, + ImplementerId = implementer.Id + }); + Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100)); + } + catch (InvalidOperationException ex) + { + _logger.LogWarning(ex, "Error try get work"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error while do work"); + throw; + } + } } } diff --git a/IceCreamShop/IceCreamShopDataModels/OrderStatus.cs b/IceCreamShop/IceCreamShopDataModels/OrderStatus.cs index 53a6a73..73c15e4 100644 --- a/IceCreamShop/IceCreamShopDataModels/OrderStatus.cs +++ b/IceCreamShop/IceCreamShopDataModels/OrderStatus.cs @@ -10,6 +10,7 @@ Готов = 2, - Выдан = 3 + Выдан = 3, + Ожидается = 4 } } diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240508064221_InitialCreate.Designer.cs b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240508064221_InitialCreate.Designer.cs new file mode 100644 index 0000000..fe670a2 --- /dev/null +++ b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240508064221_InitialCreate.Designer.cs @@ -0,0 +1,336 @@ +// +using System; +using IceCreamShopDatabaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace IceCreamShopDatabaseImplement.Migrations +{ + [DbContext(typeof(IceCreamShopDataBase))] + [Migration("20240508064221_InitialCreate")] + partial class InitialCreate + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClientFIO") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Clients"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Component", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ComponentName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Cost") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("Components"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.IceCream", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("IceCreamName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Price") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("IceCreams"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.IceCreamComponent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ComponentId") + .HasColumnType("int"); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("IceCreamId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ComponentId"); + + b.HasIndex("IceCreamId"); + + b.ToTable("IceCreamComponents"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Implementer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ImplementerFIO") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Qualification") + .HasColumnType("int"); + + b.Property("WorkExperience") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Implementers"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClientId") + .HasColumnType("int"); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateImplement") + .HasColumnType("datetime2"); + + b.Property("IceCreamId") + .HasColumnType("int"); + + b.Property("ImplementerId") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Sum") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.HasIndex("IceCreamId"); + + b.HasIndex("ImplementerId"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Shop", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DateOpen") + .HasColumnType("datetime2"); + + b.Property("MaxCapacity") + .HasColumnType("int"); + + b.Property("ShopName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Shops"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.ShopIceCream", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("IceCreamId") + .HasColumnType("int"); + + b.Property("ShopId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("IceCreamId"); + + b.HasIndex("ShopId"); + + b.ToTable("ShopIceCreams"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.IceCreamComponent", b => + { + b.HasOne("IceCreamShopDatabaseImplement.Models.Component", "Component") + .WithMany("IceCreamComponents") + .HasForeignKey("ComponentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IceCreamShopDatabaseImplement.Models.IceCream", "IceCream") + .WithMany("Components") + .HasForeignKey("IceCreamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Component"); + + b.Navigation("IceCream"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Order", b => + { + b.HasOne("IceCreamShopDatabaseImplement.Models.Client", "Client") + .WithMany("Orders") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IceCreamShopDatabaseImplement.Models.IceCream", "IceCream") + .WithMany("Orders") + .HasForeignKey("IceCreamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IceCreamShopDatabaseImplement.Models.Implementer", "Implementer") + .WithMany("Orders") + .HasForeignKey("ImplementerId"); + + b.Navigation("Client"); + + b.Navigation("IceCream"); + + b.Navigation("Implementer"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.ShopIceCream", b => + { + b.HasOne("IceCreamShopDatabaseImplement.Models.IceCream", "IceCream") + .WithMany("ShopIceCreams") + .HasForeignKey("IceCreamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IceCreamShopDatabaseImplement.Models.Shop", "Shop") + .WithMany("IceCreams") + .HasForeignKey("ShopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("IceCream"); + + b.Navigation("Shop"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Client", b => + { + b.Navigation("Orders"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Component", b => + { + b.Navigation("IceCreamComponents"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.IceCream", b => + { + b.Navigation("Components"); + + b.Navigation("Orders"); + + b.Navigation("ShopIceCreams"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Implementer", b => + { + b.Navigation("Orders"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Shop", b => + { + b.Navigation("IceCreams"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240508064221_InitialCreate.cs b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240508064221_InitialCreate.cs new file mode 100644 index 0000000..a2e980a --- /dev/null +++ b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240508064221_InitialCreate.cs @@ -0,0 +1,244 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace IceCreamShopDatabaseImplement.Migrations +{ + /// + public partial class InitialCreate : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Clients", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ClientFIO = table.Column(type: "nvarchar(max)", nullable: false), + Email = table.Column(type: "nvarchar(max)", nullable: false), + Password = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Clients", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Components", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ComponentName = table.Column(type: "nvarchar(max)", nullable: false), + Cost = table.Column(type: "float", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Components", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "IceCreams", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + IceCreamName = table.Column(type: "nvarchar(max)", nullable: false), + Price = table.Column(type: "float", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IceCreams", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Implementers", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ImplementerFIO = table.Column(type: "nvarchar(max)", nullable: false), + Password = table.Column(type: "nvarchar(max)", nullable: false), + Qualification = table.Column(type: "int", nullable: false), + WorkExperience = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Implementers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Shops", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ShopName = table.Column(type: "nvarchar(max)", nullable: false), + Address = table.Column(type: "nvarchar(max)", nullable: false), + DateOpen = table.Column(type: "datetime2", nullable: false), + MaxCapacity = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Shops", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "IceCreamComponents", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + IceCreamId = table.Column(type: "int", nullable: false), + ComponentId = table.Column(type: "int", nullable: false), + Count = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IceCreamComponents", x => x.Id); + table.ForeignKey( + name: "FK_IceCreamComponents_Components_ComponentId", + column: x => x.ComponentId, + principalTable: "Components", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_IceCreamComponents_IceCreams_IceCreamId", + column: x => x.IceCreamId, + principalTable: "IceCreams", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Orders", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Count = table.Column(type: "int", nullable: false), + Sum = table.Column(type: "float", nullable: false), + Status = table.Column(type: "int", nullable: false), + DateCreate = table.Column(type: "datetime2", nullable: false), + DateImplement = table.Column(type: "datetime2", nullable: true), + IceCreamId = table.Column(type: "int", nullable: false), + ClientId = table.Column(type: "int", nullable: false), + ImplementerId = table.Column(type: "int", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Orders", x => x.Id); + table.ForeignKey( + name: "FK_Orders_Clients_ClientId", + column: x => x.ClientId, + principalTable: "Clients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Orders_IceCreams_IceCreamId", + column: x => x.IceCreamId, + principalTable: "IceCreams", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Orders_Implementers_ImplementerId", + column: x => x.ImplementerId, + principalTable: "Implementers", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "ShopIceCreams", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + IceCreamId = table.Column(type: "int", nullable: false), + ShopId = table.Column(type: "int", nullable: false), + Count = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ShopIceCreams", x => x.Id); + table.ForeignKey( + name: "FK_ShopIceCreams_IceCreams_IceCreamId", + column: x => x.IceCreamId, + principalTable: "IceCreams", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ShopIceCreams_Shops_ShopId", + column: x => x.ShopId, + principalTable: "Shops", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_IceCreamComponents_ComponentId", + table: "IceCreamComponents", + column: "ComponentId"); + + migrationBuilder.CreateIndex( + name: "IX_IceCreamComponents_IceCreamId", + table: "IceCreamComponents", + column: "IceCreamId"); + + migrationBuilder.CreateIndex( + name: "IX_Orders_ClientId", + table: "Orders", + column: "ClientId"); + + migrationBuilder.CreateIndex( + name: "IX_Orders_IceCreamId", + table: "Orders", + column: "IceCreamId"); + + migrationBuilder.CreateIndex( + name: "IX_Orders_ImplementerId", + table: "Orders", + column: "ImplementerId"); + + migrationBuilder.CreateIndex( + name: "IX_ShopIceCreams_IceCreamId", + table: "ShopIceCreams", + column: "IceCreamId"); + + migrationBuilder.CreateIndex( + name: "IX_ShopIceCreams_ShopId", + table: "ShopIceCreams", + column: "ShopId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "IceCreamComponents"); + + migrationBuilder.DropTable( + name: "Orders"); + + migrationBuilder.DropTable( + name: "ShopIceCreams"); + + migrationBuilder.DropTable( + name: "Components"); + + migrationBuilder.DropTable( + name: "Clients"); + + migrationBuilder.DropTable( + name: "Implementers"); + + migrationBuilder.DropTable( + name: "IceCreams"); + + migrationBuilder.DropTable( + name: "Shops"); + } + } +} diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/IceCreamShopDataBaseModelSnapshot.cs b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/IceCreamShopDataBaseModelSnapshot.cs new file mode 100644 index 0000000..dbabc9a --- /dev/null +++ b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/IceCreamShopDataBaseModelSnapshot.cs @@ -0,0 +1,333 @@ +// +using System; +using IceCreamShopDatabaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace IceCreamShopDatabaseImplement.Migrations +{ + [DbContext(typeof(IceCreamShopDataBase))] + partial class IceCreamShopDataBaseModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClientFIO") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Clients"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Component", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ComponentName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Cost") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("Components"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.IceCream", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("IceCreamName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Price") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("IceCreams"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.IceCreamComponent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ComponentId") + .HasColumnType("int"); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("IceCreamId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ComponentId"); + + b.HasIndex("IceCreamId"); + + b.ToTable("IceCreamComponents"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Implementer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ImplementerFIO") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Qualification") + .HasColumnType("int"); + + b.Property("WorkExperience") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Implementers"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClientId") + .HasColumnType("int"); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateImplement") + .HasColumnType("datetime2"); + + b.Property("IceCreamId") + .HasColumnType("int"); + + b.Property("ImplementerId") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Sum") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.HasIndex("IceCreamId"); + + b.HasIndex("ImplementerId"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Shop", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DateOpen") + .HasColumnType("datetime2"); + + b.Property("MaxCapacity") + .HasColumnType("int"); + + b.Property("ShopName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Shops"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.ShopIceCream", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("IceCreamId") + .HasColumnType("int"); + + b.Property("ShopId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("IceCreamId"); + + b.HasIndex("ShopId"); + + b.ToTable("ShopIceCreams"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.IceCreamComponent", b => + { + b.HasOne("IceCreamShopDatabaseImplement.Models.Component", "Component") + .WithMany("IceCreamComponents") + .HasForeignKey("ComponentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IceCreamShopDatabaseImplement.Models.IceCream", "IceCream") + .WithMany("Components") + .HasForeignKey("IceCreamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Component"); + + b.Navigation("IceCream"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Order", b => + { + b.HasOne("IceCreamShopDatabaseImplement.Models.Client", "Client") + .WithMany("Orders") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IceCreamShopDatabaseImplement.Models.IceCream", "IceCream") + .WithMany("Orders") + .HasForeignKey("IceCreamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IceCreamShopDatabaseImplement.Models.Implementer", "Implementer") + .WithMany("Orders") + .HasForeignKey("ImplementerId"); + + b.Navigation("Client"); + + b.Navigation("IceCream"); + + b.Navigation("Implementer"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.ShopIceCream", b => + { + b.HasOne("IceCreamShopDatabaseImplement.Models.IceCream", "IceCream") + .WithMany("ShopIceCreams") + .HasForeignKey("IceCreamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IceCreamShopDatabaseImplement.Models.Shop", "Shop") + .WithMany("IceCreams") + .HasForeignKey("ShopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("IceCream"); + + b.Navigation("Shop"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Client", b => + { + b.Navigation("Orders"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Component", b => + { + b.Navigation("IceCreamComponents"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.IceCream", b => + { + b.Navigation("Components"); + + b.Navigation("Orders"); + + b.Navigation("ShopIceCreams"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Implementer", b => + { + b.Navigation("Orders"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Shop", b => + { + b.Navigation("IceCreams"); + }); +#pragma warning restore 612, 618 + } + } +}