feat(dal,aihitLoader,aihitSyncer): добавлены новые типы программного обеспечения. При синхронизации хосты находятся по имени ЭК вместо IP-адерса
This commit is contained in:
@@ -21,73 +21,40 @@ namespace PARR.DAL.Services.Implementations
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
public async Task<Host?> GetHostWithAppsAsync(string IP)
|
||||
{
|
||||
|
||||
//try
|
||||
//{
|
||||
// var host = await EntitySet.FirstAsync(h => h.IP == IP && h.RegionalEK == RegionalEK);
|
||||
// return host;
|
||||
//}
|
||||
//catch
|
||||
//{
|
||||
// logger.LogInformation($"Не найден узел с IP адресом {IP} и региональным ЭК {RegionalEK}");
|
||||
// return null;
|
||||
//}
|
||||
return await EntitySet
|
||||
.Include(t => t.ApplicationsInHosts).ThenInclude(a => a.Application).ThenInclude(t => t!.ApplicationType)
|
||||
public async Task<Host?> GetHostWithAppsByIpAsync(string ip)
|
||||
{
|
||||
return await GetHostWithIncludeApps()
|
||||
.AsSplitQuery()
|
||||
.FirstOrDefaultAsync(h => h.IP == IP);
|
||||
.FirstOrDefaultAsync(h => h.IP == ip);
|
||||
}
|
||||
|
||||
|
||||
public async Task<Host?> GetHostWithAppsByEkAsync(string ek)
|
||||
{
|
||||
return await GetHostWithIncludeApps()
|
||||
.AsSplitQuery()
|
||||
.FirstOrDefaultAsync(h => h.Ek.ToLower() == ek.ToLower());
|
||||
}
|
||||
|
||||
|
||||
private IQueryable<Host> GetHostWithIncludeApps()
|
||||
{
|
||||
return EntitySet.Include(t => t.ApplicationsInHosts).ThenInclude(a => a.Application).ThenInclude(t => t!.ApplicationType);
|
||||
}
|
||||
|
||||
|
||||
public async Task<Host?> GetByIpAsync(string ip)
|
||||
{
|
||||
return await EntitySet.FirstOrDefaultAsync(t => t.IP == ip);
|
||||
}
|
||||
|
||||
//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;
|
||||
public async Task<Host?> GetByEkAsync(string ek)
|
||||
{
|
||||
return await EntitySet.FirstOrDefaultAsync(t => t.Ek.ToLower() == ek.ToLower());
|
||||
}
|
||||
|
||||
// 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