From 58d9f27fd6f6a1e6ae6223d2c3b6cd7499498cba Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 26 Sep 2018 22:51:22 +0000 Subject: [PATCH] --- server/AyaNova/biz/IImportAyaNova7Object.cs | 2 +- server/AyaNova/biz/LocaleBiz.cs | 4 ++-- server/AyaNova/biz/TagBiz.cs | 4 ++-- server/AyaNova/biz/UserBiz.cs | 14 +++++++------- server/AyaNova/util/Seeder.cs | 3 ++- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/server/AyaNova/biz/IImportAyaNova7Object.cs b/server/AyaNova/biz/IImportAyaNova7Object.cs index 809dfa37..4f7d3a1e 100644 --- a/server/AyaNova/biz/IImportAyaNova7Object.cs +++ b/server/AyaNova/biz/IImportAyaNova7Object.cs @@ -25,7 +25,7 @@ namespace AyaNova.Biz /// /// If true, relaxes validation rules so that incomplete data can be imported /// - bool V7ValidationImportMode { get; set; } + bool SeedOrImportRelaxedRulesMode { get; set; } } diff --git a/server/AyaNova/biz/LocaleBiz.cs b/server/AyaNova/biz/LocaleBiz.cs index e8b5fcaf..f2979f67 100644 --- a/server/AyaNova/biz/LocaleBiz.cs +++ b/server/AyaNova/biz/LocaleBiz.cs @@ -21,14 +21,14 @@ namespace AyaNova.Biz private readonly AyContext ct; public readonly long userId; private readonly AuthorizationRoles userRoles; - public bool V7ValidationImportMode { get; set; } + public bool SeedOrImportRelaxedRulesMode { get; set; } internal LocaleBiz(AyContext dbcontext, long currentUserId, AuthorizationRoles UserRoles) { ct = dbcontext; userId = currentUserId; userRoles = UserRoles; - V7ValidationImportMode = false;//default + SeedOrImportRelaxedRulesMode = false;//default } diff --git a/server/AyaNova/biz/TagBiz.cs b/server/AyaNova/biz/TagBiz.cs index 471990be..37b7a7ec 100644 --- a/server/AyaNova/biz/TagBiz.cs +++ b/server/AyaNova/biz/TagBiz.cs @@ -21,14 +21,14 @@ namespace AyaNova.Biz public readonly long userId; private readonly AuthorizationRoles userRoles; - public bool V7ValidationImportMode { get; set; } + public bool SeedOrImportRelaxedRulesMode { get; set; } internal TagBiz(AyContext dbcontext, long currentUserId, AuthorizationRoles UserRoles) { ct = dbcontext; userId = currentUserId; userRoles = UserRoles; - V7ValidationImportMode = false;//default + SeedOrImportRelaxedRulesMode = false;//default } diff --git a/server/AyaNova/biz/UserBiz.cs b/server/AyaNova/biz/UserBiz.cs index c21a802e..17dc86ca 100644 --- a/server/AyaNova/biz/UserBiz.cs +++ b/server/AyaNova/biz/UserBiz.cs @@ -23,7 +23,7 @@ namespace AyaNova.Biz public readonly long UserId; public readonly long UserLocaleId; private readonly AuthorizationRoles userRoles; - public bool V7ValidationImportMode { get; set; } + public bool SeedOrImportRelaxedRulesMode { get; set; } internal UserBiz(AyContext dbcontext, long currentUserId, long userLocaleId, AuthorizationRoles UserRoles) { @@ -31,7 +31,7 @@ namespace AyaNova.Biz UserId = currentUserId; UserLocaleId = userLocaleId; userRoles = UserRoles; - V7ValidationImportMode = false;//default + SeedOrImportRelaxedRulesMode = false;//default } //todo: @@ -68,7 +68,7 @@ namespace AyaNova.Biz User outObj = inObj; outObj.OwnerId = UserId; //Seeder sets user options in advance so no need to create them here in that case - if(outObj.UserOptions==null) + if (outObj.UserOptions == null) outObj.UserOptions = new UserOptions(UserId); await ct.User.AddAsync(outObj); @@ -383,7 +383,7 @@ namespace AyaNova.Biz } //Validate client type user - if (!V7ValidationImportMode && proposedObj.UserType == UserType.Client) + if (!SeedOrImportRelaxedRulesMode && proposedObj.UserType == UserType.Client) { if (proposedObj.ClientId == null || proposedObj.ClientId == 0) { @@ -397,7 +397,7 @@ namespace AyaNova.Biz } //Validate headoffice type user - if (!V7ValidationImportMode && proposedObj.UserType == UserType.HeadOffice) + if (!SeedOrImportRelaxedRulesMode && proposedObj.UserType == UserType.HeadOffice) { if (proposedObj.HeadOfficeId == null || proposedObj.HeadOfficeId == 0) { @@ -411,7 +411,7 @@ namespace AyaNova.Biz } //Validate headoffice type user - if (!V7ValidationImportMode && proposedObj.UserType == UserType.Subcontractor) + if (!SeedOrImportRelaxedRulesMode && proposedObj.UserType == UserType.Subcontractor) { if (proposedObj.SubVendorId == null || proposedObj.SubVendorId == 0) { @@ -667,7 +667,7 @@ namespace AyaNova.Biz #endregion v7 record format - V7ValidationImportMode = true; + SeedOrImportRelaxedRulesMode = true; //some types need to import from more than one source hence the seemingly redundant switch statement for futureproofing switch (j["IMPORT_TASK"].Value()) diff --git a/server/AyaNova/util/Seeder.cs b/server/AyaNova/util/Seeder.cs index 0b128f68..0b2dcc48 100644 --- a/server/AyaNova/util/Seeder.cs +++ b/server/AyaNova/util/Seeder.cs @@ -242,7 +242,8 @@ namespace AyaNova.Util public async static void GenSeedUser(ILogger log, int count, AuthorizationRoles roles, UserType userType, bool active = true, string login = null, string password = null) { UserBiz Biz = UserBiz.GetBizInternal(ServiceProviderProvider.DBContext); - // Biz.CreateAsync() + //allow creation of not entirely ready users (missing client id or subcontractor vendor id etc) + Biz.SeedOrImportRelaxedRulesMode = true; for (int x = 0; x < count; x++) {