using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace bnhtrade.Core.Logic.Utilities { public class NightlyRoutine { private Logic.Log.LogEvent log = new Log.LogEvent(); public NightlyRoutine() { } public void DownloadAll() { log.LogInformation("Nightly scheduled tasks started."); var export = new bnhtrade.Core.Logic.Export.AmazonSettlement(); bool stockUpdate = false; bool exchangeRate = false; bool accountProcess = false; while (true) { try { if (stockUpdate == false) { stockUpdate = true; new bnhtrade.Core.Logic.Import.Amazon().SyncAllWithDatabase(); ; } if (exchangeRate == false) { exchangeRate = true; new Logic.Account.Currency().UpdateHmrcExchageRates(); } if (accountProcess == false) { accountProcess = true; export.ToInvoice(); } // if (stockProcess == false) { stockProcess = true; stock.ProcessFbaStockImportData(); } // ^^^^^^ best to process manually, case, fba inventory recepts, if a correction is made days later (ie -1) the already incorrect value // will have been entered in the stocktransaction table and maked as processed in the inventoryreceipt table break; } catch (Exception ex) { log.LogInformation( "Exception caught running all report get method, see for further details", ex.ToString() ); } } log.LogInformation("Nightly scheduled tasks finished."); } } }