diff --git a/BlacksmithWorkshop/BlackmithWorkshopRestApi/Program.cs b/BlacksmithWorkshop/BlackmithWorkshopRestApi/Program.cs index be69574..37a7774 100644 --- a/BlacksmithWorkshop/BlackmithWorkshopRestApi/Program.cs +++ b/BlacksmithWorkshop/BlackmithWorkshopRestApi/Program.cs @@ -17,11 +17,15 @@ builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); builder.Services.AddSingleton(); diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs index 8e5792e..ff8d08c 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs @@ -51,6 +51,7 @@ clientsToolStripMenuItem = new ToolStripMenuItem(); startWorkToolStripMenuItem = new ToolStripMenuItem(); buttonSellManufacture = new Button(); + messageToolStripMenuItem = new ToolStripMenuItem(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); menuStrip.SuspendLayout(); SuspendLayout(); @@ -206,7 +207,7 @@ // // работаСКлиентамиToolStripMenuItem // - работаСКлиентамиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { clientsToolStripMenuItem }); + работаСКлиентамиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { clientsToolStripMenuItem, messageToolStripMenuItem }); работаСКлиентамиToolStripMenuItem.Name = "работаСКлиентамиToolStripMenuItem"; работаСКлиентамиToolStripMenuItem.Size = new Size(161, 24); работаСКлиентамиToolStripMenuItem.Text = "Работа с клиентами"; @@ -235,6 +236,13 @@ buttonSellManufacture.UseVisualStyleBackColor = true; buttonSellManufacture.Click += ButtonSellManufacture_Click; // + // messageToolStripMenuItem + // + messageToolStripMenuItem.Name = "messageToolStripMenuItem"; + messageToolStripMenuItem.Size = new Size(224, 26); + messageToolStripMenuItem.Text = "Письма"; + messageToolStripMenuItem.Click += MessageToolStripMenuItem_Click; + // // FormMain // AutoScaleDimensions = new SizeF(8F, 20F); @@ -282,5 +290,6 @@ private ToolStripMenuItem работаСКлиентамиToolStripMenuItem; private ToolStripMenuItem clientsToolStripMenuItem; private ToolStripMenuItem startWorkToolStripMenuItem; + private ToolStripMenuItem messageToolStripMenuItem; } } \ No newline at end of file diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs index 6f379a7..4a71720 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs @@ -259,5 +259,15 @@ namespace BlacksmithWorkshop form.ShowDialog(); } } + + private void MessageToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormMails)); + + if (service is FormMails form) + { + form.ShowDialog(); + } + } } } \ No newline at end of file diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs b/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs index 1fe988e..d7d49d5 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs @@ -72,6 +72,7 @@ namespace BlacksmithWorkshop services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); @@ -80,8 +81,10 @@ namespace BlacksmithWorkshop services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); + services.AddSingleton(); services.AddTransient(); services.AddTransient(); @@ -105,6 +108,9 @@ namespace BlacksmithWorkshop services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); } + + private static void MailCheck(object obj) => ServiceProvider?.GetService()?.MailCheck(); } } \ No newline at end of file diff --git a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BlacksmithWorkshopBusinessLogic.csproj b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BlacksmithWorkshopBusinessLogic.csproj index ddb62a9..40f0332 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BlacksmithWorkshopBusinessLogic.csproj +++ b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BlacksmithWorkshopBusinessLogic.csproj @@ -8,6 +8,7 @@ + diff --git a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/OrderLogic.cs b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/OrderLogic.cs index 609c0de..0ab2678 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/OrderLogic.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/OrderLogic.cs @@ -25,12 +25,18 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic private readonly IManufactureStorage _manufactureStorage; - public OrderLogic(ILogger logger, IOrderStorage orderStorage, IShopLogic shopLogic, IManufactureStorage manufactureStorage) + private readonly IClientLogic _clientLogic; + + private readonly AbstractMailWorker _mailWorker; + + public OrderLogic(ILogger logger, IOrderStorage orderStorage, IShopLogic shopLogic, IManufactureStorage manufactureStorage, IClientLogic clientLogic, AbstractMailWorker mailWorker) { _logger = logger; _orderStorage = orderStorage; _shopLogic = shopLogic; _manufactureStorage = manufactureStorage; + _clientLogic = clientLogic; + _mailWorker = mailWorker; } //вывод отфильтрованного списка компонентов diff --git a/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/DataFileSingleton.cs b/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/DataFileSingleton.cs index 75592b1..3e8bade 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/DataFileSingleton.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/DataFileSingleton.cs @@ -24,6 +24,8 @@ namespace BlacksmithWorkshopFileImplement private readonly string ImplementerFileName = "Implementer.xml"; + private readonly string MessageFileName = "Message.xml"; + public List WorkPieces { get; private set; } public List Orders { get; private set; } @@ -36,6 +38,8 @@ namespace BlacksmithWorkshopFileImplement public List Implementers { get; private set; } + public List Messages { get; private set; } + public static DataFileSingleton GetInstance() { if (instance == null) @@ -58,6 +62,8 @@ namespace BlacksmithWorkshopFileImplement public void SaveImplementers() => SaveData(Implementers, ImplementerFileName, "Implementers", x => x.GetXElement); + public void SaveMessages() => SaveData(Messages, MessageFileName, "Messages", x => x.GetXElement); + private DataFileSingleton() { WorkPieces = LoadData(WorkPieceFileName, "WorkPiece", x => WorkPiece.Create(x)!)!;