Syncher fix

This commit is contained in:
Mikhail Kuznetsov
2023-06-05 16:28:36 +10:00
parent 730293f9fa
commit 8a72550ff0
12 changed files with 290 additions and 21 deletions

View File

@@ -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;
// }
//}
}
}