This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -53,7 +53,7 @@
|
|||||||
"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",
|
||||||
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
|
"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_SEEDLEVEL": "small",
|
||||||
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
|
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
|
||||||
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"
|
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"
|
||||||
|
|||||||
@@ -556,8 +556,7 @@ namespace AyaNova.Util
|
|||||||
await SeedUserAsync(log, 1, AuthorizationRoles.SalesLimited, UserType.NotService, "SalesLimited", "SalesLimited", KnownUserTags);
|
await SeedUserAsync(log, 1, AuthorizationRoles.SalesLimited, UserType.NotService, "SalesLimited", "SalesLimited", KnownUserTags);
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.SalesFull, UserType.NotService, "SalesFull", "SalesFull", KnownUserTags);
|
await SeedUserAsync(log, 1, AuthorizationRoles.SalesFull, UserType.NotService, "SalesFull", "SalesFull", KnownUserTags);
|
||||||
|
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.SubContractorLimited, UserType.ServiceContractor, "SubContractorLimited", "SubContractorLimited", KnownUserTags);
|
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.SubContractorFull, UserType.ServiceContractor, "SubContractorFull", "SubContractorFull", KnownUserTags);
|
|
||||||
|
|
||||||
|
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.OpsAdminLimited, UserType.NotService, "OpsAdminLimited", "OpsAdminLimited", KnownUserTags);
|
await SeedUserAsync(log, 1, AuthorizationRoles.OpsAdminLimited, UserType.NotService, "OpsAdminLimited", "OpsAdminLimited", KnownUserTags);
|
||||||
@@ -576,11 +575,11 @@ namespace AyaNova.Util
|
|||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
long HeadOfficeIdForCustomer=0;
|
long HeadOfficeIdForCustomer = 0;
|
||||||
//seed a HO
|
//seed a HO
|
||||||
HeadOffice ho = new HeadOffice();
|
HeadOffice ho = new HeadOffice();
|
||||||
ho.Name = "XYZ Head Office";
|
ho.Name = "XYZ Head Office";
|
||||||
|
|
||||||
|
|
||||||
ho.Active = true;
|
ho.Active = true;
|
||||||
ho.Notes = Fake.Company.CatchPhrase();
|
ho.Notes = Fake.Company.CatchPhrase();
|
||||||
@@ -590,7 +589,7 @@ namespace AyaNova.Util
|
|||||||
ho.Latitude = (decimal)Fake.Address.Latitude();
|
ho.Latitude = (decimal)Fake.Address.Latitude();
|
||||||
ho.Longitude = (decimal)Fake.Address.Longitude();
|
ho.Longitude = (decimal)Fake.Address.Longitude();
|
||||||
ho.Address = Fake.Address.StreetAddress();
|
ho.Address = Fake.Address.StreetAddress();
|
||||||
ho.City = Fake.Address.City();
|
ho.City = Fake.Address.City();
|
||||||
ho.Region = Fake.Address.State();
|
ho.Region = Fake.Address.State();
|
||||||
ho.Country = Fake.Address.Country();
|
ho.Country = Fake.Address.Country();
|
||||||
|
|
||||||
@@ -607,13 +606,13 @@ namespace AyaNova.Util
|
|||||||
|
|
||||||
if (NewObject == null)
|
if (NewObject == null)
|
||||||
{
|
{
|
||||||
var err = $"Seeder::SeedHeadOffice error creating {ho.Name}\r\n{biz.GetErrorsAsString()}";
|
var err = $"Seeder::SeedKnownHeadOffice error creating {ho.Name}\r\n{biz.GetErrorsAsString()}";
|
||||||
log.LogError(err);
|
log.LogError(err);
|
||||||
throw new System.Exception(err);
|
throw new System.Exception(err);
|
||||||
}
|
}
|
||||||
//Known HO type user
|
//Known HO type user
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.CustomerFull, UserType.HeadOffice, true, "HeadOffice", "HeadOffice", 0, KnownUserTags, null, null, NewObject.Id);
|
await SeedUserAsync(log, 1, AuthorizationRoles.CustomerFull, UserType.HeadOffice, true, "HeadOffice", "HeadOffice", 0, KnownUserTags, null, null, NewObject.Id);
|
||||||
HeadOfficeIdForCustomer=NewObject.Id;
|
HeadOfficeIdForCustomer = NewObject.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -622,7 +621,7 @@ namespace AyaNova.Util
|
|||||||
Customer o = new Customer();
|
Customer o = new Customer();
|
||||||
o.Name = "XYZ Accounting";
|
o.Name = "XYZ Accounting";
|
||||||
|
|
||||||
o.HeadOfficeId=HeadOfficeIdForCustomer;
|
o.HeadOfficeId = HeadOfficeIdForCustomer;
|
||||||
o.Active = true;
|
o.Active = true;
|
||||||
o.Notes = Fake.Company.CatchPhrase();
|
o.Notes = Fake.Company.CatchPhrase();
|
||||||
o.Tags = RandomTags();
|
o.Tags = RandomTags();
|
||||||
@@ -641,7 +640,7 @@ namespace AyaNova.Util
|
|||||||
o.WebAddress = Fake.Internet.Url();
|
o.WebAddress = Fake.Internet.Url();
|
||||||
o.EmailAddress = Fake.Internet.ExampleEmail();
|
o.EmailAddress = Fake.Internet.ExampleEmail();
|
||||||
|
|
||||||
|
|
||||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
{
|
{
|
||||||
CustomerBiz biz = CustomerBiz.GetBiz(ct);
|
CustomerBiz biz = CustomerBiz.GetBiz(ct);
|
||||||
@@ -649,7 +648,7 @@ namespace AyaNova.Util
|
|||||||
|
|
||||||
if (NewObject == null)
|
if (NewObject == null)
|
||||||
{
|
{
|
||||||
var err = $"Seeder::SeedCustomer error creating {o.Name}\r\n{biz.GetErrorsAsString()}";
|
var err = $"Seeder::SeedKnownCustomer error creating {o.Name}\r\n{biz.GetErrorsAsString()}";
|
||||||
log.LogError(err);
|
log.LogError(err);
|
||||||
throw new System.Exception(err);
|
throw new System.Exception(err);
|
||||||
}
|
}
|
||||||
@@ -658,10 +657,54 @@ namespace AyaNova.Util
|
|||||||
await SeedUserAsync(log, 1, AuthorizationRoles.CustomerFull, UserType.Customer, true, "CustomerLimited", "CustomerLimited", 0, KnownUserTags, null, NewObject.Id, null);
|
await SeedUserAsync(log, 1, AuthorizationRoles.CustomerFull, UserType.Customer, true, "CustomerLimited", "CustomerLimited", 0, KnownUserTags, null, NewObject.Id, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
//VENDOR AND SUBCONTRACTORS
|
||||||
|
//Yellow Cedar Consulting
|
||||||
|
long VendorIdForSubContractorUser = 0;
|
||||||
|
Vendor o = new Vendor();
|
||||||
|
o.Name = "Yellow Cedar Consulting";
|
||||||
|
|
||||||
|
|
||||||
|
o.Active = true;
|
||||||
|
o.Notes = Fake.Company.CatchPhrase();
|
||||||
|
o.Tags = RandomTags();
|
||||||
|
|
||||||
|
o.Contact = Fake.Name.FullName();
|
||||||
|
o.ContactNotes = Fake.Name.FullName();
|
||||||
|
o.AccountNumber = Fake.Finance.Account();
|
||||||
|
o.Latitude = (decimal)Fake.Address.Latitude();
|
||||||
|
o.Longitude = (decimal)Fake.Address.Longitude();
|
||||||
|
o.Address = Fake.Address.StreetAddress();
|
||||||
|
o.City = Fake.Address.City();
|
||||||
|
o.Region = Fake.Address.State();
|
||||||
|
o.Country = Fake.Address.Country();
|
||||||
|
|
||||||
|
o.Phone1 = Fake.Phone.PhoneNumber();
|
||||||
|
o.Phone2 = Fake.Phone.PhoneNumber();
|
||||||
|
o.Phone3 = Fake.Phone.PhoneNumber();
|
||||||
|
o.WebAddress = Fake.Internet.Url();
|
||||||
|
o.EmailAddress = Fake.Internet.ExampleEmail();
|
||||||
|
|
||||||
|
//This seems wrong to do in a loop but is 4 times faster this way ?!?
|
||||||
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
|
{
|
||||||
|
VendorBiz biz = VendorBiz.GetBiz(ct);
|
||||||
|
var NewObject = await biz.CreateAsync(o);
|
||||||
|
|
||||||
|
if (NewObject == null)
|
||||||
|
{
|
||||||
|
var err = $"Seeder::SeedKnownVendor error creating {o.Name}\r\n{biz.GetErrorsAsString()}";
|
||||||
|
log.LogError(err);
|
||||||
|
throw new System.Exception(err);
|
||||||
|
}
|
||||||
|
VendorIdForSubContractorUser = NewObject.Id;
|
||||||
|
|
||||||
|
}
|
||||||
|
await SeedUserAsync(log, 1, AuthorizationRoles.SubContractorLimited, UserType.ServiceContractor, true, "SubContractorLimited", "SubContractorLimited", 0, KnownUserTags, VendorIdForSubContractorUser, null, null);
|
||||||
|
await SeedUserAsync(log, 1, AuthorizationRoles.SubContractorFull, UserType.ServiceContractor, true, "SubContractorFull", "SubContractorFull", 0, KnownUserTags, VendorIdForSubContractorUser, null, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user