DepartmentProject/DepartmentPortal/Security/SecurityBusinessLogic/BusinessLogics/SynchronizationBusinessLogic.cs

57 lines
1.3 KiB
C#
Raw Normal View History

using ModuleTools.BusinessLogics;
using ModuleTools.Enums;
using SecurityBusinessLogic.Interfaces;
using System;
namespace SecurityBusinessLogic.BusinessLogics
{
/// <summary>
/// Логика синхронизации пользователей
/// </summary>
public class SynchronizationBusinessLogic : CoreBusinessLogic
{
/// <summary>
/// Серивс для работы с бекапом
/// </summary>
private readonly ISynchronizationService _service;
/// <summary>
/// Логика работы с бекапом
/// </summary>
/// <param name="service"></param>
public SynchronizationBusinessLogic(ISynchronizationService service)
{
_service = service;
_serviceOperation = AccessOperation.Синхронизация;
_entity = "Синхронизация";
}
/// <summary>
/// Запуск синхронизации
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool RunSynchronization()
{
try
{
if (NoAccess(null, AccessType.Delete))
{
return false;
}
var result = _service.RunSynchronization();
if (!result.IsSucceeded)
{
Errors.AddRange(result.Errors);
return false;
}
return true;
}
catch (Exception ex)
{
Errors.Add(("Ошибка", ex.Message));
return false;
}
}
}
}