This commit is contained in:
2018-12-11 16:09:30 +00:00
parent 62ddd43501
commit 2ce1db72b1
6 changed files with 86 additions and 77 deletions

View File

@@ -47,9 +47,10 @@ namespace AyaNova.Api.Controllers
/// "Huge" - Used for automated testing and development, if you choose this it will take a very long time (15 minutes to overnight) /// "Huge" - Used for automated testing and development, if you choose this it will take a very long time (15 minutes to overnight)
/// </summary> /// </summary>
/// <param name="size">Valid values are "Small", "Medium", "Large", "Huge"</param> /// <param name="size">Valid values are "Small", "Medium", "Large", "Huge"</param>
/// <param name="timeZoneOffset">Value in hours of local time zone offset from UTC / GMT. This ensures that data is generated relative to the desired time zone</param>
/// <returns></returns> /// <returns></returns>
[HttpPost("seed/{size}")] [HttpPost("seed/{size}")]
public ActionResult SeedTrialDatabase([FromRoute] string size) public ActionResult SeedTrialDatabase([FromRoute] string size,[FromRoute] decimal timeZoneOffset )
{ {
if (!serverState.IsOpen) if (!serverState.IsOpen)
{ {
@@ -90,7 +91,8 @@ namespace AyaNova.Api.Controllers
JObject o = JObject.FromObject(new JObject o = JObject.FromObject(new
{ {
seedLevel = seedLevel seedLevel = seedLevel,
timeZoneOffset=timeZoneOffset
}); });
OpsJob j = new OpsJob(); OpsJob j = new OpsJob();

View File

@@ -380,7 +380,7 @@ namespace AyaNova
// ******************** TESTING WIPE DB ***************************** // ******************** TESTING WIPE DB *****************************
// //
//Set this to true to wipe the db and reinstall a trial license and re-seed the data //Set this to true to wipe the db and reinstall a trial license and re-seed the data
var TESTING_REFRESH_DB = false;//############################################################################################# var TESTING_REFRESH_DB = true;//#############################################################################################
#if (DEBUG) #if (DEBUG)
//TESTING //TESTING
@@ -419,7 +419,7 @@ namespace AyaNova
if (TESTING_REFRESH_DB) if (TESTING_REFRESH_DB)
{ {
AyaNova.Core.License.Fetch(apiServerState, dbContext, _log); AyaNova.Core.License.Fetch(apiServerState, dbContext, _log);
Util.Seeder.SeedDatabase(Util.Seeder.SeedLevel.SmallOneManShopTrialDataSet);//############################################################################################# Util.Seeder.SeedDatabase(Util.Seeder.SeedLevel.SmallOneManShopTrialDataSet, -8);//#############################################################################################
} }
//TESTING //TESTING
#endif #endif

View File

@@ -26,7 +26,7 @@ namespace AyaNova.Biz
ct = dbcontext; ct = dbcontext;
UserId = currentUserId; UserId = currentUserId;
CurrentUserRoles = userRoles; CurrentUserRoles = userRoles;
BizType=AyaType.TrialSeeder; BizType = AyaType.TrialSeeder;
} }
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
@@ -70,7 +70,8 @@ namespace AyaNova.Biz
//Get the import filename from the jsondata //Get the import filename from the jsondata
JObject jobData = JObject.Parse(job.JobInfo); JObject jobData = JObject.Parse(job.JobInfo);
var seedLevel = (Seeder.SeedLevel)jobData["seedLevel"].Value<int>(); var seedLevel = (Seeder.SeedLevel)jobData["seedLevel"].Value<int>();
Seeder.SeedDatabase(seedLevel, job.GId); var timeZoneOffset = jobData["timeZoneOffset"].Value<decimal>();
Seeder.SeedDatabase(seedLevel, job.GId, timeZoneOffset);
JobsBiz.LogJob(job.GId, "Finished.", ct); JobsBiz.LogJob(job.GId, "Finished.", ct);
JobsBiz.UpdateJobStatus(job.GId, JobStatus.Completed, ct); JobsBiz.UpdateJobStatus(job.GId, JobStatus.Completed, ct);
await Task.CompletedTask; await Task.CompletedTask;

View File

@@ -63,6 +63,8 @@ namespace AyaNova.Util
} }
}//eoc }//eoc

