diff --git a/src/bnhtrade.Core/Config.cs b/src/bnhtrade.Core/Config.cs
index 20bb1a9..b70940c 100644
--- a/src/bnhtrade.Core/Config.cs
+++ b/src/bnhtrade.Core/Config.cs
@@ -12,7 +12,21 @@ namespace bnhtrade.Core
{
public string GetAppDataPath()
{
- string path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\bnhtrade\";
+ string path = null;
+ if (OperatingSystem.IsWindows())
+ {
+ path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
+ + @"\bnhtrade\";
+ }
+ else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS())
+ {
+ path = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)
+ + "/.bnhtrade/";
+ }
+ else
+ {
+ throw new PlatformNotSupportedException("Unsupported operating system");
+ }
return path;
}
diff --git a/src/bnhtrade.Core/Data/Database/Account/ReadContact.cs b/src/bnhtrade.Core/Data/Database/Account/ReadContact.cs
index 489adad..5621f17 100644
--- a/src/bnhtrade.Core/Data/Database/Account/ReadContact.cs
+++ b/src/bnhtrade.Core/Data/Database/Account/ReadContact.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/Amazon/FeeEstimate.cs b/src/bnhtrade.Core/Data/Database/Amazon/FeeEstimate.cs
index 64331c7..d7b30d9 100644
--- a/src/bnhtrade.Core/Data/Database/Amazon/FeeEstimate.cs
+++ b/src/bnhtrade.Core/Data/Database/Amazon/FeeEstimate.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/AmazonFba/ReadShipmentInfo.cs b/src/bnhtrade.Core/Data/Database/AmazonFba/ReadShipmentInfo.cs
index 718ae05..25709c5 100644
--- a/src/bnhtrade.Core/Data/Database/AmazonFba/ReadShipmentInfo.cs
+++ b/src/bnhtrade.Core/Data/Database/AmazonFba/ReadShipmentInfo.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/AmazonFba/ReadShipmentPrimaryKey.cs b/src/bnhtrade.Core/Data/Database/AmazonFba/ReadShipmentPrimaryKey.cs
index 166267a..167e01a 100644
--- a/src/bnhtrade.Core/Data/Database/AmazonFba/ReadShipmentPrimaryKey.cs
+++ b/src/bnhtrade.Core/Data/Database/AmazonFba/ReadShipmentPrimaryKey.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/AmazonFba/SetShipmentInfo.cs b/src/bnhtrade.Core/Data/Database/AmazonFba/SetShipmentInfo.cs
index 9cefbff..c0b5aaf 100644
--- a/src/bnhtrade.Core/Data/Database/AmazonFba/SetShipmentInfo.cs
+++ b/src/bnhtrade.Core/Data/Database/AmazonFba/SetShipmentInfo.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/Connection.cs b/src/bnhtrade.Core/Data/Database/Connection.cs
index c97c0e8..bfdc612 100644
--- a/src/bnhtrade.Core/Data/Database/Connection.cs
+++ b/src/bnhtrade.Core/Data/Database/Connection.cs
@@ -1,9 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Data.SqlClient;
using System.Configuration;
namespace bnhtrade.Core.Data.Database
diff --git a/src/bnhtrade.Core/Data/Database/Import/AmazonFbaCustomerReturn.cs b/src/bnhtrade.Core/Data/Database/Import/AmazonFbaCustomerReturn.cs
index c58c5f1..4d37221 100644
--- a/src/bnhtrade.Core/Data/Database/Import/AmazonFbaCustomerReturn.cs
+++ b/src/bnhtrade.Core/Data/Database/Import/AmazonFbaCustomerReturn.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
diff --git a/src/bnhtrade.Core/Data/Database/Import/AmazonFbaInventoryAdjustment.cs b/src/bnhtrade.Core/Data/Database/Import/AmazonFbaInventoryAdjustment.cs
index a0d7ef6..b85a82c 100644
--- a/src/bnhtrade.Core/Data/Database/Import/AmazonFbaInventoryAdjustment.cs
+++ b/src/bnhtrade.Core/Data/Database/Import/AmazonFbaInventoryAdjustment.cs
@@ -1,5 +1,5 @@
using System;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.IO;
namespace bnhtrade.Core.Data.Database.Import
diff --git a/src/bnhtrade.Core/Data/Database/Import/AmazonFbaInventoryAgeData.cs b/src/bnhtrade.Core/Data/Database/Import/AmazonFbaInventoryAgeData.cs
index 5cd5284..6eb13ef 100644
--- a/src/bnhtrade.Core/Data/Database/Import/AmazonFbaInventoryAgeData.cs
+++ b/src/bnhtrade.Core/Data/Database/Import/AmazonFbaInventoryAgeData.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
diff --git a/src/bnhtrade.Core/Data/Database/Import/AmazonFbaInventoryAgeRead.cs b/src/bnhtrade.Core/Data/Database/Import/AmazonFbaInventoryAgeRead.cs
index 4efb77b..34d07fc 100644
--- a/src/bnhtrade.Core/Data/Database/Import/AmazonFbaInventoryAgeRead.cs
+++ b/src/bnhtrade.Core/Data/Database/Import/AmazonFbaInventoryAgeRead.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/Import/AmazonFbaInventoryData.cs b/src/bnhtrade.Core/Data/Database/Import/AmazonFbaInventoryData.cs
index cc9bd19..04f6ffa 100644
--- a/src/bnhtrade.Core/Data/Database/Import/AmazonFbaInventoryData.cs
+++ b/src/bnhtrade.Core/Data/Database/Import/AmazonFbaInventoryData.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
diff --git a/src/bnhtrade.Core/Data/Database/Import/AmazonFbaInventoryLedgerDetail.cs b/src/bnhtrade.Core/Data/Database/Import/AmazonFbaInventoryLedgerDetail.cs
index 88f1464..0815e28 100644
--- a/src/bnhtrade.Core/Data/Database/Import/AmazonFbaInventoryLedgerDetail.cs
+++ b/src/bnhtrade.Core/Data/Database/Import/AmazonFbaInventoryLedgerDetail.cs
@@ -2,7 +2,7 @@
using bnhtrade.Core.Logic.Amazon.Fba;
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Diagnostics;
using System.Diagnostics.Eventing.Reader;
using System.IO;
diff --git a/src/bnhtrade.Core/Data/Database/Import/AmazonFbaInventoryReceipt.cs b/src/bnhtrade.Core/Data/Database/Import/AmazonFbaInventoryReceipt.cs
index 2216877..f991ef5 100644
--- a/src/bnhtrade.Core/Data/Database/Import/AmazonFbaInventoryReceipt.cs
+++ b/src/bnhtrade.Core/Data/Database/Import/AmazonFbaInventoryReceipt.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Globalization;
using System.IO;
using System.Linq;
diff --git a/src/bnhtrade.Core/Data/Database/Import/AmazonFbaReimbursement.cs b/src/bnhtrade.Core/Data/Database/Import/AmazonFbaReimbursement.cs
index 77f2c54..279315c 100644
--- a/src/bnhtrade.Core/Data/Database/Import/AmazonFbaReimbursement.cs
+++ b/src/bnhtrade.Core/Data/Database/Import/AmazonFbaReimbursement.cs
@@ -3,7 +3,7 @@ using FikaAmazonAPI.ConstructFeed.Messages;
using System;
using System.Collections.Generic;
using System.Data;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Runtime.ConstrainedExecution;
diff --git a/src/bnhtrade.Core/Data/Database/Import/AmazonFbaRemovalOrder.cs b/src/bnhtrade.Core/Data/Database/Import/AmazonFbaRemovalOrder.cs
index a7ffdf4..ba4f69b 100644
--- a/src/bnhtrade.Core/Data/Database/Import/AmazonFbaRemovalOrder.cs
+++ b/src/bnhtrade.Core/Data/Database/Import/AmazonFbaRemovalOrder.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
diff --git a/src/bnhtrade.Core/Data/Database/Import/AmazonFbaSaleShipment.cs b/src/bnhtrade.Core/Data/Database/Import/AmazonFbaSaleShipment.cs
index 5397d2e..51443b4 100644
--- a/src/bnhtrade.Core/Data/Database/Import/AmazonFbaSaleShipment.cs
+++ b/src/bnhtrade.Core/Data/Database/Import/AmazonFbaSaleShipment.cs
@@ -1,7 +1,7 @@
using Dapper;
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
diff --git a/src/bnhtrade.Core/Data/Database/Log/DateTimeLog.cs b/src/bnhtrade.Core/Data/Database/Log/DateTimeLog.cs
index a367350..b32832d 100644
--- a/src/bnhtrade.Core/Data/Database/Log/DateTimeLog.cs
+++ b/src/bnhtrade.Core/Data/Database/Log/DateTimeLog.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/Log/LogEvent.cs b/src/bnhtrade.Core/Data/Database/Log/LogEvent.cs
index b3cc8f0..e074f90 100644
--- a/src/bnhtrade.Core/Data/Database/Log/LogEvent.cs
+++ b/src/bnhtrade.Core/Data/Database/Log/LogEvent.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/Product/CreateCompetitivePrice.cs b/src/bnhtrade.Core/Data/Database/Product/CreateCompetitivePrice.cs
index df84a34..ad1823f 100644
--- a/src/bnhtrade.Core/Data/Database/Product/CreateCompetitivePrice.cs
+++ b/src/bnhtrade.Core/Data/Database/Product/CreateCompetitivePrice.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/Product/ReadCompetitivePrice.cs b/src/bnhtrade.Core/Data/Database/Product/ReadCompetitivePrice.cs
index ef8a2aa..d68132f 100644
--- a/src/bnhtrade.Core/Data/Database/Product/ReadCompetitivePrice.cs
+++ b/src/bnhtrade.Core/Data/Database/Product/ReadCompetitivePrice.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/Product/ReadProduct.cs b/src/bnhtrade.Core/Data/Database/Product/ReadProduct.cs
index ad436bc..f55de04 100644
--- a/src/bnhtrade.Core/Data/Database/Product/ReadProduct.cs
+++ b/src/bnhtrade.Core/Data/Database/Product/ReadProduct.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/Product/ReadProductId.cs b/src/bnhtrade.Core/Data/Database/Product/ReadProductId.cs
index 21b561c..45c9cda 100644
--- a/src/bnhtrade.Core/Data/Database/Product/ReadProductId.cs
+++ b/src/bnhtrade.Core/Data/Database/Product/ReadProductId.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/ReadRandomData.cs b/src/bnhtrade.Core/Data/Database/ReadRandomData.cs
index 38a5c90..9fac6e6 100644
--- a/src/bnhtrade.Core/Data/Database/ReadRandomData.cs
+++ b/src/bnhtrade.Core/Data/Database/ReadRandomData.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/Repository/Implementation/AmazonSettlementRepository.cs b/src/bnhtrade.Core/Data/Database/Repository/Implementation/AmazonSettlementRepository.cs
index ccfe64a..87dde05 100644
--- a/src/bnhtrade.Core/Data/Database/Repository/Implementation/AmazonSettlementRepository.cs
+++ b/src/bnhtrade.Core/Data/Database/Repository/Implementation/AmazonSettlementRepository.cs
@@ -2,7 +2,6 @@
using bnhtrade.Core.Data.Database.Repository.Interface;
using bnhtrade.Core.Model.Amazon;
using Microsoft.Data.SqlClient;
-using Microsoft.VisualBasic.Logging;
using System;
using System.Collections.Generic;
using System.Data;
@@ -369,7 +368,7 @@ namespace bnhtrade.Core.Data.Database.Repository.Implementation
//
///
- /// Update the settlement report marketplace name by settlement Id (not table id)
+ /// Update the settlement report marketplace name by settlement Id (not row id)
///
/// Settlement id (not table/record id) of the settlement to update
/// marketplace name
@@ -433,13 +432,13 @@ namespace bnhtrade.Core.Data.Database.Repository.Implementation
/// Takes a Settlement Report flat file from Amazon and imports it into the database.
///
/// path to the Amazon report flat file
- /// The unique Amazon SP-API report id (not settlement id)
+ /// The unique Amazon SP-API report id (not settlement id)
///
- public bool CreateAmazonSettlements(string filePath, string reportId)
+ public bool CreateAmazonSettlements(string filePath, string spapiReportId)
{
int settlementReportId = 0;
- string settlementRef = "";
- bool marketPlaceUpdated = false;
+ string settlementRef = null;
+ string marketplaceName = null;
decimal settlementAmount = 0m;
int lineNumber = 2;
int lineSkip = 0;
@@ -479,17 +478,17 @@ namespace bnhtrade.Core.Data.Database.Repository.Implementation
int indexQuantityPurchased = Array.IndexOf(headers, "quantity-purchased");
int indexPromotionId = Array.IndexOf(headers, "promotion-id");
- string currency = "";
+ string currency = null;
string fileRow;
while ((fileRow = reader.ReadLine()) != null)
{
Console.Write("\rParsing record: " + lineNumber);
//split line into array
- string[] items = fileRow.Split('\t');
- if (items.Length != columnCount)
+ string[] rowArray = fileRow.Split('\t');
+ if (rowArray.Length != columnCount)
{
- // skip line
+ // skip line, check settlement total at the end
lineSkip = lineSkip + 1;
_log.LogWarning(
"Line #" + lineNumber + " skipped due to no enough element in row.",
@@ -498,28 +497,25 @@ namespace bnhtrade.Core.Data.Database.Repository.Implementation
}
else if (lineNumber == 2)
{
- // check if settlement has already been imported
+ settlementRef = rowArray[indexSettlementId];
+ currency = rowArray[indexCurrency];
+ settlementAmount = decimal.Parse(rowArray[indexTotalAmount].Replace(",", "."));
+ // check if settlement has already been imported
using (SqlCommand cmd = _connection.CreateCommand() as SqlCommand)
{
cmd.CommandText = "SELECT COUNT(*) FROM tblImportAmazonSettlementReport WHERE [settlement-id]=@settlementId;";
cmd.Transaction = _transaction as SqlTransaction;
- cmd.Parameters.AddWithValue("@settlementId", items[indexSettlementId]);
+ cmd.Parameters.AddWithValue("@settlementId", rowArray[indexSettlementId]);
int recordCount = (int)cmd.ExecuteScalar();
if (recordCount > 0)
{
- SetSpapiReportId(items[indexSettlementId], reportId);
+ SetSpapiReportId(rowArray[indexSettlementId], spapiReportId);
_log.LogInformation("Settlement report already imported, skipping...");
return true;
}
}
- //set currencyId
- //currencyId = GeneralQueries.GetCurrencyId(items[5]);
-
- //set currency
- currency = items[indexCurrency];
- settlementAmount = decimal.Parse(items[indexTotalAmount].Replace(",", "."));
// insert
using (SqlCommand cmd = _connection.CreateCommand() as SqlCommand)
@@ -543,61 +539,38 @@ namespace bnhtrade.Core.Data.Database.Repository.Implementation
,@depositDate
,@settlementotalAmounttId
,@currency
- ,@reportId
+ ,@spapiReportId
);";
- // add parameters
- if (indexSettlementId == -1 || items[indexSettlementId].Length == 0) { cmd.Parameters.AddWithValue("@settlementId", DBNull.Value); }
- else
- {
- settlementRef = items[indexSettlementId];
- cmd.Parameters.AddWithValue("@settlementId", settlementRef);
- }
-
var parseDateTime = new Core.Logic.Utilities.DateTime();
- if (indexSettlementStartDate == -1 || items[indexSettlementStartDate].Length == 0) { cmd.Parameters.AddWithValue("@settlementStartDate", DBNull.Value); }
- else { cmd.Parameters.AddWithValue("@settlementStartDate", parseDateTime.ParseIsoDateTimeString(items[indexSettlementStartDate])); }
-
- if (indexSettlementEndDate == -1 || items[indexSettlementEndDate].Length == 0) { cmd.Parameters.AddWithValue("@settlementEndDate", DBNull.Value); }
- else { cmd.Parameters.AddWithValue("@settlementEndDate", parseDateTime.ParseIsoDateTimeString(items[indexSettlementEndDate])); }
-
- if (indexDepositDate == -1 || items[indexDepositDate].Length == 0) { cmd.Parameters.AddWithValue("@depositDate", DBNull.Value); }
- else { cmd.Parameters.AddWithValue("@depositDate", parseDateTime.ParseIsoDateTimeString(items[indexDepositDate])); }
-
- if (indexTotalAmount == -1 || items[indexTotalAmount].Length == 0) { cmd.Parameters.AddWithValue("@totalAmount", DBNull.Value); }
- else { cmd.Parameters.AddWithValue("@settlementotalAmounttId", settlementAmount); }
-
- if (string.IsNullOrWhiteSpace(reportId)) { cmd.Parameters.AddWithValue("@reportId", DBNull.Value); }
- else { cmd.Parameters.AddWithValue("@reportId", reportId); }
-
+ // add parameters
+ cmd.Parameters.AddWithValue("@settlementId", rowArray[indexSettlementId]);
+ cmd.Parameters.AddWithValue("@settlementStartDate", parseDateTime.ParseIsoDateTimeString(rowArray[indexSettlementStartDate]));
+ cmd.Parameters.AddWithValue("@settlementEndDate", parseDateTime.ParseIsoDateTimeString(rowArray[indexSettlementEndDate]));
+ cmd.Parameters.AddWithValue("@depositDate", parseDateTime.ParseIsoDateTimeString(rowArray[indexDepositDate]));
+ cmd.Parameters.AddWithValue("@settlementotalAmounttId", settlementAmount);
+ if (string.IsNullOrWhiteSpace(spapiReportId)) { cmd.Parameters.AddWithValue("@spapiReportId", DBNull.Value); }
+ else { cmd.Parameters.AddWithValue("@spapiReportId", spapiReportId); }
cmd.Parameters.AddWithValue("@currency", currency);
- //if (currencyId == -1) { sqlCommand.Parameters.AddWithValue("@currencyId", DBNull.Value); }
- //else { sqlCommand.Parameters.AddWithValue("@currencyId", currencyId); }
-
//execute and retrive id
settlementReportId = (int)cmd.ExecuteScalar();
-
}
}
else
{
- //update market place name in main table, if required
- if (marketPlaceUpdated == false && settlementReportId > 0 && items[indexMarketplaceName].Length > 1)
+ // attempt to retrieve marketplace name for header table
+ if (rowArray[indexMarketplaceName].Length > 1 && settlementReportId > 0)
{
- using (SqlCommand cmd = _connection.CreateCommand() as SqlCommand)
+ if (marketplaceName == null)
{
- cmd.Transaction = _transaction as SqlTransaction;
- cmd.CommandText = @"
- UPDATE tblImportAmazonSettlementReport
- SET [marketplace-name]=@MarketplaceName
- WHERE ImportAmazonSettlementReportID=@ImportAmazonSettlementReportID;";
- cmd.Parameters.AddWithValue("@MarketplaceName", items[indexMarketplaceName]);
- cmd.Parameters.AddWithValue("@ImportAmazonSettlementReportID", settlementReportId);
-
- cmd.ExecuteNonQuery();
- marketPlaceUpdated = true;
+ marketplaceName = rowArray[indexMarketplaceName];
+ }
+ else if (marketplaceName != rowArray[indexMarketplaceName])
+ {
+ _log.LogError("Marketplace name '" + rowArray[indexMarketplaceName] + "' on line " + lineNumber +
+ " is different from marketplace name '" + marketplaceName + "' on previous line. This shouldn't be possible!");
}
}
@@ -620,67 +593,95 @@ namespace bnhtrade.Core.Data.Database.Repository.Implementation
cmd.Parameters.AddWithValue("@currency", currency);
- if (indexTransactionType == -1 || items[indexTransactionType].Length == 0) { cmd.Parameters.AddWithValue("@TransactionType", DBNull.Value); }
- else { cmd.Parameters.AddWithValue("@TransactionType", items[indexTransactionType]); }
+ if (indexTransactionType == -1 || rowArray[indexTransactionType].Length == 0) { cmd.Parameters.AddWithValue("@TransactionType", DBNull.Value); }
+ else { cmd.Parameters.AddWithValue("@TransactionType", rowArray[indexTransactionType]); }
- if (indexOrderId == -1 || items[indexOrderId].Length == 0) { cmd.Parameters.AddWithValue("@orderRef", DBNull.Value); }
- else { cmd.Parameters.AddWithValue("@orderRef", items[indexOrderId]); }
+ if (indexOrderId == -1 || rowArray[indexOrderId].Length == 0) { cmd.Parameters.AddWithValue("@orderRef", DBNull.Value); }
+ else { cmd.Parameters.AddWithValue("@orderRef", rowArray[indexOrderId]); }
- if (indexMerchantOrderId == -1 || items[indexMerchantOrderId].Length == 0) { cmd.Parameters.AddWithValue("@merchantOrderRef", DBNull.Value); }
- else { cmd.Parameters.AddWithValue("@merchantOrderRef", items[indexMerchantOrderId]); }
+ if (indexMerchantOrderId == -1 || rowArray[indexMerchantOrderId].Length == 0) { cmd.Parameters.AddWithValue("@merchantOrderRef", DBNull.Value); }
+ else { cmd.Parameters.AddWithValue("@merchantOrderRef", rowArray[indexMerchantOrderId]); }
- if (indexAdjustmentId == -1 || items[indexAdjustmentId].Length == 0) { cmd.Parameters.AddWithValue("@AdjustmentRef", DBNull.Value); }
- else { cmd.Parameters.AddWithValue("@AdjustmentRef", items[indexAdjustmentId]); }
+ if (indexAdjustmentId == -1 || rowArray[indexAdjustmentId].Length == 0) { cmd.Parameters.AddWithValue("@AdjustmentRef", DBNull.Value); }
+ else { cmd.Parameters.AddWithValue("@AdjustmentRef", rowArray[indexAdjustmentId]); }
- if (indexShipmentId == -1 || items[indexShipmentId].Length == 0) { cmd.Parameters.AddWithValue("@ShipmentRef", DBNull.Value); }
- else { cmd.Parameters.AddWithValue("@ShipmentRef", items[indexShipmentId]); }
+ if (indexShipmentId == -1 || rowArray[indexShipmentId].Length == 0) { cmd.Parameters.AddWithValue("@ShipmentRef", DBNull.Value); }
+ else { cmd.Parameters.AddWithValue("@ShipmentRef", rowArray[indexShipmentId]); }
- if (indexMarketplaceName == -1 || items[indexMarketplaceName].Length == 0) { cmd.Parameters.AddWithValue("@MarketplaceName", DBNull.Value); }
- else { cmd.Parameters.AddWithValue("@MarketplaceName", items[indexMarketplaceName]); }
+ if (indexMarketplaceName == -1 || rowArray[indexMarketplaceName].Length == 0) { cmd.Parameters.AddWithValue("@MarketplaceName", DBNull.Value); }
+ else { cmd.Parameters.AddWithValue("@MarketplaceName", rowArray[indexMarketplaceName]); }
- if (indexAmountType == -1 || items[indexAmountType].Length == 0) { cmd.Parameters.AddWithValue("@AmountType", DBNull.Value); }
- else { cmd.Parameters.AddWithValue("@AmountType", items[indexAmountType]); }
+ if (indexAmountType == -1 || rowArray[indexAmountType].Length == 0) { cmd.Parameters.AddWithValue("@AmountType", DBNull.Value); }
+ else { cmd.Parameters.AddWithValue("@AmountType", rowArray[indexAmountType]); }
- if (indexAmountDescription == -1 || items[indexAmountDescription].Length == 0) { cmd.Parameters.AddWithValue("@AmountDescription", DBNull.Value); }
+ if (indexAmountDescription == -1 || rowArray[indexAmountDescription].Length == 0) { cmd.Parameters.AddWithValue("@AmountDescription", DBNull.Value); }
else
{
- string amountDescription = items[indexAmountDescription];
+ string amountDescription = rowArray[indexAmountDescription];
if (amountDescription.Length > 100) { amountDescription = amountDescription.Substring(0, 100); }
cmd.Parameters.AddWithValue("@AmountDescription", amountDescription);
}
- if (indexAmount == -1 || items[indexAmount].Length == 0) { cmd.Parameters.AddWithValue("@Amount", DBNull.Value); }
- else { cmd.Parameters.AddWithValue("@Amount", decimal.Parse(items[indexAmount].Replace(",", "."))); }
+ if (indexAmount == -1 || rowArray[indexAmount].Length == 0) { cmd.Parameters.AddWithValue("@Amount", DBNull.Value); }
+ else { cmd.Parameters.AddWithValue("@Amount", decimal.Parse(rowArray[indexAmount].Replace(",", "."))); }
- if (indexFulfillmentId == -1 || items[indexFulfillmentId].Length == 0) { cmd.Parameters.AddWithValue("@FulfillmentRef", DBNull.Value); }
- else { cmd.Parameters.AddWithValue("@FulfillmentRef", items[indexFulfillmentId]); }
+ if (indexFulfillmentId == -1 || rowArray[indexFulfillmentId].Length == 0) { cmd.Parameters.AddWithValue("@FulfillmentRef", DBNull.Value); }
+ else { cmd.Parameters.AddWithValue("@FulfillmentRef", rowArray[indexFulfillmentId]); }
- if (indexPostedDateTime == -1 || items[indexPostedDateTime].Length == 0) { cmd.Parameters.AddWithValue("@PostedDateTimeUTC", DBNull.Value); }
- else { cmd.Parameters.AddWithValue("@PostedDateTimeUTC", new Logic.Utilities.DateTime().ParseIsoDateTimeString(items[indexPostedDateTime])); }
+ if (indexPostedDateTime == -1 || rowArray[indexPostedDateTime].Length == 0) { cmd.Parameters.AddWithValue("@PostedDateTimeUTC", DBNull.Value); }
+ else { cmd.Parameters.AddWithValue("@PostedDateTimeUTC", new Logic.Utilities.DateTime().ParseIsoDateTimeString(rowArray[indexPostedDateTime])); }
- if (indexOrderItemCode == -1 || items[indexOrderItemCode].Length == 0) { cmd.Parameters.AddWithValue("@OrderItemCode", DBNull.Value); }
- else { cmd.Parameters.AddWithValue("@OrderItemCode", long.Parse(items[indexOrderItemCode])); }
+ if (indexOrderItemCode == -1 || rowArray[indexOrderItemCode].Length == 0) { cmd.Parameters.AddWithValue("@OrderItemCode", DBNull.Value); }
+ else { cmd.Parameters.AddWithValue("@OrderItemCode", long.Parse(rowArray[indexOrderItemCode])); }
- if (indexMerchantOrderItemId == -1 || items[indexMerchantOrderItemId].Length == 0) { cmd.Parameters.AddWithValue("@MerchantOrderItemRef", DBNull.Value); }
- else { cmd.Parameters.AddWithValue("@MerchantOrderItemRef", long.Parse(items[indexMerchantOrderItemId])); }
+ if (indexMerchantOrderItemId == -1 || rowArray[indexMerchantOrderItemId].Length == 0) { cmd.Parameters.AddWithValue("@MerchantOrderItemRef", DBNull.Value); }
+ else { cmd.Parameters.AddWithValue("@MerchantOrderItemRef", long.Parse(rowArray[indexMerchantOrderItemId])); }
- if (indexMerchantAdjustmentItemId == -1 || items[indexMerchantAdjustmentItemId].Length == 0) { cmd.Parameters.AddWithValue("@MerchantAdjustmentItemRef", DBNull.Value); }
- else { cmd.Parameters.AddWithValue("@MerchantAdjustmentItemRef", items[indexMerchantAdjustmentItemId]); }
+ if (indexMerchantAdjustmentItemId == -1 || rowArray[indexMerchantAdjustmentItemId].Length == 0) { cmd.Parameters.AddWithValue("@MerchantAdjustmentItemRef", DBNull.Value); }
+ else { cmd.Parameters.AddWithValue("@MerchantAdjustmentItemRef", rowArray[indexMerchantAdjustmentItemId]); }
- if (indexSku == -1 || items[indexSku].Length == 0) { cmd.Parameters.AddWithValue("@SkuNumber", DBNull.Value); }
- else { cmd.Parameters.AddWithValue("@SkuNumber", items[indexSku]); }
+ if (indexSku == -1 || rowArray[indexSku].Length == 0) { cmd.Parameters.AddWithValue("@SkuNumber", DBNull.Value); }
+ else { cmd.Parameters.AddWithValue("@SkuNumber", rowArray[indexSku]); }
- if (indexQuantityPurchased == -1 || items[indexQuantityPurchased].Length == 0) { cmd.Parameters.AddWithValue("@QuantityPurchased", DBNull.Value); }
- else { cmd.Parameters.AddWithValue("@QuantityPurchased", int.Parse(items[indexQuantityPurchased])); }
+ if (indexQuantityPurchased == -1 || rowArray[indexQuantityPurchased].Length == 0) { cmd.Parameters.AddWithValue("@QuantityPurchased", DBNull.Value); }
+ else { cmd.Parameters.AddWithValue("@QuantityPurchased", int.Parse(rowArray[indexQuantityPurchased])); }
- if (indexPromotionId == -1 || items[indexPromotionId].Length == 0) { cmd.Parameters.AddWithValue("@PromotionRef", DBNull.Value); }
- else { cmd.Parameters.AddWithValue("@PromotionRef", items[indexPromotionId]); }
+ if (indexPromotionId == -1 || rowArray[indexPromotionId].Length == 0) { cmd.Parameters.AddWithValue("@PromotionRef", DBNull.Value); }
+ else { cmd.Parameters.AddWithValue("@PromotionRef", rowArray[indexPromotionId]); }
cmd.ExecuteNonQuery();
}
}
lineNumber = lineNumber + 1;
}
+ // end of filestream reading
+
+ // if we haven't gotten the marketplace name from the line items, attempt to infer from currency
+ if (marketplaceName == null && settlementReportId > 0)
+ {
+ if (currency == "GBP")
+ {
+ marketplaceName = MarketPlaceEnum.AmazonUK.GetMarketplaceUrl();
+ marketplaceName = char.ToUpper(marketplaceName[0]) + marketplaceName.Substring(1);
+ }
+ }
+
+ // finally, if we have it, add marketplace name to main table
+ if (marketplaceName != null && settlementReportId > 0)
+ {
+ using (SqlCommand cmd = _connection.CreateCommand() as SqlCommand)
+ {
+ cmd.Transaction = _transaction as SqlTransaction;
+ cmd.CommandText = @"
+ UPDATE tblImportAmazonSettlementReport
+ SET [marketplace-name]=@MarketplaceName
+ WHERE ImportAmazonSettlementReportID=@ImportAmazonSettlementReportID;";
+ cmd.Parameters.AddWithValue("@MarketplaceName", marketplaceName);
+ cmd.Parameters.AddWithValue("@ImportAmazonSettlementReportID", settlementReportId);
+
+ cmd.ExecuteNonQuery();
+ }
+ }
}
//final check - settlement amount matches sum of inserted settlement lines
diff --git a/src/bnhtrade.Core/Data/Database/SKU/Price/CreatePricingDetail.cs b/src/bnhtrade.Core/Data/Database/SKU/Price/CreatePricingDetail.cs
index 06d0e6e..106ef82 100644
--- a/src/bnhtrade.Core/Data/Database/SKU/Price/CreatePricingDetail.cs
+++ b/src/bnhtrade.Core/Data/Database/SKU/Price/CreatePricingDetail.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Transactions;
namespace bnhtrade.Core.Data.Database.Sku.Price
diff --git a/src/bnhtrade.Core/Data/Database/SKU/Price/ReadParameter.cs b/src/bnhtrade.Core/Data/Database/SKU/Price/ReadParameter.cs
index 4b5d028..7839832 100644
--- a/src/bnhtrade.Core/Data/Database/SKU/Price/ReadParameter.cs
+++ b/src/bnhtrade.Core/Data/Database/SKU/Price/ReadParameter.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/SKU/Price/ReadPricingDetail.cs b/src/bnhtrade.Core/Data/Database/SKU/Price/ReadPricingDetail.cs
index dd03317..16f64e1 100644
--- a/src/bnhtrade.Core/Data/Database/SKU/Price/ReadPricingDetail.cs
+++ b/src/bnhtrade.Core/Data/Database/SKU/Price/ReadPricingDetail.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/SKU/ReadSku.cs b/src/bnhtrade.Core/Data/Database/SKU/ReadSku.cs
index c800dab..bd3f43b 100644
--- a/src/bnhtrade.Core/Data/Database/SKU/ReadSku.cs
+++ b/src/bnhtrade.Core/Data/Database/SKU/ReadSku.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/SKU/ReadSkuConditionInfo.cs b/src/bnhtrade.Core/Data/Database/SKU/ReadSkuConditionInfo.cs
index cd0edc9..f1fe400 100644
--- a/src/bnhtrade.Core/Data/Database/SKU/ReadSkuConditionInfo.cs
+++ b/src/bnhtrade.Core/Data/Database/SKU/ReadSkuConditionInfo.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/SqlUpdateBuilder.cs b/src/bnhtrade.Core/Data/Database/SqlUpdateBuilder.cs
index 6a60bc7..7ed6239 100644
--- a/src/bnhtrade.Core/Data/Database/SqlUpdateBuilder.cs
+++ b/src/bnhtrade.Core/Data/Database/SqlUpdateBuilder.cs
@@ -1,7 +1,7 @@
using bnhtrade.Core.Data.Database._BoilerPlate;
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/SqlWhereBuilder.cs b/src/bnhtrade.Core/Data/Database/SqlWhereBuilder.cs
index 62f8c9f..8c583ac 100644
--- a/src/bnhtrade.Core/Data/Database/SqlWhereBuilder.cs
+++ b/src/bnhtrade.Core/Data/Database/SqlWhereBuilder.cs
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
-using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/Stock/DeleteSkuTransaction.cs b/src/bnhtrade.Core/Data/Database/Stock/DeleteSkuTransaction.cs
index b6d320d..0b87dbd 100644
--- a/src/bnhtrade.Core/Data/Database/Stock/DeleteSkuTransaction.cs
+++ b/src/bnhtrade.Core/Data/Database/Stock/DeleteSkuTransaction.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/Stock/InsertSkuTransaction.cs b/src/bnhtrade.Core/Data/Database/Stock/InsertSkuTransaction.cs
index c3e9023..781d8ff 100644
--- a/src/bnhtrade.Core/Data/Database/Stock/InsertSkuTransaction.cs
+++ b/src/bnhtrade.Core/Data/Database/Stock/InsertSkuTransaction.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/Stock/InsertSkuTransactionType.cs b/src/bnhtrade.Core/Data/Database/Stock/InsertSkuTransactionType.cs
index 4a6236f..61a0b5d 100644
--- a/src/bnhtrade.Core/Data/Database/Stock/InsertSkuTransactionType.cs
+++ b/src/bnhtrade.Core/Data/Database/Stock/InsertSkuTransactionType.cs
@@ -1,5 +1,5 @@
using System;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Transactions;
namespace bnhtrade.Core.Data.Database.Stock
diff --git a/src/bnhtrade.Core/Data/Database/Stock/JournalCrud.cs b/src/bnhtrade.Core/Data/Database/Stock/JournalCrud.cs
index 4364612..b4c2546 100644
--- a/src/bnhtrade.Core/Data/Database/Stock/JournalCrud.cs
+++ b/src/bnhtrade.Core/Data/Database/Stock/JournalCrud.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/Stock/ReadSkuTransaction.cs b/src/bnhtrade.Core/Data/Database/Stock/ReadSkuTransaction.cs
index ec62928..040f02c 100644
--- a/src/bnhtrade.Core/Data/Database/Stock/ReadSkuTransaction.cs
+++ b/src/bnhtrade.Core/Data/Database/Stock/ReadSkuTransaction.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/Stock/ReadSkuTransactionType.cs b/src/bnhtrade.Core/Data/Database/Stock/ReadSkuTransactionType.cs
index df2d71d..671c21f 100644
--- a/src/bnhtrade.Core/Data/Database/Stock/ReadSkuTransactionType.cs
+++ b/src/bnhtrade.Core/Data/Database/Stock/ReadSkuTransactionType.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/Stock/ReadStatusBalance.cs b/src/bnhtrade.Core/Data/Database/Stock/ReadStatusBalance.cs
index 0d30750..31ea775 100644
--- a/src/bnhtrade.Core/Data/Database/Stock/ReadStatusBalance.cs
+++ b/src/bnhtrade.Core/Data/Database/Stock/ReadStatusBalance.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/Stock/ReadStatusTransaction.cs b/src/bnhtrade.Core/Data/Database/Stock/ReadStatusTransaction.cs
index b078322..3bec5de 100644
--- a/src/bnhtrade.Core/Data/Database/Stock/ReadStatusTransaction.cs
+++ b/src/bnhtrade.Core/Data/Database/Stock/ReadStatusTransaction.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/Stock/ReadStatusTypeBalance.cs b/src/bnhtrade.Core/Data/Database/Stock/ReadStatusTypeBalance.cs
index 69c9463..6789bd9 100644
--- a/src/bnhtrade.Core/Data/Database/Stock/ReadStatusTypeBalance.cs
+++ b/src/bnhtrade.Core/Data/Database/Stock/ReadStatusTypeBalance.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/Stock/ReadStockId.cs b/src/bnhtrade.Core/Data/Database/Stock/ReadStockId.cs
index a17e60f..0854aa2 100644
--- a/src/bnhtrade.Core/Data/Database/Stock/ReadStockId.cs
+++ b/src/bnhtrade.Core/Data/Database/Stock/ReadStockId.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/Stock/UpdateSkuTransaction.cs b/src/bnhtrade.Core/Data/Database/Stock/UpdateSkuTransaction.cs
index 09f835a..06d765d 100644
--- a/src/bnhtrade.Core/Data/Database/Stock/UpdateSkuTransaction.cs
+++ b/src/bnhtrade.Core/Data/Database/Stock/UpdateSkuTransaction.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Data/Database/UnitOfWork/Connection.cs b/src/bnhtrade.Core/Data/Database/UnitOfWork/Connection.cs
index b077cce..e4b298c 100644
--- a/src/bnhtrade.Core/Data/Database/UnitOfWork/Connection.cs
+++ b/src/bnhtrade.Core/Data/Database/UnitOfWork/Connection.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Configuration;
namespace bnhtrade.Core.Data.Database.UnitOfWork
diff --git a/src/bnhtrade.Core/Data/Xero/SalesInvoice.cs b/src/bnhtrade.Core/Data/Xero/SalesInvoice.cs
index 0caf1ee..d7cfd02 100644
--- a/src/bnhtrade.Core/Data/Xero/SalesInvoice.cs
+++ b/src/bnhtrade.Core/Data/Xero/SalesInvoice.cs
@@ -1,7 +1,6 @@
using bnhtrade.Core.Test.Amazon.SP_API;
using CsvHelper;
using CsvHelper.Configuration.Attributes;
-using Microsoft.VisualBasic.Logging;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
diff --git a/src/bnhtrade.Core/Logic/Account/CurrencyService.cs b/src/bnhtrade.Core/Logic/Account/CurrencyService.cs
index b8d929a..e35bf18 100644
--- a/src/bnhtrade.Core/Logic/Account/CurrencyService.cs
+++ b/src/bnhtrade.Core/Logic/Account/CurrencyService.cs
@@ -4,7 +4,7 @@ using FikaAmazonAPI.ConstructFeed.Messages;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Globalization;
using System.Linq;
using System.Text;
diff --git a/src/bnhtrade.Core/Logic/Account/GetTaxCodeInfo.cs b/src/bnhtrade.Core/Logic/Account/GetTaxCodeInfo.cs
index cc900e3..74571c9 100644
--- a/src/bnhtrade.Core/Logic/Account/GetTaxCodeInfo.cs
+++ b/src/bnhtrade.Core/Logic/Account/GetTaxCodeInfo.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using System.Windows.Forms;
namespace bnhtrade.Core.Logic.Account
{
diff --git a/src/bnhtrade.Core/Logic/Export/AccountInvoice/AmazonSettlement.cs b/src/bnhtrade.Core/Logic/Export/AccountInvoice/AmazonSettlement.cs
index f80735e..eff1b21 100644
--- a/src/bnhtrade.Core/Logic/Export/AccountInvoice/AmazonSettlement.cs
+++ b/src/bnhtrade.Core/Logic/Export/AccountInvoice/AmazonSettlement.cs
@@ -173,10 +173,12 @@ namespace bnhtrade.Core.Logic.Export.AccountInvoice
null, new List { settlementList[i].MarketPlace.GetMarketplaceUrl() }, true, true, 1);
if (completedSettlement.Any())
{
- if (completedSettlement.FirstOrDefault().Value.EndDate != settlementList[i].StartDate)
+ var tempEndDate = completedSettlement.FirstOrDefault().Value.EndDate;
+
+ if (tempEndDate != settlementList[i].StartDate)
{
- string error = (settlementList[i].StartDate - settlementList[i - 1].EndDate).Days + " day gap in "
- + settlementList[i].MarketPlace.GetMarketplaceUrl() + " settlement data (" + settlementList[i - 1].EndDate.ToString("dd MMM yyyy")
+ string error = (settlementList[i].StartDate - tempEndDate).Days + " day gap in "
+ + settlementList[i].MarketPlace.GetMarketplaceUrl() + " settlement data (" + tempEndDate.ToString("dd MMM yyyy")
+ " to " + settlementList[i].StartDate.ToString("dd MMM yyyy") + "). Ensure all settlement reports have been imported.";
ErrorMessage = error;
_log.LogError("Cancelled processing of Amazon settlement data into invoice export queue: " + error);
diff --git a/src/bnhtrade.Core/Logic/Inventory/SkuService.cs b/src/bnhtrade.Core/Logic/Inventory/SkuService.cs
index 9151c22..e3991f6 100644
--- a/src/bnhtrade.Core/Logic/Inventory/SkuService.cs
+++ b/src/bnhtrade.Core/Logic/Inventory/SkuService.cs
@@ -1,9 +1,7 @@
using bnhtrade.Core.Data.Database.UnitOfWork;
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
using System.Transactions;
-using System.Windows.Forms;
namespace bnhtrade.Core.Logic.Inventory
{
diff --git a/src/bnhtrade.Core/Logic/Sku/Price/FbaPricing.cs b/src/bnhtrade.Core/Logic/Sku/Price/FbaPricing.cs
index 18e25ec..c131872 100644
--- a/src/bnhtrade.Core/Logic/Sku/Price/FbaPricing.cs
+++ b/src/bnhtrade.Core/Logic/Sku/Price/FbaPricing.cs
@@ -1,7 +1,7 @@
using CsvHelper;
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Globalization;
using System.IO;
using System.Linq;
diff --git a/src/bnhtrade.Core/Logic/Sku/Price/UpdateRepricingValues.cs b/src/bnhtrade.Core/Logic/Sku/Price/UpdateRepricingValues.cs
index 5ea3010..6f63b2e 100644
--- a/src/bnhtrade.Core/Logic/Sku/Price/UpdateRepricingValues.cs
+++ b/src/bnhtrade.Core/Logic/Sku/Price/UpdateRepricingValues.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Transactions;
namespace bnhtrade.Core.Logic.Sku.Price
diff --git a/src/bnhtrade.Core/Logic/Stock/SkuTransactionCrud.cs b/src/bnhtrade.Core/Logic/Stock/SkuTransactionCrud.cs
index 4e8637d..790353f 100644
--- a/src/bnhtrade.Core/Logic/Stock/SkuTransactionCrud.cs
+++ b/src/bnhtrade.Core/Logic/Stock/SkuTransactionCrud.cs
@@ -1,7 +1,7 @@
using bnhtrade.Core.Data.Database;
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading;
diff --git a/src/bnhtrade.Core/Logic/Stock/SkuTransactionImport.cs b/src/bnhtrade.Core/Logic/Stock/SkuTransactionImport.cs
index 1b1faef..318750f 100644
--- a/src/bnhtrade.Core/Logic/Stock/SkuTransactionImport.cs
+++ b/src/bnhtrade.Core/Logic/Stock/SkuTransactionImport.cs
@@ -3,7 +3,7 @@ using bnhtrade.Core.Model.Stock;
using FikaAmazonAPI.AmazonSpApiSDK.Models.Restrictions;
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Logic/Stock/SkuTransactionTypeCrud.cs b/src/bnhtrade.Core/Logic/Stock/SkuTransactionTypeCrud.cs
index 62e9352..163afa4 100644
--- a/src/bnhtrade.Core/Logic/Stock/SkuTransactionTypeCrud.cs
+++ b/src/bnhtrade.Core/Logic/Stock/SkuTransactionTypeCrud.cs
@@ -1,7 +1,7 @@
using bnhtrade.Core.Data.Database;
using System;
using System.Collections.Generic;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/bnhtrade.Core/Model/Account/Journal.cs b/src/bnhtrade.Core/Model/Account/Journal.cs
index 6b69896..b9d37d4 100644
--- a/src/bnhtrade.Core/Model/Account/Journal.cs
+++ b/src/bnhtrade.Core/Model/Account/Journal.cs
@@ -1,5 +1,4 @@
-using Microsoft.VisualBasic;
-using System;
+using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
diff --git a/src/bnhtrade.Core/Model/Credentials/bnhtradeDB.cs b/src/bnhtrade.Core/Model/Credentials/bnhtradeDB.cs
index c8140ab..5fed5f3 100644
--- a/src/bnhtrade.Core/Model/Credentials/bnhtradeDB.cs
+++ b/src/bnhtrade.Core/Model/Credentials/bnhtradeDB.cs
@@ -28,7 +28,7 @@ namespace bnhtrade.Core.Model.Credentials
{
return "Data Source=" + DataSource + ";Initial Catalog=" + InitialCatalog + ";Persist Security Info=" + PersistSecurityInfo.ToString()
+ ";User ID=" + UserId + ";Password=" + UserPassword + ";MultipleActiveResultSets=" + MultipleActiveResultSets.ToString()
- + ";Connect Timeout=" + ConnectionTimeout + ";Encrypt=True;TrustServerCertificate=True";
+ + ";Connect Timeout=" + ConnectionTimeout + ";Encrypt=True";
}
}
diff --git a/src/bnhtrade.Core/Test/Account/Account.cs b/src/bnhtrade.Core/Test/Account/Account.cs
index b58226a..7454605 100644
--- a/src/bnhtrade.Core/Test/Account/Account.cs
+++ b/src/bnhtrade.Core/Test/Account/Account.cs
@@ -5,7 +5,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using System.Windows.Forms.Design;
using System.Xml;
using System.Xml.Linq;
diff --git a/src/bnhtrade.Core/bnhtrade.Core.csproj b/src/bnhtrade.Core/bnhtrade.Core.csproj
index ee5c558..329a7cf 100644
--- a/src/bnhtrade.Core/bnhtrade.Core.csproj
+++ b/src/bnhtrade.Core/bnhtrade.Core.csproj
@@ -1,10 +1,8 @@
- net8.0-windows
+ net8.0
Library
false
- true
- true
@@ -40,6 +38,7 @@
+
diff --git a/src/bnhtrade.ScheduledTasks/Properties/PublishProfiles/FolderProfile.pubxml b/src/bnhtrade.ScheduledTasks/Properties/PublishProfiles/FolderProfile.pubxml
new file mode 100644
index 0000000..5a9bf4c
--- /dev/null
+++ b/src/bnhtrade.ScheduledTasks/Properties/PublishProfiles/FolderProfile.pubxml
@@ -0,0 +1,15 @@
+
+
+
+
+ Release
+ Any CPU
+ C:\Users\Bobbie\Desktop\bnhtrade
+ FileSystem
+ <_TargetId>Folder
+ net8.0
+ linux-x64
+ false
+ true
+
+
\ No newline at end of file
diff --git a/src/bnhtrade.ScheduledTasks/bnhtrade.ScheduledTasks.csproj b/src/bnhtrade.ScheduledTasks/bnhtrade.ScheduledTasks.csproj
index 29c1d33..204280e 100644
--- a/src/bnhtrade.ScheduledTasks/bnhtrade.ScheduledTasks.csproj
+++ b/src/bnhtrade.ScheduledTasks/bnhtrade.ScheduledTasks.csproj
@@ -1,6 +1,6 @@
- net8.0-windows
+ net8.0
Exe
bnhtrade_Scheduled_Tasks
bnhtradeScheduledTasks