Exemplo n.º 1
0
        public static void Write(this FormMenuButtonControl menuItem, CSideWriter writer, int propertyIndentation)
        {
            var debt             = 0;
            var fieldFormControl = menuItem as FormControl;
            var controlID        = BuildControlPart(fieldFormControl.ID.ToString(), 4, ref debt);
            var controlType      = BuildControlPart(fieldFormControl.Type.ToString(), 13, ref debt);
            var controlXPos      = BuildControlPart(fieldFormControl.PosX.ToString(), 5, ref debt);
            var controlYPos      = BuildControlPart(fieldFormControl.PosY.ToString(), 5, ref debt);
            var controlWidth     = BuildControlPart(fieldFormControl.Width.ToString(), 5, ref debt);
            var controlHeight    = BuildControlPart(fieldFormControl.Height.ToString(), 5, ref debt);

            var relevantProperties = fieldFormControl.Properties.Where(p => p.HasValue);
            var declaration        = string.Format("{{ {0};{1};{2};{3};{4};{5}", controlID, controlType, controlXPos, controlYPos, controlWidth, controlHeight);

            writer.Write(declaration);
            writer.Write(relevantProperties.Any() ? ";" : " ");

            if ((writer.Column > propertyIndentation) && (relevantProperties.Any()))
            {
                writer.Indent(propertyIndentation);
                writer.WriteLine("");
            }
            else
            {
                writer.Indent(writer.Column);
            }

            relevantProperties.Write(PropertiesStyle.Field, writer);

            //var lastProperty = relevantProperties.LastOrDefault();
            //if (lastProperty != null)
            //    if (lastProperty is TriggerProperty)
            //        writer.Write(new string(' ', lastProperty.Name.Length + 2));
            if (menuItem.MenuItems.Any())
            {
                writer.Write("Menu=MENUITEMS");
                writer.Write("{");
                writer.Write("}");
            }
            writer.WriteLine("}");
            writer.Unindent();

            /*
             * var debt = 0;
             * var controlID = BuildControlPart(containerPageControl.ID.ToString(), 4, ref debt);
             * var controlIndentation = BuildControlPart(containerPageControl.IndentationLevel.AsString(), 4, ref debt);
             * var controlType = BuildControlPart("Container", 10, ref debt);
             * var declaration = string.Format("{{ {0};{1};{2};", controlID, controlIndentation, controlType);
             *
             * writer.WriteLine(declaration);
             *
             * writer.Indent(propertyIndentation);
             * containerPageControl.Properties.Write(PropertiesStyle.Field, writer);
             * writer.WriteLine("}");
             * writer.Unindent();
             * writer.InnerWriter.WriteLine();*/
        }
        public static void Write(this PageAction action, CSideWriter writer)
        {
            var idLength         = Math.Max(action.ID.ToString().Length, 8);
            var id               = action.ID.ToString().PadRight(idLength);
            var idAndIndentation = string.Format("{0};{1}", id, action.IndentationLevel.ToString());

            writer.Write("{{ {0};", idAndIndentation.PadRight(13));
            writer.Indent(writer.Column);
            writer.WriteLine("Action    ;");
            action.Properties.Write(PropertiesStyle.Field, writer);

            var relevantProperties = action.Properties.Where(p => p.HasValue);
            var lastProperty       = relevantProperties.LastOrDefault();

            if (lastProperty != null)
            {
                if (lastProperty is TriggerProperty)
                {
                    writer.Write(new string(' ', 10));
                }
            }

            writer.WriteLine("}");
            writer.Unindent();
        }
Exemplo n.º 3
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();
        }
