private async Task PerformExportDescriptionToFile(Guid idChart, Func <Task <IOrganizationServiceExtented> > getService) { if (!this.IsControlsEnabled) { return; } ToggleControls(false, Properties.OutputStrings.CreatingEntityDescription); var service = await getService(); if (service != null) { var repository = new SavedQueryVisualizationRepository(service); var chart = await repository.GetByIdAsync(idChart, ColumnSetInstances.AllColumns); var description = await EntityDescriptionHandler.GetEntityDescriptionAsync(chart, service.ConnectionData); string filePath = await CreateDescriptionFileAsync(service.ConnectionData, chart.PrimaryEntityTypeCode, chart.Name, EntityFileNameFormatter.Headers.EntityDescription, description); this._iWriteToOutput.PerformAction(service.ConnectionData, filePath); } ToggleControls(true, Properties.OutputStrings.CreatingEntityDescriptionCompleted); }
private async Task PerformExportEntityDescriptionToFileAsync(Guid pluginAssemblyId, string assemblyName, Func <Task <IOrganizationServiceExtented> > getService) { if (!this.IsControlsEnabled) { return; } ToggleControls(false, Properties.WindowStatusStrings.CreatingEntityDescription); var service = await getService(); if (service != null) { var repository = new PluginAssemblyRepository(service); var assembly = await repository.GetAssemblyByIdRetrieveRequestAsync(pluginAssemblyId, new ColumnSet(true)); var description = await EntityDescriptionHandler.GetEntityDescriptionAsync(assembly, EntityFileNameFormatter.PluginAssemblyIgnoreFields, service.ConnectionData); string filePath = await CreateDescriptionFileAsync(service.ConnectionData, assembly.Name, EntityFileNameFormatter.Headers.EntityDescription, description); this._iWriteToOutput.PerformAction(service.ConnectionData, filePath); } ToggleControls(true, Properties.WindowStatusStrings.CreatingEntityDescriptionCompleted); }
private async Task PerformExportDescriptionToFile(Guid idReport, Func <Task <IOrganizationServiceExtented> > getService) { if (!this.IsControlsEnabled) { return; } ToggleControls(false, Properties.WindowStatusStrings.CreatingEntityDescription); var service = await getService(); if (service != null) { var repository = new ReportRepository(service); var report = await repository.GetByIdAsync(idReport, new ColumnSet(true)); var description = await EntityDescriptionHandler.GetEntityDescriptionAsync(report, EntityFileNameFormatter.ReportIgnoreFields, service.ConnectionData); string filePath = await CreateDescriptionFileAsync(service.ConnectionData, report.Name, report.Id, "Description", description); this._iWriteToOutput.PerformAction(service.ConnectionData, filePath); } ToggleControls(true, Properties.WindowStatusStrings.CreatingEntityDescriptionCompleted); }
private async Task PerformExportDescriptionToFile(Guid idWebResource, string name, Func <Task <IOrganizationServiceExtented> > getService) { if (!this.IsControlsEnabled) { return; } ToggleControls(false, Properties.OutputStrings.CreatingEntityDescription); var service = await getService(); if (service != null) { WebResourceRepository webResourceRepository = new WebResourceRepository(service); var webresource = await webResourceRepository.GetByIdAsync(idWebResource, ColumnSetInstances.AllColumns); var description = await EntityDescriptionHandler.GetEntityDescriptionAsync(webresource, service.ConnectionData); string filePath = await CreateDescriptionFileAsync(service.ConnectionData, webresource.Name, EntityFileNameFormatter.Headers.EntityDescription, description); this._iWriteToOutput.PerformAction(service.ConnectionData, filePath); } ToggleControls(true, Properties.OutputStrings.CreatingEntityDescriptionCompleted); }
private async Task PerformShowingDifferenceDescriptionAsync(LinkedEntities <SavedQueryVisualization> linked, bool showAllways) { if (!this.IsControlsEnabled) { return; } ToggleControls(false, Properties.OutputStrings.ShowingDifferenceEntityDescription); try { var service1 = await GetService1(); var service2 = await GetService2(); if (service1 != null && service2 != null) { var repository1 = new SavedQueryVisualizationRepository(service1); var repository2 = new SavedQueryVisualizationRepository(service2); var chart1 = await repository1.GetByIdAsync(linked.Entity1.Id, ColumnSetInstances.AllColumns); var chart2 = await repository2.GetByIdAsync(linked.Entity2.Id, ColumnSetInstances.AllColumns); var desc1 = await EntityDescriptionHandler.GetEntityDescriptionAsync(chart1); var desc2 = await EntityDescriptionHandler.GetEntityDescriptionAsync(chart2); if (showAllways || desc1 != desc2) { string filePath1 = await CreateDescriptionFileAsync(service1.ConnectionData, chart1.PrimaryEntityTypeCode, chart1.Name, EntityFileNameFormatter.Headers.EntityDescription, desc1); string filePath2 = await CreateDescriptionFileAsync(service2.ConnectionData, chart2.PrimaryEntityTypeCode, chart2.Name, EntityFileNameFormatter.Headers.EntityDescription, desc2); if (File.Exists(filePath1) && File.Exists(filePath2)) { await this._iWriteToOutput.ProcessStartProgramComparerAsync(service1.ConnectionData, filePath1, filePath2, Path.GetFileName(filePath1), Path.GetFileName(filePath2), service2.ConnectionData); } else { this._iWriteToOutput.PerformAction(service1.ConnectionData, filePath1); this._iWriteToOutput.PerformAction(service2.ConnectionData, filePath2); } } } ToggleControls(true, Properties.OutputStrings.ShowingDifferenceEntityDescriptionCompleted); } catch (Exception ex) { _iWriteToOutput.WriteErrorToOutput(null, ex); ToggleControls(true, Properties.OutputStrings.ShowingDifferenceEntityDescriptionFailed); } }
private async Task PerformShowingDifferenceEntityDescriptionAsync(LinkedEntities <PluginAssembly> linked, bool showAllways) { if (!this.IsControlsEnabled) { return; } ToggleControls(false, Properties.WindowStatusStrings.ShowingDifferenceEntityDescription); try { var service1 = await GetService1(); var service2 = await GetService2(); if (service1 != null && service2 != null) { var repository1 = new PluginAssemblyRepository(service1); var repository2 = new PluginAssemblyRepository(service2); var assembly1 = await repository1.GetAssemblyByIdRetrieveRequestAsync(linked.Entity1.Id, new ColumnSet(true)); var assembly2 = await repository2.GetAssemblyByIdRetrieveRequestAsync(linked.Entity2.Id, new ColumnSet(true)); var desc1 = await EntityDescriptionHandler.GetEntityDescriptionAsync(assembly1, EntityFileNameFormatter.PluginAssemblyIgnoreFields); var desc2 = await EntityDescriptionHandler.GetEntityDescriptionAsync(assembly2, EntityFileNameFormatter.PluginAssemblyIgnoreFields); if (showAllways || desc1 != desc2) { string filePath1 = await CreateDescriptionFileAsync(service1.ConnectionData, assembly1.Name, EntityFileNameFormatter.Headers.EntityDescription, desc1); string filePath2 = await CreateDescriptionFileAsync(service2.ConnectionData, assembly2.Name, EntityFileNameFormatter.Headers.EntityDescription, desc2); if (File.Exists(filePath1) && File.Exists(filePath2)) { this._iWriteToOutput.ProcessStartProgramComparer(filePath1, filePath2, Path.GetFileName(filePath1), Path.GetFileName(filePath2)); } else { this._iWriteToOutput.PerformAction(service1.ConnectionData, filePath1); this._iWriteToOutput.PerformAction(service2.ConnectionData, filePath2); } } } ToggleControls(true, Properties.WindowStatusStrings.ShowingDifferenceEntityDescriptionCompleted); } catch (Exception ex) { _iWriteToOutput.WriteErrorToOutput(null, ex); ToggleControls(true, Properties.WindowStatusStrings.ShowingDifferenceEntityDescriptionFailed); } }
private async Task PerformShowingDifferenceDescriptionAsync(LinkedEntities <WebResource> linked, bool showAllways) { if (!this.IsControlsEnabled) { return; } ToggleControls(false, Properties.OutputStrings.ShowingDifferenceEntityDescription); var service1 = await GetService1(); var service2 = await GetService2(); if (service1 != null && service2 != null) { var repository1 = new WebResourceRepository(service1); var repository2 = new WebResourceRepository(service2); var webResource1 = await repository1.GetByIdAsync(linked.Entity1.Id, ColumnSetInstances.AllColumns); var webResource2 = await repository2.GetByIdAsync(linked.Entity2.Id, ColumnSetInstances.AllColumns); var desc1 = await EntityDescriptionHandler.GetEntityDescriptionAsync(webResource1); var desc2 = await EntityDescriptionHandler.GetEntityDescriptionAsync(webResource2); if (showAllways || desc1 != desc2) { string filePath1 = await CreateDescriptionFileAsync(service1.ConnectionData, webResource1.Name, EntityFileNameFormatter.Headers.EntityDescription, desc1); string filePath2 = await CreateDescriptionFileAsync(service2.ConnectionData, webResource2.Name, EntityFileNameFormatter.Headers.EntityDescription, desc2); if (File.Exists(filePath1) && File.Exists(filePath2)) { await this._iWriteToOutput.ProcessStartProgramComparerAsync(service1.ConnectionData, filePath1, filePath2, Path.GetFileName(filePath1), Path.GetFileName(filePath2), service2.ConnectionData); } else { this._iWriteToOutput.PerformAction(service1.ConnectionData, filePath1); this._iWriteToOutput.PerformAction(service2.ConnectionData, filePath2); } } } ToggleControls(true, Properties.OutputStrings.ShowingDifferenceEntityDescriptionCompleted); }
private async Task CreateDescription(PluginTreeViewItem node) { if (!CanCreateDescription(node)) { return; } var service = await GetService(); if (service == null) { return; } this._iWriteToOutput.WriteToOutputStartOperation(service.ConnectionData, Properties.OperationNames.CreatingFileWithDescriptionFormat1); ToggleControls(service.ConnectionData, false, Properties.OutputStrings.CreatingDescription); StringBuilder result = new StringBuilder(); string fileName = string.Empty; if (node.MessageList != null && node.MessageList.Any()) { var repository = new SdkMessageRepository(service); List <SdkMessage> listMessages = await repository.GetMessageByIdsAsync(node.MessageList.ToArray()); if (string.IsNullOrEmpty(fileName)) { fileName = EntityFileNameFormatter.GetMessageFileName(service.ConnectionData.Name, node.Name, "Description"); if (result.Length > 0) { result.AppendLine().AppendLine().AppendLine(); } result.AppendLine(service.ConnectionData.GetConnectionInfo()); } foreach (var message in listMessages) { string desc = await EntityDescriptionHandler.GetEntityDescriptionAsync(message, service.ConnectionData); if (!string.IsNullOrEmpty(desc)) { if (result.Length > 0) { result.AppendLine().AppendLine().AppendLine(); } result.AppendLine(desc); } } } if (node.MessageFilterList != null && node.MessageFilterList.Any()) { var repository = new SdkMessageFilterRepository(service); List <SdkMessageFilter> listMessages = await repository.GetMessageFiltersByIdsAsync(node.MessageFilterList.ToArray()); if (string.IsNullOrEmpty(fileName)) { fileName = EntityFileNameFormatter.GetMessageFilterFileName(service.ConnectionData.Name, node.Name, "Description"); if (result.Length > 0) { result.AppendLine().AppendLine().AppendLine(); } result.AppendLine(service.ConnectionData.GetConnectionInfo()); } foreach (var message in listMessages) { string desc = await EntityDescriptionHandler.GetEntityDescriptionAsync(message, service.ConnectionData); if (!string.IsNullOrEmpty(desc)) { if (result.Length > 0) { result.AppendLine().AppendLine().AppendLine(); } result.AppendLine(desc); } } } if (!string.IsNullOrEmpty(fileName)) { string filePath = Path.Combine(_commonConfig.FolderForExport, FileOperations.RemoveWrongSymbols(fileName)); File.WriteAllText(filePath, result.ToString(), new UTF8Encoding(false)); this._iWriteToOutput.PerformAction(service.ConnectionData, filePath); } ToggleControls(service.ConnectionData, true, Properties.OutputStrings.CreatingDescriptionCompleted); this._iWriteToOutput.WriteToOutputEndOperation(service.ConnectionData, Properties.OperationNames.CreatingFileWithDescriptionFormat1, service.ConnectionData.Name); }