This commit is contained in:
2019-06-18 00:10:49 +00:00
parent c4c11c51d8
commit fd34a4f53a
10 changed files with 28 additions and 14 deletions

View File

@@ -360,9 +360,9 @@ namespace AyaNova.Util
GenSeedUser(log, 1, AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, timeZoneOffset, false, "TEST_INACTIVE", "TEST_INACTIVE");
//Alternate locale users for each stock locale
GenSeedUser(log, 1, AuthorizationRoles.AnyRole, UserType.Administrator, timeZoneOffset, true, "de", "de", LocaleBiz.LocaleNameToIdStatic("de"));
GenSeedUser(log, 1, AuthorizationRoles.AnyRole, UserType.Administrator, timeZoneOffset, true, "es", "es", LocaleBiz.LocaleNameToIdStatic("es"));
GenSeedUser(log, 1, AuthorizationRoles.AnyRole, UserType.Administrator, timeZoneOffset, true, "fr", "fr", LocaleBiz.LocaleNameToIdStatic("fr"));
GenSeedUser(log, 1, AuthorizationRoles.All, UserType.Administrator, timeZoneOffset, true, "de", "de", LocaleBiz.LocaleNameToIdStatic("de"));
GenSeedUser(log, 1, AuthorizationRoles.All, UserType.Administrator, timeZoneOffset, true, "es", "es", LocaleBiz.LocaleNameToIdStatic("es"));
GenSeedUser(log, 1, AuthorizationRoles.All, UserType.Administrator, timeZoneOffset, true, "fr", "fr", LocaleBiz.LocaleNameToIdStatic("fr"));
}
@@ -414,7 +414,7 @@ namespace AyaNova.Util
{
User u = new User();
u.Active = active;
var p = new Bogus.Person();
u.Name = Uniquify(p.FullName);
if (login != null)
@@ -455,6 +455,13 @@ namespace AyaNova.Util
{
WidgetBiz Biz = WidgetBiz.GetBizInternal(ServiceProviderProvider.DBContext);
var f = new Bogus.Faker();
//RANDOM ROLES
Array values = Enum.GetValues(typeof(AuthorizationRoles));
Random random = new Random();
for (int x = 0; x < count; x++)
{
Widget o = new Widget();
@@ -462,9 +469,10 @@ namespace AyaNova.Util
o.Active = true;
o.StartDate = f.Date.Between(DateTime.Now, DateTime.Now.AddMinutes(60));
o.EndDate = f.Date.Between(DateTime.Now.AddMinutes(90), DateTime.Now.AddHours(5));
o.DollarAmount = Convert.ToDecimal(f.Commerce.Price());
//this is nonsense but just to test an enum
o.Roles = AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited | AuthorizationRoles.OpsAdminLimited;
o.DollarAmount = Convert.ToDecimal(f.Commerce.Price());
//Random but valid enum
AuthorizationRoles randomRole = (AuthorizationRoles)values.GetValue(random.Next(values.Length));
o.Roles = randomRole;
o.Notes = f.Lorem.Paragraph();
o.Tags = RandomTags(f);
var NewObject = Biz.Create(ServiceProviderProvider.DBContext, o);