Exemplo n.º 4
0
        public static void Write(this LinkFieldsProperty property, bool isLastProperty, PropertiesStyle style, CSideWriter writer)
        {
            writer.Write("{0}=", property.Name);
            writer.Indent(writer.Column);

            foreach (var linkField in property.Value)
            {
                writer.Write("Field{0}=FIELD(Field{1})", linkField.Field, linkField.ReferenceField);

                var isLastLine = (linkField == property.Value.Last());

                if (!isLastLine)
                {
                    writer.WriteLine(",");
                }
                else
                if (isLastProperty)
                {
                    writer.Write(" ");
                }
                else
                {
                    writer.WriteLine(";");
                }
            }

            writer.Unindent();
        }
        public static void Write(this MenuSuiteNode node, CSideWriter writer)
        {
            writer.Write("{ ");
            writer.Write(node.NodeTypeAsString());
            writer.Write(";");
            writer.Write("[{0}] ", node.ID.ToString("B").ToUpper());
            writer.Write(";");

            writer.Indent(writer.Column);

            IEnumerable <Property> properties = null;

            TypeSwitch.Do(
                node,
                TypeSwitch.Case <RootNode>(n => properties  = n.Properties),
                TypeSwitch.Case <MenuNode>(n => properties  = n.Properties),
                TypeSwitch.Case <GroupNode>(n => properties = n.Properties),
                TypeSwitch.Case <ItemNode>(n => properties  = n.Properties),
                TypeSwitch.Case <DeltaNode>(n => properties = n.Properties)
                );

            var relevantProperties = properties.Where(p => p.HasValue);

            relevantProperties.Write(PropertiesStyle.Field, writer);

            writer.Unindent();
            writer.WriteLine("}");
        }
Exemplo n.º 6
0
        public static void Write(this TableFieldGroup fieldGroup, CSideWriter writer)
        {
            var fields      = string.Join(",", fieldGroup.Fields);
            var fieldsWidth = Math.Max(fields.Length, 40);

            writer.Write("{ ");
            writer.Write(fieldGroup.ID.ToString().PadRight(4));
            writer.Write(";");
            writer.Write(fieldGroup.Name.PadRight(20));
            writer.Write(";");
            writer.Write(fields.PadRight(fieldsWidth));

            if (fieldGroup.Properties.Any(p => p.HasValue))
            {
                writer.Write(";");
                writer.Indent(writer.Column);
                fieldGroup.Properties.Write(PropertiesStyle.Field, writer);
                writer.Unindent();
            }
            else
            {
                writer.Write(" ");
            }

            writer.WriteLine("}");
        }
        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;");
        }
Exemplo n.º 8
0
        public static void Write(this CalcFormulaProperty 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 sign = property.Value.ReverseSign ? "-" : "";

            writer.Write($"{property.Name}={openingBracket}{sign}{property.Value.Method}(");

            switch (property.Value.Method.Value)
            {
            case CalcFormulaMethod.Exist:
            case CalcFormulaMethod.Count:
                writer.Write(property.Value.TableName.QuotedExcept('-', '/', '.'));
                break;

            case CalcFormulaMethod.Lookup:
            case CalcFormulaMethod.Average:
            case CalcFormulaMethod.Max:
            case CalcFormulaMethod.Min:
            case CalcFormulaMethod.Sum:
                writer.Write("{0}.{1}", property.Value.TableName.QuotedExcept('-', '/', '.'), property.Value.FieldName.QuotedExcept('-', '/', '.'));
                break;
            }

            if (property.Value.TableFilter.Any())
            {
                writer.Write(" WHERE (");
                writer.Indent(writer.Column);

                foreach (var tableFilterLine in property.Value.TableFilter)
                {
                    var value = tableFilterLine.Value;
                    if (tableFilterLine.ValueIsFilter)
                    {
                        value = string.Format("FILTER({0})", value);
                    }
                    if (tableFilterLine.OnlyMaxLimit)
                    {
                        value = string.Format("UPPERLIMIT({0})", value);
                    }

                    writer.Write("{0}={1}({2})", tableFilterLine.FieldName, tableFilterLine.Type.AsString(), value);
                    if (tableFilterLine != property.Value.TableFilter.Last())
                    {
                        writer.WriteLine(",");
                    }
                }
                writer.Write(")");
                writer.Unindent();
            }

            writer.Write(")");
            writer.Write(closingBracket);

            if (!isLastProperty)
            {
                writer.WriteLine(";");
            }
        }
