This commit is contained in:
2018-08-30 19:15:33 +00:00
parent 7f4436aac6
commit 4da015343d
3 changed files with 42 additions and 10 deletions

View File

@@ -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;

View File

@@ -376,6 +376,11 @@ namespace AyaNova.Biz
/// IMPORT v7 implementation
public async Task<bool> ImportV7Async(JObject j, List<ImportAyaNova7MapItem> 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<string>();
//some types need to import from more than one source hence the seemingly redundant switch statement for futureproofing
switch (j["V7_TYPE"].Value<string>())
{

View File

@@ -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<string>() + " " + j["LastName"].Value<string>();
i.UserType = j["UserType"].Value<UserType>();
i.Active = j["Active"].Value<bool>();
//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<string>();
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