This commit is contained in:
2018-12-06 22:39:16 +00:00
parent d097391af6
commit 1f33115703

View File

@@ -252,59 +252,30 @@ namespace AyaNova.Biz
//Other job handlers here...
private async Task ImportTagList(string entryStartsWith, Guid jobId, Dictionary<Guid, string> tagDictionary, string importFileName, List<string> zipEntries)
private void ImportTagList(string entryStartsWith, Guid jobId, Dictionary<Guid, string> tagDictionary, string importFileName, List<string> zipEntries)
{
var zipObjectList = zipEntries.Where(m => m.StartsWith(entryStartsWith)).ToList();
long importCount = 0;
long notImportCount = 0;
if (zipObjectList.Count > 0)
{
JobsBiz.LogJob(jobId, $"Starting import to TAGS of {entryStartsWith} objects", ct);
var jList = FileUtil.ZipGetUtilityArchiveEntriesAsJsonObjects(zipObjectList, importFileName);
//IImportAyaNova7Object o = (IImportAyaNova7Object)BizObjectFactory.GetBizObject(importerType, ct);
foreach (JObject j in jList)
{
bool bImportSucceeded = false;
//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)
importCount++;
else
notImportCount++;
//------- IMPORT OBJECTS NAME AND ID TO LIST ------
//-----------------------------------------------
importCount++;
}
if (importCount > 0)
{
if (importTask != "main")
{
JobsBiz.LogJob(jobId, $"Successfully ran import subtask {importTask} on {importCount.ToString()} of {zipObjectList.Count.ToString()} {entryStartsWith} objects", ct);
}
else
{
JobsBiz.LogJob(jobId, $"Successfully imported {importCount.ToString()} of {zipObjectList.Count.ToString()} {entryStartsWith} objects", ct);
}
}
if (notImportCount > 0)
{
if (importTask != "main")
{
JobsBiz.LogJob(jobId, $"Failed to run import subtask {importTask} on {notImportCount.ToString()} of {zipObjectList.Count.ToString()} {entryStartsWith} objects", ct);
}
else
{
JobsBiz.LogJob(jobId, $"Did not import {notImportCount.ToString()} of {zipObjectList.Count.ToString()} {entryStartsWith} objects", ct);
}
JobsBiz.LogJob(jobId, $"Successfully imported as TAGS {importCount.ToString()} of {zipObjectList.Count.ToString()} {entryStartsWith} objects", ct);
}
}
}