moving code our of program file

This commit is contained in:
Bobbie Hodgetts
2024-04-17 16:03:15 +01:00
parent c1e6da7a6f
commit f8452d274a
23 changed files with 122 additions and 592 deletions

View File

@@ -56,5 +56,15 @@ namespace bnhtrade.Core.Data.Database
FbaShippingPlan = 5,
// add the rest as needed
}
public enum OrderChannel
{
US = 1,
UK = 2,
De = 3,
Fr = 4,
It = 5,
Es = 6,
}
}
}

View File

@@ -62,7 +62,7 @@ namespace bnhtrade.Core.Data.Database.Import
{
// skip line
lineErrorSkip = lineErrorSkip + 1;
MiscFunction.EventLogInsert(
new Logic.Log.LogEvent().EventLogInsert(
"Line #" + lineNumber + " skipped due to no enough element in row.",
2,
filePath
@@ -183,17 +183,17 @@ namespace bnhtrade.Core.Data.Database.Import
}
trans.Commit();
Console.Write("\r");
MiscFunction.EventLogInsert((lineNumber - (1 + lineErrorSkip + lineDuplicateSkip)) + " total new items inserted, " + lineDuplicateSkip + " duplicates were skipped.");
new Logic.Log.LogEvent().EventLogInsert((lineNumber - (1 + lineErrorSkip + lineDuplicateSkip)) + " total new items inserted, " + lineDuplicateSkip + " duplicates were skipped.");
if (lineErrorSkip > 0)
{
MiscFunction.EventLogInsert(lineErrorSkip + " total line(s) where skipped due to insufficent number of cells on row", 1);
new Logic.Log.LogEvent().EventLogInsert(lineErrorSkip + " total line(s) where skipped due to insufficent number of cells on row", 1);
}
}
}
}
catch (Exception ex)
{
MiscFunction.EventLogInsert("Error running FbaInventoryReceiptReportImport, no records were commited",
new Logic.Log.LogEvent().EventLogInsert("Error running FbaInventoryReceiptReportImport, no records were commited",
1,
ex.ToString() + "\r\nTraceMessage:\r\n" + MiscFunction.TraceMessage()
);
@@ -234,7 +234,7 @@ namespace bnhtrade.Core.Data.Database.Import
}
catch (Exception ex)
{
MiscFunction.EventLogInsert("Error running GetFbaReturnsReport, no records were commited",
new Logic.Log.LogEvent().EventLogInsert("Error running GetFbaReturnsReport, no records were commited",
1,
ex.ToString() + "\r\nTraceMessage:\r\n" + MiscFunction.TraceMessage()
);

View File

@@ -59,7 +59,7 @@ namespace bnhtrade.Core.Data.Database.Import
{
// skip line
lineErrorSkip = lineErrorSkip + 1;
MiscFunction.EventLogInsert(
new Logic.Log.LogEvent().EventLogInsert(
"Line #" + lineNumber + " skipped due to no enough element in row.",
2,
filePath
@@ -185,17 +185,17 @@ namespace bnhtrade.Core.Data.Database.Import
}
trans.Commit();
Console.Write("\r");
MiscFunction.EventLogInsert((lineNumber - (1 + lineErrorSkip + lineDuplicateSkip)) + " total new items inserted, " + lineDuplicateSkip + " duplicates were skipped.");
new Logic.Log.LogEvent().EventLogInsert((lineNumber - (1 + lineErrorSkip + lineDuplicateSkip)) + " total new items inserted, " + lineDuplicateSkip + " duplicates were skipped.");
if (lineErrorSkip > 0)
{
MiscFunction.EventLogInsert(lineErrorSkip + " total line(s) where skipped due to insufficent number of cells on row", 1);
new Logic.Log.LogEvent().EventLogInsert(lineErrorSkip + " total line(s) where skipped due to insufficent number of cells on row", 1);
}
}
}
}
catch (Exception ex)
{
MiscFunction.EventLogInsert("Error running ImportFbaAdustmentReport method, no records were commited",
new Logic.Log.LogEvent().EventLogInsert("Error running ImportFbaAdustmentReport method, no records were commited",
1,
ex.ToString() + "\r\nTraceMessage:\r\n" + MiscFunction.TraceMessage()
);
@@ -236,7 +236,7 @@ namespace bnhtrade.Core.Data.Database.Import
}
catch (Exception ex)
{
MiscFunction.EventLogInsert("Error running GetFbaAdustmentData, no records were commited",
new Logic.Log.LogEvent().EventLogInsert("Error running GetFbaAdustmentData, no records were commited",
1,
ex.ToString() + "\r\nTraceMessage:\r\n" + MiscFunction.TraceMessage()
);

View File

@@ -100,7 +100,7 @@ namespace bnhtrade.Core.Data.Database.Import
{
// skip line
lineErrorSkip = lineErrorSkip + 1;
MiscFunction.EventLogInsert(
new Logic.Log.LogEvent().EventLogInsert(
"Line #" + lineNumber + " skipped due to no enough element in row.",
2,
filePath
@@ -276,12 +276,12 @@ namespace bnhtrade.Core.Data.Database.Import
}
}
Console.Write("\r");
MiscFunction.EventLogInsert(
new Logic.Log.LogEvent().EventLogInsert(
"Operation complete. " + lineNumber + " items processes. " + (lineNumber - lineErrorSkip - lineNoStockSkip) + " total new items inserted, "
+ lineNoStockSkip + " 'No Stock' records were skipped.");
if (lineErrorSkip > 0)
{
MiscFunction.EventLogInsert(lineErrorSkip + " total line(s) where skipped due to insufficent number of cells on row", 1);
new Logic.Log.LogEvent().EventLogInsert(lineErrorSkip + " total line(s) where skipped due to insufficent number of cells on row", 1);
}
}
}
@@ -290,7 +290,7 @@ namespace bnhtrade.Core.Data.Database.Import
}
catch (Exception ex)
{
MiscFunction.EventLogInsert("Something went wrong during import, check details for more.", 1, ex.ToString());
new Logic.Log.LogEvent().EventLogInsert("Something went wrong during import, check details for more.", 1, ex.ToString());
Console.WriteLine(ex.ToString());
}
}

View File

@@ -78,7 +78,7 @@ namespace bnhtrade.Core.Data.Database.Import
{
// skip line
lineErrorSkip = lineErrorSkip + 1;
MiscFunction.EventLogInsert(
new Logic.Log.LogEvent().EventLogInsert(
"Line #" + lineNumber + " skipped due to no enough element in row.",
2,
filePath
@@ -174,12 +174,12 @@ namespace bnhtrade.Core.Data.Database.Import
}
}
Console.Write("\r");
MiscFunction.EventLogInsert(
new Logic.Log.LogEvent().EventLogInsert(
"Operation complete. " + lineNumber + " items processes. " + (lineNumber - lineErrorSkip - lineNoStockSkip) + " total new items inserted, "
+ lineNoStockSkip + " 'No Stock' records were skipped.");
if (lineErrorSkip > 0)
{
MiscFunction.EventLogInsert(lineErrorSkip + " total line(s) where skipped due to insufficent number of cells on row", 1);
new Logic.Log.LogEvent().EventLogInsert(lineErrorSkip + " total line(s) where skipped due to insufficent number of cells on row", 1);
}
}
}
@@ -188,7 +188,7 @@ namespace bnhtrade.Core.Data.Database.Import
}
catch (Exception ex)
{
MiscFunction.EventLogInsert("Something went wrong during import, check details for more.", 1, ex.ToString());
new Logic.Log.LogEvent().EventLogInsert("Something went wrong during import, check details for more.", 1, ex.ToString());
Console.WriteLine(ex.ToString());
}
}

View File

@@ -42,7 +42,7 @@ namespace bnhtrade.Core.Data.Database.Import
// create notification if amazon add extra headers
if (columnCount > 7)
{
MiscFunction.EventLogInsert(
new Logic.Log.LogEvent().EventLogInsert(
"Amazon have added a new column to their 'Fba Inventory Receipt' report, you may want to check this out.",
2);
}
@@ -66,7 +66,7 @@ namespace bnhtrade.Core.Data.Database.Import
{
// skip line
lineErrorSkip = lineErrorSkip + 1;
MiscFunction.EventLogInsert(
new Logic.Log.LogEvent().EventLogInsert(
"Line #" + lineNumber + " skipped due to no enough element in row.",
2,
filePath
@@ -142,17 +142,17 @@ namespace bnhtrade.Core.Data.Database.Import
// only commit if records all complete with no errors -- ommiting duplcates relies on all records from one day being committed together
trans.Commit();
Console.Write("\r");
MiscFunction.EventLogInsert((lineNumber - (1 + lineErrorSkip + lineOutsideScope)) + " total report items inserted into db, " + lineOutsideScope + " item(s) outside of requested time scope where skipped.");
new Logic.Log.LogEvent().EventLogInsert((lineNumber - (1 + lineErrorSkip + lineOutsideScope)) + " total report items inserted into db, " + lineOutsideScope + " item(s) outside of requested time scope where skipped.");
if (lineErrorSkip > 0)
{
MiscFunction.EventLogInsert(lineErrorSkip + " total line(s) where skipped due to insufficent number of cells on row", 1);
new Logic.Log.LogEvent().EventLogInsert(lineErrorSkip + " total line(s) where skipped due to insufficent number of cells on row", 1);
}
}
}
}
catch (Exception ex)
{
MiscFunction.EventLogInsert("Error running FbaInventoryReceiptReportImport, no records were commited",
new Logic.Log.LogEvent().EventLogInsert("Error running FbaInventoryReceiptReportImport, no records were commited",
1,
ex.ToString() + "\r\nTraceMessage:\r\n" + MiscFunction.TraceMessage()
);
@@ -193,7 +193,7 @@ namespace bnhtrade.Core.Data.Database.Import
}
catch (Exception ex)
{
MiscFunction.EventLogInsert("Error running FbaInventoryReceiptReportImport, no records were commited",
new Logic.Log.LogEvent().EventLogInsert("Error running FbaInventoryReceiptReportImport, no records were commited",
1,
ex.ToString() + "\r\nTraceMessage:\r\n" + MiscFunction.TraceMessage()
);

View File

@@ -66,7 +66,7 @@ namespace bnhtrade.Core.Data.Database.Import
{
// skip line
lineErrorSkip = lineErrorSkip + 1;
MiscFunction.EventLogInsert(
new Logic.Log.LogEvent().EventLogInsert(
"Line #" + lineNumber + " skipped due to no enough element in row.",
2,
filePath
@@ -228,17 +228,17 @@ namespace bnhtrade.Core.Data.Database.Import
}
trans.Commit();
Console.Write("\r");
MiscFunction.EventLogInsert((lineNumber - (1 + lineErrorSkip + lineDuplicateSkip)) + " total new items inserted, " + lineDuplicateSkip + " duplicates were skipped.");
new Logic.Log.LogEvent().EventLogInsert((lineNumber - (1 + lineErrorSkip + lineDuplicateSkip)) + " total new items inserted, " + lineDuplicateSkip + " duplicates were skipped.");
if (lineErrorSkip > 0)
{
MiscFunction.EventLogInsert(lineErrorSkip + " total line(s) where skipped due to insufficent number of cells on row", 1);
new Logic.Log.LogEvent().EventLogInsert(lineErrorSkip + " total line(s) where skipped due to insufficent number of cells on row", 1);
}
}
}
}
catch (Exception ex)
{
MiscFunction.EventLogInsert("Error running ImportFbaReimbursementReport method, no records were commited",
new Logic.Log.LogEvent().EventLogInsert("Error running ImportFbaReimbursementReport method, no records were commited",
1,
ex.ToString() + "\r\nTraceMessage:\r\n" + MiscFunction.TraceMessage()
);
@@ -279,7 +279,7 @@ namespace bnhtrade.Core.Data.Database.Import
}
catch (Exception ex)
{
MiscFunction.EventLogInsert("Error running GetFbaReimbursementData, no records were commited",
new Logic.Log.LogEvent().EventLogInsert("Error running GetFbaReimbursementData, no records were commited",
1,
ex.ToString() + "\r\nTraceMessage:\r\n" + MiscFunction.TraceMessage()
);

View File

@@ -66,7 +66,7 @@ namespace bnhtrade.Core.Data.Database.Import
{
// skip line
lineErrorSkip = lineErrorSkip + 1;
MiscFunction.EventLogInsert(
new Logic.Log.LogEvent().EventLogInsert(
"Line #" + lineNumber + " skipped due to no enough element in row.",
2,
filePath
@@ -175,17 +175,17 @@ namespace bnhtrade.Core.Data.Database.Import
}
trans.Commit();
Console.Write("\r");
MiscFunction.EventLogInsert("ImportFbaRemovalOrderReport() " + (lineNumber - (1 + lineErrorSkip + lineUpdate)) + " records created, " + lineUpdate + " records updated.");
new Logic.Log.LogEvent().EventLogInsert("ImportFbaRemovalOrderReport() " + (lineNumber - (1 + lineErrorSkip + lineUpdate)) + " records created, " + lineUpdate + " records updated.");
if (lineErrorSkip > 0)
{
MiscFunction.EventLogInsert(lineErrorSkip + " total line(s) where skipped due to insufficent number of cells on row", 1);
new Logic.Log.LogEvent().EventLogInsert(lineErrorSkip + " total line(s) where skipped due to insufficent number of cells on row", 1);
}
}
}
}
catch (Exception ex)
{
MiscFunction.EventLogInsert("Error running ImportFbaRemovalOrderReport method, no records were commited",
new Logic.Log.LogEvent().EventLogInsert("Error running ImportFbaRemovalOrderReport method, no records were commited",
1,
ex.ToString() + "\r\nTraceMessage:\r\n" + MiscFunction.TraceMessage()
);
@@ -228,7 +228,7 @@ namespace bnhtrade.Core.Data.Database.Import
}
catch (Exception ex)
{
MiscFunction.EventLogInsert("Error running GetFbaRemovalOrderReport, no records were commited",
new Logic.Log.LogEvent().EventLogInsert("Error running GetFbaRemovalOrderReport, no records were commited",
1,
ex.ToString() + "\r\nTraceMessage:\r\n" + MiscFunction.TraceMessage()
);

View File

@@ -96,7 +96,7 @@ namespace bnhtrade.Core.Data.Database.Import
{
// skip line
lineErrorSkip = lineErrorSkip + 1;
MiscFunction.EventLogInsert(
new Logic.Log.LogEvent().EventLogInsert(
"Line #" + lineNumber + " skipped due to no enough element in row.",
2,
filePath
@@ -280,17 +280,17 @@ namespace bnhtrade.Core.Data.Database.Import
}
trans.Commit();
Console.Write("\r");
MiscFunction.EventLogInsert((lineNumber - (1 + lineErrorSkip + lineDuplicateSkip)) + " total new items inserted, " + lineDuplicateSkip + " duplicates were skipped.");
new Logic.Log.LogEvent().EventLogInsert((lineNumber - (1 + lineErrorSkip + lineDuplicateSkip)) + " total new items inserted, " + lineDuplicateSkip + " duplicates were skipped.");
if (lineErrorSkip > 0)
{
MiscFunction.EventLogInsert(lineErrorSkip + " total line(s) where skipped due to insufficent number of cells on row", 1);
new Logic.Log.LogEvent().EventLogInsert(lineErrorSkip + " total line(s) where skipped due to insufficent number of cells on row", 1);
}
}
}
}
catch (Exception ex)
{
MiscFunction.EventLogInsert("Error running FbaInventoryReceiptReportImport, no records were commited",
new Logic.Log.LogEvent().EventLogInsert("Error running FbaInventoryReceiptReportImport, no records were commited",
1,
ex.ToString() + "\r\nTraceMessage:\r\n" + MiscFunction.TraceMessage()
);
@@ -347,7 +347,7 @@ namespace bnhtrade.Core.Data.Database.Import
// {
// // skip line
// lineErrorSkip = lineErrorSkip + 1;
// MiscFunction.EventLogInsert(
// new Logic.Log.LogEvent().EventLogInsert(
// "Line #" + lineNumber + " skipped due to no enough element in row.",
// 2,
// filePath
@@ -501,17 +501,17 @@ namespace bnhtrade.Core.Data.Database.Import
// }
// trans.Commit();
// Console.Write("\r");
// MiscFunction.EventLogInsert((lineNumber - (1 + lineErrorSkip + lineDuplicateSkip)) + " total new items inserted, " + lineDuplicateSkip + " duplicates were skipped.");
// new Logic.Log.LogEvent().EventLogInsert((lineNumber - (1 + lineErrorSkip + lineDuplicateSkip)) + " total new items inserted, " + lineDuplicateSkip + " duplicates were skipped.");
// if (lineErrorSkip > 0)
// {
// MiscFunction.EventLogInsert(lineErrorSkip + " total line(s) where skipped due to insufficent number of cells on row", 1);
// new Logic.Log.LogEvent().EventLogInsert(lineErrorSkip + " total line(s) where skipped due to insufficent number of cells on row", 1);
// }
// }
// }
// //}
// //catch (Exception ex)
// //{
// // MiscFunction.EventLogInsert("Error running FbaInventoryReceiptReportImport, no records were commited",
// // new Logic.Log.LogEvent().EventLogInsert("Error running FbaInventoryReceiptReportImport, no records were commited",
// // 1,
// // ex.ToString() + "\r\nTraceMessage:\r\n" + MiscFunction.TraceMessage()
// // );
@@ -618,7 +618,7 @@ namespace bnhtrade.Core.Data.Database.Import
}
catch (Exception ex)
{
MiscFunction.EventLogInsert("Error running FbaInventoryReceiptReportImport, no records were commited",
new Logic.Log.LogEvent().EventLogInsert("Error running FbaInventoryReceiptReportImport, no records were commited",
1,
ex.ToString() + "\r\nTraceMessage:\r\n" + MiscFunction.TraceMessage()
);

View File

@@ -84,7 +84,7 @@ namespace bnhtrade.Core.Data.Database.Import
{
// skip line
lineSkip = lineSkip + 1;
MiscFunction.EventLogInsert(
new Logic.Log.LogEvent().EventLogInsert(
"Line #" + lineNumber + " skipped due to no enough element in row.",
2,
filePath
@@ -102,7 +102,7 @@ namespace bnhtrade.Core.Data.Database.Import
if (recordCount > 0)
{
UpdateSpapiReportId(items[indexSettlementId], reportId);
MiscFunction.EventLogInsert("Settlement report already imported, skipping...");
new Logic.Log.LogEvent().EventLogInsert("Settlement report already imported, skipping...");
scope.Complete();
return true;
}
@@ -285,7 +285,7 @@ namespace bnhtrade.Core.Data.Database.Import
if (sumOfAmount != settlementAmount)
{
MiscFunction.EventLogInsert("Error importing settlement id'" + settlementRef + "'. Sum of inserted settlement lines (" + sumOfAmount +
new Logic.Log.LogEvent().EventLogInsert("Error importing settlement id'" + settlementRef + "'. Sum of inserted settlement lines (" + sumOfAmount +
") does not match settlement amount (" + settlementAmount + ").", 1);
return false;
}
@@ -293,10 +293,10 @@ namespace bnhtrade.Core.Data.Database.Import
scope.Complete();
Console.Write("\r");
MiscFunction.EventLogInsert((lineNumber - (2 + lineSkip)) + " total settlement items inserted");
new Logic.Log.LogEvent().EventLogInsert((lineNumber - (2 + lineSkip)) + " total settlement items inserted");
if (lineSkip > 0)
{
MiscFunction.EventLogInsert(lineSkip + " total line(s) where skipped due to insufficent number of cells on row", 1);
new Logic.Log.LogEvent().EventLogInsert(lineSkip + " total line(s) where skipped due to insufficent number of cells on row", 1);
}
}
}