Пример #1
0
        protected override IEnumerable <Query> CreateItems()
        {
            var query = new Query(ID, Name);

            SetObjectProperties(query);

            query.Properties.Description = Description;
            query.Properties.Permissions.Set(Permissions);
            query.Properties.ReadState       = ReadState;
            query.Properties.TopNumberOfRows = TopNumberOfRows;
            query.Properties.CaptionML.Set(CaptionML);
            query.Properties.OnBeforeOpen.Set(OnBeforeOpen);

            if (AutoCaption)
            {
                query.AutoCaption();
            }

            if (SubObjects != null)
            {
                var subObjects = SubObjects.Invoke().Select(o => o.BaseObject);
                query.Code.Documentation.CodeLines.AddRange(subObjects.OfType <string>());
                query.Properties.OrderBy.AddRange(subObjects.OfType <QueryOrderByLine>());
                query.Elements.AddRange(subObjects.OfType <QueryElement>());
                query.Code.Functions.AddRange(subObjects.OfType <Function>());
                query.Code.Variables.AddRange(subObjects.OfType <Variable>());
                query.Code.Events.AddRange(subObjects.OfType <Event>());
            }

            yield return(query);
        }
Пример #2
0
        protected override IEnumerable <Function> CreateItems()
        {
            var function = new Function(ID, Name);

            function.Local = Local;
#if NAV2016
            function.TryFunction = NullableBooleanFromSwitch(nameof(TryFunction));
#endif
            function.ReturnValue.Name       = ReturnValueName;
            function.ReturnValue.Type       = ReturnValueType;
            function.ReturnValue.DataLength = ReturnValueDataLength ?? function.ReturnValue.DefaultDataLength;
            function.ReturnValue.Dimensions = ReturnValueDimensions;


            if (SubObjects != null)
            {
                var subObjects = SubObjects
                                 .Invoke()
                                 .Select(o => o.BaseObject);

                function.Variables.AddRange(subObjects.OfType <Variable>());
                function.Parameters.AddRange(subObjects.OfType <Parameter>());
                function.CodeLines.AddRange(subObjects.OfType <string>());
            }

            yield return(function);
        }
Пример #3
0
        protected override IEnumerable <Function> CreateItems()
        {
            var function = new Function(ID, Name);

            function.Local = Local;
#if NAV2018
            function.FunctionVisibility = FunctionVisibility;
            function.ServiceEnabled     = NullableBooleanFromSwitch(nameof(ServiceEnabled));
#endif

#if NAV2016
            function.TryFunction = NullableBooleanFromSwitch(nameof(TryFunction));
#endif
            function.ReturnValue.Name       = ReturnValueName;
            function.ReturnValue.Type       = ReturnValueType;
            function.ReturnValue.DataLength = ReturnValueDataLength ?? function.ReturnValue.DefaultDataLength;
            function.ReturnValue.Dimensions = ReturnValueDimensions;

            function.Event         = EventPublisherSubscriber.Publisher;
            function.EventType     = EventType.Business;
            function.IncludeSender = NullableBooleanFromSwitch(nameof(IncludeSender));

            if (SubObjects != null)
            {
                var subObjects = SubObjects
                                 .Invoke()
                                 .Select(o => o.BaseObject);

                function.Variables.AddRange(subObjects.OfType <Variable>());
                function.Parameters.AddRange(subObjects.OfType <Parameter>());
                function.CodeLines.AddRange(subObjects.OfType <string>());
            }

            yield return(function);
        }
