Вроде исправил косяки. Это был писец.

This commit is contained in:
Programmist73 2023-04-30 15:33:03 +04:00
parent cdc858faff
commit 24b5dad676
7 changed files with 44 additions and 2 deletions

View File

@ -17,11 +17,15 @@ builder.Services.AddTransient<IClientStorage, ClientStorage>();
builder.Services.AddTransient<IOrderStorage, OrderStorage>();
builder.Services.AddTransient<IManufactureStorage, ManufactureStorage>();
builder.Services.AddTransient<IShopStorage, ShopStorage>();
builder.Services.AddTransient<IImplementerStorage, ImplementerStorage>();
builder.Services.AddTransient<IMessageInfoStorage, MessageInfoStorage>();
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
builder.Services.AddTransient<IClientLogic, ClientLogic>();
builder.Services.AddTransient<IManufactureLogic, ManufactureLogic>();
builder.Services.AddTransient<IShopLogic, ShopLogic>();
builder.Services.AddTransient<IImplementerLogic, ImplementerLogic>();
builder.Services.AddTransient<IMessageInfoLogic, MessageInfoLogic>();
builder.Services.AddSingleton<AbstractMailWorker, MailKitWorker>();

View File

@ -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;
}
}

View File

@ -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();
}
}
}
}

View File

@ -72,6 +72,7 @@ namespace BlacksmithWorkshop
services.AddTransient<IShopStorage, ShopStorage>();
services.AddTransient<IImplementerStorage, ImplementerStorage>();
services.AddTransient<IClientStorage, ClientStorage>();
services.AddTransient<IMessageInfoStorage, MessageInfoStorage>();
services.AddTransient<IWorkPieceLogic, WorkPieceLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
@ -80,8 +81,10 @@ namespace BlacksmithWorkshop
services.AddTransient<IReportLogic, ReportLogic>();
services.AddTransient<IImplementerLogic, ImplementerLogic>();
services.AddTransient<IClientLogic, ClientLogic>();
services.AddTransient<IMessageInfoLogic, MessageInfoLogic>();
services.AddTransient<IWorkProcess, WorkModeling>();
services.AddSingleton<AbstractMailWorker, MailKitWorker>();
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
services.AddTransient<AbstractSaveToWord, SaveToWord>();
@ -105,6 +108,9 @@ namespace BlacksmithWorkshop
services.AddTransient<FormClients>();
services.AddTransient<FormImplementers>();
services.AddTransient<FormImplementer>();
services.AddTransient<FormMails>();
}
private static void MailCheck(object obj) => ServiceProvider?.GetService<AbstractMailWorker>()?.MailCheck();
}
}

View File

@ -8,6 +8,7 @@
<ItemGroup>
<PackageReference Include="DocumentFormat.OpenXml" Version="2.20.0" />
<PackageReference Include="MailKit" Version="4.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="MigraDocCore.DocumentObjectModel" Version="1.3.49" />
<PackageReference Include="MigraDocCore.Rendering" Version="1.3.49" />

View File

@ -25,12 +25,18 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic
private readonly IManufactureStorage _manufactureStorage;
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, IShopLogic shopLogic, IManufactureStorage manufactureStorage)
private readonly IClientLogic _clientLogic;
private readonly AbstractMailWorker _mailWorker;
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, IShopLogic shopLogic, IManufactureStorage manufactureStorage, IClientLogic clientLogic, AbstractMailWorker mailWorker)
{
_logger = logger;
_orderStorage = orderStorage;
_shopLogic = shopLogic;
_manufactureStorage = manufactureStorage;
_clientLogic = clientLogic;
_mailWorker = mailWorker;
}
//вывод отфильтрованного списка компонентов

View File

@ -24,6 +24,8 @@ namespace BlacksmithWorkshopFileImplement
private readonly string ImplementerFileName = "Implementer.xml";
private readonly string MessageFileName = "Message.xml";
public List<WorkPiece> WorkPieces { get; private set; }
public List<Order> Orders { get; private set; }
@ -36,6 +38,8 @@ namespace BlacksmithWorkshopFileImplement
public List<Implementer> Implementers { get; private set; }
public List<MessageInfo> 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)!)!;