diff --git a/SushiBar/SushiBar/FormMails.Designer.cs b/SushiBar/SushiBar/FormMails.Designer.cs
new file mode 100644
index 0000000..610f011
--- /dev/null
+++ b/SushiBar/SushiBar/FormMails.Designer.cs
@@ -0,0 +1,62 @@
+namespace SushiBar
+{
+ partial class FormMails
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.dataGridView = new System.Windows.Forms.DataGridView();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // dataGridView
+ //
+ this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.Location = new System.Drawing.Point(12, 12);
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.RowTemplate.Height = 25;
+ this.dataGridView.Size = new System.Drawing.Size(776, 426);
+ this.dataGridView.TabIndex = 0;
+ //
+ // FormMails
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Controls.Add(this.dataGridView);
+ this.Name = "FormMails";
+ this.Text = "FormMails";
+ this.Load += new System.EventHandler(this.FormMails_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private DataGridView dataGridView;
+ }
+}
\ No newline at end of file
diff --git a/SushiBar/SushiBar/FormMails.cs b/SushiBar/SushiBar/FormMails.cs
new file mode 100644
index 0000000..28ec5f7
--- /dev/null
+++ b/SushiBar/SushiBar/FormMails.cs
@@ -0,0 +1,45 @@
+using Microsoft.Extensions.Logging;
+using SushiBarContracts.BusinessLogicsContracts;
+
+namespace SushiBar
+{
+ public partial class FormMails : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IMessageInfoLogic _logic;
+
+ public FormMails(ILogger logger, IMessageInfoLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ LoadData();
+ }
+
+ private void LoadData()
+ {
+ try
+ {
+ var list = _logic.ReadList(null);
+ if (list != null)
+ {
+ dataGridView.DataSource = list;
+ dataGridView.Columns["ClientId"].Visible = false;
+ dataGridView.Columns["MessageId"].Visible = false;
+ dataGridView.Columns["Body"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
+ }
+ _logger.LogInformation("Load mails");
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Error on load mails");
+ MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void FormMails_Load(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+ }
+}
diff --git a/SushiBar/SushiBar/FormMails.resx b/SushiBar/SushiBar/FormMails.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/SushiBar/SushiBar/FormMails.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/SushiBar/SushiBar/FormMain.Designer.cs b/SushiBar/SushiBar/FormMain.Designer.cs
index 1e0a78c..2b138f9 100644
--- a/SushiBar/SushiBar/FormMain.Designer.cs
+++ b/SushiBar/SushiBar/FormMain.Designer.cs
@@ -45,6 +45,7 @@
this.buttonReady = new System.Windows.Forms.Button();
this.buttonIssue = new System.Windows.Forms.Button();
this.buttonReload = new System.Windows.Forms.Button();
+ this.mailsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
@@ -63,7 +64,8 @@
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.directoryToolStripMenuItem,
this.reportsToolStripMenuItem,
- this.startWorkToolStripMenuItem});
+ this.startWorkToolStripMenuItem,
+ this.mailsToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1421, 24);
@@ -197,6 +199,13 @@
this.buttonReload.UseVisualStyleBackColor = true;
this.buttonReload.Click += new System.EventHandler(this.ButtonReload_Click);
//
+ // mailsToolStripMenuItem
+ //
+ this.mailsToolStripMenuItem.Name = "mailsToolStripMenuItem";
+ this.mailsToolStripMenuItem.Size = new System.Drawing.Size(47, 20);
+ this.mailsToolStripMenuItem.Text = "Mails";
+ this.mailsToolStripMenuItem.Click += new System.EventHandler(this.MailsToolStripMenuItem_Click);
+ //
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
@@ -240,5 +249,6 @@
private ToolStripMenuItem clientsToolStripMenuItem;
private ToolStripMenuItem startWorkToolStripMenuItem;
private ToolStripMenuItem implementersToolStripMenuItem;
+ private ToolStripMenuItem mailsToolStripMenuItem;
}
}
\ No newline at end of file
diff --git a/SushiBar/SushiBar/FormMain.cs b/SushiBar/SushiBar/FormMain.cs
index f1a2fb4..eadfcba 100644
--- a/SushiBar/SushiBar/FormMain.cs
+++ b/SushiBar/SushiBar/FormMain.cs
@@ -240,5 +240,14 @@ namespace SushiBar
form.ShowDialog();
}
}
+
+ private void MailsToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormMails));
+ if (service is FormMails form)
+ {
+ form.ShowDialog();
+ }
+ }
}
}
diff --git a/SushiBar/SushiBar/Program.cs b/SushiBar/SushiBar/Program.cs
index 5974d02..2a63d55 100644
--- a/SushiBar/SushiBar/Program.cs
+++ b/SushiBar/SushiBar/Program.cs
@@ -94,6 +94,7 @@ namespace SushiBar
services.AddTransient();
services.AddTransient();
services.AddTransient();
+ services.AddTransient();
}
private static void MailCheck(object obj) => ServiceProvider?.GetService()?.MailCheck();
diff --git a/SushiBar/SushiBarDatabaseImplement/Migrations/20230423155623_lab7.Designer.cs b/SushiBar/SushiBarDatabaseImplement/Migrations/20230423155623_lab7.Designer.cs
new file mode 100644
index 0000000..1537609
--- /dev/null
+++ b/SushiBar/SushiBarDatabaseImplement/Migrations/20230423155623_lab7.Designer.cs
@@ -0,0 +1,290 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using SushiBarDatabaseImplement;
+
+#nullable disable
+
+namespace SushiBarDatabaseImplement.Migrations
+{
+ [DbContext(typeof(SushiBarDatabase))]
+ [Migration("20230423155623_lab7")]
+ partial class lab7
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "7.0.3")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("SushiBarDatabaseImplement.Models.Client", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("ClientFio")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Clients");
+ });
+
+ modelBuilder.Entity("SushiBarDatabaseImplement.Models.Component", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("ComponentName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Cost")
+ .HasColumnType("float");
+
+ b.HasKey("Id");
+
+ b.ToTable("Components");
+ });
+
+ modelBuilder.Entity("SushiBarDatabaseImplement.Models.Implementer", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("ImplementerFio")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Qualification")
+ .HasColumnType("int");
+
+ b.Property("WorkExperience")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("Implementers");
+ });
+
+ modelBuilder.Entity("SushiBarDatabaseImplement.Models.Message", b =>
+ {
+ b.Property("MessageId")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Body")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ClientId")
+ .HasColumnType("int");
+
+ b.Property("DateDelivery")
+ .HasColumnType("datetime2");
+
+ b.Property("SenderName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Subject")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("MessageId");
+
+ b.HasIndex("ClientId");
+
+ b.ToTable("Messages");
+ });
+
+ modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("ClientId")
+ .HasColumnType("int");
+
+ b.Property("Count")
+ .HasColumnType("int");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateImplement")
+ .HasColumnType("datetime2");
+
+ b.Property("ImplementerId")
+ .HasColumnType("int");
+
+ b.Property("Status")
+ .HasColumnType("int");
+
+ b.Property("Sum")
+ .HasColumnType("float");
+
+ b.Property("SushiId")
+ .HasColumnType("int");
+
+ b.Property("SushiName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClientId");
+
+ b.HasIndex("ImplementerId");
+
+ b.HasIndex("SushiId");
+
+ b.ToTable("Orders");
+ });
+
+ modelBuilder.Entity("SushiBarDatabaseImplement.Models.Sushi", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Price")
+ .HasColumnType("float");
+
+ b.Property("SushiName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Sushi");
+ });
+
+ modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiComponent", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("ComponentId")
+ .HasColumnType("int");
+
+ b.Property("Count")
+ .HasColumnType("int");
+
+ b.Property("SushiId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ComponentId");
+
+ b.HasIndex("SushiId");
+
+ b.ToTable("SushiComponents");
+ });
+
+ modelBuilder.Entity("SushiBarDatabaseImplement.Models.Message", b =>
+ {
+ b.HasOne("SushiBarDatabaseImplement.Models.Client", "Client")
+ .WithMany()
+ .HasForeignKey("ClientId");
+
+ b.Navigation("Client");
+ });
+
+ modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b =>
+ {
+ b.HasOne("SushiBarDatabaseImplement.Models.Client", "Client")
+ .WithMany()
+ .HasForeignKey("ClientId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("SushiBarDatabaseImplement.Models.Implementer", "Implementer")
+ .WithMany()
+ .HasForeignKey("ImplementerId");
+
+ b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi")
+ .WithMany("Orders")
+ .HasForeignKey("SushiId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Client");
+
+ b.Navigation("Implementer");
+
+ b.Navigation("Sushi");
+ });
+
+ modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiComponent", b =>
+ {
+ b.HasOne("SushiBarDatabaseImplement.Models.Component", "Component")
+ .WithMany("SushiComponent")
+ .HasForeignKey("ComponentId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi")
+ .WithMany("Components")
+ .HasForeignKey("SushiId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Component");
+
+ b.Navigation("Sushi");
+ });
+
+ modelBuilder.Entity("SushiBarDatabaseImplement.Models.Component", b =>
+ {
+ b.Navigation("SushiComponent");
+ });
+
+ modelBuilder.Entity("SushiBarDatabaseImplement.Models.Sushi", b =>
+ {
+ b.Navigation("Components");
+
+ b.Navigation("Orders");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/SushiBar/SushiBarDatabaseImplement/Migrations/20230423155623_lab7.cs b/SushiBar/SushiBarDatabaseImplement/Migrations/20230423155623_lab7.cs
new file mode 100644
index 0000000..e07a88d
--- /dev/null
+++ b/SushiBar/SushiBarDatabaseImplement/Migrations/20230423155623_lab7.cs
@@ -0,0 +1,49 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace SushiBarDatabaseImplement.Migrations
+{
+ ///
+ public partial class lab7 : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ 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)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Messages", x => x.MessageId);
+ table.ForeignKey(
+ name: "FK_Messages_Clients_ClientId",
+ column: x => x.ClientId,
+ principalTable: "Clients",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Messages_ClientId",
+ table: "Messages",
+ column: "ClientId");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "Messages");
+ }
+ }
+}
diff --git a/SushiBar/SushiBarDatabaseImplement/Migrations/SushiDatabaseModelSnapshot.cs b/SushiBar/SushiBarDatabaseImplement/Migrations/SushiDatabaseModelSnapshot.cs
index 5b4af9c..78bad80 100644
--- a/SushiBar/SushiBarDatabaseImplement/Migrations/SushiDatabaseModelSnapshot.cs
+++ b/SushiBar/SushiBarDatabaseImplement/Migrations/SushiDatabaseModelSnapshot.cs
@@ -94,6 +94,36 @@ namespace SushiBarDatabaseImplement.Migrations
b.ToTable("Implementers");
});
+ modelBuilder.Entity("SushiBarDatabaseImplement.Models.Message", b =>
+ {
+ b.Property("MessageId")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Body")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ClientId")
+ .HasColumnType("int");
+
+ b.Property("DateDelivery")
+ .HasColumnType("datetime2");
+
+ b.Property("SenderName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Subject")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("MessageId");
+
+ b.HasIndex("ClientId");
+
+ b.ToTable("Messages");
+ });
+
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b =>
{
b.Property("Id")
@@ -187,6 +217,15 @@ namespace SushiBarDatabaseImplement.Migrations
b.ToTable("SushiComponents");
});
+ modelBuilder.Entity("SushiBarDatabaseImplement.Models.Message", b =>
+ {
+ b.HasOne("SushiBarDatabaseImplement.Models.Client", "Client")
+ .WithMany()
+ .HasForeignKey("ClientId");
+
+ b.Navigation("Client");
+ });
+
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b =>
{
b.HasOne("SushiBarDatabaseImplement.Models.Client", "Client")