From e22020f8ab563f47573964be1d80c63411a98bc7 Mon Sep 17 00:00:00 2001 From: sardq Date: Fri, 17 May 2024 15:05:55 +0400 Subject: [PATCH 1/2] =?UTF-8?q?=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=20?= =?UTF-8?q?=D0=BF=D1=83=D1=81=D1=82=D0=BE=D0=B9=20=D0=BC=D0=B5=D1=82=D0=BE?= =?UTF-8?q?=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PlumbingRepairView/FormMails.Designer.cs | 23 +++++++++---------- .../PlumbingRepairView/FormMails.cs | 5 ---- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/PlumbingRepair/PlumbingRepairView/FormMails.Designer.cs b/PlumbingRepair/PlumbingRepairView/FormMails.Designer.cs index 4fd309e..790c354 100644 --- a/PlumbingRepair/PlumbingRepairView/FormMails.Designer.cs +++ b/PlumbingRepair/PlumbingRepairView/FormMails.Designer.cs @@ -30,9 +30,9 @@ { this.dataGridView = new System.Windows.Forms.DataGridView(); this.panel = new System.Windows.Forms.Panel(); - this.buttonOpen = new System.Windows.Forms.Button(); this.buttonForward = new System.Windows.Forms.Button(); this.buttonBack = new System.Windows.Forms.Button(); + this.buttonOpen = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); this.panel.SuspendLayout(); this.SuspendLayout(); @@ -54,7 +54,6 @@ this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dataGridView.Size = new System.Drawing.Size(956, 455); this.dataGridView.TabIndex = 7; - this.dataGridView.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_CellContentClick); // // panel // @@ -67,16 +66,6 @@ this.panel.Size = new System.Drawing.Size(183, 455); this.panel.TabIndex = 8; // - // buttonOpen - // - this.buttonOpen.Location = new System.Drawing.Point(14, 12); - this.buttonOpen.Name = "buttonOpen"; - this.buttonOpen.Size = new System.Drawing.Size(157, 34); - this.buttonOpen.TabIndex = 0; - this.buttonOpen.Text = "Открыть"; - this.buttonOpen.UseVisualStyleBackColor = true; - this.buttonOpen.Click += new System.EventHandler(this.ButtonOpen_Click); - // // buttonForward // this.buttonForward.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); @@ -99,6 +88,16 @@ this.buttonBack.UseVisualStyleBackColor = true; this.buttonBack.Click += new System.EventHandler(this.ButtonBack_Click); // + // buttonOpen + // + this.buttonOpen.Location = new System.Drawing.Point(14, 12); + this.buttonOpen.Name = "buttonOpen"; + this.buttonOpen.Size = new System.Drawing.Size(157, 34); + this.buttonOpen.TabIndex = 0; + this.buttonOpen.Text = "Открыть"; + this.buttonOpen.UseVisualStyleBackColor = true; + this.buttonOpen.Click += new System.EventHandler(this.ButtonOpen_Click); + // // FormMails // this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F); diff --git a/PlumbingRepair/PlumbingRepairView/FormMails.cs b/PlumbingRepair/PlumbingRepairView/FormMails.cs index fc4eb9b..c65c3e1 100644 --- a/PlumbingRepair/PlumbingRepairView/FormMails.cs +++ b/PlumbingRepair/PlumbingRepairView/FormMails.cs @@ -65,10 +65,5 @@ namespace PlumbingRepairView } } } - - private void dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) - { - - } } } From 7e61baddbf5a7b1ef636eb34513ddd5374de6e28 Mon Sep 17 00:00:00 2001 From: sardq Date: Fri, 17 May 2024 15:20:57 +0400 Subject: [PATCH 2/2] =?UTF-8?q?=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81=D0=B2=D1=8F=D0=B7=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... => 20240517111715_InitCreate.Designer.cs} | 15 +++++- ...Create.cs => 20240517111715_InitCreate.cs} | 46 +++++++++++-------- .../PlumbingRepairDatabaseModelSnapshot.cs | 13 ++++++ .../Models/Client.cs | 5 +- .../Models/MessageInfo.cs | 2 + 5 files changed, 60 insertions(+), 21 deletions(-) rename PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/{20240515153909_InitCreate.Designer.cs => 20240517111715_InitCreate.Designer.cs} (96%) rename PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/{20240515153909_InitCreate.cs => 20240517111715_InitCreate.cs} (96%) diff --git a/PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240515153909_InitCreate.Designer.cs b/PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240517111715_InitCreate.Designer.cs similarity index 96% rename from PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240515153909_InitCreate.Designer.cs rename to PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240517111715_InitCreate.Designer.cs index 701adcf..3c5618c 100644 --- a/PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240515153909_InitCreate.Designer.cs +++ b/PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240517111715_InitCreate.Designer.cs @@ -12,7 +12,7 @@ using PlumbingRepairDatabaseImplement; namespace PlumbingRepairDatabaseImplement.Migrations { [DbContext(typeof(PlumbingRepairDatabase))] - [Migration("20240515153909_InitCreate")] + [Migration("20240517111715_InitCreate")] partial class InitCreate { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -127,6 +127,8 @@ namespace PlumbingRepairDatabaseImplement.Migrations b.HasKey("MessageId"); + b.HasIndex("ClientId"); + b.ToTable("Messages"); }); @@ -272,6 +274,15 @@ namespace PlumbingRepairDatabaseImplement.Migrations b.ToTable("WorkComponents"); }); + modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.MessageInfo", b => + { + b.HasOne("PlumbingRepairDatabaseImplement.Models.Client", "Client") + .WithMany("Messages") + .HasForeignKey("ClientId"); + + b.Navigation("Client"); + }); + modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Order", b => { b.HasOne("PlumbingRepairDatabaseImplement.Models.Client", "Client") @@ -337,6 +348,8 @@ namespace PlumbingRepairDatabaseImplement.Migrations modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Client", b => { + b.Navigation("Messages"); + b.Navigation("Orders"); }); diff --git a/PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240515153909_InitCreate.cs b/PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240517111715_InitCreate.cs similarity index 96% rename from PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240515153909_InitCreate.cs rename to PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240517111715_InitCreate.cs index 0037ed3..76d58f1 100644 --- a/PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240515153909_InitCreate.cs +++ b/PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/20240517111715_InitCreate.cs @@ -54,24 +54,6 @@ namespace PlumbingRepairDatabaseImplement.Migrations table.PrimaryKey("PK_Implementers", x => x.Id); }); - migrationBuilder.CreateTable( - name: "Messages", - columns: table => new - { - MessageId = table.Column(type: "nvarchar(450)", nullable: false), - ClientId = table.Column(type: "int", nullable: true), - SenderName = table.Column(type: "nvarchar(max)", nullable: false), - DateDelivery = table.Column(type: "datetime2", nullable: false), - Subject = table.Column(type: "nvarchar(max)", nullable: false), - Body = table.Column(type: "nvarchar(max)", nullable: false), - IsRead = table.Column(type: "bit", nullable: false), - ReplyText = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Messages", x => x.MessageId); - }); - migrationBuilder.CreateTable( name: "Shops", columns: table => new @@ -102,6 +84,29 @@ namespace PlumbingRepairDatabaseImplement.Migrations table.PrimaryKey("PK_Works", x => x.Id); }); + migrationBuilder.CreateTable( + name: "Messages", + columns: table => new + { + MessageId = table.Column(type: "nvarchar(450)", nullable: false), + ClientId = table.Column(type: "int", nullable: true), + SenderName = table.Column(type: "nvarchar(max)", nullable: false), + DateDelivery = table.Column(type: "datetime2", nullable: false), + Subject = table.Column(type: "nvarchar(max)", nullable: false), + Body = table.Column(type: "nvarchar(max)", nullable: false), + IsRead = table.Column(type: "bit", nullable: false), + ReplyText = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Messages", x => x.MessageId); + table.ForeignKey( + name: "FK_Messages_Clients_ClientId", + column: x => x.ClientId, + principalTable: "Clients", + principalColumn: "Id"); + }); + migrationBuilder.CreateTable( name: "Orders", columns: table => new @@ -193,6 +198,11 @@ namespace PlumbingRepairDatabaseImplement.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateIndex( + name: "IX_Messages_ClientId", + table: "Messages", + column: "ClientId"); + migrationBuilder.CreateIndex( name: "IX_Orders_ClientId", table: "Orders", diff --git a/PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/PlumbingRepairDatabaseModelSnapshot.cs b/PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/PlumbingRepairDatabaseModelSnapshot.cs index 122b902..408f110 100644 --- a/PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/PlumbingRepairDatabaseModelSnapshot.cs +++ b/PlumbingRepair/PlumbingRepairDatabaseImplement/Migrations/PlumbingRepairDatabaseModelSnapshot.cs @@ -125,6 +125,8 @@ namespace PlumbingRepairDatabaseImplement.Migrations b.HasKey("MessageId"); + b.HasIndex("ClientId"); + b.ToTable("Messages"); }); @@ -270,6 +272,15 @@ namespace PlumbingRepairDatabaseImplement.Migrations b.ToTable("WorkComponents"); }); + modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.MessageInfo", b => + { + b.HasOne("PlumbingRepairDatabaseImplement.Models.Client", "Client") + .WithMany("Messages") + .HasForeignKey("ClientId"); + + b.Navigation("Client"); + }); + modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Order", b => { b.HasOne("PlumbingRepairDatabaseImplement.Models.Client", "Client") @@ -335,6 +346,8 @@ namespace PlumbingRepairDatabaseImplement.Migrations modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Client", b => { + b.Navigation("Messages"); + b.Navigation("Orders"); }); diff --git a/PlumbingRepair/PlumbingRepairDatabaseImplement/Models/Client.cs b/PlumbingRepair/PlumbingRepairDatabaseImplement/Models/Client.cs index 74b6e79..a7e8810 100644 --- a/PlumbingRepair/PlumbingRepairDatabaseImplement/Models/Client.cs +++ b/PlumbingRepair/PlumbingRepairDatabaseImplement/Models/Client.cs @@ -20,8 +20,9 @@ namespace PlumbingRepairDatabaseImplement.Models [ForeignKey("ClientId")] public virtual List Orders{ get; set; } = new(); - - public static Client? Create(ClientBindingModel model) + [ForeignKey("ClientId")] + public virtual List Messages { get; set; } = new(); + public static Client? Create(ClientBindingModel model) { if (model == null) { diff --git a/PlumbingRepair/PlumbingRepairDatabaseImplement/Models/MessageInfo.cs b/PlumbingRepair/PlumbingRepairDatabaseImplement/Models/MessageInfo.cs index 599abbe..be1fa55 100644 --- a/PlumbingRepair/PlumbingRepairDatabaseImplement/Models/MessageInfo.cs +++ b/PlumbingRepair/PlumbingRepairDatabaseImplement/Models/MessageInfo.cs @@ -23,6 +23,8 @@ namespace PlumbingRepairDatabaseImplement.Models public bool IsRead { get; private set; } = false; public string? ReplyText { get; private set; } + public virtual Client? Client { get; private set; } + public static MessageInfo? Create(MessageInfoBindingModel model) { if (model == null)