Exemplo n.º 9
0
        public static void Write(this DataItemQueryElementTableFilterProperty 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());
                writer.Write("{0}={1}({2})", line.FieldName, line.Type.AsString(), line.Value);

                switch (isLastLine)
                {
                case true:
                    if (isLastProperty)
                    {
                        writer.Write(" ");
                    }
                    else
                    {
                        writer.WriteLine(";");
                    }

                    break;

                case false:
                    writer.WriteLine(",");
                    break;
                }
            }

            writer.Unindent();
        }
        public static void Write(this PageActionSeparator action, CSideWriter writer)
        {
            var idLength         = Math.Max(action.ID.ToString().Length, 8);
            var id               = action.ID.ToString().PadRight(idLength);
            var idAndIndentation = string.Format("{0};{1}", id, action.IndentationLevel.ToString());

            writer.Write("{{ {0};", idAndIndentation.PadRight(13));
            writer.Indent(writer.Column);
            writer.Write("Separator ");

            var relevantProperties = action.Properties.Where(p => p.HasValue);

            if (relevantProperties.Any())
            {
                writer.WriteLine(";");
                action.Properties.Write(PropertiesStyle.Field, writer);
            }
            else
            {
                writer.Write(" ");
            }

            writer.WriteLine("}");
            writer.Unindent();
        }
Exemplo n.º 11
0
        public static CSideWriter BeginSection(this CSideWriter writer, string sectionName)
        {
            writer.WriteLine(sectionName);
            writer.WriteLine("{");
            writer.Indent();

            return(writer);
        }
Exemplo n.º 12
0
        public static void Write(this TableKey key, CSideWriter writer)
        {
            writer.Write("{");

            var enabled = "    ";

            if (key.Enabled.HasValue)
            {
                if (key.Enabled.Value == false)
                {
                    enabled = " No ";
                }
            }

            writer.Write(enabled);
            writer.Write(";");

            key.Fields.Write(writer);

            if (key.Properties.Any(p => p.HasValue))
            {
                writer.Write(";");

                if (writer.Column > 51)
                {
                    writer.Indent(51);
                    writer.WriteLine("");
                }
                else
                {
                    writer.Indent(writer.Column);
                }

                key.Properties.Write(PropertiesStyle.Field, writer);
                writer.Unindent();
            }
            else
            {
                writer.Write(" ");
            }

            writer.WriteLine("}");
        }
Exemplo n.º 13
0
        public static void Write(this ScopedTriggerProperty property, bool isLastProperty, PropertiesStyle style, CSideWriter writer)
        {
            writer.Write("{0}=", property.ScopedName());
            writer.Indent(writer.Column);
            property.Value.Variables.Write(writer);

            writer.WriteLine("BEGIN");
            writer.Indent();
            property.Value.CodeLines.Write(writer);
            writer.Unindent();
            writer.WriteLine("END;");

            writer.Unindent();

            if (!isLastProperty || style == PropertiesStyle.Object)
            {
                writer.InnerWriter.WriteLine();
            }
        }
