Ejemplo n.º 1
0
        public static void Write(this RunObjectLinkProperty property, bool isLastProperty, PropertiesStyle style, CSideWriter writer)
        {
            writer.Write("{0}=", property.Name);
            writer.Indent(writer.Column);

            foreach (var line in property.Value)
            {
                var isLastLine = (line == property.Value.Last());

                switch (isLastProperty && isLastLine)
                {
                case true:
                    writer.Write("{0}={1}({2}) ", line.FieldName, line.Type.GetValueOrDefault().AsString(), line.Value);
                    break;

                case false:
                    writer.Write("{0}={1}({2})", line.FieldName, line.Type.GetValueOrDefault().AsString(), line.Value);
                    writer.WriteLineIf(isLastLine, ";");
                    writer.WriteLineIf(!isLastLine, ",");
                    break;
                }
            }

            writer.Unindent();
        }
Ejemplo n.º 2
0
 public static void Write(this ObjectProperties objectProperties, CSideWriter writer)
 {
     writer.BeginSection("OBJECT-PROPERTIES");
     writer.WriteLineIf(objectProperties.DateTime.HasValue, "Date={0};", objectProperties.DateTime.ToShortDateString());
     writer.WriteLineIf(objectProperties.DateTime.HasValue, "Time={0};", objectProperties.DateTime.ToShortTimeString());
     writer.WriteLineIf(objectProperties.Modified, "Modified=Yes;");
     writer.WriteLineIf(objectProperties.VersionList != null, "Version List={0};", objectProperties.VersionList);
     writer.EndSection();
 }
Ejemplo n.º 3
0
        public static void Write(this ObjectProperties objectProperties, CSideWriter writer)
        {
            writer.BeginSection("OBJECT-PROPERTIES");
            var dateFieldName        = writer.CodeStyle.CustomPropertyMappings.GetDisplayName("Date");
            var timeFieldName        = writer.CodeStyle.CustomPropertyMappings.GetDisplayName("Time");
            var modifiedFieldName    = writer.CodeStyle.CustomPropertyMappings.GetDisplayName("Modified");
            var versionListFieldName = writer.CodeStyle.CustomPropertyMappings.GetDisplayName("Version List");

            writer.WriteLineIf(objectProperties.DateTime.HasValue, "{1}={0};", objectProperties.HasDateComponent? objectProperties.DateTime.ToShortDateString(writer.CodeStyle.Localization) : "", dateFieldName);
            writer.WriteLineIf(objectProperties.DateTime.HasValue, "{1}={0};", objectProperties.HasTimeComponent? objectProperties.DateTime.ToShortTimeString(writer.CodeStyle.Localization, writer.CodeStyle.UseEnclosedTimeFormat) : "", timeFieldName);
            writer.WriteLineIf(objectProperties.Modified, "{1}={0};", writer.CodeStyle.Localization.ConvertBoolToString(true), modifiedFieldName);
            writer.WriteLineIf(objectProperties.VersionList != null, "{1}={0};", objectProperties.VersionList, versionListFieldName);
            writer.EndSection();
        }
