Syncher fix
This commit is contained in:
@@ -20,5 +20,64 @@ namespace PARR.DAL.Services.Implementations
|
||||
this.dataContext = dataContext;
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
public async Task<Host?> GetHostByIPAndRegionalEKAsync(string IP, string RegionalEK)
|
||||
{
|
||||
try
|
||||
{
|
||||
var host = await EntitySet.FirstAsync(h => h.IP == IP && h.RegionalEK == RegionalEK);
|
||||
return host;
|
||||
}
|
||||
catch
|
||||
{
|
||||
logger.LogInformation($"Не найден узел с IP адресом {IP} и региональным ЭК {RegionalEK}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
//public async Task<Host?> GetHostByRegionalEKAsync(string RegionalEK)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// var host = await EntitySet.FirstAsync(h => h.RegionalEK == RegionalEK);
|
||||
// return host;
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// logger.LogInformation($"Не найден узел с региональным ЭК {RegionalEK}");
|
||||
// return null;
|
||||
// }
|
||||
//}
|
||||
|
||||
//public async Task<bool> UpdateAsync(Host host)
|
||||
//{
|
||||
// var orig = await EntitySet.FirstAsync(h => h.IP == host.IP);
|
||||
// if (orig == null)
|
||||
// return false;
|
||||
|
||||
// orig.DateModified = DateTimeOffset.UtcNow;
|
||||
// orig.HostName = host.HostName;
|
||||
// orig.RegionalEK = host.RegionalEK;
|
||||
// orig.LinkEK = host.LinkEK;
|
||||
// orig.Status = host.Status;
|
||||
// orig.WorkGroup = host.WorkGroup;
|
||||
// orig.Responsible = host.Responsible;
|
||||
// orig.OS = host.OS;
|
||||
// orig.DB = host.DB;
|
||||
// orig.APP = host.APP;
|
||||
|
||||
// if (!await CommitAsync())
|
||||
// {
|
||||
// logger.LogError($"Ошибка обновления узла {host.IP}");
|
||||
// return false;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// logger.LogInformation($"Обновлен узел {host.IP}");
|
||||
// return true;
|
||||
// }
|
||||
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user