Exemplo n.º 14
0
        public static void Write(this ReportElement reportElement, CSideWriter writer)
        {
            string type = null;

            TypeSwitch.Do(
                reportElement,
                TypeSwitch.Case <DataItemReportElement>(e => type = "DataItem"),
                TypeSwitch.Case <ColumnReportElement>(e => type   = "Column"));

            var debt               = 0;
            var elementID          = BuildReportElementPart(reportElement.ID.ToString(), 4, ref debt);
            var elementIndentation = BuildReportElementPart(reportElement.IndentationLevel.AsString(), 4, ref debt);
            var elementType        = BuildReportElementPart(type, 8, ref debt);
            var elementName        = BuildReportElementPart(reportElement.Name ?? string.Empty, 20, ref debt);
            var declaration        = string.Format("{{ {0};{1};{2};{3}", elementID, elementIndentation, elementType, elementName);

            writer.Write(declaration);
            writer.Indent(15);

            IEnumerable <Property> properties = null;

            TypeSwitch.Do(
                reportElement,
                TypeSwitch.Case <DataItemReportElement>(e => properties = e.Properties),
                TypeSwitch.Case <ColumnReportElement>(e => properties   = e.Properties));

            var relevantProperties = properties.Where(p => p.HasValue);

            switch (relevantProperties.Any())
            {
            case true:
                writer.WriteLine(";");
                relevantProperties.Write(PropertiesStyle.Field, writer);
                break;

            default:
                writer.Write(" ");
                break;
            }

            var lastProperty = relevantProperties.LastOrDefault();

            if (lastProperty != null)
            {
                if (lastProperty is TriggerProperty)
                {
                    writer.Write(new string(' ', lastProperty.Name.Length + 2));
                }
            }

            writer.WriteLine("}");
            writer.Unindent();
            writer.InnerWriter.WriteLine();
        }
 public static void Write(this SectionBase reportDataItemSection, CSideWriter writer)
 {
     writer.Write("{ ");
     writer.Indent();
     writer.BeginSection("PROPERTIES");
     reportDataItemSection.AllProperties.Where(p => p.HasValue).Write(PropertiesStyle.Object, writer);
     writer.EndSection();
     reportDataItemSection.Controls.Write(writer, 58);
     writer.WriteLine(" }");
     writer.Unindent();
 }
 public static void Write(this DataportDataItem dataportDataItem, CSideWriter writer)
 {
     writer.Write("{ ");
     writer.Indent();
     writer.BeginSection("PROPERTIES");
     dataportDataItem.Properties.Write(PropertiesStyle.Object, writer);
     writer.EndSection();
     dataportDataItem.Fields.Write(writer);
     writer.WriteLine(" }");
     writer.Unindent();
 }
