From 94cefbfbe1586be081f24aecf4ad82f451b63f04 Mon Sep 17 00:00:00 2001 From: abazov73 <92822431+abazov73@users.noreply.github.com> Date: Mon, 15 May 2023 10:09:47 +0400 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=BE=D1=81=D1=8C=D0=BC=D0=B0=D1=8F=20?= =?UTF-8?q?=D0=BB=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82=D0=BE=D1=80=D0=BD?= =?UTF-8?q?=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0.=20=D0=A4?= =?UTF-8?q?=D0=B8=D0=BA=D1=81=20id=20=D1=83=20messageinfo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BindingModels/MessageInfoBindingModel.cs | 2 + .../ViewModels/MessageInfoViewModel.cs | 2 + ...0230515055212_IdForMessageInfo.Designer.cs | 281 ++++++++++++++++++ .../20230515055212_IdForMessageInfo.cs | 29 ++ .../ConfectioneryDatabaseModelSnapshot.cs | 3 + .../Models/MessageInfo.cs | 1 + .../Models/IMessageInfoModel.cs | 2 +- .../Models/MessageInfo.cs | 2 + .../Models/MessageInfo.cs | 2 + 9 files changed, 323 insertions(+), 1 deletion(-) create mode 100644 Confectionery/ConfectioneryDataBaseImplement/Migrations/20230515055212_IdForMessageInfo.Designer.cs create mode 100644 Confectionery/ConfectioneryDataBaseImplement/Migrations/20230515055212_IdForMessageInfo.cs diff --git a/Confectionery/ConfectioneryContracts/BindingModels/MessageInfoBindingModel.cs b/Confectionery/ConfectioneryContracts/BindingModels/MessageInfoBindingModel.cs index 85b4c39..a84be8c 100644 --- a/Confectionery/ConfectioneryContracts/BindingModels/MessageInfoBindingModel.cs +++ b/Confectionery/ConfectioneryContracts/BindingModels/MessageInfoBindingModel.cs @@ -15,5 +15,7 @@ namespace ConfectioneryContracts.BindingModels public DateTime DateDelivery { get; set; } public string Subject { get; set; } = string.Empty; public string Body { get; set; } = string.Empty; + + public int Id { get; set; } } } diff --git a/Confectionery/ConfectioneryContracts/ViewModels/MessageInfoViewModel.cs b/Confectionery/ConfectioneryContracts/ViewModels/MessageInfoViewModel.cs index 0972e21..863604f 100644 --- a/Confectionery/ConfectioneryContracts/ViewModels/MessageInfoViewModel.cs +++ b/Confectionery/ConfectioneryContracts/ViewModels/MessageInfoViewModel.cs @@ -23,5 +23,7 @@ namespace ConfectioneryContracts.ViewModels public string Subject { get; set; } = string.Empty; [Column(title:"Текст", gridViewAutoSize:GridViewAutoSize.Fill, isUseAutoSize:true)] public string Body { get; set; } = string.Empty; + + public int Id { get; set; } } } diff --git a/Confectionery/ConfectioneryDataBaseImplement/Migrations/20230515055212_IdForMessageInfo.Designer.cs b/Confectionery/ConfectioneryDataBaseImplement/Migrations/20230515055212_IdForMessageInfo.Designer.cs new file mode 100644 index 0000000..7e6e3b4 --- /dev/null +++ b/Confectionery/ConfectioneryDataBaseImplement/Migrations/20230515055212_IdForMessageInfo.Designer.cs @@ -0,0 +1,281 @@ +// +using System; +using ConfectioneryDataBaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace ConfectioneryDataBaseImplement.Migrations +{ + [DbContext(typeof(ConfectioneryDatabase))] + [Migration("20230515055212_IdForMessageInfo")] + partial class IdForMessageInfo + { + /// + 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("ConfectioneryDataBaseImplement.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("ConfectioneryDataBaseImplement.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("ConfectioneryDataBaseImplement.Models.Ingredient", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Cost") + .HasColumnType("float"); + + b.Property("IngredientName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Ingredients"); + }); + + modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.MessageInfo", b => + { + b.Property("MessageId") + .HasColumnType("nvarchar(450)"); + + b.Property("Body") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ClientId") + .HasColumnType("int"); + + b.Property("DateDelivery") + .HasColumnType("datetime2"); + + b.Property("Id") + .HasColumnType("int"); + + b.Property("SenderName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("MessageId"); + + b.ToTable("MessageInfos"); + }); + + modelBuilder.Entity("ConfectioneryDataBaseImplement.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("ImplementerId") + .HasColumnType("int"); + + b.Property("PastryId") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Sum") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.HasIndex("ImplementerId"); + + b.HasIndex("PastryId"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.Pastry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("PastryName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Price") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("Pastrys"); + }); + + modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.PastryIngredient", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("IngredientId") + .HasColumnType("int"); + + b.Property("PastryId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("IngredientId"); + + b.HasIndex("PastryId"); + + b.ToTable("PastryIngredients"); + }); + + modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.Order", b => + { + b.HasOne("ConfectioneryDataBaseImplement.Models.Client", "Client") + .WithMany() + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ConfectioneryDataBaseImplement.Models.Implementer", "Implementer") + .WithMany("Orders") + .HasForeignKey("ImplementerId"); + + b.HasOne("ConfectioneryDataBaseImplement.Models.Pastry", null) + .WithMany("Orders") + .HasForeignKey("PastryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Client"); + + b.Navigation("Implementer"); + }); + + modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.PastryIngredient", b => + { + b.HasOne("ConfectioneryDataBaseImplement.Models.Ingredient", "Ingredient") + .WithMany("PastryIgredients") + .HasForeignKey("IngredientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ConfectioneryDataBaseImplement.Models.Pastry", "Pastry") + .WithMany("Ingredients") + .HasForeignKey("PastryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ingredient"); + + b.Navigation("Pastry"); + }); + + modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.Implementer", b => + { + b.Navigation("Orders"); + }); + + modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.Ingredient", b => + { + b.Navigation("PastryIgredients"); + }); + + modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.Pastry", b => + { + b.Navigation("Ingredients"); + + b.Navigation("Orders"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Confectionery/ConfectioneryDataBaseImplement/Migrations/20230515055212_IdForMessageInfo.cs b/Confectionery/ConfectioneryDataBaseImplement/Migrations/20230515055212_IdForMessageInfo.cs new file mode 100644 index 0000000..e67fb33 --- /dev/null +++ b/Confectionery/ConfectioneryDataBaseImplement/Migrations/20230515055212_IdForMessageInfo.cs @@ -0,0 +1,29 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace ConfectioneryDataBaseImplement.Migrations +{ + /// + public partial class IdForMessageInfo : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Id", + table: "MessageInfos", + type: "int", + nullable: false, + defaultValue: 0); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Id", + table: "MessageInfos"); + } + } +} diff --git a/Confectionery/ConfectioneryDataBaseImplement/Migrations/ConfectioneryDatabaseModelSnapshot.cs b/Confectionery/ConfectioneryDataBaseImplement/Migrations/ConfectioneryDatabaseModelSnapshot.cs index ce1089f..342cf99 100644 --- a/Confectionery/ConfectioneryDataBaseImplement/Migrations/ConfectioneryDatabaseModelSnapshot.cs +++ b/Confectionery/ConfectioneryDataBaseImplement/Migrations/ConfectioneryDatabaseModelSnapshot.cs @@ -109,6 +109,9 @@ namespace ConfectioneryDataBaseImplement.Migrations b.Property("DateDelivery") .HasColumnType("datetime2"); + b.Property("Id") + .HasColumnType("int"); + b.Property("SenderName") .IsRequired() .HasColumnType("nvarchar(max)"); diff --git a/Confectionery/ConfectioneryDataBaseImplement/Models/MessageInfo.cs b/Confectionery/ConfectioneryDataBaseImplement/Models/MessageInfo.cs index 0d2eaf3..1e1a106 100644 --- a/Confectionery/ConfectioneryDataBaseImplement/Models/MessageInfo.cs +++ b/Confectionery/ConfectioneryDataBaseImplement/Models/MessageInfo.cs @@ -60,5 +60,6 @@ namespace ConfectioneryDataBaseImplement.Models Subject = Subject, DateDelivery = DateDelivery }; + public int Id { get; set; } } } diff --git a/Confectionery/ConfectioneryDataModels/Models/IMessageInfoModel.cs b/Confectionery/ConfectioneryDataModels/Models/IMessageInfoModel.cs index b9ef9d2..e005065 100644 --- a/Confectionery/ConfectioneryDataModels/Models/IMessageInfoModel.cs +++ b/Confectionery/ConfectioneryDataModels/Models/IMessageInfoModel.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace ConfectioneryDataModels.Models { - public interface IMessageInfoModel + public interface IMessageInfoModel : IId { string MessageId { get; } int? ClientId { get; } diff --git a/Confectionery/ConfectioneryFileImplements/Models/MessageInfo.cs b/Confectionery/ConfectioneryFileImplements/Models/MessageInfo.cs index 5afc9cc..68c45a9 100644 --- a/Confectionery/ConfectioneryFileImplements/Models/MessageInfo.cs +++ b/Confectionery/ConfectioneryFileImplements/Models/MessageInfo.cs @@ -78,5 +78,7 @@ namespace ConfectioneryFileImplement.Models new XElement("Subject", Subject), new XElement("Body", Body), new XElement("DateDelivery", DateDelivery.ToString())); + + public int Id { get; set; } } } diff --git a/Confectionery/ConfectioneryListImplement/Models/MessageInfo.cs b/Confectionery/ConfectioneryListImplement/Models/MessageInfo.cs index 18b93e9..42c29a8 100644 --- a/Confectionery/ConfectioneryListImplement/Models/MessageInfo.cs +++ b/Confectionery/ConfectioneryListImplement/Models/MessageInfo.cs @@ -44,5 +44,7 @@ namespace ConfectioneryListImplement.Models Subject = Subject, DateDelivery = DateDelivery }; + + public int Id { get; set; } } }