This commit is contained in:
2018-08-31 17:53:21 +00:00
parent 9067f9695f
commit 4121cb5928
4 changed files with 30 additions and 26 deletions

View File

@@ -91,56 +91,56 @@ namespace AyaNova.Biz
//USERS //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 //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 //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 //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 //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 //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 //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 //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 //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 //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 //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 //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 //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 //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 //CLIENT
//do import for client here //do import for client here
//Now can do user client settings properly //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 //HEADOFFICE
//do import for ho here //do import for ho here
//Now can do user ho settings properly //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 /// - Passing the json parsed to the biz object one at a time to do the import
/// </summary> /// </summary>
/// <param name="entryStartsWith"></param> /// <param name="entryStartsWith"></param>
/// <param name="importTask"></param>
/// <param name="importerType"></param> /// <param name="importerType"></param>
/// <param name="jobId"></param> /// <param name="jobId"></param>
/// <param name="importMap"></param> /// <param name="importMap"></param>
/// <param name="importFileName"></param> /// <param name="importFileName"></param>
/// <param name="zipEntries"></param> /// <param name="zipEntries"></param>
/// <returns></returns> /// <returns></returns>
private async Task DoImport(string entryStartsWith, AyaType importerType, Guid jobId, List<ImportAyaNova7MapItem> importMap, string importFileName, List<string> zipEntries) private async Task DoImport(string entryStartsWith, string importTask, AyaType importerType, Guid jobId, List<ImportAyaNova7MapItem> importMap, string importFileName, List<string> zipEntries)
{ {
var zipObjectList = zipEntries.Where(m => m.StartsWith(entryStartsWith)).ToList(); var zipObjectList = zipEntries.Where(m => m.StartsWith(entryStartsWith)).ToList();
long importCount = 0; 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 //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 //so tag it with the original type
j.Add("V7_TYPE", JToken.FromObject(entryStartsWith)); j.Add("V7_TYPE", JToken.FromObject(entryStartsWith));
j.Add("IMPORT_TASK", JToken.FromObject(importTask));
bImportSucceeded = await o.ImportV7Async(j, importMap, jobId); bImportSucceeded = await o.ImportV7Async(j, importMap, jobId);
if (bImportSucceeded) if (bImportSucceeded)

View File

@@ -383,9 +383,9 @@ namespace AyaNova.Biz
public async Task<bool> ImportV7Async(JObject j, List<ImportAyaNova7MapItem> importMap, Guid jobId) public async Task<bool> ImportV7Async(JObject j, List<ImportAyaNova7MapItem> importMap, Guid jobId)
{ {
//some types need to import from more than one source hence the seemingly redundant switch statement for futureproofing //some types need to import from more than one source hence the seemingly redundant switch statement for futureproofing
switch (j["V7_TYPE"].Value<string>()) switch (j["IMPORT_TASK"].Value<string>())
{ {
case "GZTW.AyaNova.BLL.Locale": case "main":
{ {
//Get source locale name from filename using regex //Get source locale name from filename using regex
var SourceLocaleFileName = j["V7_SOURCE_FILE_NAME"].Value<string>(); var SourceLocaleFileName = j["V7_SOURCE_FILE_NAME"].Value<string>();

View File

@@ -244,6 +244,7 @@ namespace AyaNova.Biz
/// IMPORT v7 implementation /// IMPORT v7 implementation
public async Task<bool> ImportV7Async(JObject j, List<ImportAyaNova7MapItem> importMap, Guid jobId) public async Task<bool> ImportV7Async(JObject j, List<ImportAyaNova7MapItem> 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<string>(); string SourceType = j["V7_TYPE"].Value<string>();
switch (SourceType) switch (SourceType)
{ {

View File

@@ -410,9 +410,9 @@ namespace AyaNova.Biz
V7ValidationImportMode = true; V7ValidationImportMode = true;
//some types need to import from more than one source hence the seemingly redundant switch statement for futureproofing //some types need to import from more than one source hence the seemingly redundant switch statement for futureproofing
switch (j["V7_TYPE"].Value<string>()) switch (j["IMPORT_TASK"].Value<string>())
{ {
case "GZTW.AyaNova.BLL.User": case "main":
{ {
var V7Id = new Guid(j["ID"].Value<string>()); var V7Id = new Guid(j["ID"].Value<string>());
@@ -472,8 +472,9 @@ namespace AyaNova.Biz
} }
} }
break; break;
case "GZTW.AyaNova.BLL.User-eventlog": case "eventlog":
{ {
var V7Id = new Guid(j["ID"].Value<string>());
//handle EventLog entries for users now that we have the user's created //handle EventLog entries for users now that we have the user's created
//Log //Log
//EventLogProcessor.AddEntry(new Event(userId, o.Id, AyaType.User, AyaEvent.Created), ct); //EventLogProcessor.AddEntry(new Event(userId, o.Id, AyaType.User, AyaEvent.Created), ct);
@@ -482,7 +483,7 @@ namespace AyaNova.Biz
} }
break; break;
case "GZTW.AyaNova.BLL.User-locale": case "locale":
{ {
//get the userId //get the userId
var V7Id = new Guid(j["ID"].Value<string>()); var V7Id = new Guid(j["ID"].Value<string>());
@@ -538,19 +539,19 @@ namespace AyaNova.Biz
} }
break; break;
case "GZTW.AyaNova.BLL.User-scheduleableusergrouptags": case "scheduleableusergrouptags":
{ {
//handle tag entries for users now that we have the SUG tags created //handle tag entries for users now that we have the SUG tags created
// throw new System.NotImplementedException(); // throw new System.NotImplementedException();
} }
break; break;
case "GZTW.AyaNova.BLL.User-client": case "clientid":
{ {
//handle setting client id for user client login //handle setting client id for user client login
//throw new System.NotImplementedException(); //throw new System.NotImplementedException();
} }
break; break;
case "GZTW.AyaNova.BLL.User-headoffice": case "headofficeid":
{ {
//handle setting ho id for user headoffice login //handle setting ho id for user headoffice login
//throw new System.NotImplementedException(); //throw new System.NotImplementedException();