From c7e33406931c014bdc1922bead5ec1a5aab623ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=91=D0=B0=D0=BA=D0=B0?= =?UTF-8?q?=D0=BB=D1=8C=D1=81=D0=BA=D0=B0=D1=8F?= Date: Sat, 20 Apr 2024 23:14:21 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B2=D1=80=D0=BE=D0=B4=D0=B5=20=D0=B2=D1=81?= =?UTF-8?q?=D0=B5=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D0=B5=D1=82,=20?= =?UTF-8?q?=D1=87=D1=82=D0=BE=20=D0=BA=D0=B0=D1=81=D0=B0=D0=B5=D1=82=D1=81?= =?UTF-8?q?=D1=8F=20=D0=B4=D0=B5=D1=81=D0=BA=D1=82=D0=BE=D0=BF=D0=BD=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=20=D0=BF=D1=80=D0=B8=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20(=D0=BA=D1=80=D0=BE=D0=BC=D0=B5=20=D0=B8=D0=BC?= =?UTF-8?q?=D0=B8=D1=82=D0=B0=D1=86=D0=B8=D0=B8=20=D0=B7=D0=B0=D0=BF=D1=83?= =?UTF-8?q?=D1=81=D0=BA=D0=B0=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=20:)=20)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SushiBar/FormImplementers.Designer.cs | 6 ++- SushiBar/FormImplementers.cs | 1 + .../ViewModels/ImplementerViewModel.cs | 2 +- ... => 20240420174458_InitCreate.Designer.cs} | 48 ++++++++++++++++++- ...Create.cs => 20240420174458_InitCreate.cs} | 31 ++++++++++++ .../SushiBarDatabaseModelSnapshot.cs | 46 ++++++++++++++++++ SushiBarDatabaseImplement/Models/Order.cs | 4 +- 7 files changed, 133 insertions(+), 5 deletions(-) rename SushiBarDatabaseImplement/Migrations/{20240406182026_InitCreate.Designer.cs => 20240420174458_InitCreate.Designer.cs} (81%) rename SushiBarDatabaseImplement/Migrations/{20240406182026_InitCreate.cs => 20240420174458_InitCreate.cs} (81%) diff --git a/SushiBar/FormImplementers.Designer.cs b/SushiBar/FormImplementers.Designer.cs index 5552cf1..0f79c48 100644 --- a/SushiBar/FormImplementers.Designer.cs +++ b/SushiBar/FormImplementers.Designer.cs @@ -52,6 +52,7 @@ // // buttonAdd // + buttonAdd.Anchor = AnchorStyles.Top | AnchorStyles.Right; buttonAdd.Location = new Point(801, 34); buttonAdd.Margin = new Padding(4, 3, 4, 3); buttonAdd.Name = "buttonAdd"; @@ -63,6 +64,7 @@ // // buttonUpdate // + buttonUpdate.Anchor = AnchorStyles.Top | AnchorStyles.Right; buttonUpdate.Location = new Point(801, 160); buttonUpdate.Margin = new Padding(4, 3, 4, 3); buttonUpdate.Name = "buttonUpdate"; @@ -74,6 +76,7 @@ // // buttonDelete // + buttonDelete.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonDelete.Location = new Point(801, 282); buttonDelete.Margin = new Padding(4, 3, 4, 3); buttonDelete.Name = "buttonDelete"; @@ -85,6 +88,7 @@ // // buttonRefresh // + buttonRefresh.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonRefresh.Location = new Point(801, 407); buttonRefresh.Margin = new Padding(4, 3, 4, 3); buttonRefresh.Name = "buttonRefresh"; @@ -99,7 +103,7 @@ AutoScaleDimensions = new SizeF(10F, 22F); AutoScaleMode = AutoScaleMode.Font; BackColor = Color.MediumOrchid; - ClientSize = new Size(1000, 495); + ClientSize = new Size(1018, 495); Controls.Add(buttonRefresh); Controls.Add(buttonDelete); Controls.Add(buttonUpdate); diff --git a/SushiBar/FormImplementers.cs b/SushiBar/FormImplementers.cs index 95d8ff5..6519eee 100644 --- a/SushiBar/FormImplementers.cs +++ b/SushiBar/FormImplementers.cs @@ -33,6 +33,7 @@ namespace SushiBarView { form.ShowDialog(); } + LoadData(); } private void buttonUpdate_Click(object sender, EventArgs e) diff --git a/SushiBarContracts/ViewModels/ImplementerViewModel.cs b/SushiBarContracts/ViewModels/ImplementerViewModel.cs index b150df0..3dc78f6 100644 --- a/SushiBarContracts/ViewModels/ImplementerViewModel.cs +++ b/SushiBarContracts/ViewModels/ImplementerViewModel.cs @@ -11,7 +11,7 @@ namespace SushiBarContracts.ViewModels public class ImplementerViewModel : IImplementerModel { public int Id { get; set; } - [DisplayName("ИсполнительФИО")] + [DisplayName("Исполнитель ФИО")] public string ImplementerFIO { get; set; } = string.Empty; [DisplayName("Пароль")] diff --git a/SushiBarDatabaseImplement/Migrations/20240406182026_InitCreate.Designer.cs b/SushiBarDatabaseImplement/Migrations/20240420174458_InitCreate.Designer.cs similarity index 81% rename from SushiBarDatabaseImplement/Migrations/20240406182026_InitCreate.Designer.cs rename to SushiBarDatabaseImplement/Migrations/20240420174458_InitCreate.Designer.cs index 1d66215..3f71726 100644 --- a/SushiBarDatabaseImplement/Migrations/20240406182026_InitCreate.Designer.cs +++ b/SushiBarDatabaseImplement/Migrations/20240420174458_InitCreate.Designer.cs @@ -12,7 +12,7 @@ using SushiBarDatabaseImplement; namespace SushiBarDatabaseImplement.Migrations { [DbContext(typeof(SushiBarDatabase))] - [Migration("20240406182026_InitCreate")] + [Migration("20240420174458_InitCreate")] partial class InitCreate { /// @@ -70,6 +70,33 @@ namespace SushiBarDatabaseImplement.Migrations b.ToTable("Components"); }); + modelBuilder.Entity("SushiBarDatabaseImplement.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("SushiBarDatabaseImplement.Models.Order", b => { b.Property("Id") @@ -90,6 +117,10 @@ namespace SushiBarDatabaseImplement.Migrations b.Property("DateImplement") .HasColumnType("datetime2"); + b.Property("ImplementerId") + .IsRequired() + .HasColumnType("int"); + b.Property("Status") .HasColumnType("int"); @@ -103,6 +134,8 @@ namespace SushiBarDatabaseImplement.Migrations b.HasIndex("ClientId"); + b.HasIndex("ImplementerId"); + b.HasIndex("SushiId"); b.ToTable("Orders"); @@ -162,6 +195,12 @@ namespace SushiBarDatabaseImplement.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.HasOne("SushiBarDatabaseImplement.Models.Implementer", "Implementer") + .WithMany("Orders") + .HasForeignKey("ImplementerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi") .WithMany("Orders") .HasForeignKey("SushiId") @@ -170,6 +209,8 @@ namespace SushiBarDatabaseImplement.Migrations b.Navigation("Client"); + b.Navigation("Implementer"); + b.Navigation("Sushi"); }); @@ -202,6 +243,11 @@ namespace SushiBarDatabaseImplement.Migrations b.Navigation("SushiComponents"); }); + modelBuilder.Entity("SushiBarDatabaseImplement.Models.Implementer", b => + { + b.Navigation("Orders"); + }); + modelBuilder.Entity("SushiBarDatabaseImplement.Models.Sushi", b => { b.Navigation("Components"); diff --git a/SushiBarDatabaseImplement/Migrations/20240406182026_InitCreate.cs b/SushiBarDatabaseImplement/Migrations/20240420174458_InitCreate.cs similarity index 81% rename from SushiBarDatabaseImplement/Migrations/20240406182026_InitCreate.cs rename to SushiBarDatabaseImplement/Migrations/20240420174458_InitCreate.cs index 7ec4630..b39c233 100644 --- a/SushiBarDatabaseImplement/Migrations/20240406182026_InitCreate.cs +++ b/SushiBarDatabaseImplement/Migrations/20240420174458_InitCreate.cs @@ -40,6 +40,22 @@ namespace SushiBarDatabaseImplement.Migrations table.PrimaryKey("PK_Components", 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), + WorkExperience = table.Column(type: "int", nullable: false), + Qualification = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Implementers", x => x.Id); + }); + migrationBuilder.CreateTable( name: "Sushis", columns: table => new @@ -62,6 +78,7 @@ namespace SushiBarDatabaseImplement.Migrations .Annotation("SqlServer:Identity", "1, 1"), SushiId = table.Column(type: "int", nullable: false), ClientId = table.Column(type: "int", nullable: false), + ImplementerId = table.Column(type: "int", nullable: false), Count = table.Column(type: "int", nullable: false), Sum = table.Column(type: "float", nullable: false), Status = table.Column(type: "int", nullable: false), @@ -77,6 +94,12 @@ namespace SushiBarDatabaseImplement.Migrations principalTable: "Clients", principalColumn: "Id", onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Orders_Implementers_ImplementerId", + column: x => x.ImplementerId, + principalTable: "Implementers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_Orders_Sushis_SushiId", column: x => x.SushiId, @@ -117,6 +140,11 @@ namespace SushiBarDatabaseImplement.Migrations table: "Orders", column: "ClientId"); + migrationBuilder.CreateIndex( + name: "IX_Orders_ImplementerId", + table: "Orders", + column: "ImplementerId"); + migrationBuilder.CreateIndex( name: "IX_Orders_SushiId", table: "Orders", @@ -145,6 +173,9 @@ namespace SushiBarDatabaseImplement.Migrations migrationBuilder.DropTable( name: "Clients"); + migrationBuilder.DropTable( + name: "Implementers"); + migrationBuilder.DropTable( name: "Components"); diff --git a/SushiBarDatabaseImplement/Migrations/SushiBarDatabaseModelSnapshot.cs b/SushiBarDatabaseImplement/Migrations/SushiBarDatabaseModelSnapshot.cs index 9f4dd7d..87adc60 100644 --- a/SushiBarDatabaseImplement/Migrations/SushiBarDatabaseModelSnapshot.cs +++ b/SushiBarDatabaseImplement/Migrations/SushiBarDatabaseModelSnapshot.cs @@ -67,6 +67,33 @@ namespace SushiBarDatabaseImplement.Migrations b.ToTable("Components"); }); + modelBuilder.Entity("SushiBarDatabaseImplement.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("SushiBarDatabaseImplement.Models.Order", b => { b.Property("Id") @@ -87,6 +114,10 @@ namespace SushiBarDatabaseImplement.Migrations b.Property("DateImplement") .HasColumnType("datetime2"); + b.Property("ImplementerId") + .IsRequired() + .HasColumnType("int"); + b.Property("Status") .HasColumnType("int"); @@ -100,6 +131,8 @@ namespace SushiBarDatabaseImplement.Migrations b.HasIndex("ClientId"); + b.HasIndex("ImplementerId"); + b.HasIndex("SushiId"); b.ToTable("Orders"); @@ -159,6 +192,12 @@ namespace SushiBarDatabaseImplement.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.HasOne("SushiBarDatabaseImplement.Models.Implementer", "Implementer") + .WithMany("Orders") + .HasForeignKey("ImplementerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi") .WithMany("Orders") .HasForeignKey("SushiId") @@ -167,6 +206,8 @@ namespace SushiBarDatabaseImplement.Migrations b.Navigation("Client"); + b.Navigation("Implementer"); + b.Navigation("Sushi"); }); @@ -199,6 +240,11 @@ namespace SushiBarDatabaseImplement.Migrations b.Navigation("SushiComponents"); }); + modelBuilder.Entity("SushiBarDatabaseImplement.Models.Implementer", b => + { + b.Navigation("Orders"); + }); + modelBuilder.Entity("SushiBarDatabaseImplement.Models.Sushi", b => { b.Navigation("Components"); diff --git a/SushiBarDatabaseImplement/Models/Order.cs b/SushiBarDatabaseImplement/Models/Order.cs index bea39f1..e43d13c 100644 --- a/SushiBarDatabaseImplement/Models/Order.cs +++ b/SushiBarDatabaseImplement/Models/Order.cs @@ -32,10 +32,10 @@ namespace SushiBarDatabaseImplement.Models public DateTime DateCreate { get; set; } = DateTime.Now; public DateTime? DateImplement { get; set; } - public virtual Client Client { get; set; } + public virtual Client? Client { get; set; } public virtual Implementer? Implementer { get; set; } - public virtual Sushi Sushi { get; set; } + public virtual Sushi? Sushi { get; set; } public static Order? Create(OrderBindingModel? model) {