This commit is contained in:
Sergey Kozyrev 2024-05-01 16:03:48 +04:00
parent 86c36d602b
commit 3d30383620
7 changed files with 42 additions and 373 deletions

View File

@ -17,11 +17,10 @@ namespace SewingDressesBusinessLogic.BusinessLogic
private readonly IShopStorage _shopStorage;
private readonly IShopLogic _shopLogic;
private readonly IDressStorage _dressStorage;
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, IShopStorage shopStorage, IShopLogic shopLogic, IDressStorage dressStorage)
static readonly object locker = new object();
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage)
{
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, IShopStorage shopStorage, IShopLogic shopLogic, IDressStorage dressStorage)
{
_logger = logger;
_orderStorage = orderStorage;
_shopStorage = shopStorage;

View File

@ -1,260 +0,0 @@
// <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 SewingDressesDatabaseImplement;
#nullable disable
namespace SewingDressesDatabaseImplement.Migrations
{
[DbContext(typeof(SewingDressesDatabase))]
[Migration("20240418162241_init")]
partial class init
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.16")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("SewingDressesDatabaseImplement.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("SewingDressesDatabaseImplement.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("SewingDressesDatabaseImplement.Models.Dress", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("DressName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<double>("Price")
.HasColumnType("float");
b.HasKey("Id");
b.ToTable("Dresses");
});
modelBuilder.Entity("SewingDressesDatabaseImplement.Models.DressComponent", 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>("DressId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ComponentId");
b.HasIndex("DressId");
b.ToTable("DressComponents");
});
modelBuilder.Entity("SewingDressesDatabaseImplement.Models.Implement", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ImplementFIO")
.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("Implements");
});
modelBuilder.Entity("SewingDressesDatabaseImplement.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>("DressId")
.HasColumnType("int");
b.Property<int?>("ImplementId")
.IsRequired()
.HasColumnType("int");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<double>("Sum")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("DressId");
b.HasIndex("ImplementId");
b.ToTable("Orders");
});
modelBuilder.Entity("SewingDressesDatabaseImplement.Models.DressComponent", b =>
{
b.HasOne("SewingDressesDatabaseImplement.Models.Component", "Component")
.WithMany("DressComponents")
.HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SewingDressesDatabaseImplement.Models.Dress", "Dress")
.WithMany("Components")
.HasForeignKey("DressId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Component");
b.Navigation("Dress");
});
modelBuilder.Entity("SewingDressesDatabaseImplement.Models.Order", b =>
{
b.HasOne("SewingDressesDatabaseImplement.Models.Client", "Client")
.WithMany("Orders")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SewingDressesDatabaseImplement.Models.Dress", "Dress")
.WithMany("Orders")
.HasForeignKey("DressId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SewingDressesDatabaseImplement.Models.Implement", "Implement")
.WithMany("Orders")
.HasForeignKey("ImplementId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("Dress");
b.Navigation("Implement");
});
modelBuilder.Entity("SewingDressesDatabaseImplement.Models.Client", b =>
{
b.Navigation("Orders");
});
modelBuilder.Entity("SewingDressesDatabaseImplement.Models.Component", b =>
{
b.Navigation("DressComponents");
});
modelBuilder.Entity("SewingDressesDatabaseImplement.Models.Dress", b =>
{
b.Navigation("Components");
b.Navigation("Orders");
});
modelBuilder.Entity("SewingDressesDatabaseImplement.Models.Implement", b =>
{
b.Navigation("Orders");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,59 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SewingDressesDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class nullab : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Orders_Implements_ImplementId",
table: "Orders");
migrationBuilder.AlterColumn<int>(
name: "ImplementId",
table: "Orders",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AddForeignKey(
name: "FK_Orders_Implements_ImplementId",
table: "Orders",
column: "ImplementId",
principalTable: "Implements",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Orders_Implements_ImplementId",
table: "Orders");
migrationBuilder.AlterColumn<int>(
name: "ImplementId",
table: "Orders",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_Orders_Implements_ImplementId",
table: "Orders",
column: "ImplementId",
principalTable: "Implements",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@ -12,13 +12,8 @@ using SewingDressesDatabaseImplement;
namespace SewingDressesDatabaseImplement.Migrations
{
[DbContext(typeof(SewingDressesDatabase))]
<<<<<<<< HEAD:SewingDresses/SewingDressesDatabaseImplement/Migrations/20240422093207_SomeAboba.Designer.cs
[Migration("20240422093207_SomeAboba")]
partial class SomeAboba
========
[Migration("20240418182438_nullab")]
partial class nullab
>>>>>>>> Lab6:SewingDresses/SewingDressesDatabaseImplement/Migrations/20240418182438_nullab.Designer.cs
[Migration("20240501120305_aboba")]
partial class aboba
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -326,15 +321,15 @@ namespace SewingDressesDatabaseImplement.Migrations
b.Navigation("Shops");
});
modelBuilder.Entity("SewingDressesDatabaseImplement.Models.Shop", b =>
{
b.Navigation("Dresses");
});
modelBuilder.Entity("SewingDressesDatabaseImplement.Models.Implement", b =>
{
b.Navigation("Orders");
});
modelBuilder.Entity("SewingDressesDatabaseImplement.Models.Shop", b =>
{
b.Navigation("Dresses");
});
#pragma warning restore 612, 618
}
}

View File

@ -6,11 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace SewingDressesDatabaseImplement.Migrations
{
/// <inheritdoc />
<<<<<<<< HEAD:SewingDresses/SewingDressesDatabaseImplement/Migrations/20240422093207_SomeAboba.cs
public partial class SomeAboba : Migration
========
public partial class init : Migration
>>>>>>>> Lab6:SewingDresses/SewingDressesDatabaseImplement/Migrations/20240418162241_init.cs
public partial class aboba : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
@ -59,25 +55,11 @@ namespace SewingDressesDatabaseImplement.Migrations
});
migrationBuilder.CreateTable(
<<<<<<<< HEAD:SewingDresses/SewingDressesDatabaseImplement/Migrations/20240422093207_SomeAboba.cs
name: "Shops",
========
name: "Implements",
>>>>>>>> Lab6:SewingDresses/SewingDressesDatabaseImplement/Migrations/20240418162241_init.cs
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
<<<<<<<< HEAD:SewingDresses/SewingDressesDatabaseImplement/Migrations/20240422093207_SomeAboba.cs
ShopName = table.Column<string>(type: "nvarchar(max)", nullable: false),
Adress = table.Column<string>(type: "nvarchar(max)", nullable: false),
DateOpen = table.Column<DateTime>(type: "datetime2", nullable: false),
MaxCount = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Shops", x => x.Id);
========
ImplementFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
WorkExperience = table.Column<int>(type: "int", nullable: false),
Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
@ -86,7 +68,22 @@ namespace SewingDressesDatabaseImplement.Migrations
constraints: table =>
{
table.PrimaryKey("PK_Implements", x => x.Id);
>>>>>>>> Lab6:SewingDresses/SewingDressesDatabaseImplement/Migrations/20240418162241_init.cs
});
migrationBuilder.CreateTable(
name: "Shops",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ShopName = table.Column<string>(type: "nvarchar(max)", nullable: false),
Adress = table.Column<string>(type: "nvarchar(max)", nullable: false),
DateOpen = table.Column<DateTime>(type: "datetime2", nullable: false),
MaxCount = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Shops", x => x.Id);
});
migrationBuilder.CreateTable(
@ -124,7 +121,7 @@ namespace SewingDressesDatabaseImplement.Migrations
.Annotation("SqlServer:Identity", "1, 1"),
DressId = table.Column<int>(type: "int", nullable: false),
ClientId = table.Column<int>(type: "int", nullable: false),
ImplementId = table.Column<int>(type: "int", nullable: false),
ImplementId = table.Column<int>(type: "int", nullable: true),
Count = table.Column<int>(type: "int", nullable: false),
Sum = table.Column<double>(type: "float", nullable: false),
Status = table.Column<int>(type: "int", nullable: false),
@ -150,8 +147,7 @@ namespace SewingDressesDatabaseImplement.Migrations
name: "FK_Orders_Implements_ImplementId",
column: x => x.ImplementId,
principalTable: "Implements",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
principalColumn: "Id");
});
migrationBuilder.CreateTable(
@ -202,7 +198,11 @@ namespace SewingDressesDatabaseImplement.Migrations
column: "DressId");
migrationBuilder.CreateIndex(
<<<<<<<< HEAD:SewingDresses/SewingDressesDatabaseImplement/Migrations/20240422093207_SomeAboba.cs
name: "IX_Orders_ImplementId",
table: "Orders",
column: "ImplementId");
migrationBuilder.CreateIndex(
name: "IX_ShopDresses_DressId",
table: "ShopDresses",
column: "DressId");
@ -211,11 +211,6 @@ namespace SewingDressesDatabaseImplement.Migrations
name: "IX_ShopDresses_ShopId",
table: "ShopDresses",
column: "ShopId");
========
name: "IX_Orders_ImplementId",
table: "Orders",
column: "ImplementId");
>>>>>>>> Lab6:SewingDresses/SewingDressesDatabaseImplement/Migrations/20240418162241_init.cs
}
/// <inheritdoc />
@ -236,15 +231,14 @@ namespace SewingDressesDatabaseImplement.Migrations
migrationBuilder.DropTable(
name: "Clients");
migrationBuilder.DropTable(
name: "Implements");
migrationBuilder.DropTable(
name: "Dresses");
migrationBuilder.DropTable(
<<<<<<<< HEAD:SewingDresses/SewingDressesDatabaseImplement/Migrations/20240422093207_SomeAboba.cs
name: "Shops");
========
name: "Implements");
>>>>>>>> Lab6:SewingDresses/SewingDressesDatabaseImplement/Migrations/20240418162241_init.cs
}
}
}

View File

@ -318,15 +318,15 @@ namespace SewingDressesDatabaseImplement.Migrations
b.Navigation("Shops");
});
modelBuilder.Entity("SewingDressesDatabaseImplement.Models.Shop", b =>
{
b.Navigation("Dresses");
});
modelBuilder.Entity("SewingDressesDatabaseImplement.Models.Implement", b =>
{
b.Navigation("Orders");
});
modelBuilder.Entity("SewingDressesDatabaseImplement.Models.Shop", b =>
{
b.Navigation("Dresses");
});
#pragma warning restore 612, 618
}
}

View File

@ -115,7 +115,7 @@ namespace SewingDressesView
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void buttonOrderGive_Click(object sender, EventArgs e)
{