private async Task PerformExportEntityDescription(string folder, Guid idImportJob, string solutionName, DateTime?createdOn) { var service = await GetService(); ToggleControls(service.ConnectionData, false, Properties.WindowStatusStrings.CreatingEntityDescription); try { string fileName = EntityFileNameFormatter.GetImportJobFileName(service.ConnectionData.Name, solutionName, createdOn, EntityFileNameFormatter.Headers.EntityDescription, "txt"); string filePath = Path.Combine(folder, FileOperations.RemoveWrongSymbols(fileName)); var repository = new ImportJobRepository(service); var importJob = await repository.GetByIdAsync(idImportJob, new ColumnSet(true)); await EntityDescriptionHandler.ExportEntityDescriptionAsync(filePath, importJob, EntityFileNameFormatter.ImportJobIgnoreFields, service.ConnectionData); this._iWriteToOutput.WriteToOutput(service.ConnectionData, Properties.OutputStrings.ExportedEntityDescriptionForConnectionFormat3 , service.ConnectionData.Name , importJob.LogicalName , filePath); this._iWriteToOutput.PerformAction(service.ConnectionData, filePath); ToggleControls(service.ConnectionData, true, Properties.WindowStatusStrings.CreatingEntityDescriptionCompleted); } catch (Exception ex) { _iWriteToOutput.WriteErrorToOutput(service.ConnectionData, ex); ToggleControls(service.ConnectionData, true, Properties.WindowStatusStrings.CreatingEntityDescriptionFailed); } }
private async Task PerformExportXmlToFile(string folder, Guid idImportJob, string solutionName, DateTime?createdOn, string fieldName, string fieldTitle) { if (!this.IsControlsEnabled) { return; } var service = await GetService(); ToggleControls(service.ConnectionData, false, Properties.WindowStatusStrings.ExportingXmlFieldToFileFormat1, fieldTitle); try { var repository = new ImportJobRepository(service); var importJob = await repository.GetByIdAsync(idImportJob, new ColumnSet(fieldName)); string xmlContent = importJob.GetAttributeValue <string>(fieldName); string filePath = await CreateFileAsync(service.ConnectionData, folder, solutionName, createdOn, fieldTitle, xmlContent); this._iWriteToOutput.PerformAction(service.ConnectionData, filePath); ToggleControls(service.ConnectionData, true, Properties.WindowStatusStrings.ExportingXmlFieldToFileCompletedFormat1, fieldName); } catch (Exception ex) { _iWriteToOutput.WriteErrorToOutput(service.ConnectionData, ex); ToggleControls(service.ConnectionData, true, Properties.WindowStatusStrings.ExportingXmlFieldToFileFailedFormat1, fieldName); } }