This commit is contained in:
@@ -78,6 +78,13 @@ namespace AyaNova.Biz
|
||||
throw new System.ArgumentNullException("ImportAyaNova7 job failed due to import file specified not existing");
|
||||
}
|
||||
|
||||
|
||||
//Erase all the data except for the license, schema and the manager user
|
||||
Microsoft.Extensions.Logging.ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger("ImportAyaNova7");
|
||||
JobsBiz.LogJob(job.GId, "ImportAyaNova7 - Erasing data from database", ct);
|
||||
DbUtil.EmptyBizDataFromDatabaseForSeedingOrImporting(log);
|
||||
|
||||
|
||||
//get the contents of the archive
|
||||
List<string> zipEntries = FileUtil.ZipGetUtilityFileEntries(importFileName);
|
||||
|
||||
@@ -94,45 +101,45 @@ namespace AyaNova.Biz
|
||||
//
|
||||
|
||||
//FIRST: import items that will become tags first into temporary cache lists
|
||||
Dictionary<string,Dictionary<Guid,string>> TagLists=new Dictionary<string, Dictionary<Guid, string>>();
|
||||
Dictionary<string, Dictionary<Guid, string>> TagLists = new Dictionary<string, Dictionary<Guid, string>>();
|
||||
|
||||
//IMPORT UNIT MODEL CATEGORIES AS TAGS
|
||||
TagLists.Add("UnitModelCategory",new Dictionary<Guid, string>());
|
||||
TagLists.Add("UnitModelCategory", new Dictionary<Guid, string>());
|
||||
ImportTagList("GZTW.AyaNova.BLL.UnitModelCategory", job.GId, TagLists["UnitModelCategory"], importFileName, zipEntries);
|
||||
|
||||
//IMPORT Unit service type AS TAGS
|
||||
TagLists.Add("UnitServiceType",new Dictionary<Guid, string>());
|
||||
TagLists.Add("UnitServiceType", new Dictionary<Guid, string>());
|
||||
ImportTagList("GZTW.AyaNova.BLL.UnitServiceType", job.GId, TagLists["UnitServiceType"], importFileName, zipEntries);
|
||||
|
||||
//IMPORT Workorder Item Type AS TAGS
|
||||
TagLists.Add("WorkorderItemType",new Dictionary<Guid, string>());
|
||||
TagLists.Add("WorkorderItemType", new Dictionary<Guid, string>());
|
||||
ImportTagList("GZTW.AyaNova.BLL.WorkorderItemType", job.GId, TagLists["WorkorderItemType"], importFileName, zipEntries);
|
||||
|
||||
//IMPORT Client group AS TAGS
|
||||
TagLists.Add("ClientGroup",new Dictionary<Guid, string>());
|
||||
TagLists.Add("ClientGroup", new Dictionary<Guid, string>());
|
||||
ImportTagList("GZTW.AyaNova.BLL.ClientGroup", job.GId, TagLists["ClientGroup"], importFileName, zipEntries);
|
||||
|
||||
//IMPORT Workorder category AS TAGS
|
||||
TagLists.Add("WorkorderCategory",new Dictionary<Guid, string>());
|
||||
TagLists.Add("WorkorderCategory", new Dictionary<Guid, string>());
|
||||
ImportTagList("GZTW.AyaNova.BLL.WorkorderCategory", job.GId, TagLists["WorkorderCategory"], importFileName, zipEntries);
|
||||
|
||||
//IMPORT Part Category AS TAGS
|
||||
TagLists.Add("PartCategory",new Dictionary<Guid, string>());
|
||||
TagLists.Add("PartCategory", new Dictionary<Guid, string>());
|
||||
ImportTagList("GZTW.AyaNova.BLL.PartCategory", job.GId, TagLists["PartCategory"], importFileName, zipEntries);
|
||||
|
||||
//IMPORT Dispatch zones AS TAGS
|
||||
TagLists.Add("DispatchZone",new Dictionary<Guid, string>());
|
||||
TagLists.Add("DispatchZone", new Dictionary<Guid, string>());
|
||||
ImportTagList("GZTW.AyaNova.BLL.DispatchZone", job.GId, TagLists["DispatchZone"], importFileName, zipEntries);
|
||||
|
||||
//IMPORT Scheduleable User Groups AS TAGS
|
||||
TagLists.Add("ScheduleableUserGroup",new Dictionary<Guid, string>());
|
||||
TagLists.Add("ScheduleableUserGroup", new Dictionary<Guid, string>());
|
||||
ImportTagList("GZTW.AyaNova.BLL.ScheduleableUserGroup", job.GId, TagLists["ScheduleableUserGroup"], importFileName, zipEntries);
|
||||
|
||||
//Now can set users to correct tag for scheduleable user group
|
||||
// await ImportTagList("GZTW.AyaNova.BLL.ScheduleableUserGroup", "scheduleableusergrouptags", AyaType.Tag, job.GId, importMap, importFileName, zipEntries);
|
||||
|
||||
//IMPORT REGIONS AS TAGS
|
||||
TagLists.Add("Region",new Dictionary<Guid, string>());
|
||||
TagLists.Add("Region", new Dictionary<Guid, string>());
|
||||
ImportTagList("GZTW.AyaNova.BLL.Region", job.GId, TagLists["Region"], importFileName, zipEntries);
|
||||
|
||||
|
||||
@@ -187,7 +194,7 @@ namespace AyaNova.Biz
|
||||
/// <param name="zipEntries"></param>
|
||||
/// <param name="tagLists"></param>
|
||||
/// <returns></returns>
|
||||
private async Task DoImport(string entryStartsWith, string importTask, AyaType importerType, Guid jobId,
|
||||
private async Task DoImport(string entryStartsWith, string importTask, AyaType importerType, Guid jobId,
|
||||
List<ImportAyaNova7MapItem> importMap, string importFileName, List<string> zipEntries, Dictionary<string, Dictionary<Guid, string>> tagLists)
|
||||
{
|
||||
var zipObjectList = zipEntries.Where(m => m.StartsWith(entryStartsWith)).ToList();
|
||||
|
||||
Reference in New Issue
Block a user