public static void Obfuscate(PerformContext performContext, DbAppContext dbContext, string sourceLocation, string destinationLocation, string systemId) { int startPoint = ImportUtility.CheckInterMapForStartPoint(dbContext, "Obfuscate_" + OldTableProgress, BcBidImport.SigId, NewTable); if (startPoint == BcBidImport.SigId) // this means the import job it has done today is complete for all the records in the xml file. { performContext.WriteLine("*** Obfuscating " + XmlFileName + " is complete from the former process ***"); return; } try { string rootAttr = "ArrayOf" + OldTable; // create progress indicator performContext.WriteLine("Processing " + OldTable); // create serializer and serialize xml file XmlSerializer ser = new XmlSerializer(typeof(ImportModels.DumpTruck[]), new XmlRootAttribute(rootAttr)); MemoryStream memoryStream = ImportUtility.MemoryStreamGenerator(XmlFileName, OldTable, sourceLocation, rootAttr); ImportModels.DumpTruck[] legacyItems = (ImportModels.DumpTruck[])ser.Deserialize(memoryStream); // no fields to mask for dump truck - straight copy performContext.WriteLine("Writing " + XmlFileName + " to " + destinationLocation); // write out the array FileStream fs = ImportUtility.GetObfuscationDestination(XmlFileName, destinationLocation); ser.Serialize(fs, legacyItems); fs.Close(); } catch (Exception e) { performContext.WriteLine("*** ERROR ***"); performContext.WriteLine(e.ToString()); } }
/// <summary> /// Import Service Areas /// </summary> /// <param name="performContext"></param> /// <param name="dbContext"></param> /// <param name="fileLocation"></param> /// <param name="systemId"></param> public static void Import(PerformContext performContext, DbAppContext dbContext, string fileLocation, string systemId) { // check the start point. If startPoint == sigId then it is already completed int startPoint = ImportUtility.CheckInterMapForStartPoint(dbContext, OldTableProgress, BcBidImport.SigId, NewTable); if (startPoint == BcBidImport.SigId) // this means the import job it has done today is complete for all the records in the xml file. { performContext.WriteLine("*** Importing " + XmlFileName + " is complete from the former process ***"); return; } try { string rootAttr = "ArrayOf" + OldTable; performContext.WriteLine("Processing Service Areas"); IProgressBar progress = performContext.WriteProgressBar(); progress.SetValue(0); // create serializer and serialize xml file XmlSerializer ser = new XmlSerializer(typeof(ImportModels.ServiceArea[]), new XmlRootAttribute(rootAttr)); ser.UnknownAttribute += ImportUtility.UnknownAttribute; ser.UnknownElement += ImportUtility.UnknownElement; MemoryStream memoryStream = ImportUtility.MemoryStreamGenerator(XmlFileName, OldTable, fileLocation, rootAttr); ImportModels.ServiceArea[] legacyItems = (ImportModels.ServiceArea[])ser.Deserialize(memoryStream); Debug.WriteLine("Importing ServiceArea Data. Total Records: " + legacyItems.Length); foreach (ImportModels.ServiceArea item in legacyItems.WithProgress(progress)) { // see if we have this one already HetImportMap importMap = dbContext.HetImportMap.AsNoTracking() .FirstOrDefault(x => x.OldTable == OldTable && x.OldKey == item.Service_Area_Id.ToString()); // new entry if (importMap == null && item.Service_Area_Cd != "000") { HetServiceArea serviceArea = null; CopyToInstance(dbContext, item, ref serviceArea, systemId); ImportUtility.AddImportMap(dbContext, OldTable, item.Service_Area_Id.ToString(), NewTable, serviceArea.ServiceAreaId); } } performContext.WriteLine("*** Importing " + XmlFileName + " is Done ***"); ImportUtility.AddImportMapForProgress(dbContext, OldTableProgress, BcBidImport.SigId.ToString(), BcBidImport.SigId, NewTable); dbContext.SaveChangesForImport(); } catch (Exception e) { performContext.WriteLine("*** ERROR ***"); performContext.WriteLine(e.ToString()); throw; } }
public static void Obfuscate(PerformContext performContext, DbAppContext dbContext, string sourceLocation, string destinationLocation, string systemId) { try { string rootAttr = "ArrayOf" + OldTable; // create progress indicator performContext.WriteLine("Processing " + OldTable); IProgressBar progress = performContext.WriteProgressBar(); progress.SetValue(0); // create serializer and serialize xml file XmlSerializer ser = new XmlSerializer(typeof(ImportModels.ServiceArea[]), new XmlRootAttribute(rootAttr)); ser.UnknownAttribute += ImportUtility.UnknownAttribute; ser.UnknownElement += ImportUtility.UnknownElement; MemoryStream memoryStream = ImportUtility.MemoryStreamGenerator(XmlFileName, OldTable, sourceLocation, rootAttr); ImportModels.ServiceArea[] legacyItems = (ImportModels.ServiceArea[])ser.Deserialize(memoryStream); foreach (ImportModels.ServiceArea item in legacyItems.WithProgress(progress)) { item.Created_By = systemId; } performContext.WriteLine("Writing " + XmlFileName + " to " + destinationLocation); // write out the array FileStream fs = ImportUtility.GetObfuscationDestination(XmlFileName, destinationLocation); ser.Serialize(fs, legacyItems); fs.Close(); } catch (Exception e) { performContext.WriteLine("*** ERROR ***"); performContext.WriteLine(e.ToString()); } }
/// <summary> /// Import Equipment Attachments /// </summary> /// <param name="performContext"></param> /// <param name="dbContext"></param> /// <param name="fileLocation"></param> /// <param name="systemId"></param> public static void Import(PerformContext performContext, DbAppContext dbContext, string fileLocation, string systemId) { // check the start point. If startPoint == sigId then it is already completed int startPoint = ImportUtility.CheckInterMapForStartPoint(dbContext, OldTableProgress, BcBidImport.SigId, NewTable); if (startPoint == BcBidImport.SigId) // This means the import job it has done today is complete for all the records in the xml file. { performContext.WriteLine("*** Importing " + XmlFileName + " is complete from the former process ***"); return; } int maxEquipAttachIndex = 0; if (dbContext.HetEquipmentAttachment.Any()) { maxEquipAttachIndex = dbContext.HetEquipmentAttachment.Max(x => x.EquipmentAttachmentId); } try { string rootAttr = "ArrayOf" + OldTable; // create progress indicator performContext.WriteLine("Processing " + OldTable); IProgressBar progress = performContext.WriteProgressBar(); progress.SetValue(0); // create serializer and serialize xml file XmlSerializer ser = new XmlSerializer(typeof(ImportModels.EquipAttach[]), new XmlRootAttribute(rootAttr)); MemoryStream memoryStream = ImportUtility.MemoryStreamGenerator(XmlFileName, OldTable, fileLocation, rootAttr); ImportModels.EquipAttach[] legacyItems = (ImportModels.EquipAttach[])ser.Deserialize(memoryStream); int ii = startPoint; // skip the portion already processed if (startPoint > 0) { legacyItems = legacyItems.Skip(ii).ToArray(); } Debug.WriteLine("Importing Equipment Attachment Data. Total Records: " + legacyItems.Length); foreach (ImportModels.EquipAttach item in legacyItems.WithProgress(progress)) { // see if we have this one already. We used old combine because item.Equip_Id is not unique string oldKeyCombined = (item.Equip_Id ?? 0 * 100 + item.Attach_Seq_Num ?? 0).ToString(); HetImportMap importMap = dbContext.HetImportMap.AsNoTracking() .FirstOrDefault(x => x.OldTable == OldTable && x.OldKey == oldKeyCombined); // new entry if (importMap == null && item.Equip_Id > 0) { HetEquipmentAttachment instance = null; CopyToInstance(dbContext, item, ref instance, systemId, ref maxEquipAttachIndex); ImportUtility.AddImportMap(dbContext, OldTable, oldKeyCombined, NewTable, instance.EquipmentAttachmentId); } // save change to database periodically to avoid frequent writing to the database if (++ii % 1000 == 0) { try { ImportUtility.AddImportMapForProgress(dbContext, OldTableProgress, ii.ToString(), BcBidImport.SigId, NewTable); dbContext.SaveChangesForImport(); } catch (Exception e) { performContext.WriteLine("Error saving data " + e.Message); } } } try { performContext.WriteLine("*** Importing " + XmlFileName + " is Done ***"); ImportUtility.AddImportMapForProgress(dbContext, OldTableProgress, BcBidImport.SigId.ToString(), BcBidImport.SigId, NewTable); dbContext.SaveChangesForImport(); } catch (Exception e) { string temp = string.Format("Error saving data (EquipmentAttachmentIndex: {0}): {1}", maxEquipAttachIndex, e.Message); performContext.WriteLine(temp); throw new DataException(temp); } } catch (Exception e) { performContext.WriteLine("*** ERROR ***"); performContext.WriteLine(e.ToString()); throw; } }
/// <summary> /// Import Users /// </summary> /// <param name="performContext"></param> /// <param name="dbContext"></param> /// <param name="fileLocation"></param> /// <param name="systemId"></param> public static void Import(PerformContext performContext, DbAppContext dbContext, string fileLocation, string systemId) { // check the start point. If startPoint == sigId then it is already completed int startPoint = ImportUtility.CheckInterMapForStartPoint(dbContext, OldTableProgress, BcBidImport.SigId, NewTable); if (startPoint == BcBidImport.SigId) // this means the import job it has done today is complete for all the records in the xml file. { performContext.WriteLine("*** Importing " + XmlFileName + " is complete from the former process ***"); return; } // manage the id value for new user records int maxUserIndex = 0; if (dbContext.HetUser.Any()) { maxUserIndex = dbContext.HetUser.Max(x => x.UserId); maxUserIndex = maxUserIndex + 1; } try { string rootAttr = "ArrayOf" + OldTable; // create progress indicator performContext.WriteLine("Processing " + OldTable); IProgressBar progress = performContext.WriteProgressBar(); progress.SetValue(0); // create serializer and serialize xml file XmlSerializer ser = new XmlSerializer(typeof(ImportModels.UserHets[]), new XmlRootAttribute(rootAttr)); MemoryStream memoryStream = ImportUtility.MemoryStreamGenerator(XmlFileName, OldTable, fileLocation, rootAttr); ImportModels.UserHets[] legacyItems = (ImportModels.UserHets[])ser.Deserialize(memoryStream); int ii = startPoint; // skip the portion already processed if (startPoint > 0) { legacyItems = legacyItems.Skip(ii).ToArray(); } // create an array of names using the created by and modified by values in the data performContext.WriteLine("Extracting first and last names"); progress.SetValue(0); Dictionary <string, string> firstNames = new Dictionary <string, string>(); Dictionary <string, string> lastNames = new Dictionary <string, string>(); foreach (ImportModels.UserHets item in legacyItems.WithProgress(progress)) { string name = item.Created_By; GetNameParts(name, ref firstNames, ref lastNames); name = item.Modified_By; GetNameParts(name, ref firstNames, ref lastNames); } // import the data performContext.WriteLine("Importing User Data"); progress.SetValue(0); foreach (ImportModels.UserHets item in legacyItems.WithProgress(progress)) { string tempId = item.Popt_Id + "-" + item.Service_Area_Id; HetImportMap importMap = dbContext.HetImportMap.AsNoTracking() .FirstOrDefault(x => x.OldTable == OldTable && x.OldKey == tempId); if (importMap == null) { string username = NormalizeUserCode(item.User_Cd).ToUpper(); string firstName = GetNamePart(username, firstNames); string lastName = GetNamePart(username, lastNames); HetUser user = null; username = username.ToLower(); CopyToInstance(dbContext, item, ref user, systemId, username, firstName, lastName, ref maxUserIndex); if (user != null) { ImportUtility.AddImportMap(dbContext, OldTable, tempId, NewTable, user.UserId); dbContext.SaveChangesForImport(); } } } try { performContext.WriteLine("*** Importing " + XmlFileName + " is Done ***"); ImportUtility.AddImportMapForProgress(dbContext, OldTableProgress, BcBidImport.SigId.ToString(), BcBidImport.SigId, NewTable); dbContext.SaveChangesForImport(); } catch (Exception e) { string temp = string.Format("Error saving data (UserIndex: {0}): {1}", maxUserIndex, e.Message); performContext.WriteLine(temp); throw new DataException(temp); } } catch (Exception e) { performContext.WriteLine("*** ERROR ***"); performContext.WriteLine(e.ToString()); throw; } }
/// <summary> /// Import Rotation Doc Records Records /// </summary> /// <param name="performContext"></param> /// <param name="dbContext"></param> /// <param name="fileLocation"></param> /// <param name="systemId"></param> public static void Import(PerformContext performContext, DbAppContext dbContext, string fileLocation, string systemId) { // check the start point. If startPoint == sigId then it is already completed int startPoint = ImportUtility.CheckInterMapForStartPoint(dbContext, OldTableProgress, BcBidImport.SigId, NewTable); if (startPoint == BcBidImport.SigId) // this means the import job it has done today is complete for all the records in the xml file. // This means the import job it has done today is complete for all the records in the xml file. { performContext.WriteLine("*** Importing " + XmlFileName + " is complete from the former process ***"); return; } int maxIndex = startPoint; try { string rootAttr = "ArrayOf" + OldTable; // create progress indicator performContext.WriteLine("Processing " + OldTable); IProgressBar progress = performContext.WriteProgressBar(); progress.SetValue(0); // create serializer and serialize xml file XmlSerializer ser = new XmlSerializer(typeof(ImportModels.RotationDoc[]), new XmlRootAttribute(rootAttr)); MemoryStream memoryStream = ImportUtility.MemoryStreamGenerator(XmlFileName, OldTable, fileLocation, rootAttr); ImportModels.RotationDoc[] legacyItems = (ImportModels.RotationDoc[])ser.Deserialize(memoryStream); int ii = startPoint; // skip the portion already processed if (startPoint > 0) { legacyItems = legacyItems.Skip(ii).ToArray(); } Debug.WriteLine("Importing Rotation Doc Data. Total Records: " + legacyItems.Length); foreach (ImportModels.RotationDoc item in legacyItems.WithProgress(progress)) { // see if we have this one already. HetImportMap importMap = dbContext.HetImportMap.AsNoTracking() .FirstOrDefault(x => x.OldTable == OldTable && x.OldKey == item.Note_Id.ToString()); // new entry if (importMap == null) { BcbidRotationDoc rotationDoc = null; CopyToInstance(dbContext, item, ref rotationDoc, systemId, ref maxIndex); ImportUtility.AddImportMap(dbContext, OldTable, item.Note_Id.ToString(), NewTable, rotationDoc.NoteId); } // save change to database if (++ii % 2000 == 0) { ImportUtility.AddImportMapForProgress(dbContext, OldTableProgress, ii.ToString(), BcBidImport.SigId, NewTable); dbContext.SaveChangesForImport(); } } try { performContext.WriteLine("*** Importing " + XmlFileName + " is Done ***"); ImportUtility.AddImportMapForProgress(dbContext, OldTableProgress, BcBidImport.SigId.ToString(), BcBidImport.SigId, NewTable); dbContext.SaveChangesForImport(); } catch (Exception e) { string temp = string.Format("Error saving data (Index: {0}): {1}", maxIndex, e.Message); performContext.WriteLine(temp); throw new DataException(temp); } } catch (Exception e) { performContext.WriteLine("*** ERROR ***"); performContext.WriteLine(e.ToString()); throw; } }
/// <summary> /// Import Equipment Usage /// </summary> /// <param name="performContext"></param> /// <param name="dbContext"></param> /// <param name="fileLocation"></param> /// <param name="systemId"></param> public static void Import(PerformContext performContext, DbAppContext dbContext, string fileLocation, string systemId) { // check the start point. If startPoint == sigId then it is already completed int startPoint = ImportUtility.CheckInterMapForStartPoint(dbContext, OldTableProgress, BcBidImport.SigId, NewTable); if (startPoint == BcBidImport.SigId) // this means the import job completed for all the records in this file { performContext.WriteLine("*** Importing " + XmlFileName + " is complete from the former process ***"); return; } int maxTimeSheetIndex = 0; if (dbContext.HetTimeRecord.Any()) { maxTimeSheetIndex = dbContext.HetTimeRecord.Max(x => x.TimeRecordId); } try { string rootAttr = "ArrayOf" + OldTable; // create progress indicator performContext.WriteLine("Processing " + OldTable); IProgressBar progress = performContext.WriteProgressBar(); progress.SetValue(0); // create serializer and serialize xml file XmlSerializer ser = new XmlSerializer(typeof(ImportModels.EquipUsage[]), new XmlRootAttribute(rootAttr)); MemoryStream memoryStream = ImportUtility.MemoryStreamGenerator(XmlFileName, OldTable, fileLocation, rootAttr); ImportModels.EquipUsage[] legacyItems = (ImportModels.EquipUsage[])ser.Deserialize(memoryStream); int ii = startPoint; // skip the portion already processed if (startPoint > 0) { legacyItems = legacyItems.Skip(ii).ToArray(); } Debug.WriteLine("Importing TimeSheet Data. Total Records: " + legacyItems.Length); foreach (ImportModels.EquipUsage item in legacyItems.WithProgress(progress)) { // see if we have this one already string oldProjectKey = item.Project_Id.ToString(); string oldEquipKey = item.Equip_Id.ToString(); string oldCreatedDate = item.Created_Dt; string oldKey = string.Format("{0}-{1}-{2}", oldProjectKey, oldEquipKey, oldCreatedDate); HetImportMap importMap = dbContext.HetImportMap.AsNoTracking() .FirstOrDefault(x => x.OldTable == OldTable && x.OldKey == oldKey); // new entry if (importMap == null && item.Equip_Id > 0 && item.Project_Id > 0) { HetTimeRecord instance = null; CopyToTimeRecorded(dbContext, item, ref instance, systemId, ref maxTimeSheetIndex); if (instance != null) { ImportUtility.AddImportMap(dbContext, OldTable, oldKey, NewTable, instance.TimeRecordId); } // save change to database if (++ii % 2000 == 0) { ImportUtility.AddImportMapForProgress(dbContext, OldTableProgress, ii.ToString(), BcBidImport.SigId, NewTable); dbContext.SaveChanges(); } } } try { performContext.WriteLine("*** Importing " + XmlFileName + " is Done ***"); ImportUtility.AddImportMapForProgress(dbContext, OldTableProgress, BcBidImport.SigId.ToString(), BcBidImport.SigId, NewTable); dbContext.SaveChanges(); } catch (Exception e) { string temp = string.Format("Error saving data (TimeRecordIndex: {0}): {1}", maxTimeSheetIndex, e.Message); performContext.WriteLine(temp); throw new DataException(temp); } } catch (Exception e) { performContext.WriteLine("*** ERROR ***"); performContext.WriteLine(e.ToString()); throw; } }
public static void Obfuscate(PerformContext performContext, DbAppContext dbContext, string sourceLocation, string destinationLocation, string systemId) { int startPoint = ImportUtility.CheckInterMapForStartPoint(dbContext, "Obfuscate_" + OldTableProgress, BcBidImport.SigId, NewTable); if (startPoint == BcBidImport.SigId) // this means the import job it has done today is complete for all the records in the xml file. { performContext.WriteLine("*** Obfuscating " + XmlFileName + " is complete from the former process ***"); return; } try { string rootAttr = "ArrayOf" + OldTable; // create progress indicator performContext.WriteLine("Processing " + OldTable); IProgressBar progress = performContext.WriteProgressBar(); progress.SetValue(0); // create serializer and serialize xml file XmlSerializer ser = new XmlSerializer(typeof(ImportModels.Owner[]), new XmlRootAttribute(rootAttr)); MemoryStream memoryStream = ImportUtility.MemoryStreamGenerator(XmlFileName, OldTable, sourceLocation, rootAttr); ImportModels.Owner[] legacyItems = (ImportModels.Owner[])ser.Deserialize(memoryStream); performContext.WriteLine("Obfuscating owner data"); progress.SetValue(0); int currentOwner = 0; List <ImportMapRecord> importMapRecords = new List <ImportMapRecord>(); foreach (ImportModels.Owner item in legacyItems.WithProgress(progress)) { item.Created_By = systemId; if (item.Modified_By != null) { item.Modified_By = systemId; } ImportMapRecord importMapRecordOrganization = new ImportMapRecord { TableName = NewTable, MappedColumn = "OrganizationName", OriginalValue = item.CGL_Company, NewValue = "Company " + currentOwner }; importMapRecords.Add(importMapRecordOrganization); ImportMapRecord importMapRecordFirstName = new ImportMapRecord { TableName = NewTable, MappedColumn = "Owner_First_Name", OriginalValue = item.Owner_First_Name, NewValue = "OwnerFirst" + currentOwner }; importMapRecords.Add(importMapRecordFirstName); ImportMapRecord importMapRecordLastName = new ImportMapRecord { TableName = NewTable, MappedColumn = "Owner_Last_Name", OriginalValue = item.Owner_Last_Name, NewValue = "OwnerLast" + currentOwner }; importMapRecords.Add(importMapRecordLastName); ImportMapRecord importMapRecordOwnerCode = new ImportMapRecord { TableName = NewTable, MappedColumn = "Owner_Cd", OriginalValue = item.Owner_Cd, NewValue = "OO" + currentOwner }; importMapRecords.Add(importMapRecordOwnerCode); item.Owner_Cd = "OO" + currentOwner; item.Owner_First_Name = "OwnerFirst" + currentOwner; item.Owner_Last_Name = "OwnerLast" + currentOwner; item.Contact_Person = ImportUtility.ScrambleString(ImportUtility.CleanString(item.Contact_Person)); item.Comment = ImportUtility.ScrambleString(ImportUtility.CleanString(item.Comment)); item.WCB_Num = ImportUtility.ScrambleString(ImportUtility.CleanString(item.WCB_Num)); item.CGL_Company = ImportUtility.ScrambleString(ImportUtility.CleanString(item.CGL_Company)); item.CGL_Policy = ImportUtility.ScrambleString(ImportUtility.CleanString(item.CGL_Policy)); currentOwner++; } performContext.WriteLine("Writing " + XmlFileName + " to " + destinationLocation); // write out the array FileStream fs = ImportUtility.GetObfuscationDestination(XmlFileName, destinationLocation); ser.Serialize(fs, legacyItems); fs.Close(); // write out the spreadsheet of import records ImportUtility.WriteImportRecordsToExcel(destinationLocation, importMapRecords, OldTable); } catch (Exception e) { performContext.WriteLine("*** ERROR ***"); performContext.WriteLine(e.ToString()); throw; } }
public static void Obfuscate(PerformContext performContext, DbAppContext dbContext, string sourceLocation, string destinationLocation, string systemId) { int startPoint = ImportUtility.CheckInterMapForStartPoint(dbContext, "Obfuscate_" + OldTableProgress, BcBidImport.SigId, NewTable); if (startPoint == BcBidImport.SigId) // this means the import job it has done today is complete for all the records in the xml file. { performContext.WriteLine("*** Obfuscating " + XmlFileName + " is complete from the former process ***"); return; } try { string rootAttr = "ArrayOf" + OldTable; // create progress indicator performContext.WriteLine("Processing " + OldTable); IProgressBar progress = performContext.WriteProgressBar(); progress.SetValue(0); // create serializer and serialize xml file XmlSerializer ser = new XmlSerializer(typeof(ImportModels.Equip[]), new XmlRootAttribute(rootAttr)); MemoryStream memoryStream = ImportUtility.MemoryStreamGenerator(XmlFileName, OldTable, sourceLocation, rootAttr); ImportModels.Equip[] legacyItems = (ImportModels.Equip[])ser.Deserialize(memoryStream); performContext.WriteLine("Obfuscating Equip data"); progress.SetValue(0); List <ImportMapRecord> importMapRecords = new List <ImportMapRecord>(); foreach (ImportModels.Equip item in legacyItems.WithProgress(progress)) { item.Created_By = systemId; if (item.Modified_By != null) { item.Modified_By = systemId; } Random random = new Random(); string newSerialNum = random.Next(10000).ToString(); ImportMapRecord importMapRecordOrganization = new ImportMapRecord { TableName = NewTable, MappedColumn = "Serial_Num", OriginalValue = item.Serial_Num, NewValue = newSerialNum }; importMapRecords.Add(importMapRecordOrganization); item.Serial_Num = newSerialNum; item.Addr1 = ImportUtility.ScrambleString(item.Addr1); item.Addr2 = ImportUtility.ScrambleString(item.Addr2); item.Addr3 = ImportUtility.ScrambleString(item.Addr3); item.Addr4 = ImportUtility.ScrambleString(item.Addr4); item.Postal = ImportUtility.ScrambleString(item.Postal); item.Licence = ImportUtility.ScrambleString(ImportUtility.CleanString(item.Licence)); item.Operator = ImportUtility.ScrambleString(item.Operator); } performContext.WriteLine("Writing " + XmlFileName + " to " + destinationLocation); // write out the array FileStream fs = ImportUtility.GetObfuscationDestination(XmlFileName, destinationLocation); ser.Serialize(fs, legacyItems); fs.Close(); // write out the spreadsheet of import records ImportUtility.WriteImportRecordsToExcel(destinationLocation, importMapRecords, OldTable); } catch (Exception e) { performContext.WriteLine("*** ERROR ***"); performContext.WriteLine(e.ToString()); throw; } }