diff --git a/server/AyaNova/biz/ImportAyaNova7Biz.cs b/server/AyaNova/biz/ImportAyaNova7Biz.cs index 480d9b51..ab1ca98b 100644 --- a/server/AyaNova/biz/ImportAyaNova7Biz.cs +++ b/server/AyaNova/biz/ImportAyaNova7Biz.cs @@ -91,56 +91,56 @@ namespace AyaNova.Biz //USERS - await DoImport("GZTW.AyaNova.BLL.User", AyaType.User, job.GId, importMap, importFileName, zipEntries); + await DoImport("GZTW.AyaNova.BLL.User", "main", 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); + await DoImport("GZTW.AyaNova.BLL.User", "eventlog", 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); + await DoImport("GZTW.AyaNova.BLL.UnitModelCategory", "main", AyaType.Tag, job.GId, importMap, importFileName, zipEntries); //IMPORT Unit service type AS TAGS - await DoImport("GZTW.AyaNova.BLL.UnitServiceType", AyaType.Tag, job.GId, importMap, importFileName, zipEntries); + await DoImport("GZTW.AyaNova.BLL.UnitServiceType", "main", AyaType.Tag, job.GId, importMap, importFileName, zipEntries); //IMPORT Workorder Item Type AS TAGS - await DoImport("GZTW.AyaNova.BLL.WorkorderItemType", AyaType.Tag, job.GId, importMap, importFileName, zipEntries); + await DoImport("GZTW.AyaNova.BLL.WorkorderItemType", "main", AyaType.Tag, job.GId, importMap, importFileName, zipEntries); //IMPORT Client group AS TAGS - await DoImport("GZTW.AyaNova.BLL.ClientGroup", AyaType.Tag, job.GId, importMap, importFileName, zipEntries); + await DoImport("GZTW.AyaNova.BLL.ClientGroup", "main", AyaType.Tag, job.GId, importMap, importFileName, zipEntries); //IMPORT Workorder category AS TAGS - await DoImport("GZTW.AyaNova.BLL.WorkorderCategory", AyaType.Tag, job.GId, importMap, importFileName, zipEntries); + await DoImport("GZTW.AyaNova.BLL.WorkorderCategory", "main", AyaType.Tag, job.GId, importMap, importFileName, zipEntries); //IMPORT Part Category AS TAGS - await DoImport("GZTW.AyaNova.BLL.PartCategory", AyaType.Tag, job.GId, importMap, importFileName, zipEntries); + await DoImport("GZTW.AyaNova.BLL.PartCategory", "main", AyaType.Tag, job.GId, importMap, importFileName, zipEntries); //IMPORT Dispatch zones AS TAGS - await DoImport("GZTW.AyaNova.BLL.DispatchZone", AyaType.Tag, job.GId, importMap, importFileName, zipEntries); + await DoImport("GZTW.AyaNova.BLL.DispatchZone", "main", AyaType.Tag, job.GId, importMap, importFileName, zipEntries); //IMPORT Scheduleable User Groups AS TAGS - await DoImport("GZTW.AyaNova.BLL.ScheduleableUserGroup", AyaType.Tag, job.GId, importMap, importFileName, zipEntries); + await DoImport("GZTW.AyaNova.BLL.ScheduleableUserGroup", "main", AyaType.Tag, job.GId, importMap, importFileName, zipEntries); //Now can set users to correct tag for scheduleable user group - await DoImport("GZTW.AyaNova.BLL.User-scheduleableusergrouptags", AyaType.User, job.GId, importMap, importFileName, zipEntries); + await DoImport("GZTW.AyaNova.BLL.User", "scheduleableusergrouptags", AyaType.User, job.GId, importMap, importFileName, zipEntries); //IMPORT REGIONS AS TAGS - await DoImport("GZTW.AyaNova.BLL.Region", AyaType.Tag, job.GId, importMap, importFileName, zipEntries); + await DoImport("GZTW.AyaNova.BLL.Region", "main", AyaType.Tag, job.GId, importMap, importFileName, zipEntries); //IMPORT LOCALES - await DoImport("GZTW.AyaNova.BLL.Locale", AyaType.Locale, job.GId, importMap, importFileName, zipEntries); + await DoImport("GZTW.AyaNova.BLL.Locale", "main", AyaType.Locale, job.GId, importMap, importFileName, zipEntries); //Now can do user locale settings properly - await DoImport("GZTW.AyaNova.BLL.User-locale", AyaType.User, job.GId, importMap, importFileName, zipEntries); + await DoImport("GZTW.AyaNova.BLL.User", "locale", AyaType.User, job.GId, importMap, importFileName, zipEntries); //CLIENT //do import for client here //Now can do user client settings properly - //await DoImport("GZTW.AyaNova.BLL.User-client", AyaType.User, job.GId, importMap, importFileName, zipEntries); + //await DoImport("GZTW.AyaNova.BLL.User","clientid", AyaType.User, job.GId, importMap, importFileName, zipEntries); //HEADOFFICE //do import for ho here //Now can do user ho settings properly - //await DoImport("GZTW.AyaNova.BLL.User-headoffice", AyaType.User, job.GId, importMap, importFileName, zipEntries); + //await DoImport("GZTW.AyaNova.BLL.User","headofficeid", AyaType.User, job.GId, importMap, importFileName, zipEntries); @@ -162,13 +162,14 @@ namespace AyaNova.Biz /// - Passing the json parsed to the biz object one at a time to do the import /// /// + /// /// /// /// /// /// /// - private async Task DoImport(string entryStartsWith, AyaType importerType, Guid jobId, List importMap, string importFileName, List zipEntries) + private async Task DoImport(string entryStartsWith, string importTask, AyaType importerType, Guid jobId, List importMap, string importFileName, List zipEntries) { var zipObjectList = zipEntries.Where(m => m.StartsWith(entryStartsWith)).ToList(); long importCount = 0; @@ -186,6 +187,7 @@ namespace AyaNova.Biz //some new types can import multiple old types and it might matter which is which to the importer //so tag it with the original type j.Add("V7_TYPE", JToken.FromObject(entryStartsWith)); + j.Add("IMPORT_TASK", JToken.FromObject(importTask)); bImportSucceeded = await o.ImportV7Async(j, importMap, jobId); if (bImportSucceeded) diff --git a/server/AyaNova/biz/LocaleBiz.cs b/server/AyaNova/biz/LocaleBiz.cs index 343313a2..22be196e 100644 --- a/server/AyaNova/biz/LocaleBiz.cs +++ b/server/AyaNova/biz/LocaleBiz.cs @@ -383,9 +383,9 @@ namespace AyaNova.Biz public async Task ImportV7Async(JObject j, List importMap, Guid jobId) { //some types need to import from more than one source hence the seemingly redundant switch statement for futureproofing - switch (j["V7_TYPE"].Value()) + switch (j["IMPORT_TASK"].Value()) { - case "GZTW.AyaNova.BLL.Locale": + case "main": { //Get source locale name from filename using regex var SourceLocaleFileName = j["V7_SOURCE_FILE_NAME"].Value(); diff --git a/server/AyaNova/biz/TagBiz.cs b/server/AyaNova/biz/TagBiz.cs index 3ded6aba..4562a97f 100644 --- a/server/AyaNova/biz/TagBiz.cs +++ b/server/AyaNova/biz/TagBiz.cs @@ -244,6 +244,7 @@ namespace AyaNova.Biz /// IMPORT v7 implementation public async Task ImportV7Async(JObject j, List importMap, Guid jobId) { + //NO TASK TYPE, IT'S ALL THE SAME, KEEPING THIS FOR POSSIBLE FUTURE PURPOSES LIKE APPENDING OBJECT TYPE OR SOMETHING string SourceType = j["V7_TYPE"].Value(); switch (SourceType) { diff --git a/server/AyaNova/biz/UserBiz.cs b/server/AyaNova/biz/UserBiz.cs index 31bb273a..ef19b71e 100644 --- a/server/AyaNova/biz/UserBiz.cs +++ b/server/AyaNova/biz/UserBiz.cs @@ -410,9 +410,9 @@ namespace AyaNova.Biz V7ValidationImportMode = true; //some types need to import from more than one source hence the seemingly redundant switch statement for futureproofing - switch (j["V7_TYPE"].Value()) + switch (j["IMPORT_TASK"].Value()) { - case "GZTW.AyaNova.BLL.User": + case "main": { var V7Id = new Guid(j["ID"].Value()); @@ -472,8 +472,9 @@ namespace AyaNova.Biz } } break; - case "GZTW.AyaNova.BLL.User-eventlog": + case "eventlog": { + var V7Id = new Guid(j["ID"].Value()); //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); @@ -482,7 +483,7 @@ namespace AyaNova.Biz } break; - case "GZTW.AyaNova.BLL.User-locale": + case "locale": { //get the userId var V7Id = new Guid(j["ID"].Value()); @@ -538,19 +539,19 @@ namespace AyaNova.Biz } break; - case "GZTW.AyaNova.BLL.User-scheduleableusergrouptags": + case "scheduleableusergrouptags": { //handle tag entries for users now that we have the SUG tags created // throw new System.NotImplementedException(); } break; - case "GZTW.AyaNova.BLL.User-client": + case "clientid": { //handle setting client id for user client login //throw new System.NotImplementedException(); } break; - case "GZTW.AyaNova.BLL.User-headoffice": + case "headofficeid": { //handle setting ho id for user headoffice login //throw new System.NotImplementedException();