From 0b2f2fa6aa0339c7dd3dedc01476c16dc112bb15 Mon Sep 17 00:00:00 2001 From: "ns.potapov" Date: Sun, 5 May 2024 20:50:26 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=84=D0=BE=D1=80=D0=BC=D1=83=20=D0=B4=D0=BB=D1=8F=20=D0=BF?= =?UTF-8?q?=D0=B8=D1=81=D0=B5=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SecuritySystem/SecuritySystemView/App.config | 10 +- .../SecuritySystemView/FormMain.Designer.cs | 11 +- SecuritySystem/SecuritySystemView/FormMain.cs | 10 ++ .../Mail/FormMails.Designer.cs | 66 ++++++++++ .../SecuritySystemView/Mail/FormMails.cs | 42 ++++++ .../SecuritySystemView/Mail/FormMails.resx | 120 ++++++++++++++++++ SecuritySystem/SecuritySystemView/Program.cs | 3 +- 7 files changed, 255 insertions(+), 7 deletions(-) create mode 100644 SecuritySystem/SecuritySystemView/Mail/FormMails.Designer.cs create mode 100644 SecuritySystem/SecuritySystemView/Mail/FormMails.cs create mode 100644 SecuritySystem/SecuritySystemView/Mail/FormMails.resx diff --git a/SecuritySystem/SecuritySystemView/App.config b/SecuritySystem/SecuritySystemView/App.config index f7dfd6a..ef81e19 100644 --- a/SecuritySystem/SecuritySystemView/App.config +++ b/SecuritySystem/SecuritySystemView/App.config @@ -1,11 +1,11 @@  - - - + + + - - + + \ No newline at end of file diff --git a/SecuritySystem/SecuritySystemView/FormMain.Designer.cs b/SecuritySystem/SecuritySystemView/FormMain.Designer.cs index 0845fe2..99c1116 100644 --- a/SecuritySystem/SecuritySystemView/FormMain.Designer.cs +++ b/SecuritySystem/SecuritySystemView/FormMain.Designer.cs @@ -43,6 +43,7 @@ buttonCreateOrder = new Button(); button4 = new Button(); buttonRefresh = new Button(); + почтаToolStripMenuItem = new ToolStripMenuItem(); menuStrip.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); SuspendLayout(); @@ -50,7 +51,7 @@ // menuStrip // menuStrip.ImageScalingSize = new Size(20, 20); - menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, отчетыToolStripMenuItem, запускРаботToolStripMenuItem }); + menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, отчетыToolStripMenuItem, запускРаботToolStripMenuItem, почтаToolStripMenuItem }); menuStrip.Location = new Point(0, 0); menuStrip.Name = "menuStrip"; menuStrip.Size = new Size(1043, 28); @@ -174,6 +175,13 @@ buttonRefresh.UseVisualStyleBackColor = true; buttonRefresh.Click += ButtonRefresh_Click; // + // почтаToolStripMenuItem + // + почтаToolStripMenuItem.Name = "почтаToolStripMenuItem"; + почтаToolStripMenuItem.Size = new Size(65, 24); + почтаToolStripMenuItem.Text = "Почта"; + почтаToolStripMenuItem.Click += MailsToolStripMenuItem_Click; + // // FormMain // AutoScaleDimensions = new SizeF(8F, 20F); @@ -212,5 +220,6 @@ private ToolStripMenuItem клиентыToolStripMenuItem; private ToolStripMenuItem исполнителиToolStripMenuItem; private ToolStripMenuItem запускРаботToolStripMenuItem; + private ToolStripMenuItem почтаToolStripMenuItem; } } \ No newline at end of file diff --git a/SecuritySystem/SecuritySystemView/FormMain.cs b/SecuritySystem/SecuritySystemView/FormMain.cs index b9a58bf..4e7bc1a 100644 --- a/SecuritySystem/SecuritySystemView/FormMain.cs +++ b/SecuritySystem/SecuritySystemView/FormMain.cs @@ -3,6 +3,7 @@ using SecuritySystemContracts.BindingModels; using SecuritySystemContracts.BusinessLogicsContracts; using SecuritySystemView.Client; using SecuritySystemView.Implementer; +using SecuritySystemView.Mail; using SecuritySystemView.Report; namespace SecuritySystemView @@ -213,5 +214,14 @@ namespace SecuritySystemView _workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic); MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); } + + 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/SecuritySystem/SecuritySystemView/Mail/FormMails.Designer.cs b/SecuritySystem/SecuritySystemView/Mail/FormMails.Designer.cs new file mode 100644 index 0000000..b83ec9b --- /dev/null +++ b/SecuritySystem/SecuritySystemView/Mail/FormMails.Designer.cs @@ -0,0 +1,66 @@ +namespace SecuritySystemView.Mail +{ + 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() + { + dataGridView = new DataGridView(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Dock = DockStyle.Fill; + dataGridView.Location = new Point(0, 0); + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersVisible = false; + dataGridView.RowHeadersWidth = 51; + dataGridView.RowTemplate.Height = 29; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(800, 450); + dataGridView.TabIndex = 0; + // + // FormMails + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridView); + Name = "FormMails"; + Text = "Почта"; + Load += FormMails_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView; + } +} \ No newline at end of file diff --git a/SecuritySystem/SecuritySystemView/Mail/FormMails.cs b/SecuritySystem/SecuritySystemView/Mail/FormMails.cs new file mode 100644 index 0000000..d211c93 --- /dev/null +++ b/SecuritySystem/SecuritySystemView/Mail/FormMails.cs @@ -0,0 +1,42 @@ +using Microsoft.Extensions.Logging; +using SecuritySystemContracts.BusinessLogicsContracts; + +namespace SecuritySystemView.Mail +{ + public partial class FormMails : Form + { + private readonly ILogger _logger; + private readonly IMessageInfoLogic _logic; + public FormMails(ILogger logger, IMessageInfoLogic messageInfoLogic) + { + InitializeComponent(); + _logger = logger; + _logic = messageInfoLogic; + } + + private void FormMails_Load(object sender, EventArgs e) + { + LoadData(); + } + private void LoadData() + { + try + { + var list = _logic.ReadList(null); + if (list != null) + { + dataGridView.DataSource = list; + dataGridView.Columns["MessageId"].Visible = false; + dataGridView.Columns["ClientId"].Visible = false; + } + _logger.LogInformation("Загрузка почты"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки почты"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + } +} diff --git a/SecuritySystem/SecuritySystemView/Mail/FormMails.resx b/SecuritySystem/SecuritySystemView/Mail/FormMails.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/SecuritySystem/SecuritySystemView/Mail/FormMails.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/SecuritySystem/SecuritySystemView/Program.cs b/SecuritySystem/SecuritySystemView/Program.cs index 2568ba5..1245f95 100644 --- a/SecuritySystem/SecuritySystemView/Program.cs +++ b/SecuritySystem/SecuritySystemView/Program.cs @@ -11,6 +11,7 @@ using SecuritySystemContracts.StoragesContracts; using SecuritySystemDatabaseImplement.Implements; using SecuritySystemView.Client; using SecuritySystemView.Implementer; +using SecuritySystemView.Mail; using SecuritySystemView.Report; namespace SecuritySystemView @@ -92,7 +93,7 @@ namespace SecuritySystemView services.AddTransient(); services.AddTransient(); services.AddTransient(); - //services.AddTransient(); + services.AddTransient(); } private static void MailCheck(object obj) => ServiceProvider?.GetService()?.MailCheck(); }