7 лаба исправления

This commit is contained in:
spacyboy 2024-05-22 18:56:53 +04:00
parent 4ae8ee3e9f
commit 5eaa15c044
10 changed files with 512 additions and 389 deletions

View File

@ -5,7 +5,7 @@
<add key="SmtpClientPort" value="587" />
<add key="PopHost" value="pop.gmail.com" />
<add key="PopPort" value="995" />
<add key="MailLogin" value="spaccyy@mail.com" />
<add key="MailPassword" value="123" />
<add key="MailLogin" value="rpplabss@gmail.com" />
<add key="MailPassword" value="fcwf gdjw zooy ehpq" />
</appSettings>
</configuration>

View File

@ -45,6 +45,7 @@
buttonCreateOrder = new Button();
buttonRef = new Button();
buttonIssuedOrder = new Button();
письмаToolStripMenuItem = new ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
menuStrip1.SuspendLayout();
SuspendLayout();
@ -73,7 +74,7 @@
//
// toolStripMenuItem
//
toolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { SensorToolStripMenuItem, SecureToolStripMenuItem });
toolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { SensorToolStripMenuItem, SecureToolStripMenuItem, письмаToolStripMenuItem });
toolStripMenuItem.Name = "toolStripMenuItem";
toolStripMenuItem.Size = new Size(94, 20);
toolStripMenuItem.Text = "Справочники";
@ -81,14 +82,14 @@
// SensorToolStripMenuItem
//
SensorToolStripMenuItem.Name = "SensorToolStripMenuItem";
SensorToolStripMenuItem.Size = new Size(130, 22);
SensorToolStripMenuItem.Size = new Size(180, 22);
SensorToolStripMenuItem.Text = "Заготовки";
SensorToolStripMenuItem.Click += SensorToolStripMenuItem_Click;
//
// SecureToolStripMenuItem
//
SecureToolStripMenuItem.Name = "SecureToolStripMenuItem";
SecureToolStripMenuItem.Size = new Size(130, 22);
SecureToolStripMenuItem.Size = new Size(180, 22);
SecureToolStripMenuItem.Text = "Изделия";
SecureToolStripMenuItem.Click += SecureToolStripMenuItem_Click;
//
@ -144,7 +145,7 @@
// implementerToolStripMenuItem
//
implementerToolStripMenuItem.Name = "implementerToolStripMenuItem";
implementerToolStripMenuItem.Size = new Size(180, 22);
implementerToolStripMenuItem.Size = new Size(149, 22);
implementerToolStripMenuItem.Text = "Исполнители";
implementerToolStripMenuItem.Click += ImplementerToolStripMenuItem_Click;
//
@ -188,6 +189,13 @@
buttonIssuedOrder.UseVisualStyleBackColor = true;
buttonIssuedOrder.Click += ButtonIssuedOrder_Click;
//
// письмаToolStripMenuItem
//
письмаToolStripMenuItem.Name = "письмаToolStripMenuItem";
письмаToolStripMenuItem.Size = new Size(180, 22);
письмаToolStripMenuItem.Text = "Письма";
письмаToolStripMenuItem.Click += MailsToolStripMenuItem_Click;
//
// FormMain
//
AutoScaleDimensions = new SizeF(7F, 15F);
@ -226,5 +234,6 @@
private Button buttonCreateOrder;
private Button buttonRef;
private Button buttonIssuedOrder;
private ToolStripMenuItem письмаToolStripMenuItem;
}
}

View File

@ -97,7 +97,7 @@ namespace SecuritySystemBusinessLogic.BusinessLogic
return false;
}
SendOrderMessage(result.ClientId, $"Кузнечная мастерская, Заказ №{result.Id}", $"Заказ №{result.Id} от {result.DateCreate} на сумму {result.Sum:0.00} принят");
SendOrderMessage(result.ClientId, $"SecuritySystem, Заказ №{result.Id}", $"Заказ №{result.Id} от {result.DateCreate} на сумму {result.Sum:0.00} принят");
return true;
}
@ -213,7 +213,7 @@ namespace SecuritySystemBusinessLogic.BusinessLogic
return false;
}
SendOrderMessage(result.ClientId, $"Кузнечаня мастерская, Заказ №{result.Id}", $"Заказ №{model.Id} изменен статус на {result.Status}");
SendOrderMessage(result.ClientId, $"SecuritySystem, Заказ №{result.Id}", $"Заказ №{model.Id} изменен статус на {result.Status}");
return true;
}

View File