Exemplo n.º 17
0
/*
 *      public static void Write(this PageControlGroup groupPageControl, CSideWriter writer, int propertyIndentation)
 *      {
 *          var debt = 0;
 *          var controlID = BuildControlPart(groupPageControl.ID.ToString(), 4, ref debt);
 *          var controlIndentation = BuildControlPart(groupPageControl.IndentationLevel.AsString(), 4, ref debt);
 *          var controlType = BuildControlPart("Group", 10, ref debt);
 *          var declaration = string.Format("{{ {0};{1};{2}", controlID, controlIndentation, controlType);
 *
 *          writer.Write(declaration);
 *
 *          if (groupPageControl.Properties.Any(p => p.HasValue))
 *          {
 *              writer.WriteLine(";");
 *              writer.Indent(propertyIndentation);
 *              groupPageControl.Properties.Write(PropertiesStyle.Field, writer);
 *              writer.Unindent();
 *          }
 *          else
 *          {
 *              writer.Write(" ");
 *          }
 *
 *          //var idLength = Math.Max(groupPageControl.ID.ToString().Length, 4);
 *          //var id = groupPageControl.ID.ToString().PadRight(idLength);
 *          //var idAndIndentation = string.Format("{0};{1}", id, groupPageControl.IndentationLevel.ToString()).PadRight(9);
 *          //var idAndIndentationAndType = string.Format("{0};Group", idAndIndentation);
 *
 *          //writer.WriteLine("{{ {0};", idAndIndentationAndType.PadRight(20));
 *
 *          if (groupPageControl.Properties.Where(p => p.HasValue).LastOrDefault() is ActionListProperty)
 *              writer.Write(new string(' ', 13));
 *
 *          writer.WriteLine("}");
 *          writer.InnerWriter.WriteLine();
 *      }
 *
 *      public static void Write(this PageControlPart partPageControl, CSideWriter writer, int propertyIndentation)
 *      {
 *          var debt = 0;
 *          var controlID = BuildControlPart(partPageControl.ID.ToString(), 4, ref debt);
 *          var controlIndentation = BuildControlPart(partPageControl.IndentationLevel.AsString(), 4, ref debt);
 *          var controlType = BuildControlPart("Part", 10, ref debt);
 *          var declaration = string.Format("{{ {0};{1};{2};", controlID, controlIndentation, controlType);
 *          writer.WriteLine(declaration);
 *
 *
 *          //var idLength = Math.Max(partPageControl.ID.ToString().Length, 4);
 *          //var id = partPageControl.ID.ToString().PadRight(idLength);
 *          //var idAndIndentation = string.Format("{0};{1}", id, partPageControl.IndentationLevel.ToString());
 *          //var idAndIndentationAndType = string.Format("{{ {0};Part", idAndIndentation.PadRight(9));
 *
 *          //writer.WriteLine("{0};", idAndIndentationAndType.PadRight(22));
 *
 *          writer.Indent(propertyIndentation);
 *          partPageControl.Properties.Write(PropertiesStyle.Field, writer);
 *          writer.WriteLine("}");
 *          writer.Unindent();
 *          writer.InnerWriter.WriteLine();
 *      }*/

        public static void Write(this FormControl fieldFormControl, CSideWriter writer, int propertyIndentation)
        {
            var debt          = 0;
            var controlID     = BuildControlPart(fieldFormControl.ID.ToString(), 4, ref debt);
            var controlType   = BuildControlPart(fieldFormControl.Type.ToString(), 13, ref debt);
            var controlXPos   = BuildControlPart(fieldFormControl.PosX.ToString(), 5, ref debt);
            var controlYPos   = BuildControlPart(fieldFormControl.PosY.ToString(), 5, ref debt);
            var controlWidth  = BuildControlPart(fieldFormControl.Width.ToString(), 5, ref debt);
            var controlHeight = BuildControlPart(fieldFormControl.Height.ToString(), 5, ref debt);

            var relevantProperties = fieldFormControl.Properties.Where(p => p.HasValue);
            var declaration        = string.Format("{{ {0};{1};{2};{3};{4};{5}", controlID, controlType, controlXPos, controlYPos, controlWidth, controlHeight);

            writer.Write(declaration);
            writer.Write(relevantProperties.Any() ? ";" : " ");

            if ((writer.Column > propertyIndentation) && (relevantProperties.Any()))
            {
                writer.Indent(propertyIndentation);
                writer.WriteLine("");
            }
            else
            {
                writer.Indent(writer.Column);
            }

            relevantProperties.Write(PropertiesStyle.Field, writer);

            var lastProperty = relevantProperties.LastOrDefault();

            if (lastProperty != null)
            {
                if (lastProperty is TriggerProperty)
                {
                    writer.Write(new string(' ', lastProperty.Name.Length + 2));
                }
            }

            writer.WriteLine("}");
            writer.Unindent();
        }
Exemplo n.º 18
0
        public static void Write(this TableKey key, CSideWriter writer)
        {
            writer.Write("{");

            switch (key.Enabled)
            {
            case null: writer.Write("    "); break;

            case true: writer.Write(" Yes"); break;

            case false: writer.Write(" No "); break;
            }

            writer.Write(";");

            key.Fields.Write(writer);

            if (key.Properties.Any(p => p.HasValue))
            {
                writer.Write(";");

                if (writer.Column > 51)
                {
                    writer.Indent(51);
                    writer.WriteLine("");
                }
                else
                {
                    writer.Indent(writer.Column);
                }

                key.Properties.Write(PropertiesStyle.Field, writer);
                writer.Unindent();
            }
            else
            {
                writer.Write(" ");
            }

            writer.WriteLine("}");
        }
        public static void Write(this TableKey key, CSideWriter writer)
        {
            writer.Write("{");

            switch (key.Enabled)
            {
            case null: writer.Write("    "); break;

            default:
                writer.Write(writer.CodeStyle.Localization.ConvertBoolToString(key.Enabled).EqualPad(4));
                break;
            }

            writer.Write(";");

            key.Fields.Write(writer);

            if (key.Properties.Any(p => p.HasValue))
            {
                writer.Write(";");

                if (writer.Column > 51)
                {
                    writer.Indent(51);
                    writer.WriteLine("");
                }
                else
                {
                    writer.Indent(writer.Column);
                }

                key.Properties.Write(PropertiesStyle.Field, writer);
                writer.Unindent();
            }
            else
            {
                writer.Write(" ");
            }

            writer.WriteLine("}");
        }