View File

@@ -21,13 +21,13 @@ namespace AyaNova.Util
//Seed database for trial and testing purposes //Seed database for trial and testing purposes
// //
public static void SeedDatabase(SeedLevel slevel) public static void SeedDatabase(SeedLevel slevel, Decimal timeZoneOffset)
{ {
SeedDatabase(slevel, Guid.Empty); SeedDatabase(slevel, Guid.Empty, timeZoneOffset);
} }
public static void SeedDatabase(SeedLevel slevel, Guid JobId) public static void SeedDatabase(SeedLevel slevel, Guid JobId, Decimal timeZoneOffset)
{ {
bool LogJob = JobId != Guid.Empty; bool LogJob = JobId != Guid.Empty;
@@ -44,7 +44,7 @@ namespace AyaNova.Util
try try
{ {
LogStatus(JobId, LogJob, log, $"SEEDER: Seed data level - {slevel.ToString()}"); LogStatus(JobId, LogJob, log, $"SEEDER: Seed data level - {slevel.ToString()}, timeZoneOffset - {timeZoneOffset.ToString()}");
//Only allow this in a trial database //Only allow this in a trial database
if (!AyaNova.Core.License.ActiveKey.TrialLicense) if (!AyaNova.Core.License.ActiveKey.TrialLicense)
@@ -59,9 +59,11 @@ namespace AyaNova.Util
//Erase all the data except for the license, schema and the manager user //Erase all the data except for the license, schema and the manager user
DbUtil.PrepareDatabaseForSeeding(log); DbUtil.PrepareDatabaseForSeeding(log);
Set the time zone of the manager account here
//Seed special test data for integration testing //Seed special test data for integration testing
//log.LogInformation("Seeding known users"); //log.LogInformation("Seeding known users");
SeedKnownUsers(log); SeedKnownUsers(log, timeZoneOffset);
//log.LogInformation("Seeding all other data"); //log.LogInformation("Seeding all other data");
switch (slevel) switch (slevel)
@@ -72,10 +74,10 @@ namespace AyaNova.Util
//This is for a busy but one man shop with a single office person handling stuff back at the shop //This is for a busy but one man shop with a single office person handling stuff back at the shop
//Generate owner and lead tech //Generate owner and lead tech
GenSeedUser(log, 1, AuthorizationRoles.BizAdminFull | AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryFull | AuthorizationRoles.OpsAdminFull, UserType.Schedulable); GenSeedUser(log, 1, AuthorizationRoles.BizAdminFull | AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryFull | AuthorizationRoles.OpsAdminFull, UserType.Schedulable, timeZoneOffset);
//Generate one office person / secretary //Generate one office person / secretary
GenSeedUser(log, 1, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryFull | AuthorizationRoles.AccountingFull, UserType.NonSchedulable); GenSeedUser(log, 1, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryFull | AuthorizationRoles.AccountingFull, UserType.NonSchedulable, timeZoneOffset);
//100 widgets //100 widgets
GenSeedWidget(log, 100); GenSeedWidget(log, 100);
@@ -89,37 +91,37 @@ namespace AyaNova.Util
//has one location, many techs and full staff for each department //has one location, many techs and full staff for each department
//One IT administrator, can change ops but nothing else //One IT administrator, can change ops but nothing else
GenSeedUser(log, 1, AuthorizationRoles.OpsAdminFull, UserType.NonSchedulable); GenSeedUser(log, 1, AuthorizationRoles.OpsAdminFull, UserType.NonSchedulable, timeZoneOffset);
//One business administrator, can view ops issues //One business administrator, can view ops issues
GenSeedUser(log, 1, AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable); GenSeedUser(log, 1, AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, timeZoneOffset);
//One owner who doesn't control anything but views stuff //One owner who doesn't control anything but views stuff
GenSeedUser(log, 1, AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited | AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable); GenSeedUser(log, 1, AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited | AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, timeZoneOffset);
//20 techs //20 techs
GenSeedUser(log, 20, AuthorizationRoles.TechFull | AuthorizationRoles.DispatchLimited, UserType.Schedulable); GenSeedUser(log, 20, AuthorizationRoles.TechFull | AuthorizationRoles.DispatchLimited, UserType.Schedulable, timeZoneOffset);
//2 subcontractors //2 subcontractors
GenSeedUser(log, 2, AuthorizationRoles.SubContractorFull, UserType.Subcontractor); GenSeedUser(log, 2, AuthorizationRoles.SubContractorFull, UserType.Subcontractor, timeZoneOffset);
//3 sales / generic office people people //3 sales / generic office people people
GenSeedUser(log, 3, AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited, UserType.NonSchedulable); GenSeedUser(log, 3, AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited, UserType.NonSchedulable, timeZoneOffset);
//1 dispatch manager //1 dispatch manager
GenSeedUser(log, 1, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryLimited, UserType.NonSchedulable); GenSeedUser(log, 1, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryLimited, UserType.NonSchedulable, timeZoneOffset);
//1 Inventory manager //1 Inventory manager
GenSeedUser(log, 1, AuthorizationRoles.InventoryFull | AuthorizationRoles.DispatchLimited, UserType.NonSchedulable); GenSeedUser(log, 1, AuthorizationRoles.InventoryFull | AuthorizationRoles.DispatchLimited, UserType.NonSchedulable, timeZoneOffset);
//1 accountant / bookkeeper //1 accountant / bookkeeper
GenSeedUser(log, 1, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NonSchedulable); GenSeedUser(log, 1, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NonSchedulable, timeZoneOffset);
//10 full on client users //10 full on client users
GenSeedUser(log, 10, AuthorizationRoles.ClientLimited, UserType.Client); GenSeedUser(log, 10, AuthorizationRoles.ClientLimited, UserType.Client, timeZoneOffset);
//10 limited client users //10 limited client users
GenSeedUser(log, 10, AuthorizationRoles.ClientLimited, UserType.Client); GenSeedUser(log, 10, AuthorizationRoles.ClientLimited, UserType.Client, timeZoneOffset);
//500 widgets //500 widgets
GenSeedWidget(log, 500); GenSeedWidget(log, 500);
@@ -138,46 +140,46 @@ namespace AyaNova.Util
watch.Start(); watch.Start();
//IT administrator, can change ops but nothing else //IT administrator, can change ops but nothing else
GenSeedUser(log, 2, AuthorizationRoles.OpsAdminFull, UserType.NonSchedulable); GenSeedUser(log, 2, AuthorizationRoles.OpsAdminFull, UserType.NonSchedulable, timeZoneOffset);
//business administrator, can view ops issues //business administrator, can view ops issues
GenSeedUser(log, 2, AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable); GenSeedUser(log, 2, AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, timeZoneOffset);
//owner / upper management who doesn't control anything but views stuff //owner / upper management who doesn't control anything but views stuff
GenSeedUser(log, 5, AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited | AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable); GenSeedUser(log, 5, AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited | AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, timeZoneOffset);
//100 techs //100 techs
GenSeedUser(log, 100, AuthorizationRoles.TechFull | AuthorizationRoles.DispatchLimited, UserType.Schedulable); GenSeedUser(log, 100, AuthorizationRoles.TechFull | AuthorizationRoles.DispatchLimited, UserType.Schedulable, timeZoneOffset);
//limited techs //limited techs
GenSeedUser(log, 50, AuthorizationRoles.TechLimited | AuthorizationRoles.DispatchLimited, UserType.Schedulable); GenSeedUser(log, 50, AuthorizationRoles.TechLimited | AuthorizationRoles.DispatchLimited, UserType.Schedulable, timeZoneOffset);
//20 subcontractors //20 subcontractors
GenSeedUser(log, 20, AuthorizationRoles.SubContractorFull, UserType.Subcontractor); GenSeedUser(log, 20, AuthorizationRoles.SubContractorFull, UserType.Subcontractor, timeZoneOffset);
//10 limited subcontractors //10 limited subcontractors
GenSeedUser(log, 10, AuthorizationRoles.SubContractorLimited, UserType.Subcontractor); GenSeedUser(log, 10, AuthorizationRoles.SubContractorLimited, UserType.Subcontractor, timeZoneOffset);
//30 sales / generic office people people //30 sales / generic office people people
GenSeedUser(log, 30, AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited, UserType.NonSchedulable); GenSeedUser(log, 30, AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited, UserType.NonSchedulable, timeZoneOffset);
//5 dispatch manager //5 dispatch manager
GenSeedUser(log, 5, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryLimited, UserType.NonSchedulable); GenSeedUser(log, 5, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryLimited, UserType.NonSchedulable, timeZoneOffset);
//5 Inventory manager //5 Inventory manager
GenSeedUser(log, 5, AuthorizationRoles.InventoryFull | AuthorizationRoles.DispatchLimited, UserType.NonSchedulable); GenSeedUser(log, 5, AuthorizationRoles.InventoryFull | AuthorizationRoles.DispatchLimited, UserType.NonSchedulable, timeZoneOffset);
//10 Inventory manager assistants //10 Inventory manager assistants
GenSeedUser(log, 5, AuthorizationRoles.InventoryLimited, UserType.NonSchedulable); GenSeedUser(log, 5, AuthorizationRoles.InventoryLimited, UserType.NonSchedulable, timeZoneOffset);
//5 accountant / bookkeeper //5 accountant / bookkeeper
GenSeedUser(log, 5, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NonSchedulable); GenSeedUser(log, 5, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NonSchedulable, timeZoneOffset);
//100 full on client users //100 full on client users
GenSeedUser(log, 20, AuthorizationRoles.ClientFull, UserType.Client); GenSeedUser(log, 20, AuthorizationRoles.ClientFull, UserType.Client, timeZoneOffset);
//100 limited client users //100 limited client users
GenSeedUser(log, 20, AuthorizationRoles.ClientLimited, UserType.Client); GenSeedUser(log, 20, AuthorizationRoles.ClientLimited, UserType.Client, timeZoneOffset);
//PERF //PERF
watch.Stop(); watch.Stop();
@@ -208,46 +210,46 @@ namespace AyaNova.Util
watch.Start(); watch.Start();
//IT administrator, can change ops but nothing else //IT administrator, can change ops but nothing else
GenSeedUser(log, 10, AuthorizationRoles.OpsAdminFull, UserType.NonSchedulable); GenSeedUser(log, 10, AuthorizationRoles.OpsAdminFull, UserType.NonSchedulable, timeZoneOffset);
//business administrator, can view ops issues //business administrator, can view ops issues
GenSeedUser(log, 10, AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable); GenSeedUser(log, 10, AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, timeZoneOffset);
//owner / upper management who doesn't control anything but views stuff //owner / upper management who doesn't control anything but views stuff
GenSeedUser(log, 20, AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited | AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable); GenSeedUser(log, 20, AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited | AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, timeZoneOffset);
//regular techs //regular techs
GenSeedUser(log, 500, AuthorizationRoles.TechFull | AuthorizationRoles.DispatchLimited, UserType.Schedulable); GenSeedUser(log, 500, AuthorizationRoles.TechFull | AuthorizationRoles.DispatchLimited, UserType.Schedulable, timeZoneOffset);
//limited techs //limited techs
GenSeedUser(log, 200, AuthorizationRoles.TechLimited | AuthorizationRoles.DispatchLimited, UserType.Schedulable); GenSeedUser(log, 200, AuthorizationRoles.TechLimited | AuthorizationRoles.DispatchLimited, UserType.Schedulable, timeZoneOffset);
//subcontractors //subcontractors
GenSeedUser(log, 80, AuthorizationRoles.SubContractorFull, UserType.Subcontractor); GenSeedUser(log, 80, AuthorizationRoles.SubContractorFull, UserType.Subcontractor, timeZoneOffset);
//limited subcontractors //limited subcontractors
GenSeedUser(log, 40, AuthorizationRoles.SubContractorLimited, UserType.Subcontractor); GenSeedUser(log, 40, AuthorizationRoles.SubContractorLimited, UserType.Subcontractor, timeZoneOffset);
//sales / generic office people people //sales / generic office people people
GenSeedUser(log, 200, AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited, UserType.NonSchedulable); GenSeedUser(log, 200, AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited, UserType.NonSchedulable, timeZoneOffset);
//dispatch manager //dispatch manager
GenSeedUser(log, 20, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryLimited, UserType.NonSchedulable); GenSeedUser(log, 20, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryLimited, UserType.NonSchedulable, timeZoneOffset);
//Inventory manager //Inventory manager
GenSeedUser(log, 40, AuthorizationRoles.InventoryFull | AuthorizationRoles.DispatchLimited, UserType.NonSchedulable); GenSeedUser(log, 40, AuthorizationRoles.InventoryFull | AuthorizationRoles.DispatchLimited, UserType.NonSchedulable, timeZoneOffset);
//Inventory manager assistants //Inventory manager assistants
GenSeedUser(log, 20, AuthorizationRoles.InventoryLimited, UserType.NonSchedulable); GenSeedUser(log, 20, AuthorizationRoles.InventoryLimited, UserType.NonSchedulable, timeZoneOffset);
//accountant / bookkeeper //accountant / bookkeeper
GenSeedUser(log, 20, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NonSchedulable); GenSeedUser(log, 20, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NonSchedulable, timeZoneOffset);
//full on client users //full on client users
GenSeedUser(log, 200, AuthorizationRoles.ClientFull, UserType.Client); GenSeedUser(log, 200, AuthorizationRoles.ClientFull, UserType.Client, timeZoneOffset);
//limited client users //limited client users
GenSeedUser(log, 50, AuthorizationRoles.ClientLimited, UserType.Client); GenSeedUser(log, 50, AuthorizationRoles.ClientLimited, UserType.Client, timeZoneOffset);
//PERF //PERF
watch.Stop(); watch.Stop();
@@ -310,41 +312,41 @@ namespace AyaNova.Util
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
//Seed test data for integration tests //Seed test data for integration tests
// //
public static void SeedKnownUsers(ILogger log) public static void SeedKnownUsers(ILogger log, decimal timeZoneOffset)
{ {
try try
{ {
//TEST USERS //TEST USERS
//one of each role type //one of each role type
GenSeedUser(log, 1, AuthorizationRoles.BizAdminLimited, UserType.NonSchedulable, "BizAdminLimited", "BizAdminLimited"); GenSeedUser(log, 1, AuthorizationRoles.BizAdminLimited, UserType.NonSchedulable, timeZoneOffset, "BizAdminLimited", "BizAdminLimited");
GenSeedUser(log, 1, AuthorizationRoles.BizAdminFull, UserType.NonSchedulable, "BizAdminFull", "BizAdminFull"); GenSeedUser(log, 1, AuthorizationRoles.BizAdminFull, UserType.NonSchedulable, timeZoneOffset, "BizAdminFull", "BizAdminFull");
GenSeedUser(log, 1, AuthorizationRoles.DispatchLimited, UserType.NonSchedulable, "DispatchLimited", "DispatchLimited"); GenSeedUser(log, 1, AuthorizationRoles.DispatchLimited, UserType.NonSchedulable, timeZoneOffset, "DispatchLimited", "DispatchLimited");
GenSeedUser(log, 1, AuthorizationRoles.DispatchFull, UserType.NonSchedulable, "DispatchFull", "DispatchFull"); GenSeedUser(log, 1, AuthorizationRoles.DispatchFull, UserType.NonSchedulable, timeZoneOffset, "DispatchFull", "DispatchFull");
GenSeedUser(log, 1, AuthorizationRoles.InventoryLimited, UserType.NonSchedulable, "InventoryLimited", "InventoryLimited"); GenSeedUser(log, 1, AuthorizationRoles.InventoryLimited, UserType.NonSchedulable, timeZoneOffset, "InventoryLimited", "InventoryLimited");
GenSeedUser(log, 1, AuthorizationRoles.InventoryFull, UserType.NonSchedulable, "InventoryFull", "InventoryFull"); GenSeedUser(log, 1, AuthorizationRoles.InventoryFull, UserType.NonSchedulable, timeZoneOffset, "InventoryFull", "InventoryFull");
GenSeedUser(log, 1, AuthorizationRoles.AccountingFull, UserType.NonSchedulable, "Accounting", "Accounting"); GenSeedUser(log, 1, AuthorizationRoles.AccountingFull, UserType.NonSchedulable, timeZoneOffset, "Accounting", "Accounting");
GenSeedUser(log, 1, AuthorizationRoles.TechLimited, UserType.Schedulable, "TechLimited", "TechLimited"); GenSeedUser(log, 1, AuthorizationRoles.TechLimited, UserType.Schedulable, timeZoneOffset, "TechLimited", "TechLimited");
GenSeedUser(log, 1, AuthorizationRoles.TechFull, UserType.Schedulable, "TechFull", "TechFull"); GenSeedUser(log, 1, AuthorizationRoles.TechFull, UserType.Schedulable, timeZoneOffset, "TechFull", "TechFull");
GenSeedUser(log, 1, AuthorizationRoles.SubContractorLimited, UserType.Subcontractor, "SubContractorLimited", "SubContractorLimited"); GenSeedUser(log, 1, AuthorizationRoles.SubContractorLimited, UserType.Subcontractor, timeZoneOffset, "SubContractorLimited", "SubContractorLimited");
GenSeedUser(log, 1, AuthorizationRoles.SubContractorFull, UserType.Subcontractor, "SubContractorFull", "SubContractorFull"); GenSeedUser(log, 1, AuthorizationRoles.SubContractorFull, UserType.Subcontractor, timeZoneOffset, "SubContractorFull", "SubContractorFull");
GenSeedUser(log, 1, AuthorizationRoles.ClientLimited, UserType.Client, "ClientLimited", "ClientLimited"); GenSeedUser(log, 1, AuthorizationRoles.ClientLimited, UserType.Client, timeZoneOffset, "ClientLimited", "ClientLimited");
GenSeedUser(log, 1, AuthorizationRoles.ClientFull, UserType.Client, "ClientFull", "ClientFull"); GenSeedUser(log, 1, AuthorizationRoles.ClientFull, UserType.Client, timeZoneOffset, "ClientFull", "ClientFull");
GenSeedUser(log, 1, AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, "OpsAdminLimited", "OpsAdminLimited"); GenSeedUser(log, 1, AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, timeZoneOffset, "OpsAdminLimited", "OpsAdminLimited");
GenSeedUser(log, 1, AuthorizationRoles.OpsAdminFull, UserType.NonSchedulable, "OpsAdminFull", "OpsAdminFull"); GenSeedUser(log, 1, AuthorizationRoles.OpsAdminFull, UserType.NonSchedulable, timeZoneOffset, "OpsAdminFull", "OpsAdminFull");
//PRIVACY TEST USER - this is used for a test to see if user info leaks into the logs //PRIVACY TEST USER - this is used for a test to see if user info leaks into the logs
GenSeedUser(log, 1, AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, "TEST_PRIVACY_USER_ACCOUNT", "TEST_PRIVACY_USER_ACCOUNT"); GenSeedUser(log, 1, AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, timeZoneOffset, "TEST_PRIVACY_USER_ACCOUNT", "TEST_PRIVACY_USER_ACCOUNT");
//TEST NOT ACTIVE - this is used for a test to see if inactive user can login //TEST NOT ACTIVE - this is used for a test to see if inactive user can login
GenSeedUser(log, 1, AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, false, "TEST_INACTIVE", "TEST_INACTIVE"); GenSeedUser(log, 1, AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, timeZoneOffset, false, "TEST_INACTIVE", "TEST_INACTIVE");
//Alternate locale users for each stock locale //Alternate locale users for each stock locale
GenSeedUser(log, 1, AuthorizationRoles.AnyRole, UserType.Administrator, true, "de", "de", LocaleBiz.LocaleNameToIdStatic("de")); GenSeedUser(log, 1, AuthorizationRoles.AnyRole, UserType.Administrator, timeZoneOffset, true, "de", "de", LocaleBiz.LocaleNameToIdStatic("de"));
GenSeedUser(log, 1, AuthorizationRoles.AnyRole, UserType.Administrator, true, "es", "es", LocaleBiz.LocaleNameToIdStatic("es")); GenSeedUser(log, 1, AuthorizationRoles.AnyRole, UserType.Administrator, timeZoneOffset, true, "es", "es", LocaleBiz.LocaleNameToIdStatic("es"));
GenSeedUser(log, 1, AuthorizationRoles.AnyRole, UserType.Administrator, true, "fr", "fr", LocaleBiz.LocaleNameToIdStatic("fr")); GenSeedUser(log, 1, AuthorizationRoles.AnyRole, UserType.Administrator, timeZoneOffset, true, "fr", "fr", LocaleBiz.LocaleNameToIdStatic("fr"));
} }
@@ -364,13 +366,14 @@ namespace AyaNova.Util
/// <param name="count"></param> /// <param name="count"></param>
/// <param name="roles"></param> /// <param name="roles"></param>
/// <param name="userType"></param> /// <param name="userType"></param>
/// <param name="timeZoneOffset"></param>
/// <param name="login"></param> /// <param name="login"></param>
/// <param name="password"></param> /// <param name="password"></param>
public static void GenSeedUser(ILogger log, int count, AuthorizationRoles roles, UserType userType, string login, string password) public static void GenSeedUser(ILogger log, int count, AuthorizationRoles roles, UserType userType, decimal timeZoneOffset, string login, string password)
{ {
try try
{ {
GenSeedUser(log, count, roles, userType, true, login, password); GenSeedUser(log, count, roles, userType, timeZoneOffset, true, login, password);
} }
catch catch
{ {
@@ -381,7 +384,7 @@ namespace AyaNova.Util
public static void GenSeedUser(ILogger log, int count, AuthorizationRoles roles, UserType userType, bool active = true, string login = null, string password = null, long localeId = 0) public static void GenSeedUser(ILogger log, int count, AuthorizationRoles roles, UserType userType, decimal timeZoneOffset, bool active = true, string login = null, string password = null, long localeId = 0)
{ {
UserBiz Biz = UserBiz.GetBizInternal(ServiceProviderProvider.DBContext); UserBiz Biz = UserBiz.GetBizInternal(ServiceProviderProvider.DBContext);
@@ -418,6 +421,7 @@ namespace AyaNova.Util
//Children and relations //Children and relations
u.UserOptions = new UserOptions(1); u.UserOptions = new UserOptions(1);
u.UserOptions.EmailAddress = p.Email.Replace("gmail.com", "helloayanova.com").Replace("hotmail.com", "helloayanova.com").Replace("yahoo.com", "helloayanova.com"); u.UserOptions.EmailAddress = p.Email.Replace("gmail.com", "helloayanova.com").Replace("hotmail.com", "helloayanova.com").Replace("yahoo.com", "helloayanova.com");
u.UserOptions.TimeZoneOffset=timeZoneOffset;
var NewObject = Biz.Create(ServiceProviderProvider.DBContext, u); var NewObject = Biz.Create(ServiceProviderProvider.DBContext, u);
if (NewObject == null) if (NewObject == null)

View File

@@ -1534,7 +1534,7 @@ namespace raven_integration
//included widget //included widget
dynamic w = new JObject(); dynamic w = new JObject();
w.name = Util.Uniquify(WidgetNameStart); w.name = Util.Uniquify(WidgetNameStart);
//Put it right at midnight this month to ensure boundaries are respected //Put it right at midnight next month to ensure boundaries are respected
w.startDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1, 00, 00, 00).AddMonths(1).ToUniversalTime(); w.startDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1, 00, 00, 00).AddMonths(1).ToUniversalTime();
w.endDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1, 00, 00, 00).AddMonths(1).AddHours(1).ToUniversalTime(); w.endDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1, 00, 00, 00).AddMonths(1).AddHours(1).ToUniversalTime();