Пример #4
0
        protected override IEnumerable <Function> CreateItems()
        {
            var function = new Function(ID, Name);

            function.Local = Local;
#if NAV2016
            function.TryFunction = NullableBooleanFromSwitch(nameof(TryFunction));
#endif
            function.ReturnValue.Name       = ReturnValueName;
            function.ReturnValue.Type       = ReturnValueType;
            function.ReturnValue.DataLength = ReturnValueDataLength ?? function.ReturnValue.DefaultDataLength;
            function.ReturnValue.Dimensions = ReturnValueDimensions;

            function.Event = EventPublisherSubscriber.Subscriber;
            function.EventPublisherObject.Type = EventPublisherObjectType;
            function.EventPublisherObject.ID   = EventPublisherObjectID;
            function.EventPublisherElement     = EventPublisherElement;
            function.EventFunction             = EventFunction;
            function.OnMissingLicense          = OnMissingLicense;
            function.OnMissingPermission       = OnMissingPermission;

            if (SubObjects != null)
            {
                var subObjects = SubObjects
                                 .Invoke()
                                 .Select(o => o.BaseObject);

                function.Variables.AddRange(subObjects.OfType <Variable>());
                function.Parameters.AddRange(subObjects.OfType <Parameter>());
                function.CodeLines.AddRange(subObjects.OfType <string>());
            }

            yield return(function);
        }
Пример #5
0
        protected override IEnumerable <PageControlBase> CreateItems()
        {
            var partPageControl = new PageControlPart(ID, GetIndentation());

#if NAV2015
            partPageControl.Properties.AccessByPermission.Set(AccessByPermission);
#endif
#if NAV2017
            partPageControl.Properties.ApplicationArea.Set(ApplicationArea);
#endif
            partPageControl.Properties.CaptionML.Set(CaptionML);
            partPageControl.Properties.Description = Description;
            partPageControl.Properties.Editable    = Editable;
            partPageControl.Properties.Enabled     = Enabled;
#if NAV2018
            partPageControl.Properties.EntityName    = EntityName;
            partPageControl.Properties.EntitySetName = EntitySetName;
#endif
            partPageControl.Properties.Name     = Name;
            partPageControl.Properties.PartType = PartType;

            if (ChartPartID != null)
            {
                partPageControl.Properties.PartType    = PageControlPartType.Chart;
                partPageControl.Properties.ChartPartID = ChartPartID;
            }
            else if (PagePartID != null)
            {
                // If PartType has been assigned a value explicitly, overwrite that value with
                // "Page". If previously, PartType was null, leave the value as is.
                if (partPageControl.Properties.PartType.HasValue)
                {
                    partPageControl.Properties.PartType = PageControlPartType.Page;
                }
                partPageControl.Properties.PagePartID = PagePartID;
            }
            else if (SystemPartID != null)
            {
                partPageControl.Properties.PartType     = PageControlPartType.System;
                partPageControl.Properties.SystemPartID = SystemPartID;
            }

            partPageControl.Properties.ProviderID        = ProviderID;
            partPageControl.Properties.ShowFilter        = NullableBooleanFromSwitch(nameof(ShowFilter));
            partPageControl.Properties.SubPageView.Key   = SubPageViewKey;
            partPageControl.Properties.SubPageView.Order = SubPageViewOrder;
            partPageControl.Properties.ToolTipML.Set(ToolTipML);
#if NAV2015
            partPageControl.Properties.UpdatePropagation = UpdatePropagation;
#endif
            partPageControl.Properties.Visible = Visible;
            partPageControl.AutoCaption(AutoCaption);

            var subObjects = SubObjects?.Invoke().Select(o => o.BaseObject) ?? Enumerable.Empty <object>();
            partPageControl.Properties.SubPageLink.AddRange(subObjects.OfType <RunObjectLinkLine>());
            partPageControl.Properties.SubPageView.TableFilter.AddRange(subObjects.OfType <TableFilterLine>());

            yield return(partPageControl);
        }
