From 4da015343d68f92d330b9b914d76a069058e02c1 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 30 Aug 2018 19:15:33 +0000 Subject: [PATCH] --- server/AyaNova/biz/ImportAyaNova7Biz.cs | 12 +++++++-- server/AyaNova/biz/LocaleBiz.cs | 5 ++++ server/AyaNova/biz/UserBiz.cs | 35 +++++++++++++++++++------ 3 files changed, 42 insertions(+), 10 deletions(-) diff --git a/server/AyaNova/biz/ImportAyaNova7Biz.cs b/server/AyaNova/biz/ImportAyaNova7Biz.cs index 66315dae..04e97990 100644 --- a/server/AyaNova/biz/ImportAyaNova7Biz.cs +++ b/server/AyaNova/biz/ImportAyaNova7Biz.cs @@ -88,10 +88,18 @@ namespace AyaNova.Biz //NOTE: Many of these require a second pass - one to get the object imported and then another to set another imported object to that object //for example scheduleable user groups are imported as tags, but then a second pass is required to tag the users of that group - + //USERS await DoImport("GZTW.AyaNova.BLL.User", AyaType.User, job.GId, importMap, importFileName, zipEntries); + //Now can do event log entries + await DoImport("GZTW.AyaNova.BLL.User-eventlog", AyaType.User, job.GId, importMap, importFileName, zipEntries); + + //LOCALE HERE + //await DoImport .... blah blah for locale, then: + //Now can do user locale settings properly + //await DoImport("GZTW.AyaNova.BLL.User-locale", AyaType.User, job.GId, importMap, importFileName, zipEntries); + //IMPORT UNIT MODEL CATEGORIES AS TAGS await DoImport("GZTW.AyaNova.BLL.UnitModelCategory", AyaType.Tag, job.GId, importMap, importFileName, zipEntries); @@ -160,7 +168,7 @@ namespace AyaNova.Biz var jList = FileUtil.ZipGetUtilityArchiveEntriesAsJsonObjects(zipObjectList, importFileName); IImportAyaNova7Object o = (IImportAyaNova7Object)BizObjectFactory.GetBizObject(importerType, ct); - + foreach (JObject j in jList) { bool bImportSucceeded = false; diff --git a/server/AyaNova/biz/LocaleBiz.cs b/server/AyaNova/biz/LocaleBiz.cs index beedcb39..49e153cf 100644 --- a/server/AyaNova/biz/LocaleBiz.cs +++ b/server/AyaNova/biz/LocaleBiz.cs @@ -376,6 +376,11 @@ namespace AyaNova.Biz /// IMPORT v7 implementation public async Task ImportV7Async(JObject j, List importMap, Guid jobId) { + //TODO: when locales are imported that's when it should take a pass over users collection and then set the correct locale accordingly + //or default if it's missing + //v7 users locale json element: + //var V7Locale=j["DefaultLanguage"].Value(); + //some types need to import from more than one source hence the seemingly redundant switch statement for futureproofing switch (j["V7_TYPE"].Value()) { diff --git a/server/AyaNova/biz/UserBiz.cs b/server/AyaNova/biz/UserBiz.cs index 330aae74..a614558f 100644 --- a/server/AyaNova/biz/UserBiz.cs +++ b/server/AyaNova/biz/UserBiz.cs @@ -329,13 +329,13 @@ namespace AyaNova.Biz #region V7 record format /* { - "DefaultLanguage": "Custom English", - "DefaultServiceTemplateID": "ca83a7b8-4e5f-4a7b-a02b-9cf78d5f983f", + TODO: "DefaultLanguage": "Custom English", + TODO: "DefaultServiceTemplateID": "ca83a7b8-4e5f-4a7b-a02b-9cf78d5f983f", "UserType": 2, "Active": true, - "ClientID": "00000000-0000-0000-0000-000000000000", - "HeadOfficeID": "00000000-0000-0000-0000-000000000000", - "MemberOfGroup": "0f8a80ff-4b03-4114-ae51-2d13b812dd65", + TODO: "ClientID": "00000000-0000-0000-0000-000000000000", + TODO: "HeadOfficeID": "00000000-0000-0000-0000-000000000000", + TODO: "MemberOfGroup": "0f8a80ff-4b03-4114-ae51-2d13b812dd65", "Created": "03/21/2005 07:19 AM", "Modified": "09/15/2015 12:22 PM", "Creator": "2ecc77fc-69e2-4a7e-b88d-bd0ecaf36aed", @@ -419,6 +419,11 @@ namespace AyaNova.Biz User i = new User(); i.Name = j["FirstName"].Value() + " " + j["LastName"].Value(); i.UserType = j["UserType"].Value(); + i.Active = j["Active"].Value(); + + //TODO: i.LocaleId + //when locales are imported that's when it should take a pass over users and set them as per here + //var V7Locale=j["DefaultLanguage"].Value(); User o = await CreateAsync(i); if (HasErrors) @@ -435,12 +440,26 @@ namespace AyaNova.Biz { await ct.SaveChangesAsync(); var mapItem = new ImportAyaNova7MapItem(V7Id, AyaType.User, o.Id); - //Log - EventLogProcessor.AddEntry(new Event(userId, o.Id, AyaType.User, AyaEvent.Created), ct); - await ct.SaveChangesAsync(); + } } break; + case "GZTW.AyaNova.BLL.User-eventlog": + { + //handle EventLog entries for users now that we have the user's created + //Log + //EventLogProcessor.AddEntry(new Event(userId, o.Id, AyaType.User, AyaEvent.Created), ct); + //MODIFIED HERE + // await ct.SaveChangesAsync(); + + } + break; + case "GZTW.AyaNova.BLL.User-locale": + { + //handle locale entries for users now that we have the locales created + + } + break; } //just to hide compiler warning for now