Пример #1
0
        private async Task <IEnumerable <Guid> > GetDescriptionWithEntityFieldStringsInAllWorkflows(StringBuilder strFile)
        {
            var workflowsWithStrings = new Dictionary <Guid, List <WorkflowEntityFieldString> >();

            try
            {
                this._iWriteToOutput.WriteToOutput(_service.ConnectionData, string.Empty);
                this._iWriteToOutput.WriteToOutput(_service.ConnectionData, string.Empty);

                strFile.AppendLine(this._iWriteToOutput.WriteToOutputStartOperation(_service.ConnectionData, Properties.OperationNames.AnalyzingWorkflowsFormat1, _service.ConnectionData.Name));

                var repositoryWorkflow = new WorkflowRepository(_service);

                var handler = new WorkflowUsedEntitiesHandler();

                {
                    var workflowsList = await repositoryWorkflow.GetListAsync(null, null, null, null, new ColumnSet(Workflow.Schema.Attributes.xaml));

                    _descriptor.GetEntities <Workflow>((int)ComponentType.Workflow, workflowsList.Select(c => c.Id));

                    foreach (var workflow in workflowsList)
                    {
                        if (string.IsNullOrEmpty(workflow.Xaml))
                        {
                            continue;
                        }

                        var xmlContent = ContentComparerHelper.RemoveDiacritics(workflow.Xaml);

                        var doc = XElement.Parse(xmlContent);

                        List <WorkflowEntityFieldString> coll = await handler.GetWorkflowStringsEntityFieldsAsync(doc);

                        if (coll.Count > 0)
                        {
                            workflowsWithStrings.Add(workflow.Id, coll);
                        }
                    }
                }

                await FillDescriptionEntityFieldStrings(strFile, workflowsWithStrings);

                strFile.AppendLine(this._iWriteToOutput.WriteToOutputEndOperation(_service.ConnectionData, Properties.OperationNames.AnalyzingWorkflowsFormat1, _service.ConnectionData.Name));
            }
            catch (Exception ex)
            {
                this._iWriteToOutput.WriteErrorToOutput(_service.ConnectionData, ex);
            }

            return(workflowsWithStrings.Keys.ToArray());
        }
Пример #2
0
        public async Task GetDescriptionEntityFieldStringsInWorkflowAsync(StringBuilder strFile, Guid idWorkflow)
        {
            try
            {
                var repository = new WorkflowRepository(_service);

                var workflow = await repository.GetByIdAsync(idWorkflow, ColumnSetInstances.AllColumns);

                string xmlContent = ContentComparerHelper.RemoveDiacritics(workflow.Xaml);

                var doc = XElement.Parse(xmlContent);

                var handler = new WorkflowUsedEntitiesHandler();

                strFile
                .AppendFormat("Entity:   {0}", workflow.PrimaryEntity).AppendLine()
                .AppendFormat("Category: {0}", workflow.FormattedValues[Workflow.Schema.Attributes.category]).AppendLine()
                .AppendFormat("Name:     {0}", workflow.Name).AppendLine()
                .AppendFormat("Url:      {0}", _service.UrlGenerator.GetSolutionComponentUrl(ComponentType.Workflow, idWorkflow)).AppendLine()
                .AppendLine()
                .AppendLine()
                .AppendLine()
                ;

                var strings = await handler.GetWorkflowStringsEntityFieldsAsync(doc);

                Dictionary <Guid, List <WorkflowEntityFieldString> > workflowsWithStrings = new Dictionary <Guid, List <WorkflowEntityFieldString> >();

                if (strings.Any())
                {
                    workflowsWithStrings.Add(idWorkflow, strings);
                }

                await FillDescriptionEntityFieldStrings(strFile, workflowsWithStrings);
            }
            catch (Exception ex)
            {
                this._iWriteToOutput.WriteErrorToOutput(_service.ConnectionData, ex);
            }
        }