Ejemplo n.º 4
0
        public static void Write(this TableViewProperty property, bool isLastProperty, PropertiesStyle style, CSideWriter writer)
        {
            var requiresSquareBrackets = property.Value.TableFilter.Any(f => f.Value.Any(c => "{}".Contains(c)));
            var openingBracket         = requiresSquareBrackets ? "[" : "";
            var closingBracket         = requiresSquareBrackets ? "]" : "";

            var components = new List <string>();

            if (!string.IsNullOrEmpty(property.Value.Key))
            {
                components.Add(string.Format("SORTING({0})", property.Value.Key));
            }

            if (property.Value.Order.HasValue)
            {
                components.Add(string.Format("ORDER({0})", property.Value.Order));
            }

            if (property.Value.TableFilter.Any())
            {
                components.AddRange(property.Value.TableFilter.AsStrings());
            }

            writer.Write("{0}={1}", property.Name, openingBracket);
            writer.Indent(writer.Column);

            foreach (var component in components)
            {
                var isLastComponent = (component == components.Last());

                switch (isLastProperty && isLastComponent)
                {
                case true:
                    writer.Write("{0}{1} ", component, closingBracket);
                    break;

                case false:
                    writer.Write(component);
                    writer.WriteLineIf(isLastComponent, $"{closingBracket};");
                    writer.WriteLineIf(!isLastComponent, string.Empty);
                    break;
                }
            }

            writer.Unindent();
        }
        public static void Write(this Function function, CSideWriter writer)
        {
            writer.InnerWriter.WriteLine();
#if NAV2016
            WriteSubscriberAttributes(function, writer);
            writer.WriteLineIf(function.TryFunction.GetValueOrDefault(false), "[TryFunction]");
            WritePublisherAttributes(function, writer);
#endif
#if NAV2018
            writer.WriteLineIf(
                function.FunctionVisibility.GetValueOrDefault(Common.FunctionVisibility.Internal) == Common.FunctionVisibility.External &&
                function.ServiceEnabled.GetValueOrDefault(false),
                "[ServiceEnabled]");
#endif
#if NAV2019 || NAVBC
            writer.WriteLineIf(function.NormalFunctionType.HasValue, "[{0}]", function.NormalFunctionType);
#endif
#if NAV2015
            writer.WriteLineIf(function.UpgradeFunctionType.HasValue, "[{0}]", function.UpgradeFunctionType);
#endif
            writer.WriteLineIf(function.TestFunctionType.HasValue, "[{0}]", function.TestFunctionType);
            writer.WriteLineIf(function.HandlerFunctions != null, "[HandlerFunctions({0})]", function.HandlerFunctions);
            writer.WriteLineIf(function.TransactionModel.HasValue, "[TransactionModel({0})]", function.TransactionModel);
#if NAV2017
            writer.WriteLineIf(function.TestPermissions.HasValue, "[TestPermissions({0})]", function.TestPermissions);
#endif
#if NAV2018
            writer.WriteLineIf(function.FunctionVisibility.HasValue, "[{0}]", function.FunctionVisibility);
#endif
#if NAVBC
            writer.WriteLineIf(function.LineStart.HasValue, "[LineStart({0})]", GetLineStartForWrite(function, writer));
#endif
            writer.Write("{2}PROCEDURE {0}@{1}(", function.Name, function.ID, function.Local ? "LOCAL " : "");
            function.Parameters.Write(writer);
            writer.Write(")");
            function.ReturnValue.Write(writer);
            writer.WriteLine(";");
            function.Variables.Write(writer);
            writer.WriteLine("BEGIN");
            writer.Indent();
            function.CodeLines.Write(writer);
            writer.Unindent();
            writer.WriteLine("END;");
        }
        public static void Write(this Function function, CSideWriter writer)
        {
            writer.InnerWriter.WriteLine();
#if NAV2016
            writer.WriteLineIf(function.TryFunction.GetValueOrDefault(false), "[TryFunction]");
            WriteEventingAttributes(function, writer);
#endif
#if NAV2015
            writer.WriteLineIf(function.UpgradeFunctionType.HasValue, "[{0}]", function.UpgradeFunctionType);
#endif
            writer.WriteLineIf(function.TestFunctionType.HasValue, "[{0}]", function.TestFunctionType);
            writer.WriteLineIf(function.HandlerFunctions != null, "[HandlerFunctions({0})]", function.HandlerFunctions);
            writer.WriteLineIf(function.TransactionModel.HasValue, "[TransactionModel({0})]", function.TransactionModel);
#if NAV2017
            writer.WriteLineIf(function.TestPermissions.HasValue, "[TestPermissions({0})]", function.TestPermissions);
#endif

            writer.Write("{2}PROCEDURE {0}@{1}(", function.Name, function.ID, function.Local ? "LOCAL " : "");
            function.Parameters.Write(writer);
            writer.Write(")");
            function.ReturnValue.Write(writer);
            writer.WriteLine(";");
            function.Variables.Write(writer);
            writer.WriteLine("BEGIN");
            writer.Indent();
            function.CodeLines.Write(writer);
            writer.Unindent();
            writer.WriteLine("END;");
        }
