This commit is contained in:
2018-08-23 20:42:47 +00:00
parent 0c0818a539
commit a1e1eb9376
7 changed files with 69 additions and 59 deletions

View File

@@ -38,11 +38,11 @@ namespace AyaNova.Util
{
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger("Seeder");
ApiServerState apiServerState = (ApiServerState)ServiceProviderProvider.Provider.GetService(typeof(ApiServerState));
//get the current server state so can set back to it later
ApiServerState.ServerState wasServerState = apiServerState.GetState();
string wasReason=apiServerState.Reason;
string wasReason = apiServerState.Reason;
try
{
log.LogInformation("SEEDER: SeedDatabase, level is: " + slevel.ToString());
@@ -230,7 +230,7 @@ namespace AyaNova.Util
for (int x = 0; x < count; x++)
{
User u = new User();
var p = new Bogus.Person();
var p = new Bogus.Person();
u.Name = p.FullName;
u.Salt = Hasher.GenerateSalt();
if (login != null)
@@ -245,7 +245,7 @@ namespace AyaNova.Util
else
u.Password = Hasher.hash(u.Salt, u.Login);
u.Roles = roles;
u.LocaleId=ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID;
u.LocaleId = ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID;
ct.User.Add(u);
}
ct.SaveChanges();
@@ -264,7 +264,7 @@ namespace AyaNova.Util
var f = new Bogus.Faker();
o.Name = f.Commerce.ProductName();
o.Active = f.Random.Bool();
o.StartDate = f.Date.Between(DateTime.Now, DateTime.Now.AddMinutes(60));
o.EndDate = f.Date.Between(DateTime.Now.AddMinutes(90), DateTime.Now.AddHours(5));
@@ -273,8 +273,10 @@ namespace AyaNova.Util
//this is nonsense but just to test an enum
o.Roles = AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited | AuthorizationRoles.OpsAdminLimited;
ct.Widget.Add(o);
ct.SaveChanges();
EventLogProcessor.AddEntry(new Event(o.OwnerId, o.Id, AyaType.Widget, AyaEvent.Created), ct);
}
ct.SaveChanges();
}