Пример #6
0
        protected override IEnumerable <Table> CreateItems()
        {
            var table = new Table(ID, Name);

            SetObjectProperties(table);

            table.Properties.CaptionML.Set(CaptionML);
            table.Properties.DataCaptionFields.AddRange(DataCaptionFields ?? new string[] { });
#if NAV2018
            table.Properties.DataClassification = DataClassification;
#endif
            table.Properties.DataPerCompany  = NullableBooleanFromSwitch(nameof(DataPerCompany));
            table.Properties.Description     = Description;
            table.Properties.DrillDownPageID = DrillDownPageID;
#if NAV2016
            table.Properties.ExternalName   = ExternalName;
            table.Properties.ExternalSchema = ExternalSchema;
#endif
            table.Properties.LinkedInTransaction = NullableBooleanFromSwitch(nameof(LinkedInTransaction));
            table.Properties.LinkedObject        = NullableBooleanFromSwitch(nameof(LinkedObject));
            table.Properties.LookupPageID        = LookupPageID;
#if NAV2018
            table.Properties.ObsoleteState  = ObsoleteState;
            table.Properties.ObsoleteReason = ObsoleteReason;
#endif
            table.Properties.OnInsert.Set(OnInsert);
            table.Properties.OnModify.Set(OnModify);
            table.Properties.OnDelete.Set(OnDelete);
            table.Properties.OnRename.Set(OnRename);
            table.Properties.PasteIsValid = NullableBooleanFromSwitch(nameof(PasteIsValid));
            table.Properties.Permissions.Set(Permissions);
#if NAVBC
            table.Properties.ReplicateData = NullableBooleanFromSwitch(nameof(ReplicateData));
#endif
#if NAV2016
            table.Properties.TableType = TableType;
#endif

            if (AutoCaption)
            {
                table.AutoCaption();
            }

            if (SubObjects != null)
            {
                var subObjects = SubObjects.Invoke().Select(o => o.BaseObject);
                table.Code.Documentation.CodeLines.AddRange(subObjects.OfType <string>());
                table.Fields.AddRange(subObjects.OfType <TableField>());
                table.FieldGroups.AddRange(subObjects.OfType <TableFieldGroup>());
                table.Keys.AddRange(subObjects.OfType <TableKey>());
                table.Code.Functions.AddRange(subObjects.OfType <Function>());
                table.Code.Variables.AddRange(subObjects.OfType <Variable>());
                table.Code.Events.AddRange(subObjects.OfType <Event>());
            }

            yield return(table);
        }
