Пример #1
0
        private ImportedDocGridViewItem GetMatchingFileUnassignedAttachmentFromUi(ImportedDocument importedDocument,
                                                                                  IDictionary <GVItem, ImageAttachment> fileManagerAttachmentDictionary)
        {
            ImportedDocGridViewItem result = new ImportedDocGridViewItem();

            var matchingAttachment =
                fileManagerAttachmentDictionary
                .FirstOrDefault(x => x.Value.ID.Equals(importedDocument.EncompassAttachmentId, StringComparison.OrdinalIgnoreCase));

            // if matching file is found from loan cdo, highlight row!
            if (matchingAttachment.Key == null)
            {
                result.HighlightEfolderRow = false;
                return(result);
            }

            var externalSource =
                _externalSourcesDictionary.FirstOrDefault(x =>
                                                          x.Key.Equals(importedDocument.ExternalSourceId));

            if (externalSource.Value == null)
            {
                result.HighlightEfolderRow = false;
                return(result);
            }

            result.HighlightEfolderRow = true;
            result.DocumentSource      = externalSource.Value;
            result.EfolderGridViewRow  = matchingAttachment.Key;

            return(result);
        }
Пример #2
0
        private ImportedDocGridViewItem GetMatchingEfolderDocFromDataGridView(ImportedDocument importedDocument,
                                                                              IDictionary <GVItem, DocumentLog> efolderDocDictionary)
        {
            ImportedDocGridViewItem result = new ImportedDocGridViewItem();

            var matchingEfolderDoc = GetTrackedDocumentGridViewItem(importedDocument.EncompassEfolderId, efolderDocDictionary);

            // if matching efolder is found (if not found, efolder has been deleted by end user)
            if (matchingEfolderDoc.Key == null)
            {
                result.HighlightEfolderRow = false;
                return(result);
            }
            result.EfolderDocumentDetails = matchingEfolderDoc.Value;
            result.EfolderGridViewRow     = matchingEfolderDoc.Key;


            var externalSource =
                _externalSourcesDictionary.FirstOrDefault(x =>
                                                          x.Key.Equals(importedDocument.ExternalSourceId));

            if (externalSource.Value == null)
            {
                result.HighlightEfolderRow = false;
                return(result);
            }

            result.HighlightEfolderRow = true;

            result.DocumentSource = externalSource.Value;


            return(result);
        }
Пример #3
0
        /// <summary>
        /// Exports to C#
        /// </summary>
        /// <param name="Output">C# Output.</param>
        /// <param name="State">C# export state.</param>
        /// <param name="Indent">Indentation</param>
        /// <param name="Pass">Export pass</param>
        public override void ExportCSharp(StringBuilder Output, CSharpExportState State,
                                          int Indent, CSharpExportPass Pass)
        {
            if (Pass == CSharpExportPass.Explicit && !(this.body is null))
            {
                if (!(this.body.Imports is null))
                {
                    foreach (Asn1Import Import in this.body.Imports)
                    {
                        if (string.IsNullOrEmpty(Import.Module))
                        {
                            continue;
                        }

                        Asn1Document ImportedDocument;

                        if (State.Settings.ContainsCode(Import.Module))
                        {
                            ImportedDocument = State.Settings.GetDocument(Import.Module);
                        }
                        else
                        {
                            ImportedDocument = Import.LoadDocument();
                            string CSharp = ImportedDocument.ExportCSharp(State.Settings);
                            State.Settings.AddCode(Import.Module, CSharp, ImportedDocument);
                        }

                        Output.Append("using ");
                        Output.Append(State.Settings.Namespace(Import.Module));
                        Output.AppendLine(";");
                    }

                    Output.AppendLine();
                }
                else
                {
                    Output.AppendLine();
                }

                Output.Append(Tabs(Indent));
                Output.Append("namespace ");
                Output.Append(State.Settings.BaseNamespace);
                Output.Append('.');
                Output.AppendLine(ToCSharp(this.identifier));
                Output.Append(Tabs(Indent));
                Output.AppendLine("{");
                Indent++;

                if (!(this.body.Imports is null))
                {
                    foreach (Asn1Import Import in this.body.Imports)
                    {
                        if (string.IsNullOrEmpty(Import.Module))
                        {
                            continue;
                        }

                        Asn1Document ImportedDocument = State.Settings.GetDocument(Import.Module);
                        Asn1Node[]   Nodes            = ImportedDocument.Root?.Body?.Items;

                        if (!(Nodes is null))
                        {
                            foreach (Asn1Node Node in Nodes)
                            {
                                if (Node is Asn1TypeDefinition TypeDef &&
                                    !TypeDef.ConstructedType &&
                                    Array.IndexOf <string>(Import.Identifiers, TypeDef.Name) >= 0)
                                {
                                    TypeDef.ExportCSharp(Output, State, Indent, CSharpExportPass.Preprocess);
                                }
                            }
                        }
                    }
                }

                this.body.ExportCSharp(Output, State, Indent, CSharpExportPass.Preprocess);
                State.ClosePending(Output);

                this.body.ExportCSharp(Output, State, Indent, CSharpExportPass.Variables);
                State.ClosePending(Output);

                this.body.ExportCSharp(Output, State, Indent, CSharpExportPass.Explicit);
                State.ClosePending(Output);

                Indent--;
                Output.Append(Tabs(Indent));
                Output.AppendLine("}");
            }