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

View File

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

View File

@ -97,7 +97,7 @@ namespace SecuritySystemBusinessLogic.BusinessLogic
return false; 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; return true;
} }
@ -213,7 +213,7 @@ namespace SecuritySystemBusinessLogic.BusinessLogic
return false; return false;
} }
SendOrderMessage(result.ClientId, $"Кузнечаня мастерская, Заказ №{result.Id}", $"Заказ №{model.Id} изменен статус на {result.Status}"); SendOrderMessage(result.ClientId, $"SecuritySystem, Заказ №{result.Id}", $"Заказ №{model.Id} изменен статус на {result.Status}");
return true; return true;
} }

View File

@ -12,7 +12,7 @@ using SecuritySystemDatabaseImplement;
namespace SecuritySystemDatabaseImplement.Migrations namespace SecuritySystemDatabaseImplement.Migrations
{ {
[DbContext(typeof(SecuritySystemDatabase))] [DbContext(typeof(SecuritySystemDatabase))]
[Migration("20240508043144_Init")] [Migration("20240522072007_Init")]
partial class Init partial class Init
{ {
/// <inheritdoc /> /// <inheritdoc />
@ -77,6 +77,36 @@ namespace SecuritySystemDatabaseImplement.Migrations
b.ToTable("Implementers"); 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 => modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Order", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@ -186,6 +216,15 @@ namespace SecuritySystemDatabaseImplement.Migrations
b.ToTable("Sensors"); 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 => modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Order", b =>
{ {
b.HasOne("SecuritySystemDatabaseImplement.Models.Client", "Client") b.HasOne("SecuritySystemDatabaseImplement.Models.Client", "Client")
@ -232,6 +271,8 @@ namespace SecuritySystemDatabaseImplement.Migrations
modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Client", b => modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Client", b =>
{ {
b.Navigation("MessageInfos");
b.Navigation("Orders"); b.Navigation("Orders");
}); });

View File

@ -70,6 +70,27 @@ namespace SecuritySystemDatabaseImplement.Migrations
table.PrimaryKey("PK_Sensors", x => x.Id); 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( migrationBuilder.CreateTable(
name: "Orders", name: "Orders",
columns: table => new columns: table => new
@ -134,6 +155,11 @@ namespace SecuritySystemDatabaseImplement.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",
@ -163,6 +189,9 @@ namespace SecuritySystemDatabaseImplement.Migrations
/// <inheritdoc /> /// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropTable(
name: "Messages");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Orders"); name: "Orders");

View File

@ -74,6 +74,36 @@ namespace SecuritySystemDatabaseImplement.Migrations
b.ToTable("Implementers"); 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 => modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Order", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@ -183,6 +213,15 @@ namespace SecuritySystemDatabaseImplement.Migrations
b.ToTable("Sensors"); 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 => modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Order", b =>
{ {
b.HasOne("SecuritySystemDatabaseImplement.Models.Client", "Client") b.HasOne("SecuritySystemDatabaseImplement.Models.Client", "Client")
@ -229,6 +268,8 @@ namespace SecuritySystemDatabaseImplement.Migrations
modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Client", b => modelBuilder.Entity("SecuritySystemDatabaseImplement.Models.Client", b =>
{ {
b.Navigation("MessageInfos");
b.Navigation("Orders"); b.Navigation("Orders");
}); });

View File

@ -15,7 +15,7 @@ namespace SecuritySystemDatabaseImplement
{ {
if (optionsBuilder.IsConfigured == false) 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> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
@ -16,4 +16,8 @@
<ProjectReference Include="..\SecuritySystemDataModels\SecuritySystemDataModels.csproj" /> <ProjectReference Include="..\SecuritySystemDataModels\SecuritySystemDataModels.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>
</Project> </Project>

View File

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