This commit is contained in:
2021-05-31 19:18:12 +00:00
parent 145e664d89
commit 6ef0884b66
4 changed files with 49 additions and 55 deletions

2
.vscode/launch.json vendored
View File

@@ -48,7 +48,7 @@
"AYANOVA_DEFAULT_TRANSLATION": "en", "AYANOVA_DEFAULT_TRANSLATION": "en",
//TRANSLATION MUST BE en for Integration TESTING //TRANSLATION MUST BE en for Integration TESTING
//"AYANOVA_PERMANENTLY_ERASE_DATABASE": "true", //"AYANOVA_PERMANENTLY_ERASE_DATABASE": "true",
"AYANOVA_DB_CONNECTION": "Server=localhost;Username=postgres;Password=raven;Database=AyaNova;CommandTimeout=90;", "AYANOVA_DB_CONNECTION": "Server=localhost;Username=postgres;Password=raven;Database=AyaNova;CommandTimeout=120;",
"AYANOVA_USE_URLS": "http://*:7575;", "AYANOVA_USE_URLS": "http://*:7575;",
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles", "AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles", "AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",

View File

@@ -386,13 +386,13 @@
"LoanUnitList": "Loan Items", "LoanUnitList": "Loan Items",
"LoanUnitName": "Name", "LoanUnitName": "Name",
"LoanUnitNotes": "Notes", "LoanUnitNotes": "Notes",
"LoanUnitRateDay": "Day rate", "LoanUnitRateDay": "Day",
"LoanUnitRateHalfDay": "Half day rate", "LoanUnitRateHalfDay": "Half day",
"LoanUnitRateHour": "Hour rate", "LoanUnitRateHour": "Hour",
"LoanUnitRateMonth": "Month rate", "LoanUnitRateMonth": "Month",
"LoanUnitRateNone": "-", "LoanUnitRateNone": "-",
"LoanUnitRateWeek": "Week rate", "LoanUnitRateWeek": "Week",
"LoanUnitRateYear": "Year rate", "LoanUnitRateYear": "Year",
"LoanUnitDefaultRate": "Default rate", "LoanUnitDefaultRate": "Default rate",
"LoanUnitSerial": "Serial number", "LoanUnitSerial": "Serial number",
"LoanUnitShadowUnit": "Shadow Unit", "LoanUnitShadowUnit": "Shadow Unit",

View File