@ -12,7 +12,7 @@ using SecuritySystemDatabaseImplement;
namespace SecuritySystemDatabaseImplement.Migrations
{
[DbContext(typeof(SecuritySystemDatabase))]
[Migration("20240508043144_Init")]
[Migration("20240522072007_Init")]
partial class Init
{
/// <inheritdoc />
@ -77,6 +77,36 @@ namespace SecuritySystemDatabaseImplement.Migrations
b.ToTable("Implementers");
});
modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.MessageInfo", b =>
{
b.Property<string>("MessageId")
.HasColumnType("nvarchar(450)");
b.Property<string>("Body")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int?>("ClientId")
.HasColumnType("int");
b.Property<DateTime>("DateDelivery")
.HasColumnType("datetime2");
b.Property<string>("SenderName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Subject")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("MessageId");
b.HasIndex("ClientId");
b.ToTable("Messages");
});
modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Order", b =>
{
b.Property<int>("Id")
@ -186,6 +216,15 @@ namespace SecuritySystemDatabaseImplement.Migrations
b.ToTable("Sensors");
});
modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.MessageInfo", b =>
{
b.HasOne("SecuritySystemDatabaseImplement.Models.Client", "Client")
.WithMany("MessageInfos")
.HasForeignKey("ClientId");
b.Navigation("Client");
});
modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Order", b =>
{
b.HasOne("SecuritySystemDatabaseImplement.Models.Client", "Client")
@ -232,6 +271,8 @@ namespace SecuritySystemDatabaseImplement.Migrations
modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Client", b =>
{
b.Navigation("MessageInfos");
b.Navigation("Orders");
});

View File

@ -70,6 +70,27 @@ namespace SecuritySystemDatabaseImplement.Migrations
table.PrimaryKey("PK_Sensors", 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)
},
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
@ -134,6 +155,11 @@ namespace SecuritySystemDatabaseImplement.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Messages_ClientId",
table: "Messages",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_Orders_ClientId",
table: "Orders",
@ -163,6 +189,9 @@ namespace SecuritySystemDatabaseImplement.Migrations
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Messages");
migrationBuilder.DropTable(
name: "Orders");

View File

@ -74,6 +74,36 @@ namespace SecuritySystemDatabaseImplement.Migrations
b.ToTable("Implementers");
});
modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.MessageInfo", b =>
{
b.Property<string>("MessageId")
.HasColumnType("nvarchar(450)");
b.Property<string>("Body")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int?>("ClientId")
.HasColumnType("int");
b.Property<DateTime>("DateDelivery")
.HasColumnType("datetime2");
b.Property<string>("SenderName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Subject")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("MessageId");
b.HasIndex("ClientId");
b.ToTable("Messages");
});
modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Order", b =>
{
b.Property<int>("Id")
@ -183,6 +213,15 @@ namespace SecuritySystemDatabaseImplement.Migrations
b.ToTable("Sensors");
});
modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.MessageInfo", b =>
{
b.HasOne("SecuritySystemDatabaseImplement.Models.Client", "Client")
.WithMany("MessageInfos")
.HasForeignKey("ClientId");
b.Navigation("Client");
});
modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Order", b =>
{
b.HasOne("SecuritySystemDatabaseImplement.Models.Client", "Client")
@ -229,6 +268,8 @@ namespace SecuritySystemDatabaseImplement.Migrations
modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Client", b =>
{
b.Navigation("MessageInfos");
b.Navigation("Orders");
});

View File

@ -15,7 +15,7 @@ namespace SecuritySystemDatabaseImplement
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseSqlServer(@"Data Source=WIN-GKU3FFNUNO6;Initial Catalog=SecuritySystemDatabase;Integrated Security=True;MultipleActiveResultSets=True;TrustServerCertificate=True");
optionsBuilder.UseSqlServer(@"Data Source=WIN-GKU3FFNUNO6;Initial Catalog=SecuritySystemDatabase7;Integrated Security=True;MultipleActiveResultSets=True;TrustServerCertificate=True");
}

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
@ -16,4 +16,8 @@
<ProjectReference Include="..\SecuritySystemDataModels\SecuritySystemDataModels.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>
</Project>

View File

@ -6,11 +6,10 @@
}
},
"AllowedHosts": "*",
"SmtpClientHost": "smtp.gmail.com",
"SmtpClientPort": "587",
"PopHost": "pop.gmail.com",
"PopPort": "995",
"MailLogin": "spaccyy@mail.ru",
"MailPassword": "123"
"MailLogin": "rpplabss@gmail.com",
"MailPassword": "fcwf gdjw zooy ehpq"
}