Fixes
This commit is contained in:
parent
6354412e33
commit
251a8440a5
@ -58,6 +58,32 @@ namespace AircraftPlantBusinessLogic.BusinessLogics
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение отдельной записи
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
public MessageInfoViewModel? ReadElement(MessageInfoSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
|
||||
_logger.LogInformation("ReadElement. MessageId:{Id}", model.MessageId);
|
||||
|
||||
var element = _messageStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
|
||||
_logger.LogInformation("ReadElement find. MessageId:{Id}", element.MessageId);
|
||||
return element;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Создание записи
|
||||
/// </summary>
|
||||
|
@ -1,6 +1,7 @@
|
||||
using AircraftPlantBusinessLogic.BusinessLogics;
|
||||
using AircraftPlantContracts.BindingModels;
|
||||
using AircraftPlantContracts.BusinessLogicsContracts;
|
||||
using AircraftPlantContracts.SearchModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -46,22 +47,27 @@ namespace AircraftPlantBusinessLogic.MailWorker
|
||||
/// Порт протокола POP3
|
||||
/// </summary>
|
||||
protected int _popPort;
|
||||
private object _clientLogic;
|
||||
|
||||
/// <summary>
|
||||
/// Бизнес-логика для писем
|
||||
/// </summary>
|
||||
private readonly IMessageInfoLogic _messageInfoLogic;
|
||||
|
||||
/// <summary>
|
||||
/// Бизнес-логика для клиентов
|
||||
/// </summary>
|
||||
private readonly IClientLogic _clientLogic;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="logger"></param>
|
||||
/// <param name="messageInfoLogic"></param>
|
||||
public AbstractMailWorker(ILogger<AbstractMailWorker> logger, IMessageInfoLogic messageInfoLogic)
|
||||
public AbstractMailWorker(ILogger<AbstractMailWorker> logger, IMessageInfoLogic messageInfoLogic, IClientLogic clientLogic)
|
||||
{
|
||||
_logger = logger;
|
||||
_messageInfoLogic = messageInfoLogic;
|
||||
_clientLogic = clientLogic;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -130,6 +136,10 @@ namespace AircraftPlantBusinessLogic.MailWorker
|
||||
|
||||
foreach (var mail in list)
|
||||
{
|
||||
mail.ClientId = _clientLogic.ReadElement(new ClientSearchModel
|
||||
{
|
||||
Email = mail.SenderName
|
||||
})?.Id;
|
||||
_messageInfoLogic.Create(mail);
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,13 @@ namespace AircraftPlantContracts.BusinessLogicsContracts
|
||||
/// <returns></returns>
|
||||
List<MessageInfoViewModel>? ReadList(MessageInfoSearchModel? model);
|
||||
|
||||
/// <summary>
|
||||
/// Получение отдельной записи
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
MessageInfoViewModel? ReadElement(MessageInfoSearchModel model);
|
||||
|
||||
/// <summary>
|
||||
/// Создание записи
|
||||
/// </summary>
|
||||
|
@ -1,5 +1,6 @@
|
||||
using AircraftPlantContracts.BindingModels;
|
||||
using AircraftPlantContracts.SearchModels;
|
||||
using AircraftPlantContracts.StoragesContracts;
|
||||
using AircraftPlantContracts.ViewModels;
|
||||
using AircraftPlantFileImplement.Models;
|
||||
using System;
|
||||
@ -13,7 +14,7 @@ namespace AircraftPlantFileImplement.Implements
|
||||
/// <summary>
|
||||
/// Реализация интерфейса хранилища для писем
|
||||
/// </summary>
|
||||
public class MessageInfoStorage
|
||||
public class MessageInfoStorage : IMessageInfoStorage
|
||||
{
|
||||
/// <summary>
|
||||
/// Хранилище
|
||||
|
Loading…
Reference in New Issue
Block a user