Правки миграции и логики

This commit is contained in:
nikbel2004@outlook.com 2024-05-12 02:24:28 +04:00
parent 95b789ee16
commit 5fb89ed63c
8 changed files with 84 additions and 77 deletions

View File

@ -24,6 +24,8 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
private readonly IFurnitureStorage _furnitureStorage;
static readonly object locker = new object();
// Конструктор
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, IShopLogic shopLogic, IFurnitureStorage furnitureStorage)
{
@ -101,7 +103,10 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
public bool TakeOrderInWork(OrderBindingModel model)
{
return StatusUpdate(model, OrderStatus.Выполняется);
lock (locker)
{
return StatusUpdate(model, OrderStatus.Выполняется);
}
}
public bool FinishOrder(OrderBindingModel model)
@ -181,6 +186,12 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
model.Status = newOrderStatus;
// Помещаем id работника, не забываем про него...
if (viewModel.ImplementerId.HasValue)
{
model.ImplementerId = viewModel.ImplementerId;
}
// Проверка на выдачу
if (model.Status == OrderStatus.Готов || viewModel.Status == OrderStatus.Ожидание)
{

View File

@ -1,5 +1,4 @@
using BlacksmithWorkshopDatabaseImplement.Models;
using FurnitureAssemblyDatabaseImplement.Models;
using FurnitureAssemblyDatabaseImplement.Models;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;

View File

@ -1,10 +1,10 @@
using BlacksmithWorkshopDatabaseImplement.Models;
using FurnitureAssemblyContracts.BindingModels;
using FurnitureAssemblyContracts.BindingModels;
using FurnitureAssemblyContracts.SearchModels;
using FurnitureAssemblyContracts.StoragesContracts;
using FurnitureAssemblyContracts.ViewModels;
using FurnitureAssemblyDataModels.Models;
using Microsoft.EntityFrameworkCore;
using FurnitureAssemblyDatabaseImplement.Models;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace FurnitureAssemblyDatabaseImplement.Migrations
{
[DbContext(typeof(FurnitureAssemblyDatabase))]
[Migration("20240511200002_InitialCreate")]
[Migration("20240511222321_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />
@ -25,33 +25,6 @@ namespace FurnitureAssemblyDatabaseImplement.Migrations
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Shop", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Address")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DateOpen")
.HasColumnType("datetime2");
b.Property<int>("MaxCountFurnitures")
.HasColumnType("int");
b.Property<string>("ShopName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Shops");
});
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Client", b =>
{
b.Property<int>("Id")
@ -193,6 +166,33 @@ namespace FurnitureAssemblyDatabaseImplement.Migrations
b.ToTable("Orders");
});
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Shop", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Address")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DateOpen")
.HasColumnType("datetime2");
b.Property<int>("MaxCountFurnitures")
.HasColumnType("int");
b.Property<string>("ShopName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Shops");
});
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.ShopFurniture", b =>
{
b.Property<int>("Id")
@ -291,7 +291,7 @@ namespace FurnitureAssemblyDatabaseImplement.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Shop", "Shop")
b.HasOne("FurnitureAssemblyDatabaseImplement.Models.Shop", "Shop")
.WithMany("Furnitures")
.HasForeignKey("ShopId")
.OnDelete(DeleteBehavior.Cascade)
@ -302,11 +302,6 @@ namespace FurnitureAssemblyDatabaseImplement.Migrations
b.Navigation("Shop");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Shop", b =>
{
b.Navigation("Furnitures");
});
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Client", b =>
{
b.Navigation("Orders");
@ -326,6 +321,11 @@ namespace FurnitureAssemblyDatabaseImplement.Migrations
b.Navigation("Order");
});
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Shop", b =>
{
b.Navigation("Furnitures");
});
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.WorkPiece", b =>
{
b.Navigation("FurnitureWorkPieces");

View File

@ -22,33 +22,6 @@ namespace FurnitureAssemblyDatabaseImplement.Migrations
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Shop", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Address")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DateOpen")
.HasColumnType("datetime2");
b.Property<int>("MaxCountFurnitures")
.HasColumnType("int");
b.Property<string>("ShopName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Shops");
});
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Client", b =>
{
b.Property<int>("Id")
@ -190,6 +163,33 @@ namespace FurnitureAssemblyDatabaseImplement.Migrations
b.ToTable("Orders");
});
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Shop", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Address")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DateOpen")
.HasColumnType("datetime2");
b.Property<int>("MaxCountFurnitures")
.HasColumnType("int");
b.Property<string>("ShopName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Shops");
});
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.ShopFurniture", b =>
{
b.Property<int>("Id")
@ -288,7 +288,7 @@ namespace FurnitureAssemblyDatabaseImplement.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Shop", "Shop")
b.HasOne("FurnitureAssemblyDatabaseImplement.Models.Shop", "Shop")
.WithMany("Furnitures")
.HasForeignKey("ShopId")
.OnDelete(DeleteBehavior.Cascade)
@ -299,11 +299,6 @@ namespace FurnitureAssemblyDatabaseImplement.Migrations
b.Navigation("Shop");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Shop", b =>
{
b.Navigation("Furnitures");
});
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Client", b =>
{
b.Navigation("Orders");
@ -323,6 +318,11 @@ namespace FurnitureAssemblyDatabaseImplement.Migrations
b.Navigation("Order");
});
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Shop", b =>
{
b.Navigation("Furnitures");
});
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.WorkPiece", b =>
{
b.Navigation("FurnitureWorkPieces");

View File

@ -1,7 +1,5 @@
using FurnitureAssemblyContracts.BindingModels;
using FurnitureAssemblyContracts.ViewModels;
using FurnitureAssemblyDatabaseImplement;
using FurnitureAssemblyDatabaseImplement.Models;
using FurnitureAssemblyDataModels.Models;
using System;
using System.Collections.Generic;
@ -11,7 +9,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BlacksmithWorkshopDatabaseImplement.Models
namespace FurnitureAssemblyDatabaseImplement.Models
{
public class Shop : IShopModel
{

View File

@ -1,5 +1,4 @@
using BlacksmithWorkshopDatabaseImplement.Models;
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;