Ejemplo n.º 7
0
        public static void Write(this MultiLanguageProperty property, bool isLastProperty, PropertiesStyle style, CSideWriter writer)
        {
            var requiresBrackets = (
                property.Value.Count() > 1 ||
                property.Value.Any(e => e.Value.Contains('{') ||
                                   property.Value.Any(f => f.Value.Contains(';'))));

            writer.Write("{0}=", property.Name);
            if (requiresBrackets)
            {
                writer.Write("[");
            }
            writer.Indent(writer.Column);

            var multiLanguageEntries = property.Value.OrderBy(e => e.LanguageID.GetLCIDFromLanguageCode());

            foreach (var multiLanguageEntry in multiLanguageEntries)
            {
                writer.Write("{0}={1}", multiLanguageEntry.LanguageID, multiLanguageEntry.QuotedValue);
                writer.WriteLineIf(multiLanguageEntry != multiLanguageEntries.Last(), ";");
            }

            writer.Unindent();
            if (requiresBrackets)
            {
                writer.Write("]");
            }

            switch (style)
            {
            case PropertiesStyle.Object:
                writer.WriteLine(";");
                break;

            case PropertiesStyle.Field:
                if (!isLastProperty)
                {
                    writer.WriteLine(";");
                }
                else
                {
                    writer.Write(" ");
                }
                break;
            }
        }
Ejemplo n.º 8
0
        public static void WriteDeclaration(Guid id, string name, int?indentation, string nodeType, string sourceType, bool anyRelevantProperties, CSideWriter writer)
        {
            var debt = 0;

            var nodeID          = BuildNodePart(id.ToString("B").ToUpper(), 38, ref debt);
            var nodeIndentation = BuildNodePart(indentation.AsString(), 2, ref debt);
            var nodeName        = BuildNodePart(name, 20, ref debt);
            var nodeTypeText    = BuildNodePart(nodeType, 8, ref debt);
            var sourceTypeText  = BuildNodePart(sourceType, 8, ref debt);

            var declaration1 = string.Format("{{ [{0}];{1};", nodeID, nodeIndentation);
            var declaration2 = string.Format("{0};{1};{2}", nodeName, nodeTypeText, sourceTypeText);

            writer.Write(declaration1);
            writer.Indent(writer.Column);
            writer.Write(declaration2);
            writer.WriteLineIf(anyRelevantProperties, ";");
            writer.WriteIf(!anyRelevantProperties, " ");
        }
Ejemplo n.º 9
0
        public static void Write(this XmlPortNamespacesProperty property, bool isLastProperty, PropertiesStyle style, CSideWriter writer)
        {
            var requiresBrackets = (property.Value.Count() > 1); // ?

            writer.Write("{0}=", property.Name);
            if (requiresBrackets)
            {
                writer.Write("[");
            }

            writer.Indent(writer.Column - 1);

            foreach (var xmlPortNamespace in property.Value)
            {
                writer.Write("{0}={1}", xmlPortNamespace.Prefix, xmlPortNamespace.Namespace);
                writer.WriteLineIf(xmlPortNamespace != property.Value.Last(), ";");
            }

            writer.Unindent();
            if (requiresBrackets)
            {
                writer.Write("]");
            }

            switch (style)
            {
            case PropertiesStyle.Object:
                writer.WriteLine(";");
                break;

            case PropertiesStyle.Field:
                if (!isLastProperty)
                {
                    writer.WriteLine(";");
                }
                else
                {
                    writer.Write(" ");
                }
                break;
            }
        }
Ejemplo n.º 10
0
 public static void Write(this MenuItemRunObjectTypeProperty property, bool isLastProperty, PropertiesStyle style, CSideWriter writer)
 {
     writer.Write("{0}={1}", property.Name, FormatMenuItemRunObjectType(property.Value.Value));
     writer.WriteIf(isLastProperty, " ");
     writer.WriteLineIf(!isLastProperty, ";");
 }