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

58 lines
1.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using SecurityContract.Logics;
using SecurityContract.Services;
using System;
using ToolsModule.ManagmentEntity;
using ToolsModule.ManagmentSecurity;
namespace SecurityBusinessLogic.BusinessLogics
{
/// <summary>
/// Логика синхронизации пользователей
/// </summary>
public class SynchronizationBusinessLogic : CoreBusinessLogic, ISynchronizationLogic
{
/// <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;
}
}
}
}