Check import results
This commit is contained in:
@ -1,6 +1,9 @@
|
|||||||
using Hcs.Client.Api.Request;
|
using Hcs.Client.Api.Request;
|
||||||
using Hcs.Client.Api.Request.Adapter;
|
using Hcs.Client.Api.Request.Adapter;
|
||||||
|
using Hcs.Client.Api.Request.Exception;
|
||||||
using Hcs.Service.Async.HouseManagement;
|
using Hcs.Service.Async.HouseManagement;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Hcs.Service.Async.HouseManagement
|
namespace Hcs.Service.Async.HouseManagement
|
||||||
@ -51,5 +54,29 @@ namespace Hcs.Client.Api.Request.HouseManagement
|
|||||||
protected override bool CanBeRestarted => true;
|
protected override bool CanBeRestarted => true;
|
||||||
|
|
||||||
protected override int RestartTimeoutMinutes => 20;
|
protected override int RestartTimeoutMinutes => 20;
|
||||||
|
|
||||||
|
protected getStateResultImportResultCommonResult[] GetCommonResults(IEnumerable<getStateResultImportResult> importResults)
|
||||||
|
{
|
||||||
|
var result = new List<getStateResultImportResultCommonResult>();
|
||||||
|
foreach (var importResult in importResults)
|
||||||
|
{
|
||||||
|
importResult.Items.OfType<ErrorMessageType>().ToList().ForEach(error =>
|
||||||
|
{
|
||||||
|
throw RemoteException.CreateNew(error.ErrorCode, error.Description);
|
||||||
|
});
|
||||||
|
|
||||||
|
var commonResults = importResult.Items.OfType<getStateResultImportResultCommonResult>();
|
||||||
|
foreach (var commonResult in commonResults)
|
||||||
|
{
|
||||||
|
commonResult.Items.OfType<CommonResultTypeError>().ToList().ForEach(error =>
|
||||||
|
{
|
||||||
|
throw RemoteException.CreateNew(error.ErrorCode, error.Description);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
result.AddRange(commonResults);
|
||||||
|
}
|
||||||
|
return [.. result];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,7 +36,17 @@ namespace Hcs.Client.Api.Request.HouseManagement
|
|||||||
throw RemoteException.CreateNew(error.ErrorCode, error.Description);
|
throw RemoteException.CreateNew(error.ErrorCode, error.Description);
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
var importResults = result.Items.OfType<getStateResultImportResult>();
|
||||||
|
var commonResults = GetCommonResults(importResults);
|
||||||
|
foreach (var commonResult in commonResults)
|
||||||
|
{
|
||||||
|
if (commonResult.ItemElementName == ItemChoiceType26.ImportAccount)
|
||||||
|
{
|
||||||
|
return commonResult.Item is getStateResultImportResultCommonResultImportAccount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private importAccountRequestAccount GetAccountFromPayload(ImportAccountDataPayload payload)
|
private importAccountRequestAccount GetAccountFromPayload(ImportAccountDataPayload payload)
|
||||||
|
|||||||
@ -43,6 +43,9 @@ namespace Hcs.Client.Api.Request.HouseManagement
|
|||||||
throw RemoteException.CreateNew(error.ErrorCode, error.Description);
|
throw RemoteException.CreateNew(error.ErrorCode, error.Description);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var importResults = result.Items.OfType<getStateResultImportResult>();
|
||||||
|
var commonResults = GetCommonResults(importResults);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -296,29 +296,5 @@ namespace Hcs.Client.Api.Request.HouseManagement
|
|||||||
|
|
||||||
return contract;
|
return contract;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getStateResultImportResultCommonResult[] GetCommonResults(IEnumerable<getStateResultImportResult> importResults)
|
|
||||||
{
|
|
||||||
var result = new List<getStateResultImportResultCommonResult>();
|
|
||||||
foreach (var importResult in importResults)
|
|
||||||
{
|
|
||||||
importResult.Items.OfType<ErrorMessageType>().ToList().ForEach(error =>
|
|
||||||
{
|
|
||||||
throw RemoteException.CreateNew(error.ErrorCode, error.Description);
|
|
||||||
});
|
|
||||||
|
|
||||||
var commonResults = importResult.Items.OfType<getStateResultImportResultCommonResult>();
|
|
||||||
foreach (var commonResult in commonResults)
|
|
||||||
{
|
|
||||||
commonResult.Items.OfType<CommonResultTypeError>().ToList().ForEach(error =>
|
|
||||||
{
|
|
||||||
throw RemoteException.CreateNew(error.ErrorCode, error.Description);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
result.AddRange(commonResults);
|
|
||||||
}
|
|
||||||
return [.. result];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user