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\\"
|
||||||
|
|||||||
@@ -575,12 +575,54 @@ namespace AyaNova.Util
|
|||||||
await SeedUserAsync(log, 1, AuthorizationRoles.All, UserType.NotService, true, "fr", "fr", await TranslationBiz.TranslationNameToIdStaticAsync("fr"), KnownUserTags);
|
await SeedUserAsync(log, 1, AuthorizationRoles.All, UserType.NotService, true, "fr", "fr", await TranslationBiz.TranslationNameToIdStaticAsync("fr"), KnownUserTags);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
long HeadOfficeIdForCustomer=0;
|
||||||
|
//seed a HO
|
||||||
|
HeadOffice ho = new HeadOffice();
|
||||||
|
ho.Name = "XYZ Head Office";
|
||||||
|
|
||||||
|
|
||||||
|
ho.Active = true;
|
||||||
|
ho.Notes = Fake.Company.CatchPhrase();
|
||||||
|
ho.Tags = RandomTags();
|
||||||
|
|
||||||
|
ho.AccountNumber = Fake.Finance.Account();
|
||||||
|
ho.Latitude = (decimal)Fake.Address.Latitude();
|
||||||
|
ho.Longitude = (decimal)Fake.Address.Longitude();
|
||||||
|
ho.Address = Fake.Address.StreetAddress();
|
||||||
|
ho.City = Fake.Address.City();
|
||||||
|
ho.Region = Fake.Address.State();
|
||||||
|
ho.Country = Fake.Address.Country();
|
||||||
|
|
||||||
|
ho.Phone1 = Fake.Phone.PhoneNumber();
|
||||||
|
ho.Phone2 = Fake.Phone.PhoneNumber();
|
||||||
|
ho.Phone3 = Fake.Phone.PhoneNumber();
|
||||||
|
ho.WebAddress = Fake.Internet.Url();
|
||||||
|
ho.EmailAddress = Fake.Internet.ExampleEmail();
|
||||||
|
|
||||||
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
|
{
|
||||||
|
HeadOfficeBiz biz = HeadOfficeBiz.GetBiz(ct);
|
||||||
|
var NewObject = await biz.CreateAsync(ho);
|
||||||
|
|
||||||
|
if (NewObject == null)
|
||||||
|
{
|
||||||
|
var err = $"Seeder::SeedHeadOffice error creating {ho.Name}\r\n{biz.GetErrorsAsString()}";
|
||||||
|
log.LogError(err);
|
||||||
|
throw new System.Exception(err);
|
||||||
|
}
|
||||||
|
//Known HO type user
|
||||||
|
await SeedUserAsync(log, 1, AuthorizationRoles.CustomerFull, UserType.HeadOffice, true, "HeadOffice", "HeadOffice", 0, KnownUserTags, null, NewObject.Id, null);
|
||||||
|
HeadOfficeIdForCustomer=NewObject.Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//CUSTOMER / HO Users
|
//CUSTOMER / HO Users
|
||||||
//seed a customer
|
//seed a customer
|
||||||
Customer o = new Customer();
|
Customer o = new Customer();
|
||||||
o.Name = "XYZ Accounting";
|
o.Name = "XYZ Accounting";
|
||||||
|
|
||||||
|
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();
|
||||||
@@ -599,6 +641,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);
|
||||||
@@ -610,12 +653,13 @@ namespace AyaNova.Util
|
|||||||
log.LogError(err);
|
log.LogError(err);
|
||||||
throw new System.Exception(err);
|
throw new System.Exception(err);
|
||||||
}
|
}
|
||||||
//Known customer type users
|
//Known customer type users
|
||||||
|
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.CustomerFull, UserType.Customer, true, "CustomerFull", "CustomerFull", 0, KnownUserTags, null, NewObject.Id, null);
|
await SeedUserAsync(log, 1, AuthorizationRoles.CustomerFull, UserType.Customer, true, "CustomerFull", "CustomerFull", 0, KnownUserTags, null, NewObject.Id, null);
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user