mirror of
https://github.com/stokebob/bnhtrade.git
synced 2026-03-19 06:27:15 +00:00
moving code our of program file
This commit is contained in:
@@ -25,7 +25,7 @@ namespace bnhtrade.Core.Logic.Import
|
||||
|
||||
if (!getFile.ReportFilePathIsSet)
|
||||
{
|
||||
MiscFunction.EventLogInsert(
|
||||
new Logic.Log.LogEvent().EventLogInsert(
|
||||
"Something went wrong retriving report from Amazon SP API. Operation cancelled.",
|
||||
2
|
||||
);
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace bnhtrade.Core.Logic.Import
|
||||
|
||||
if (!getFile.ReportFilePathIsSet)
|
||||
{
|
||||
MiscFunction.EventLogInsert(
|
||||
new Logic.Log.LogEvent().EventLogInsert(
|
||||
"Something went wrong retriving report from Amazon SP API. Operation cancelled.",
|
||||
2
|
||||
);
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace bnhtrade.Core.Logic.Import
|
||||
|
||||
if (!getFile.ReportFilePathIsSet)
|
||||
{
|
||||
MiscFunction.EventLogInsert(
|
||||
new Logic.Log.LogEvent().EventLogInsert(
|
||||
"Something went wrong retriving report from Amazon SP API. Operation cancelled.",
|
||||
2
|
||||
);
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace bnhtrade.Core.Logic.Import
|
||||
|
||||
if (!getFile.ReportFilePathIsSet)
|
||||
{
|
||||
MiscFunction.EventLogInsert(
|
||||
new Logic.Log.LogEvent().EventLogInsert(
|
||||
"Something went wrong retriving report from Amazon SP API. Operation cancelled.",
|
||||
2
|
||||
);
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace bnhtrade.Core.Logic.Import
|
||||
|
||||
if (!getReport.ReportFilePathIsSet)
|
||||
{
|
||||
MiscFunction.EventLogInsert(
|
||||
new Logic.Log.LogEvent().EventLogInsert(
|
||||
"Something went wrong retriving report from Amazon SP API. Operation cancelled.",
|
||||
2
|
||||
);
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace bnhtrade.Core.Logic.Import
|
||||
|
||||
if (!getFile.ReportFilePathIsSet)
|
||||
{
|
||||
MiscFunction.EventLogInsert(
|
||||
new Logic.Log.LogEvent().EventLogInsert(
|
||||
"Something went wrong retriving report from Amazon SP API. Operation cancelled.",
|
||||
2
|
||||
);
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace bnhtrade.Core.Logic.Import
|
||||
|
||||
if (!getFile.ReportFilePathIsSet)
|
||||
{
|
||||
MiscFunction.EventLogInsert(
|
||||
new Logic.Log.LogEvent().EventLogInsert(
|
||||
"Something went wrong retriving report from Amazon SP API. Operation cancelled.",
|
||||
2
|
||||
);
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace bnhtrade.Core.Logic.Import
|
||||
{
|
||||
string operation = "Import Amazon Settlement Reports";
|
||||
|
||||
MiscFunction.EventLogInsert("Started '" + operation + "' operation.");
|
||||
new Logic.Log.LogEvent().EventLogInsert("Started '" + operation + "' operation.");
|
||||
|
||||
// get avaiable reports from amazon api
|
||||
var spapiReportIdList = amazonReport.ListAvaliableReports();
|
||||
@@ -23,7 +23,7 @@ namespace bnhtrade.Core.Logic.Import
|
||||
|
||||
if (reportCount == 0)
|
||||
{
|
||||
MiscFunction.EventLogInsert("Exiting '" + operation + "' operation. No settlement reports availble on Amazon SP-API.");
|
||||
new Logic.Log.LogEvent().EventLogInsert("Exiting '" + operation + "' operation. No settlement reports availble on Amazon SP-API.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace bnhtrade.Core.Logic.Import
|
||||
|
||||
if (!spapiReportIdList.Any())
|
||||
{
|
||||
MiscFunction.EventLogInsert("Exiting '" + operation + "' operation. No new reports to import (" + reportCount + " avaibale).");
|
||||
new Logic.Log.LogEvent().EventLogInsert("Exiting '" + operation + "' operation. No new reports to import (" + reportCount + " avaibale).");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace bnhtrade.Core.Logic.Import
|
||||
UI.Console.WriteLine("Importing settlement report " + (i + 1) + " of " + spapiReportIdList.Count() + " (ReportID:" + spapiReportIdList[i] + ").");
|
||||
var filePath = amazonReport.GetFile(spapiReportIdList[i]);
|
||||
bool ack = dbImport.ByFlatFile(filePath, spapiReportIdList[i]);
|
||||
MiscFunction.EventLogInsert("Settlment Report imported (ReportID:" + spapiReportIdList[i] + ").");
|
||||
new Logic.Log.LogEvent().EventLogInsert("Settlment Report imported (ReportID:" + spapiReportIdList[i] + ").");
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -114,6 +114,22 @@ namespace bnhtrade.Core.Logic.Log
|
||||
Execute();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Depreciated, do not use!
|
||||
/// </summary>
|
||||
public void EventLogInsert(string detailShort = "", int eventType = 3, string detailLong = "", DateTime eventDateTime = default(DateTime), bool consolePrint = true)
|
||||
{
|
||||
this.eventType = eventType;
|
||||
DetailShort = detailShort;
|
||||
if (!string.IsNullOrEmpty(detailLong))
|
||||
DetailLong = detailLong;
|
||||
if (!(eventDateTime == default(DateTime)))
|
||||
this.eventDateTimeUtc = eventDateTime;
|
||||
this.printToConsole = consolePrint;
|
||||
Execute();
|
||||
Initialise();
|
||||
}
|
||||
|
||||
public void Initialise()
|
||||
{
|
||||
eventDateTimeUtc = null;
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace bnhtrade.Core.Logic.Stock
|
||||
{
|
||||
ProgressMessage = "New 'Transaction-Type' encountered";
|
||||
//Console.Write("\r");
|
||||
//MiscFunction.EventLogInsert(errMessage, 1);
|
||||
//new Logic.Log.LogEvent().EventLogInsert(errMessage, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace bnhtrade.Core.Logic.Utilities
|
||||
|
||||
public void DownloadAll()
|
||||
{
|
||||
MiscFunction.EventLogInsert("Nightly scheduled tasks started.");
|
||||
new Logic.Log.LogEvent().EventLogInsert("Nightly scheduled tasks started.");
|
||||
|
||||
var stock = new bnhtrade.Core.Stock.StockReconciliation();
|
||||
var export = new bnhtrade.Core.Logic.Export.AmazonSettlement(dbCredentials.ConnectionString);
|
||||
@@ -46,14 +46,14 @@ namespace bnhtrade.Core.Logic.Utilities
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MiscFunction.EventLogInsert(
|
||||
new Logic.Log.LogEvent().EventLogInsert(
|
||||
"Exception caught running all report get method, see for further details",
|
||||
1,
|
||||
ex.ToString()
|
||||
);
|
||||
}
|
||||
}
|
||||
MiscFunction.EventLogInsert("Nightly scheduled tasks finished.");
|
||||
new Logic.Log.LogEvent().EventLogInsert("Nightly scheduled tasks finished.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user