From 7cf85f127074644b1c140c0bbe217994f445cdf0 Mon Sep 17 00:00:00 2001 From: Yuee Shiness Date: Mon, 24 Apr 2023 00:48:28 +0400 Subject: [PATCH] LabWork08 is finally done. --- .gitignore | 2 +- .../ViewModels/EmployeeViewModel.cs | 4 ++-- .../ViewModels/MessageInfoViewModel.cs | 1 + .../ViewModels/OrderViewModel.cs | 2 +- ... 20230423203827_FixesMessages.Designer.cs} | 19 ++++++++++++++----- ...ges.cs => 20230423203827_FixesMessages.cs} | 6 ++++-- .../DressAtelierDatabaseModelSnapshot.cs | 15 ++++++++++++--- SewingDresses/SewingDresses.csproj | 2 +- 8 files changed, 36 insertions(+), 15 deletions(-) rename DressAtelierDatabaseImplement/Migrations/{20230422104256_Messages.Designer.cs => 20230423203827_FixesMessages.Designer.cs} (94%) rename DressAtelierDatabaseImplement/Migrations/{20230422104256_Messages.cs => 20230423203827_FixesMessages.cs} (85%) diff --git a/.gitignore b/.gitignore index ca1c7a3..17c2b58 100644 --- a/.gitignore +++ b/.gitignore @@ -397,4 +397,4 @@ FodyWeavers.xsd # JetBrains Rider *.sln.iml - +*.dll diff --git a/DressAtelierContracts/ViewModels/EmployeeViewModel.cs b/DressAtelierContracts/ViewModels/EmployeeViewModel.cs index 36f4acd..afbc0a9 100644 --- a/DressAtelierContracts/ViewModels/EmployeeViewModel.cs +++ b/DressAtelierContracts/ViewModels/EmployeeViewModel.cs @@ -17,9 +17,9 @@ namespace DressAtelierContracts.ViewModels public string FullName { get; set; } = string.Empty; [Column(title: "Password", width: 150)] public string Password { get; set; } = string.Empty; - [Column(title: "WorkExperience", width: 50)] + [Column(title: "WorkExperience", width: 150)] public int WorkExperience { get; set; } - [Column(title: "Qualification", width: 50)] + [Column(title: "Qualification", width: 150)] public int Qualification { get; set; } } } diff --git a/DressAtelierContracts/ViewModels/MessageInfoViewModel.cs b/DressAtelierContracts/ViewModels/MessageInfoViewModel.cs index 2cffc00..9342302 100644 --- a/DressAtelierContracts/ViewModels/MessageInfoViewModel.cs +++ b/DressAtelierContracts/ViewModels/MessageInfoViewModel.cs @@ -29,6 +29,7 @@ namespace DressAtelierContracts.ViewModels [Column(title: "Message content", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] public string Body { get; set; } = string.Empty; + [Column(visible: false)] public int ID { get; set; } } } diff --git a/DressAtelierContracts/ViewModels/OrderViewModel.cs b/DressAtelierContracts/ViewModels/OrderViewModel.cs index 6f3ff9d..9327c3c 100644 --- a/DressAtelierContracts/ViewModels/OrderViewModel.cs +++ b/DressAtelierContracts/ViewModels/OrderViewModel.cs @@ -33,7 +33,7 @@ namespace DressAtelierContracts.ViewModels [Column(title: "DressName", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] public string DressName { get; set; } = string.Empty; - [Column(title: "Quantity", width: 50)] + [Column(title: "Quantity", width: 100)] public int Count { get; set; } [Column(title: "Overall price", width: 50)] diff --git a/DressAtelierDatabaseImplement/Migrations/20230422104256_Messages.Designer.cs b/DressAtelierDatabaseImplement/Migrations/20230423203827_FixesMessages.Designer.cs similarity index 94% rename from DressAtelierDatabaseImplement/Migrations/20230422104256_Messages.Designer.cs rename to DressAtelierDatabaseImplement/Migrations/20230423203827_FixesMessages.Designer.cs index b217bc9..9fe3b03 100644 --- a/DressAtelierDatabaseImplement/Migrations/20230422104256_Messages.Designer.cs +++ b/DressAtelierDatabaseImplement/Migrations/20230423203827_FixesMessages.Designer.cs @@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace DressAtelierDatabaseImplement.Migrations { [DbContext(typeof(DressAtelierDatabase))] - [Migration("20230422104256_Messages")] - partial class Messages + [Migration("20230423203827_FixesMessages")] + partial class FixesMessages { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -79,8 +79,11 @@ namespace DressAtelierDatabaseImplement.Migrations modelBuilder.Entity("DressAtelierDatabaseImplement.Models.MessageInfo", b => { - b.Property("ID") - .HasColumnType("nvarchar(450)"); + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); b.Property("Body") .IsRequired() @@ -92,6 +95,10 @@ namespace DressAtelierDatabaseImplement.Migrations b.Property("DeliveryDate") .HasColumnType("datetime2"); + b.Property("MessageID") + .IsRequired() + .HasColumnType("nvarchar(max)"); + b.Property("SenderName") .IsRequired() .HasColumnType("nvarchar(max)"); @@ -219,7 +226,7 @@ namespace DressAtelierDatabaseImplement.Migrations modelBuilder.Entity("DressAtelierDatabaseImplement.Models.MessageInfo", b => { b.HasOne("DressAtelierDatabaseImplement.Models.Client", "Client") - .WithMany() + .WithMany("Messages") .HasForeignKey("ClientID"); b.Navigation("Client"); @@ -271,6 +278,8 @@ namespace DressAtelierDatabaseImplement.Migrations modelBuilder.Entity("DressAtelierDatabaseImplement.Models.Client", b => { + b.Navigation("Messages"); + b.Navigation("Orders"); }); diff --git a/DressAtelierDatabaseImplement/Migrations/20230422104256_Messages.cs b/DressAtelierDatabaseImplement/Migrations/20230423203827_FixesMessages.cs similarity index 85% rename from DressAtelierDatabaseImplement/Migrations/20230422104256_Messages.cs rename to DressAtelierDatabaseImplement/Migrations/20230423203827_FixesMessages.cs index 2befa14..5ec646c 100644 --- a/DressAtelierDatabaseImplement/Migrations/20230422104256_Messages.cs +++ b/DressAtelierDatabaseImplement/Migrations/20230423203827_FixesMessages.cs @@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations; namespace DressAtelierDatabaseImplement.Migrations { /// - public partial class Messages : Migration + public partial class FixesMessages : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) @@ -15,7 +15,9 @@ namespace DressAtelierDatabaseImplement.Migrations name: "Messages", columns: table => new { - ID = table.Column(type: "nvarchar(450)", nullable: false), + ID = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + MessageID = table.Column(type: "nvarchar(max)", nullable: false), ClientID = table.Column(type: "int", nullable: true), SenderName = table.Column(type: "nvarchar(max)", nullable: false), DeliveryDate = table.Column(type: "datetime2", nullable: false), diff --git a/DressAtelierDatabaseImplement/Migrations/DressAtelierDatabaseModelSnapshot.cs b/DressAtelierDatabaseImplement/Migrations/DressAtelierDatabaseModelSnapshot.cs index 9262014..7028792 100644 --- a/DressAtelierDatabaseImplement/Migrations/DressAtelierDatabaseModelSnapshot.cs +++ b/DressAtelierDatabaseImplement/Migrations/DressAtelierDatabaseModelSnapshot.cs @@ -76,8 +76,11 @@ namespace DressAtelierDatabaseImplement.Migrations modelBuilder.Entity("DressAtelierDatabaseImplement.Models.MessageInfo", b => { - b.Property("ID") - .HasColumnType("nvarchar(450)"); + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); b.Property("Body") .IsRequired() @@ -89,6 +92,10 @@ namespace DressAtelierDatabaseImplement.Migrations b.Property("DeliveryDate") .HasColumnType("datetime2"); + b.Property("MessageID") + .IsRequired() + .HasColumnType("nvarchar(max)"); + b.Property("SenderName") .IsRequired() .HasColumnType("nvarchar(max)"); @@ -216,7 +223,7 @@ namespace DressAtelierDatabaseImplement.Migrations modelBuilder.Entity("DressAtelierDatabaseImplement.Models.MessageInfo", b => { b.HasOne("DressAtelierDatabaseImplement.Models.Client", "Client") - .WithMany() + .WithMany("Messages") .HasForeignKey("ClientID"); b.Navigation("Client"); @@ -268,6 +275,8 @@ namespace DressAtelierDatabaseImplement.Migrations modelBuilder.Entity("DressAtelierDatabaseImplement.Models.Client", b => { + b.Navigation("Messages"); + b.Navigation("Orders"); }); diff --git a/SewingDresses/SewingDresses.csproj b/SewingDresses/SewingDresses.csproj index 9cdb937..e6a6a87 100644 --- a/SewingDresses/SewingDresses.csproj +++ b/SewingDresses/SewingDresses.csproj @@ -37,7 +37,7 @@ - +