Skip to content

Commit

Permalink
13436-LogHowManyRecordsWereImported
Browse files Browse the repository at this point in the history
  • Loading branch information
DWDBE committed Nov 16, 2023
1 parent b818c0e commit b5f2e60
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Dynamicweb.DataIntegration.Providers.EcomProvider.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>10.0.10</Version>
<Version>10.0.11</Version>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<Title>Ecom Provider</Title>
<Description>Ecom Provider</Description>
Expand All @@ -23,7 +23,7 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Dynamicweb.DataIntegration" Version="10.0.17" />
<PackageReference Include="Dynamicweb.DataIntegration" Version="10.0.19" />
<PackageReference Include="Dynamicweb.Ecommerce" Version="10.0.9" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>
Expand Down
22 changes: 17 additions & 5 deletions src/EcomDestinationWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2641,7 +2641,9 @@ public void DeleteExcessFromMainTable(string shop, SqlTransaction transaction, s
{
sqlCommand.Transaction = transaction;
string extraConditions = GetDeleteFromSpecificLanguageExtraCondition(mapping, tempTablePrefix, languageId);
DeleteExcessFromMainTable(mapping, extraConditions, sqlCommand, tempTablePrefix, removeMissingAfterImportDestinationTablesOnly);
var rowsAffected = DeleteExcessFromMainTable(sqlCommand, mapping, extraConditions, tempTablePrefix, removeMissingAfterImportDestinationTablesOnly);
if (rowsAffected > 0)
logger.Log($"The number of deleted rows: {rowsAffected} for the destination {mapping.DestinationTable.Name} table mapping");
}
else if (!(mapping.DestinationTable.Name == "EcomGroups" && !_removeFromEcomGroups) && !(mapping.DestinationTable.Name == "EcomVariantGroups" && !_removeFromEcomVariantGroups))
{
Expand All @@ -2653,11 +2655,15 @@ public void DeleteExcessFromMainTable(string shop, SqlTransaction transaction, s
sqlCommand.Transaction = transaction;
if (mapping.DestinationTable.Name == "EcomProducts" && deactivateMissing)
{
DeactivateMissingProductsInMainTable(mapping, sqlCommand, shop, _defaultLanguageId, hideDeactivatedProducts);
var rowsAffected = DeactivateMissingProductsInMainTable(mapping, sqlCommand, shop, _defaultLanguageId, hideDeactivatedProducts);
if (rowsAffected > 0)
logger.Log($"The number of the deactivated product rows: {rowsAffected}");
}
else if (removeMissingAfterImport || removeMissingAfterImportDestinationTablesOnly)
{
DeleteExcessFromMainTable(mapping, GetExtraConditions(mapping, shop, null), sqlCommand, tempTablePrefix, removeMissingAfterImportDestinationTablesOnly);
var rowsAffected = DeleteExcessFromMainTable(sqlCommand, mapping, GetExtraConditions(mapping, shop, null), tempTablePrefix, removeMissingAfterImportDestinationTablesOnly);
if (rowsAffected > 0)
logger.Log($"The number of deleted rows: {rowsAffected} for the destination {mapping.DestinationTable.Name} table mapping");
}
}
}
Expand All @@ -2672,7 +2678,9 @@ public void DeleteExistingFromMainTable(string shop, SqlTransaction transaction,
string tempTablePrefix = "TempTableForBulkImport" + mapping.GetId();
if (HasRowsToImport(mapping, out tempTablePrefix))
{
DeleteExistingFromMainTable(mapping, GetExtraConditions(mapping, shop, languageId), sqlCommand, tempTablePrefix);
var rowsAffected = DeleteExistingFromMainTable(sqlCommand, mapping, GetExtraConditions(mapping, shop, languageId), tempTablePrefix);
if (rowsAffected > 0)
logger.Log($"The number of deleted rows: {rowsAffected} for the destination {mapping.DestinationTable.Name} table mapping");
}
}
}
Expand Down Expand Up @@ -2864,7 +2872,11 @@ private void MoveDataToMainTable(Mapping mapping, string tempTablePrefix, SqlTra
if (timeout < 360)
timeout = 360;
sqlCommand.CommandTimeout = timeout;
sqlCommand.ExecuteNonQuery();
var rowsAffected = sqlCommand.ExecuteNonQuery();
if (rowsAffected > 0)
{
logger.Log($"The number of rows affected: {rowsAffected} in the {mapping.DestinationTable.Name} table");
}
}
catch (Exception ex)
{
Expand Down

0 comments on commit b5f2e60

Please sign in to comment.