Skip to content

Commit

Permalink
OrderIsExported is not set to True after job execution
Browse files Browse the repository at this point in the history
  • Loading branch information
DWDBE committed Dec 17, 2024
1 parent 9303fe1 commit aacedab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>10.9.0</Version>
<Version>10.9.1</Version>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<Title>Order Provider</Title>
<Description>Order Provider</Description>
Expand Down
8 changes: 4 additions & 4 deletions src/OrderSourceReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private void LoadReader(string whereSql)
if (_columnMappings.Count == 0)
return;

string sql = $"SELECT * FROM (SELECT {GetColumns()} FROM {GetFromTables()}) AS innerTable ";
string sql = $"SELECT {GetColumns()} FROM {GetFromTables()} ";

if (!string.IsNullOrEmpty(whereSql))
sql = sql + " where " + whereSql;
Expand Down Expand Up @@ -178,11 +178,11 @@ public static void UpdateExportedOrdersInDb(string orderStateIDAfterExport, SqlC
SqlCommand command = new SqlCommand { Connection = connection };
try
{
command.Transaction = connection.BeginTransaction("OrderProviderTransaction");

if (connection.State.ToString() != "Open")
connection.Open();

command.Transaction = connection.BeginTransaction("OrderProviderTransaction");

string sql = "UPDATE EcomOrders SET OrderIsExported = 1";

if (!string.IsNullOrEmpty(orderStateIDAfterExport))
Expand Down Expand Up @@ -216,7 +216,7 @@ public static void UpdateExportedOrdersInDb(string orderStateIDAfterExport, SqlC
}
catch (Exception ex)
{
command.Transaction.Rollback();
command?.Transaction?.Rollback();
throw new Exception(string.Format("A rollback is made as exception is made with message: {0} Sql query: {1}", ex.Message, command.CommandText), ex);
}
finally
Expand Down

0 comments on commit aacedab

Please sign in to comment.