слияние с коммитом 7 усложненки

This commit is contained in:
sardq 2024-06-15 09:52:48 +04:00
commit 5f8c7773b5
6 changed files with 68 additions and 36 deletions

View File

@ -12,7 +12,7 @@ using PlumbingRepairDatabaseImplement;
namespace PlumbingRepairDatabaseImplement.Migrations namespace PlumbingRepairDatabaseImplement.Migrations
{ {
[DbContext(typeof(PlumbingRepairDatabase))] [DbContext(typeof(PlumbingRepairDatabase))]
[Migration("20240515153909_InitCreate")] [Migration("20240517111715_InitCreate")]
partial class InitCreate partial class InitCreate
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -127,6 +127,8 @@ namespace PlumbingRepairDatabaseImplement.Migrations
b.HasKey("MessageId"); b.HasKey("MessageId");
b.HasIndex("ClientId");
b.ToTable("Messages"); b.ToTable("Messages");
}); });
@ -272,6 +274,15 @@ namespace PlumbingRepairDatabaseImplement.Migrations
b.ToTable("WorkComponents"); 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 => modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Order", b =>
{ {
b.HasOne("PlumbingRepairDatabaseImplement.Models.Client", "Client") b.HasOne("PlumbingRepairDatabaseImplement.Models.Client", "Client")
@ -337,6 +348,8 @@ namespace PlumbingRepairDatabaseImplement.Migrations
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Client", b => modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Client", b =>
{ {
b.Navigation("Messages");
b.Navigation("Orders"); b.Navigation("Orders");
}); });

View File

@ -54,24 +54,6 @@ namespace PlumbingRepairDatabaseImplement.Migrations
table.PrimaryKey("PK_Implementers", x => x.Id); table.PrimaryKey("PK_Implementers", x => x.Id);
}); });
migrationBuilder.CreateTable(
name: "Messages",
columns: table => new
{
MessageId = table.Column<string>(type: "nvarchar(450)", nullable: false),
ClientId = table.Column<int>(type: "int", nullable: true),
SenderName = table.Column<string>(type: "nvarchar(max)", nullable: false),
DateDelivery = table.Column<DateTime>(type: "datetime2", nullable: false),
Subject = table.Column<string>(type: "nvarchar(max)", nullable: false),
Body = table.Column<string>(type: "nvarchar(max)", nullable: false),
IsRead = table.Column<bool>(type: "bit", nullable: false),
ReplyText = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Messages", x => x.MessageId);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "Shops", name: "Shops",
columns: table => new columns: table => new
@ -102,6 +84,29 @@ namespace PlumbingRepairDatabaseImplement.Migrations
table.PrimaryKey("PK_Works", x => x.Id); table.PrimaryKey("PK_Works", x => x.Id);
}); });
migrationBuilder.CreateTable(
name: "Messages",
columns: table => new
{
MessageId = table.Column<string>(type: "nvarchar(450)", nullable: false),
ClientId = table.Column<int>(type: "int", nullable: true),
SenderName = table.Column<string>(type: "nvarchar(max)", nullable: false),
DateDelivery = table.Column<DateTime>(type: "datetime2", nullable: false),
Subject = table.Column<string>(type: "nvarchar(max)", nullable: false),
Body = table.Column<string>(type: "nvarchar(max)", nullable: false),
IsRead = table.Column<bool>(type: "bit", nullable: false),
ReplyText = table.Column<string>(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( migrationBuilder.CreateTable(
name: "Orders", name: "Orders",
columns: table => new columns: table => new
@ -193,6 +198,11 @@ namespace PlumbingRepairDatabaseImplement.Migrations
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateIndex(
name: "IX_Messages_ClientId",
table: "Messages",
column: "ClientId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Orders_ClientId", name: "IX_Orders_ClientId",
table: "Orders", table: "Orders",

View File

@ -125,6 +125,8 @@ namespace PlumbingRepairDatabaseImplement.Migrations
b.HasKey("MessageId"); b.HasKey("MessageId");
b.HasIndex("ClientId");
b.ToTable("Messages"); b.ToTable("Messages");
}); });
@ -270,6 +272,15 @@ namespace PlumbingRepairDatabaseImplement.Migrations
b.ToTable("WorkComponents"); 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 => modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Order", b =>
{ {
b.HasOne("PlumbingRepairDatabaseImplement.Models.Client", "Client") b.HasOne("PlumbingRepairDatabaseImplement.Models.Client", "Client")
@ -335,6 +346,8 @@ namespace PlumbingRepairDatabaseImplement.Migrations
modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Client", b => modelBuilder.Entity("PlumbingRepairDatabaseImplement.Models.Client", b =>
{ {
b.Navigation("Messages");
b.Navigation("Orders"); b.Navigation("Orders");
}); });

View File

@ -35,6 +35,8 @@ namespace PlumbingRepairDatabaseImplement.Models
public virtual Client? Client { get; set; } public virtual Client? Client { get; set; }
public virtual Client? Client { get; private set; }
public static MessageInfo? Create(MessageInfoBindingModel model) public static MessageInfo? Create(MessageInfoBindingModel model)
{ {
if (model == null) if (model == null)

View File

@ -30,9 +30,9 @@
{ {
this.dataGridView = new System.Windows.Forms.DataGridView(); this.dataGridView = new System.Windows.Forms.DataGridView();
this.panel = new System.Windows.Forms.Panel(); this.panel = new System.Windows.Forms.Panel();
this.buttonOpen = new System.Windows.Forms.Button();
this.buttonForward = new System.Windows.Forms.Button(); this.buttonForward = new System.Windows.Forms.Button();
this.buttonBack = 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(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.panel.SuspendLayout(); this.panel.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
@ -54,7 +54,6 @@
this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dataGridView.Size = new System.Drawing.Size(956, 455); this.dataGridView.Size = new System.Drawing.Size(956, 455);
this.dataGridView.TabIndex = 7; this.dataGridView.TabIndex = 7;
this.dataGridView.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_CellContentClick);
// //
// panel // panel
// //
@ -67,16 +66,6 @@
this.panel.Size = new System.Drawing.Size(183, 455); this.panel.Size = new System.Drawing.Size(183, 455);
this.panel.TabIndex = 8; 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 // buttonForward
// //
this.buttonForward.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 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.UseVisualStyleBackColor = true;
this.buttonBack.Click += new System.EventHandler(this.ButtonBack_Click); 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 // FormMails
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F); this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);

View File

@ -54,10 +54,5 @@ namespace PlumbingRepairView
form.ShowDialog(); form.ShowDialog();
} }
} }
private void dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
} }
} }