diff --git a/SewingDresses/SewingDressesBusinessLogic/BusinessLogic/OrderLogic.cs b/SewingDresses/SewingDressesBusinessLogic/BusinessLogic/OrderLogic.cs index 357a908..19a5b1f 100644 --- a/SewingDresses/SewingDressesBusinessLogic/BusinessLogic/OrderLogic.cs +++ b/SewingDresses/SewingDressesBusinessLogic/BusinessLogic/OrderLogic.cs @@ -17,11 +17,10 @@ namespace SewingDressesBusinessLogic.BusinessLogic private readonly IShopStorage _shopStorage; private readonly IShopLogic _shopLogic; private readonly IDressStorage _dressStorage; - public OrderLogic(ILogger logger, IOrderStorage orderStorage, IShopStorage shopStorage, IShopLogic shopLogic, IDressStorage dressStorage) static readonly object locker = new object(); - public OrderLogic(ILogger logger, IOrderStorage orderStorage) - { + public OrderLogic(ILogger logger, IOrderStorage orderStorage, IShopStorage shopStorage, IShopLogic shopLogic, IDressStorage dressStorage) + { _logger = logger; _orderStorage = orderStorage; _shopStorage = shopStorage; diff --git a/SewingDresses/SewingDressesDatabaseImplement/Migrations/20240418162241_init.Designer.cs b/SewingDresses/SewingDressesDatabaseImplement/Migrations/20240418162241_init.Designer.cs deleted file mode 100644 index 11b427c..0000000 --- a/SewingDresses/SewingDressesDatabaseImplement/Migrations/20240418162241_init.Designer.cs +++ /dev/null @@ -1,260 +0,0 @@ -// -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 - { - /// - 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("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("SewingDressesDatabaseImplement.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("SewingDressesDatabaseImplement.Models.Dress", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("DressName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Price") - .HasColumnType("float"); - - b.HasKey("Id"); - - b.ToTable("Dresses"); - }); - - modelBuilder.Entity("SewingDressesDatabaseImplement.Models.DressComponent", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ComponentId") - .HasColumnType("int"); - - b.Property("Count") - .HasColumnType("int"); - - b.Property("DressId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ComponentId"); - - b.HasIndex("DressId"); - - b.ToTable("DressComponents"); - }); - - modelBuilder.Entity("SewingDressesDatabaseImplement.Models.Implement", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ImplementFIO") - .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("Implements"); - }); - - modelBuilder.Entity("SewingDressesDatabaseImplement.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("DressId") - .HasColumnType("int"); - - b.Property("ImplementId") - .IsRequired() - .HasColumnType("int"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("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 - } - } -} diff --git a/SewingDresses/SewingDressesDatabaseImplement/Migrations/20240418182438_nullab.cs b/SewingDresses/SewingDressesDatabaseImplement/Migrations/20240418182438_nullab.cs deleted file mode 100644 index 7b643d3..0000000 --- a/SewingDresses/SewingDressesDatabaseImplement/Migrations/20240418182438_nullab.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace SewingDressesDatabaseImplement.Migrations -{ - /// - public partial class nullab : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Orders_Implements_ImplementId", - table: "Orders"); - - migrationBuilder.AlterColumn( - 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"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Orders_Implements_ImplementId", - table: "Orders"); - - migrationBuilder.AlterColumn( - 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); - } - } -} diff --git a/SewingDresses/SewingDressesDatabaseImplement/Migrations/20240422093207_SomeAboba.Designer.cs b/SewingDresses/SewingDressesDatabaseImplement/Migrations/20240501120305_aboba.Designer.cs similarity index 96% rename from SewingDresses/SewingDressesDatabaseImplement/Migrations/20240422093207_SomeAboba.Designer.cs rename to SewingDresses/SewingDressesDatabaseImplement/Migrations/20240501120305_aboba.Designer.cs index ea9e64b..4343cb8 100644 --- a/SewingDresses/SewingDressesDatabaseImplement/Migrations/20240422093207_SomeAboba.Designer.cs +++ b/SewingDresses/SewingDressesDatabaseImplement/Migrations/20240501120305_aboba.Designer.cs @@ -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 { /// 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 } } diff --git a/SewingDresses/SewingDressesDatabaseImplement/Migrations/20240422093207_SomeAboba.cs b/SewingDresses/SewingDressesDatabaseImplement/Migrations/20240501120305_aboba.cs similarity index 89% rename from SewingDresses/SewingDressesDatabaseImplement/Migrations/20240422093207_SomeAboba.cs rename to SewingDresses/SewingDressesDatabaseImplement/Migrations/20240501120305_aboba.cs index 262ffc6..f1c53ce 100644 --- a/SewingDresses/SewingDressesDatabaseImplement/Migrations/20240422093207_SomeAboba.cs +++ b/SewingDresses/SewingDressesDatabaseImplement/Migrations/20240501120305_aboba.cs @@ -6,11 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations; namespace SewingDressesDatabaseImplement.Migrations { /// -<<<<<<<< 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 { /// 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(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), -<<<<<<<< HEAD:SewingDresses/SewingDressesDatabaseImplement/Migrations/20240422093207_SomeAboba.cs - ShopName = table.Column(type: "nvarchar(max)", nullable: false), - Adress = table.Column(type: "nvarchar(max)", nullable: false), - DateOpen = table.Column(type: "datetime2", nullable: false), - MaxCount = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Shops", x => x.Id); -======== ImplementFIO = table.Column(type: "nvarchar(max)", nullable: false), WorkExperience = table.Column(type: "int", nullable: false), Password = table.Column(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(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ShopName = table.Column(type: "nvarchar(max)", nullable: false), + Adress = table.Column(type: "nvarchar(max)", nullable: false), + DateOpen = table.Column(type: "datetime2", nullable: false), + MaxCount = table.Column(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(type: "int", nullable: false), ClientId = table.Column(type: "int", nullable: false), - ImplementId = table.Column(type: "int", nullable: false), + ImplementId = table.Column(type: "int", nullable: true), Count = table.Column(type: "int", nullable: false), Sum = table.Column(type: "float", nullable: false), Status = table.Column(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 } /// @@ -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 } } } diff --git a/SewingDresses/SewingDressesDatabaseImplement/Migrations/SewingDressesDatabaseModelSnapshot.cs b/SewingDresses/SewingDressesDatabaseImplement/Migrations/SewingDressesDatabaseModelSnapshot.cs index 1f5903c..7270293 100644 --- a/SewingDresses/SewingDressesDatabaseImplement/Migrations/SewingDressesDatabaseModelSnapshot.cs +++ b/SewingDresses/SewingDressesDatabaseImplement/Migrations/SewingDressesDatabaseModelSnapshot.cs @@ -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 } } diff --git a/SewingDresses/SewingDressesView/MainForm.cs b/SewingDresses/SewingDressesView/MainForm.cs index 61a5577..5520df3 100644 --- a/SewingDresses/SewingDressesView/MainForm.cs +++ b/SewingDresses/SewingDressesView/MainForm.cs @@ -115,7 +115,7 @@ namespace SewingDressesView MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } - + } private void buttonOrderGive_Click(object sender, EventArgs e) {