Пример #7
0
        protected override IEnumerable <Report> CreateItems()
        {
            var report = new Report(ID, Name);

            SetObjectProperties(report);

            report.Properties.CaptionML.Set(CaptionML);
#if NAV2015
            report.Properties.DefaultLayout = DefaultLayout;
#endif
            report.Properties.Description = Description;
            report.Properties.EnableExternalAssemblies = NullableBooleanFromSwitch(nameof(EnableExternalAssemblies));
            report.Properties.EnableExternalImages     = NullableBooleanFromSwitch(nameof(EnableExternalImages));
            report.Properties.EnableHyperlinks         = NullableBooleanFromSwitch(nameof(EnableHyperlinks));
            report.Properties.OnInitReport.Set(OnInitReport);
            report.Properties.OnPreReport.Set(OnPreReport);
            report.Properties.OnPostReport.Set(OnPostReport);
            report.Properties.PaperSourceDefaultPage = PaperSourceDefaultPage;
            report.Properties.PaperSourceFirstPage   = PaperSourceFirstPage;
            report.Properties.PaperSourceLastPage    = PaperSourceLastPage;
            report.Properties.Permissions.Set(Permissions);
#if NAV2015
            report.Properties.PreviewMode = PreviewMode;
#endif
            report.Properties.ProcessingOnly   = NullableBooleanFromSwitch(nameof(ProcessingOnly));
            report.Properties.ShowPrintStatus  = NullableBooleanFromSwitch(nameof(ShowPrintStatus));
            report.Properties.TransactionType  = TransactionType;
            report.Properties.UseRequestPage   = NullableBooleanFromSwitch(nameof(UseRequestPage));
            report.Properties.UseSystemPrinter = NullableBooleanFromSwitch(nameof(UseSystemPrinter));
#if NAV2015
            report.Properties.WordMergeDataItem = WordMergeDataItem;
#endif

            report.RdlData.CodeLines.Set(RdlData?.BaseObject);
#if NAV2015
            report.WordLayout.CodeLines.Set(WordLayout?.BaseObject);
#endif

            ProcessRequestPage(report);

            if (AutoCaption)
            {
                report.AutoCaption();
            }

            var subObjects = SubObjects?.Invoke().Select(o => o.BaseObject) ?? Enumerable.Empty <object>();
            report.Code.Documentation.CodeLines.AddRange(subObjects.OfType <string>());
            report.Labels.AddRange(subObjects.OfType <ReportLabel>());
            report.Elements.AddRange(subObjects.OfType <ReportElement>());
            report.Code.Functions.AddRange(subObjects.OfType <Function>());
            report.Code.Variables.AddRange(subObjects.OfType <Variable>());
            report.Code.Events.AddRange(subObjects.OfType <Event>());

            yield return(report);
        }
        protected override IEnumerable <XmlPort> CreateItems()
        {
            var xmlPort = new XmlPort(ID, Name);

            SetObjectProperties(xmlPort);

            xmlPort.Properties.CaptionML.Set(CaptionML);
            xmlPort.Properties.DefaultFieldsValidation = NullableBooleanFromSwitch(nameof(DefaultFieldsValidation));
            xmlPort.Properties.DefaultNamespace        = DefaultNamespace;
            xmlPort.Properties.Direction      = Direction;
            xmlPort.Properties.Encoding       = Encoding;
            xmlPort.Properties.FieldDelimiter = FieldDelimiter;
            xmlPort.Properties.FieldSeparator = FieldSeparator;
            xmlPort.Properties.FileName       = FileName;
            xmlPort.Properties.Format         = Format;
            xmlPort.Properties.FormatEvaluate = FormatEvaluate;
            xmlPort.Properties.InlineSchema   = NullableBooleanFromSwitch(nameof(InlineSchema));
#if NAV2016
            xmlPort.Properties.Namespaces.Set(Namespaces);
#endif
            xmlPort.Properties.OnInitXMLport.Set(OnInitXmlPort);
            xmlPort.Properties.OnPreXMLport.Set(OnPreXmlPort);
            xmlPort.Properties.OnPostXMLport.Set(OnPostXmlPort);
            xmlPort.Properties.Permissions.Set(Permissions);
            xmlPort.Properties.PreserveWhiteSpace  = NullableBooleanFromSwitch(nameof(PreserveWhitespace));
            xmlPort.Properties.RecordSeparator     = RecordSeparator;
            xmlPort.Properties.TableSeparator      = TableSeparator;
            xmlPort.Properties.TextEncoding        = TextEncoding;
            xmlPort.Properties.TransactionType     = TransactionType;
            xmlPort.Properties.UseDefaultNamespace = NullableBooleanFromSwitch(nameof(UseDefaultNamespace));
            xmlPort.Properties.UseLax         = NullableBooleanFromSwitch(nameof(UseLax));
            xmlPort.Properties.UseRequestPage = NullableBooleanFromSwitch(nameof(UseRequestPage));
            xmlPort.Properties.XmlVersionNo   = XmlVersionNo;

            ProcessRequestPage(xmlPort);

            if (AutoCaption)
            {
                xmlPort.AutoCaption();
            }

            if (SubObjects != null)
            {
                var subObjects = SubObjects.Invoke().Select(o => o.BaseObject);
                xmlPort.Code.Documentation.CodeLines.AddRange(subObjects.OfType <string>());
                xmlPort.Nodes.AddRange(subObjects.OfType <XmlPortNode>());
                xmlPort.Code.Functions.AddRange(subObjects.OfType <Function>());
                xmlPort.Code.Variables.AddRange(subObjects.OfType <Variable>());
                xmlPort.Code.Events.AddRange(subObjects.OfType <Event>());
            }

            yield return(xmlPort);
        }