Exemplo n.º 20
0
        public static void Write(this TableField field, CSideWriter writer)
        {
            var debt = 0;

            var fieldNo       = BuildFieldPart(field.ID.ToString(), 4, ref debt);
            var fieldEnabled  = BuildFieldPart(field.Enabled.AsString(), 3, ref debt);
            var fieldName     = BuildFieldPart(field.Name, 20, ref debt);
            var fieldTypeName = BuildFieldPart(field.TypeName(), 14, ref debt);
            var declaration   = string.Format("{{ {0};{1};{2};{3}", fieldNo, fieldEnabled, fieldName, fieldTypeName);
            var properties    = field.AllProperties;

            writer.Write("{0}", declaration.PadRight(46));
            writer.Write(properties.Any(p => p.HasValue) ? ";" : " ");

            if ((writer.Column > 51) && (properties.Any(p => p.HasValue)))
            {
                writer.Indent(51);
                writer.WriteLine("");
            }
            else
            {
                writer.Indent(writer.Column);
            }

            properties.Write(PropertiesStyle.Field, writer);

            var relevantProperties = properties.Where(p => p.HasValue);
            var lastProperty       = relevantProperties.LastOrDefault();

            if (lastProperty != null)
            {
                if (lastProperty is TriggerProperty)
                {
                    writer.Write(new string(' ', lastProperty.Name.Length + 2));
                }
            }

            writer.WriteLine("}");
            writer.Unindent();
        }
Exemplo n.º 21
0
        public static void Write(this ColumnFilterProperty 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());
                writer.WriteLine("{0}={1}({2}){3}", line.FieldName, line.Type.AsString(), line.Value, isLastLine ? ";" : ",");
            }

            writer.Unindent();
        }
Exemplo n.º 22
0
        public static void Write(this QueryOrderByLinesProperty 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());
                writer.WriteLine("{0}={1}{2}", line.Column, line.Direction, isLastLine ? ";" : ",");
            }

            writer.Unindent();
        }
        public static void Write(this ReportLabel reportLabel, CSideWriter writer)
        {
            var id   = reportLabel.ID.ToString().PadRight(4);
            var debt = id.Length > 4 ? id.Length - 4 : 0;
            var name = reportLabel.Name.PadRight(20 - debt);

            writer.Write("{ ");
            writer.Write(id);
            writer.Write(";");
            writer.Write(name);

            var relevantProperties = reportLabel.Properties.Where(p => p.HasValue);

            switch (relevantProperties.Any())
            {
            case true:
                writer.Write(";");
                break;

            default:
                writer.Write(" ");
                break;
            }

            if (writer.Column > 32)
            {
                writer.Indent(32);
                writer.WriteLine("");
            }
            else
            {
                writer.Indent(writer.Column);
            }

            reportLabel.Properties.Write(PropertiesStyle.Field, writer);

            writer.WriteLine("}");
            writer.Unindent();
        }
        public static void Write(this PageActionGroup action, CSideWriter writer)
        {
            var idLength         = Math.Max(action.ID.ToString().Length, 8);
            var id               = action.ID.ToString().PadRight(idLength);
            var idAndIndentation = string.Format("{0};{1}", id, action.IndentationLevel.ToString());

            writer.Write("{{ {0};", idAndIndentation.PadRight(13));
            writer.Indent(writer.Column);
            writer.WriteLine("ActionGroup;");
            action.Properties.Write(PropertiesStyle.Field, writer);
            writer.WriteLine("}");
            writer.Unindent();
        }
Exemplo n.º 25
0
        public static void Write(this ActionListProperty property, bool isLastProperty, PropertiesStyle style, CSideWriter writer)
        {
            writer.WriteLine("{0}=ACTIONS", property.Name);
            writer.WriteLine("{");
            writer.Indent();

            foreach (var action in property.Value)
            {
                action.Write(writer);
            }

            writer.Unindent();
            writer.WriteLine("}");
        }