@@ -432,12 +432,12 @@ namespace AyaNova.Util
//after cleanup //after cleanup
using (var cmd = new Npgsql.NpgsqlCommand()) using (var cmd = new Npgsql.NpgsqlCommand())
{ {
cmd.Connection = conn; cmd.Connection = conn;
cmd.CommandText = "delete from \"auseroptions\" where UserId <> 1;"; cmd.CommandText = "delete from \"auseroptions\" where UserId <> 1;";
await cmd.ExecuteNonQueryAsync(); await cmd.ExecuteNonQueryAsync();
cmd.CommandText = "ALTER SEQUENCE auseroptions_id_seq RESTART WITH 2;"; cmd.CommandText = "ALTER SEQUENCE auseroptions_id_seq RESTART WITH 2;";
await cmd.ExecuteNonQueryAsync(); await cmd.ExecuteNonQueryAsync();
cmd.CommandText = "delete from \"auser\" where id <> 1;"; cmd.CommandText = "delete from \"auser\" where id <> 1;";
await cmd.ExecuteNonQueryAsync(); await cmd.ExecuteNonQueryAsync();
cmd.CommandText = "ALTER SEQUENCE auser_id_seq RESTART WITH 2;"; cmd.CommandText = "ALTER SEQUENCE auser_id_seq RESTART WITH 2;";
@@ -477,7 +477,7 @@ namespace AyaNova.Util
/////////////////////////////////////////// ///////////////////////////////////////////
// Erase all data from the table specified // Erase all data from the table specified
// //
private static async Task EraseTableAsync(string sTable, Npgsql.NpgsqlConnection conn, bool tableHasNoIdentity = false) private static async Task EraseTableAsync(string sTable, Npgsql.NpgsqlConnection conn, bool tableHasNoSequence = false)
{ {
using (var cmd = new Npgsql.NpgsqlCommand()) using (var cmd = new Npgsql.NpgsqlCommand())
{ {
@@ -486,24 +486,18 @@ namespace AyaNova.Util
//but then cascade causes things to delete in any referenced table //but then cascade causes things to delete in any referenced table
// cmd.CommandText = "TRUNCATE \"" + sTable + "\" RESTART IDENTITY;"; // cmd.CommandText = "TRUNCATE \"" + sTable + "\" RESTART IDENTITY;";
// cmd.CommandText = $"delete from {sTable};"; cmd.CommandText = $"delete from {sTable};";
if (tableHasNoIdentity)
cmd.CommandText = $"TRUNCATE {sTable};";
else
cmd.CommandText = $"TRUNCATE {sTable} RESTART IDENTITY;";
await cmd.ExecuteNonQueryAsync(); await cmd.ExecuteNonQueryAsync();
// if (!tableHasNoSequence) if (!tableHasNoSequence)
// { {
// cmd.CommandText = $"ALTER SEQUENCE {sTable}_id_seq RESTART WITH 1;"; cmd.CommandText = $"ALTER SEQUENCE {sTable}_id_seq RESTART WITH 1;";
// await cmd.ExecuteNonQueryAsync(); await cmd.ExecuteNonQueryAsync();
// } }
} }
} }
/////////////////////////////////////////// ///////////////////////////////////////////
// Check if DB is empty // Check if DB is empty
// CALLED BY LICENSE CONTROLLER AND LICENSE.CS FOR TRIAL Request check // CALLED BY LICENSE CONTROLLER AND LICENSE.CS FOR TRIAL Request check

View File

@@ -228,7 +228,7 @@ namespace AyaNova.Util
await SeedUserAsync(log, 1, AuthorizationRoles.BizAdminFull | AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryFull | AuthorizationRoles.OpsAdminFull, UserType.Service); await SeedUserAsync(log, 1, AuthorizationRoles.BizAdminFull | AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryFull | AuthorizationRoles.OpsAdminFull, UserType.Service);
//Generate one office person / secretary //Generate one office person / secretary
await SeedUserAsync(log, 1, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryFull | AuthorizationRoles.AccountingFull, UserType.NotService); await SeedUserAsync(log, 1, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryFull | AuthorizationRoles.AccountingFull, UserType.NotService);
await SeedWidgetAsync(log, 25); await SeedWidgetAsync(log, 3);//keeping this here for now but must remove later
await SeedCustomerAsync(log, 25); await SeedCustomerAsync(log, 25);
await SeedHeadOfficeAsync(log, 10); await SeedHeadOfficeAsync(log, 10);
await SeedVendorAsync(log, 10); await SeedVendorAsync(log, 10);
@@ -283,15 +283,15 @@ namespace AyaNova.Util
//1 accountant / bookkeeper //1 accountant / bookkeeper
await SeedUserAsync(log, 1, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NotService); await SeedUserAsync(log, 1, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NotService);
await SeedWidgetAsync(log, 100); //await SeedWidgetAsync(log, 100);
await SeedCustomerAsync(log, 500); await SeedCustomerAsync(log, 500);
await SeedHeadOfficeAsync(log, 20); await SeedHeadOfficeAsync(log, 20);
await SeedVendorAsync(log, 50); await SeedVendorAsync(log, 50);
await SeedProjectAsync(log, 50); await SeedProjectAsync(log, 50);
await SeedServiceRateAsync(log, 10); await SeedServiceRateAsync(log, 10);
await SeedTravelRateAsync(log, 5); await SeedTravelRateAsync(log, 5);
await SeedUnitModelAsync(log, 25); await SeedUnitModelAsync(log, 20);
await SeedUnitAsync(log, 2500);//5 times the customers or 5 units per customer await SeedUnitAsync(log, 2500);
await SeedLoanLoanUnitAsync(log, 10); await SeedLoanLoanUnitAsync(log, 10);
await SeedCustomerServiceRequestAsync(log, 10); await SeedCustomerServiceRequestAsync(log, 10);
await SeedPartWarehouseAsync(log, 10); await SeedPartWarehouseAsync(log, 10);
@@ -325,10 +325,10 @@ namespace AyaNova.Util
await SeedUserAsync(log, 2, AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminLimited, UserType.NotService); await SeedUserAsync(log, 2, AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminLimited, UserType.NotService);
//owner / upper management who doesn't control anything but views stuff //owner / upper management who doesn't control anything but views stuff
await SeedUserAsync(log, 5, AuthorizationRoles.BizAdminLimited | AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited | AuthorizationRoles.OpsAdminLimited, UserType.NotService); await SeedUserAsync(log, 5, AuthorizationRoles.BizAdminLimited | AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited | AuthorizationRoles.OpsAdminLimited, UserType.NotService);
//100 techs //TECHS
await SeedUserAsync(log, 100, AuthorizationRoles.TechFull | AuthorizationRoles.DispatchLimited, UserType.Service); await SeedUserAsync(log, 50, AuthorizationRoles.TechFull | AuthorizationRoles.DispatchLimited, UserType.Service);
//limited techs //limited techs
await SeedUserAsync(log, 50, AuthorizationRoles.TechLimited | AuthorizationRoles.DispatchLimited, UserType.Service); await SeedUserAsync(log, 10, AuthorizationRoles.TechLimited | AuthorizationRoles.DispatchLimited, UserType.Service);
//20 subcontractors //20 subcontractors
await SeedUserAsync(log, 20, AuthorizationRoles.SubContractorFull, UserType.ServiceContractor); await SeedUserAsync(log, 20, AuthorizationRoles.SubContractorFull, UserType.ServiceContractor);
//10 limited subcontractors //10 limited subcontractors
@@ -348,22 +348,22 @@ namespace AyaNova.Util
//5 accountant / bookkeeper //5 accountant / bookkeeper
await SeedUserAsync(log, 5, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NotService); await SeedUserAsync(log, 5, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NotService);
await SeedWidgetAsync(log, 100); //await SeedWidgetAsync(log, 100);
await SeedCustomerAsync(log, 5000); await SeedCustomerAsync(log, 1000);
await SeedHeadOfficeAsync(log, 30); await SeedHeadOfficeAsync(log, 40);
await SeedVendorAsync(log, 75); await SeedVendorAsync(log, 100);
await SeedProjectAsync(log, 75); await SeedProjectAsync(log, 100);
await SeedServiceRateAsync(log, 20); await SeedServiceRateAsync(log, 20);
await SeedTravelRateAsync(log, 10); await SeedTravelRateAsync(log, 10);
await SeedUnitModelAsync(log, 30); await SeedUnitModelAsync(log, 40);
await SeedUnitAsync(log, 25000);//5 times the customers or 5 units per customer await SeedUnitAsync(log, 5000);
await SeedLoanLoanUnitAsync(log, 15); await SeedLoanLoanUnitAsync(log, 20);
await SeedCustomerServiceRequestAsync(log, 15); await SeedCustomerServiceRequestAsync(log, 20);
await SeedPartWarehouseAsync(log, 15); await SeedPartWarehouseAsync(log, 20);
await SeedPartAsync(log, 200, 15); await SeedPartAsync(log, 200, 15);
await SeedPartAssemblyAsync(log, 5); await SeedPartAssemblyAsync(log, 5);
await SeedPurchaseOrderAsync(log, 50); await SeedPurchaseOrderAsync(log, 50);
await SeedWorkOrderAsync(log, 50); await SeedWorkOrderAsync(log, 60);
//PERF //PERF
watch.Stop(); watch.Stop();
@@ -414,22 +414,22 @@ namespace AyaNova.Util
//accountant / bookkeeper //accountant / bookkeeper
await SeedUserAsync(log, 20, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NotService); await SeedUserAsync(log, 20, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NotService);
await SeedWidgetAsync(log, 100); //await SeedWidgetAsync(log, 100);
await SeedCustomerAsync(log, 20000); await SeedCustomerAsync(log, 10000);
await SeedHeadOfficeAsync(log, 40); await SeedHeadOfficeAsync(log, 200);
await SeedVendorAsync(log, 100); await SeedVendorAsync(log, 500);
await SeedProjectAsync(log, 500); await SeedProjectAsync(log, 500);
await SeedServiceRateAsync(log, 30); await SeedServiceRateAsync(log, 100);
await SeedTravelRateAsync(log, 15); await SeedTravelRateAsync(log, 50);
await SeedUnitModelAsync(log, 40); await SeedUnitModelAsync(log, 200);
await SeedUnitAsync(log, 100000);//5 times the customers or 5 units per customer await SeedUnitAsync(log, 25000);
await SeedLoanLoanUnitAsync(log, 20); await SeedLoanLoanUnitAsync(log, 100);
await SeedCustomerServiceRequestAsync(log, 20); await SeedCustomerServiceRequestAsync(log, 100);
await SeedPartWarehouseAsync(log, 20); await SeedPartWarehouseAsync(log, 100);
await SeedPartAsync(log, 500, 20); await SeedPartAsync(log, 1000, 1000);
await SeedPartAssemblyAsync(log, 5); await SeedPartAssemblyAsync(log, 25);
await SeedPurchaseOrderAsync(log, 200); await SeedPurchaseOrderAsync(log, 250);
await SeedWorkOrderAsync(log, 200); await SeedWorkOrderAsync(log, 300);
//PERF //PERF
watch.Stop(); watch.Stop();