Пример #9
0
        protected override IEnumerable <MenuSuite> CreateItems()
        {
            var menusuite = new MenuSuite(ID, Name);

            SetObjectProperties(menusuite);

            menusuite
            .Nodes
            .AddRange(
                SubObjects?
                .Invoke()
                .Select(o => o.BaseObject)
                .Cast <MenuSuiteNode>() ?? Enumerable.Empty <MenuSuiteNode>()
                );

            yield return(menusuite);
        }
        protected override IEnumerable <TableRelationLine> CreateItems()
        {
            var result = new TableRelationLine(TableName)
            {
                FieldName = FieldName
            };

            var subObjects =
                SubObjects?
                .Invoke()
                .Select(o => o.BaseObject)
                ?? Enumerable.Empty <object>();

            result.Conditions.AddRange(subObjects.OfType <TableRelationCondition>());
            result.TableFilter.AddRange(subObjects.OfType <TableRelationTableFilterLine>());

            yield return(result);
        }
        protected override IEnumerable <Codeunit> CreateItems()
        {
            var codeunit = new Codeunit(ID, Name);

            SetObjectProperties(codeunit);

#if !NAV2016
            codeunit.Properties.CFRONTMayUsePermissions = NullableBooleanFromSwitch(nameof(CFrontMayUsePermissions));
#endif
#if NAV2016
            codeunit.Properties.EventSubscriberInstance = EventSubscriberInstance;
#endif
            codeunit.Properties.Permissions.Set(Permissions);
            codeunit.Properties.SingleInstance = NullableBooleanFromSwitch(nameof(SingleInstance));
            codeunit.Properties.Subtype        = SubType;
            codeunit.Properties.TableNo        = TableNo;
            codeunit.Properties.TestIsolation  = TestIsolation;
#if NAV2017
            codeunit.Properties.TestPermissions = TestPermissions;
#endif

            if (OnRun != null)
            {
                var subObjects = OnRun.Invoke().Select(o => o.BaseObject);
                codeunit.Properties.OnRun.CodeLines.AddRange(subObjects.OfType <string>());
                codeunit.Properties.OnRun.Variables.AddRange(subObjects.OfType <Variable>());
            }

            if (SubObjects != null)
            {
                var subObjects = SubObjects.Invoke().Select(o => o.BaseObject);
                codeunit.Code.Documentation.CodeLines.AddRange(subObjects.OfType <string>());
                codeunit.Code.Functions.AddRange(subObjects.OfType <Function>());
                codeunit.Code.Variables.AddRange(subObjects.OfType <Variable>());
                codeunit.Code.Events.AddRange(subObjects.OfType <Event>());
            }

            yield return(codeunit);
        }
Пример #12
0
        protected override IEnumerable <Function> CreateItems()
        {
            var function = new Function(ID, Name);

            function.Local = Local;
#if NAV2018
            function.FunctionVisibility = FunctionVisibility;
            function.ServiceEnabled     = NullableBooleanFromSwitch(nameof(ServiceEnabled));
#endif

#if NAV2016
            function.TryFunction = NullableBooleanFromSwitch(nameof(TryFunction));
#endif
            function.ReturnValue.Name       = ReturnValueName;
            function.ReturnValue.Type       = ReturnValueType;
            function.ReturnValue.DataLength = ReturnValueDataLength ?? function.ReturnValue.DefaultDataLength;
            function.ReturnValue.Dimensions = ReturnValueDimensions;

            function.HandlerFunctions = HandlerFunctions;
            function.TestFunctionType = TestFunctionType;
            function.TransactionModel = TransactionModel;
#if NAV2017
            function.TestPermissions = TestPermissions;
#endif

            if (SubObjects != null)
            {
                var subObjects = SubObjects
                                 .Invoke()
                                 .Select(o => o.BaseObject);

                function.Variables.AddRange(subObjects.OfType <Variable>());
                function.Parameters.AddRange(subObjects.OfType <Parameter>());
                function.CodeLines.AddRange(subObjects.OfType <string>());
            }

            yield return(function);
        }