Exemplo n.º 26
0
        public static void Write(this Event @event, CSideWriter writer)
        {
            writer.InnerWriter.WriteLine();

            writer.Write("EVENT {0}@{1}::{2}@{3}(", @event.SourceName, @event.SourceID, @event.Name, @event.ID);
            @event.Parameters.Write(writer);
            writer.WriteLine(");");
            @event.Variables.Write(writer);
            writer.WriteLine("BEGIN");
            writer.Indent();
            @event.CodeLines.Write(writer);
            writer.Unindent();
            writer.WriteLine("END;");
        }
        public static void Write(this DataportField dataportField, CSideWriter writer, int propertyIndentation)
        {
            var debt               = 0;
            var startPos           = BuildControlPart(dataportField.StartPosition.HasValue? dataportField.StartPosition.Value.ToString() : "", 5, ref debt);
            var width              = BuildControlPart(dataportField.Width.HasValue? dataportField.Width.Value.ToString() : "", 5, ref debt);
            var sourceExp          = BuildControlPart(dataportField.SourceExpr, 20, ref debt);
            var relevantProperties = dataportField.Properties.Where(p => p.HasValue);
            var declaration        = string.Format("{{ {0};{1};{2}", startPos, width, sourceExp);

            writer.Write(declaration);
            writer.Write(relevantProperties.Any() ? ";" : " ");

            if ((writer.Column > propertyIndentation) && (relevantProperties.Any()))
            {
                writer.Indent(propertyIndentation);
                writer.WriteLine("");
            }
            else
            {
                writer.Indent(writer.Column);
            }

            relevantProperties.Write(PropertiesStyle.Field, writer);

            var lastProperty = relevantProperties.LastOrDefault();

            if (lastProperty != null)
            {
                if (lastProperty is TriggerProperty)
                {
                    writer.Write(new string(' ', lastProperty.Name.Length + 2));
                }
            }

            writer.WriteLine("}");
            writer.Unindent();
        }
        public static void Write(this PageControlContainer containerPageControl, CSideWriter writer, int propertyIndentation)
        {
            var debt               = 0;
            var controlID          = BuildControlPart(containerPageControl.ID.ToString(), 4, ref debt);
            var controlIndentation = BuildControlPart(containerPageControl.IndentationLevel.AsString(), 4, ref debt);
            var controlType        = BuildControlPart("Container", 10, ref debt);
            var declaration        = string.Format("{{ {0};{1};{2};", controlID, controlIndentation, controlType);

            writer.WriteLine(declaration);

            writer.Indent(propertyIndentation);
            containerPageControl.Properties.Write(PropertiesStyle.Field, writer);
            writer.WriteLine("}");
            writer.Unindent();
            writer.InnerWriter.WriteLine();
        }
        private static void WriteDeclaration(int id, int?indentation, string type, string name, CSideWriter writer)
        {
            name = name ?? string.Empty;
            var nameLength = Math.Max(name.Length, 20);

            writer.Write("{ ");
            writer.Write(id.ToString().PadRight(4));
            writer.Write(";");
            writer.Write((indentation.HasValue ? indentation.Value.ToString() : string.Empty).PadRight(4));
            writer.Indent(writer.Column);
            writer.Write(";");
            writer.Write(type.PadRight(8));
            writer.Write(";");
            writer.Write(name.PadRight(nameLength));
            writer.WriteLine(";");
        }
Exemplo n.º 30
0
        public static void Write(this Documentation documentation, CSideWriter writer)
        {
            writer.InnerWriter.WriteLine();
            writer.WriteLine("BEGIN");

            if (documentation.CodeLines.Any())
            {
                writer.WriteLine("{");
                writer.Indent();
                documentation.CodeLines.Write(writer);
                writer.Unindent();
                writer.WriteLine("}");
            }

            writer.WriteLine("END.");
        }