Skip to content

Commit 3081da3

Browse files
author
Jani Giannoudis
committed
exchange import: keep existing lookup on bulk import
command base: enhanced error output updated version to 0.9.0-beta.11
1 parent 048080e commit 3081da3

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

Client.Core/Command/CommandBase.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,21 @@ public abstract class CommandBase : ICommand
2020
/// <inheritdoc />
2121
public async Task<int> ExecuteAsync(CommandContext context, ICommandParameters parameters)
2222
{
23-
if (!string.IsNullOrWhiteSpace(parameters.Test()))
23+
// parameter test
24+
var error = parameters.Test();
25+
if (!string.IsNullOrWhiteSpace(error))
2426
{
27+
// logger
28+
context.Logger?.Error(error);
29+
30+
// console
31+
if (context.DisplayLevel == DisplayLevel.Full)
32+
{
33+
context.Console.DisplayErrorLine(error);
34+
}
2535
return -1;
2636
}
37+
2738
return await OnExecute(context, parameters);
2839
}
2940

Client.Core/Exchange/ExchangeImport.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,17 +208,10 @@ private async Task SetupBulkLookupsAsync(IExchangeTenant tenant, IRegulationSet
208208
// cleanup existing lookups
209209
var resLookups = new LookupSetService(HttpClient);
210210
var context = new RegulationServiceContext(tenant.Id, regulation.Id);
211-
var existingLookups = await resLookups.QueryAsync<LookupSet>(context);
212211
foreach (var lookup in lookups)
213212
{
214213
// validate lookup
215214
ValidateLookup(lookup);
216-
// get existing object
217-
var existingLookup = existingLookups.FirstOrDefault(x => string.Equals(x.Name, lookup.Name));
218-
if (existingLookup != null)
219-
{
220-
await resLookups.DeleteAsync(context, existingLookup.Id);
221-
}
222215
}
223216

224217
// created date

Client.Core/PayrollEngine.Client.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
</None>
9090
</ItemGroup>
9191
<ItemGroup>
92-
<PackageReference Include="PayrollEngine.Core" Version="0.9.0-beta.10" />
92+
<PackageReference Include="PayrollEngine.Core" Version="0.9.0-beta.11" />
9393
</ItemGroup>
9494

9595
<!-- build json schema -->

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>net9.0</TargetFramework>
5-
<Version>0.9.0-beta.10</Version>
5+
<Version>0.9.0-beta.11</Version>
66
<FileVersion>0.9.0</FileVersion>
77
<InformationalVersion></InformationalVersion>
88
<Authors>Jani Giannoudis</Authors>

0 commit comments

Comments
 (0)