Теперь точно готово

This commit is contained in:
gg12 darfren 2024-04-30 12:52:50 +04:00
parent 2e5c36d63b
commit 269964f62d
4 changed files with 34 additions and 28 deletions

View File

@ -70,38 +70,42 @@ namespace IceCreamShop
option.SetMinimumLevel(LogLevel.Information);
option.AddNLog("nlog.config");
});
services.AddSingleton<AbstractMailWorker, MailKitWorker>();
services.AddTransient<IComponentStorage, ComponentStorage>();
services.AddTransient<IOrderStorage, OrderStorage>();
services.AddTransient<IIceCreamStorage, IceCreamStorage>();
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IReportLogic, ReportLogic>();
services.AddTransient<IIceCreamLogic, IceCreamLogic>();
services.AddTransient<IImplementerLogic, ImplementerLogic>();
services.AddTransient<IOrderStorage, OrderStorage>();
services.AddTransient<IImplementerStorage, ImplementerStorage>();
services.AddTransient<IIceCreamStorage, IceCreamStorage>();
services.AddTransient<IClientStorage, ClientStorage>();
services.AddTransient<IMessageInfoStorage, MessageInfoStorage>();
services.AddTransient<IClientLogic, ClientLogic>();
services.AddTransient<IClientStorage, ClientStorage>();
services.AddTransient<IImplementerLogic, ImplementerLogic>();
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IIceCreamLogic, IceCreamLogic>();
services.AddTransient<IReportLogic, ReportLogic>();
services.AddTransient<IWorkProcess, WorkModeling>();
services.AddTransient<IMessageInfoLogic, MessageInfoLogic>();
services.AddTransient<IMessageInfoStorage, MessageInfoStorage>();
services.AddSingleton<AbstractMailWorker, MailKitWorker>();
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
services.AddTransient<AbstractSaveToWord, SaveToWord>();
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
services.AddTransient<MainForm>();
services.AddTransient<ViewMailForm>();
services.AddTransient<ComponentForm>();
services.AddTransient<ComponentsForm>();
services.AddTransient<OrderForm>();
services.AddTransient<IceCreamForm>();
services.AddTransient<ImplementersForm>();
services.AddTransient<ImplementerForm>();
services.AddTransient<ImplementersForm>();
services.AddTransient<ClientsForm>();
services.AddTransient<IceCreamComponentForm>();
services.AddTransient<IceCreamsForm>();
services.AddTransient<ReportIceCreamComponentForm>();
services.AddTransient<ReportOrdersForm>();
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
services.AddTransient<AbstractSaveToWord, SaveToWord>();
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
}
services.AddTransient<ComponentForm>();
services.AddTransient<ComponentLogic>();
services.AddTransient<OrderForm>();
services.AddTransient<IceCreamForm>();
services.AddTransient<IceCreamComponentForm>();
services.AddTransient<IceCreamsForm>();
services.AddTransient<ReportIceCreamComponentForm>();
services.AddTransient<ReportOrdersForm>();
services.AddTransient<ViewMailForm>();
}
private static void MailCheck(object obj) =>
ServiceProvider?.GetService<AbstractMailWorker>()?.MailCheck();

View File

@ -39,7 +39,7 @@ namespace IceCreamShopDatabaseImplement.Implements
public MessageInfoViewModel? Insert(MessageInfoBindingModel model)
{
using var context = new IceCreamShopDataBase();
var newMessage = MessageInfo.Create(model);
var newMessage = MessageInfo.Create(context, model);
if (newMessage == null || context.Messages.Any(x => x.MessageId.Equals(model.MessageId)))
{
return null;

View File

@ -22,7 +22,7 @@ namespace IceCreamShopDatabaseImplement.Models
public Client? Client { get; private set; }
public static MessageInfo? Create(MessageInfoBindingModel model)
public static MessageInfo? Create(IceCreamShopDataBase context, MessageInfoBindingModel model)
{
if (model == null)
{
@ -32,7 +32,8 @@ namespace IceCreamShopDatabaseImplement.Models
{
Body = model.Body,
Subject = model.Subject,
ClientId = model.ClientId,
ClientId = context.Clients.FirstOrDefault(x => x.Email == model.SenderName).Id,
Client = context.Clients.FirstOrDefault(x => x.Email == model.SenderName),
MessageId = model.MessageId,
SenderName = model.SenderName,
DateDelivery = model.DateDelivery,

View File

@ -21,7 +21,8 @@ builder.Services.AddTransient<IClientLogic, ClientLogic>();
builder.Services.AddTransient<IIceCreamLogic, IceCreamLogic>();
builder.Services.AddTransient<IImplementerLogic, ImplementerLogic>();
builder.Services.AddTransient<IMessageInfoLogic, MessageInfoLogic>();
builder.Services.AddTransient<AbstractMailWorker, MailKitWorker>();
builder.Services.AddSingleton<AbstractMailWorker, MailKitWorker>();
builder.Services.AddControllers();