private async Task GettingSystemFormCurrentAttribute(IOrganizationServiceExtented service, CommonConfiguration commonConfig, Guid formId, ActionOnComponent actionOnComponent, string fieldName, string fieldTitle) { var repositorySystemForm = new SystemFormRepository(service); var systemForm = await repositorySystemForm.GetByIdAsync(formId, ColumnSetInstances.AllColumns); if (actionOnComponent == ActionOnComponent.SingleXmlField) { if (string.Equals(fieldName, SystemForm.Schema.Attributes.formxml, StringComparison.InvariantCultureIgnoreCase)) { GetCurrentSystemFormXml(service, commonConfig, systemForm); } } else if (actionOnComponent == ActionOnComponent.SingleField) { if (string.Equals(fieldName, SystemForm.Schema.Attributes.formjson, StringComparison.InvariantCultureIgnoreCase)) { GetCurrentSystemFormJson(service, commonConfig, systemForm); } } else if (actionOnComponent == ActionOnComponent.EntityDescription) { await GetCurrentEntityDescription(service, commonConfig, systemForm); } else if (actionOnComponent == ActionOnComponent.Description) { await GetCurrentFormDescription(service, commonConfig, systemForm); } }
private async Task CopingToClipboardSystemFormCurrentTabsAndSections(IOrganizationServiceExtented service, CommonConfiguration commonConfig, JavaScriptObjectType jsObjectType, string entityName, Guid formId, int formType) { var repositorySystemForm = new SystemFormRepository(service); var systemForm = await repositorySystemForm.GetByIdAsync(formId, ColumnSetInstances.AllColumns); string formXml = systemForm.FormXml; if (string.IsNullOrEmpty(formXml)) { this._iWriteToOutput.WriteToOutput(service.ConnectionData, Properties.OutputStrings.InConnectionEntityFieldIsEmptyFormat4, service.ConnectionData.Name, SystemForm.Schema.EntityLogicalName, systemForm.Name, SystemForm.Schema.Headers.formxml); this._iWriteToOutput.ActivateOutputWindow(service.ConnectionData); return; } try { var fileGenerationOptions = FileGenerationConfiguration.GetFileGenerationOptions(); var config = new CreateFileJavaScriptConfiguration(fileGenerationOptions); var doc = XElement.Parse(formXml); var descriptor = new SolutionComponentDescriptor(service); descriptor.SetSettings(commonConfig); var handler = new FormDescriptionHandler(descriptor, new DependencyRepository(service)); FormInformation formInfo = handler.GetFormInformation(doc); var stringBuilder = new StringBuilder(); using (var writer = new StringWriter(stringBuilder)) { var handlerCreate = new CreateFormTabsJavaScriptHandler(writer, config, jsObjectType, service); handlerCreate.WriteContentOnlyForm(formInfo); } ClipboardHelper.SetText(stringBuilder.ToString().Trim(' ', '\r', '\n')); this._iWriteToOutput.WriteToOutput(service.ConnectionData, Properties.OutputStrings.CopyingEntityJavaScriptContentOnFormCompletedFormat2, systemForm.ObjectTypeCode, systemForm.Name); this._iWriteToOutput.ActivateOutputWindow(service.ConnectionData); service.TryDispose(); } catch (Exception ex) { this._iWriteToOutput.WriteErrorToOutput(service.ConnectionData, ex); } }
private async Task <Tuple <bool, SystemForm> > GetSystemFormByAttribute(IOrganizationServiceExtented service, CommonConfiguration commonConfig, string systemFormId) { var repositorySystemForm = new SystemFormRepository(service); var systemForm = await repositorySystemForm.GetByIdAsync(Guid.Parse(systemFormId), ColumnSetInstances.AllColumns); if (systemForm == null) { this._iWriteToOutput.WriteToOutput(service.ConnectionData, Properties.OutputStrings.InConnectionSystemFormWasNotFoundFormat2, service.ConnectionData.Name, systemFormId); this._iWriteToOutput.ActivateOutputWindow(service.ConnectionData); WindowHelper.OpenSystemFormExplorer(_iWriteToOutput, service, commonConfig, systemFormId); } return(Tuple.Create(systemForm != null, systemForm)); }