This commit is contained in:
2021-09-06 23:09:12 +00:00
parent 5ff995ff22
commit 2d2b13cf00
4 changed files with 18 additions and 24 deletions

2
.vscode/launch.json vendored
View File

@@ -53,7 +53,7 @@
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
"AYANOVA_SERVER_TEST_MODE": "false",
"AYANOVA_SERVER_TEST_MODE": "true",
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"

View File

@@ -84,8 +84,7 @@ namespace AyaNova.Biz
}
//Log modification and save context
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, 1, BizType, AyaEvent.Modified), ct);
//Update the static copy for the server
ServerGlobalBizSettings.Initialize(putObject);
return putObject;
}

View File

@@ -277,11 +277,10 @@ namespace AyaNova.Util
/////////////////////////////////////////////////////////
// Erase all user entered data from the db
// This is called by seeder for trial seeding purposes
// and by v8 migrate v7 exporter
// and by v8 migrate v7 exporter and by license controller when erasing db
internal static async Task EmptyBizDataFromDatabaseForSeedingOrImportingAsync(ILogger _log)
{
_log.LogInformation("Erasing Database \"{0}\"", _dbName);
AyaNova.Api.ControllerHelpers.ApiServerState apiServerState = (AyaNova.Api.ControllerHelpers.ApiServerState)ServiceProviderProvider.Provider.GetService(typeof(AyaNova.Api.ControllerHelpers.ApiServerState));
@@ -325,6 +324,10 @@ namespace AyaNova.Util
cmd.CommandText = "update aglobalbizsettings set taxpartpurchaseid=null,taxpartsaleid=null,taxratesaleid=null;";
await cmd.ExecuteNonQueryAsync();
//reset global settings cache taxes
ServerGlobalBizSettings.Cache.TaxPartPurchaseId = null;
ServerGlobalBizSettings.Cache.TaxPartSaleId = null;
ServerGlobalBizSettings.Cache.TaxRateSaleId = null;
cmd.CommandText = "update aworkorder set fromcsrid=null;";
await cmd.ExecuteNonQueryAsync();
@@ -412,18 +415,11 @@ namespace AyaNova.Util
await EraseTableAsync("apurchaseorderitem", conn);
await EraseTableAsync("apurchaseorder", conn);
await EraseTableAsync("apartassemblyitem", conn);
await EraseTableAsync("apartassembly", conn);
await EraseTableAsync("apartinventory", conn);
await EraseTableAsync("apart", conn);
await EraseTableAsync("aloanunit", conn);
await EraseTableAsync("aunitmodel", conn);
await EraseTableAsync("avendor", conn);
@@ -489,9 +485,6 @@ namespace AyaNova.Util
cmd.CommandText = "ALTER SEQUENCE apm_serial_seq RESTART WITH 1;";
await cmd.ExecuteNonQueryAsync();
}
await conn.CloseAsync();

View File

@@ -16,10 +16,12 @@ namespace AyaNova.Util
/// <summary>
/// Populate and / or create the settings
/// </summary>
internal static void Initialize(GlobalBizSettings global, AyContext ct = null)
internal static void Initialize(GlobalBizSettings global, AyContext ct)
{
if (global == null)
{
//fetch or create as not provided (meaning this was called from Startup.cs)
global = ct.GlobalBizSettings.FirstOrDefault(z => z.Id == 1);
if (global == null)