Пример #13
0
        protected override IEnumerable <Page> CreateItems()
        {
            var page = new Page(ID, Name);

            SetObjectProperties(page);

            page.Properties.AutoSplitKey = NullableBooleanFromSwitch(nameof(AutoSplitKey));
            page.Properties.CaptionML.Set(CaptionML);
            page.Properties.CardPageID      = CardPageID;
            page.Properties.DataCaptionExpr = DataCaptionExpr;
            page.Properties.DataCaptionFields.AddRange(DataCaptionFields ?? new string[] { });
            page.Properties.DelayedInsert = NullableBooleanFromSwitch(nameof(DelayedInsert));
            page.Properties.DeleteAllowed = NullableBooleanFromSwitch(nameof(DeleteAllowed));
            page.Properties.Description   = Description;
            page.Properties.Editable      = NullableBooleanFromSwitch(nameof(Editable));
            page.Properties.InsertAllowed = NullableBooleanFromSwitch(nameof(InsertAllowed));
            page.Properties.InstructionalTextML.Set(InstructionalTextML);
            page.Properties.LinksAllowed     = NullableBooleanFromSwitch(nameof(LinksAllowed));
            page.Properties.ModifyAllowed    = NullableBooleanFromSwitch(nameof(ModifyAllowed));
            page.Properties.MultipleNewLines = NullableBooleanFromSwitch(nameof(MultipleNewLines));
            page.Properties.OnAfterGetCurrRecord.Set(OnAfterGetCurrRecord);
            page.Properties.OnAfterGetRecord.Set(OnAfterGetRecord);
            page.Properties.OnClosePage.Set(OnClosePage);
            page.Properties.OnDeleteRecord.Set(OnDeleteRecord);
            page.Properties.OnFindRecord.Set(OnFindRecord);
            page.Properties.OnInit.Set(OnInit);
            page.Properties.OnInsertRecord.Set(OnInsertRecord);
            page.Properties.OnModifyRecord.Set(OnModifyRecord);
            page.Properties.OnNewRecord.Set(OnNewRecord);
            page.Properties.OnNextRecord.Set(OnNextRecord);
            page.Properties.OnOpenPage.Set(OnOpenPage);
            page.Properties.OnQueryClosePage.Set(OnQueryClosePage);
            page.Properties.PageType = PageType;
            page.Properties.Permissions.Set(Permissions);
            page.Properties.PopulateAllFields = NullableBooleanFromSwitch(nameof(PopulateAllFields));
            page.Properties.PromotedActionCategoriesML.Set(PromotedActionCategoriesML);
            page.Properties.RefreshOnActivate     = NullableBooleanFromSwitch(nameof(RefreshOnActivate));
            page.Properties.SaveValues            = NullableBooleanFromSwitch(nameof(SaveValues));
            page.Properties.ShowFilter            = NullableBooleanFromSwitch(nameof(ShowFilter));
            page.Properties.SourceTable           = SourceTable;
            page.Properties.SourceTableTemporary  = NullableBooleanFromSwitch(nameof(SourceTableTemporary));
            page.Properties.SourceTableView.Key   = SourceTableViewKey;
            page.Properties.SourceTableView.Order = SourceTableViewOrder;

            if (AutoCaption)
            {
                page.AutoCaption();
            }

            if (SubObjects != null)
            {
                var subObjects = SubObjects.Invoke().Select(o => o.BaseObject);
                page.Controls.AddRange(subObjects.OfType <PageControlBase>());
                page.Properties.ActionList.AddRange(subObjects.OfType <PageActionBase>());
                page.Properties.SourceTableView.TableFilter.AddRange(subObjects.OfType <TableFilterLine>());
                page.Code.Documentation.CodeLines.AddRange(subObjects.OfType <string>());
                page.Code.Functions.AddRange(subObjects.OfType <Function>());
                page.Code.Variables.AddRange(subObjects.OfType <Variable>());
                page.Code.Events.AddRange(subObjects.OfType <Event>());
            }

            yield return(page);
        }