Exemple #1
0
        internal static string GetCalcFormulaFilterValue(ref string value)
        {
            Parsing.MustMatch(ref value, @"^\(");
            return(Parsing.MatchUntilUnnested(ref value, ')', '('));

            // return Parsing.MatchUntil(ref value, ')', '\'');
        }
Exemple #2
0
        internal static List <TableRelationFilterLine> GetTableRelationConditions(ref string propertyValue)
        {
            // ELSE IF (Type=CONST("Charge (Item)")) "Item Charge";

            var result = new List <TableRelationFilterLine>();

            if (!Parsing.TryMatch(ref propertyValue, @"^IF\s\("))
            {
                return(result);
            }

            do
            {
                var fieldName = Parsing.MustMatch(ref propertyValue, @"^([^=]+)=").Groups[1].Value;
                var type      = Parsing.MustMatch(ref propertyValue, @"(CONST|FILTER)").Groups[1].Value;
                Parsing.MustMatch(ref propertyValue, @"^\(");
                var value = Parsing.MatchUntil(ref propertyValue, ')', '"', '\'');

                result.Add(new TableRelationFilterLine(fieldName, type, value, false, false));
            }while (Parsing.TryMatch(ref propertyValue, @"^,\s?"));

            Parsing.MustMatch(ref propertyValue, @"^\)\s");

            return(result);
        }
        internal static void SetSIFTLevelsProperty(this SIFTLevelsProperty property, string propertyValue)
        {
            property.EmptyValueIsSet = true;
            propertyValue            = RemoveSurroundingSquareBrackets(propertyValue);

            while (!string.IsNullOrEmpty(propertyValue))
            {
                property.EmptyValueIsSet = false;
                var siftLevelLine = Parsing.MustMatch(ref propertyValue, @"^\{(.*?)\}").Groups[1].Value;
                var fields        = siftLevelLine.Split(",".ToCharArray());
                var siftLevel     = property.Value.Add(new SIFTLevel());

                foreach (var field in fields)
                {
                    var field2    = field;
                    var match     = Parsing.MustMatch(ref field2, @"^([^:]+)(:(.*))?");
                    var fieldName = match.Groups[1].Value;
                    var aspect    = match.Groups[3].Value;

                    siftLevel.Components.Add(new SIFTLevelComponent(fieldName, aspect));
                }

                Parsing.TryMatch(ref propertyValue, @"^,\s?");
            }
        }
Exemple #4
0
        internal static List <TableRelationFilterLine> GetCalcFormulaFilters(ref string propertyValue)
        {
            var result = new List <TableRelationFilterLine>();

            if (!Parsing.TryMatch(ref propertyValue, @"^ WHERE\s\("))
            {
                return(result);
            }

            do
            {
                var fieldName     = Parsing.MustMatch(ref propertyValue, @"^([^=]+)=").Groups[1].Value;
                var type          = Parsing.MustMatch(ref propertyValue, @"^(CONST|FILTER|FIELD)").Groups[1].Value;
                var valueIsFilter = GetCalcFormulaFilterValueIsFilter(ref propertyValue);
                var onlyMaxLimit  = GetCalcFormulaFilterOnlyMaxLimit(ref propertyValue);
                var value         = GetCalcFormulaFilterValue(ref propertyValue);
                if (onlyMaxLimit)
                {
                    Parsing.MustMatch(ref propertyValue, @"^\)");
                }
                if (valueIsFilter)
                {
                    Parsing.MustMatch(ref propertyValue, @"^\)");
                }
                result.Add(new TableRelationFilterLine(fieldName, type, value, valueIsFilter, onlyMaxLimit));
            }while (Parsing.TryMatch(ref propertyValue, @"^,\s?"));

            Parsing.MustMatch(ref propertyValue, @"^\)");

            return(result);
        }
Exemple #5
0
 internal static void SetLinkFieldsProperty(this LinkFieldsProperty property, string propertyValue)
 {
     do
     {
         var fieldNo          = Parsing.MustMatch(ref propertyValue, @"^Field(\d+)=FIELD\(").Groups[1].Value.ToInteger();
         var referenceFieldNo = Parsing.MustMatch(ref propertyValue, @"^Field(\d+)\)").Groups[1].Value.ToInteger();
         property.Value.Add(new LinkField(fieldNo, referenceFieldNo));
     }while (Parsing.TryMatch(ref propertyValue, @"^,\s?"));
 }
Exemple #6
0
 internal static void SetPermissionProperty(this PermissionsProperty property, string propertyValue)
 {
     // TableData 21=r
     while (propertyValue.Length > 0)
     {
         var match = Parsing.MustMatch(ref propertyValue, @"^TableData\s(\d+)=(r?)(i?)(m?)(d?)(,\s)?");
         property.Value.Set(match.Groups[1].Value.ToInteger(), match.Groups[2].Value == "r", match.Groups[3].Value == "i", match.Groups[4].Value == "m", match.Groups[5].Value == "d");
     }
 }
Exemple #7
0
 internal static void SetReportDataItemLinkProperty(this ReportDataItemLinkProperty property, string propertyValue)
 {
     do
     {
         var fieldName          = Parsing.MustMatch(ref propertyValue, @"^([^=]+)=FIELD\(").Groups[1].Value;
         var referenceFieldName = Parsing.MatchUntilUnnested(ref propertyValue, ')', '(');
         //var referenceFieldName = Parsing.MustMatch(ref propertyValue, @"^([^)]+)\)").Groups[1].Value;
         property.Value.Add(new ReportDataItemLinkLine(fieldName, referenceFieldName));
     }while (Parsing.TryMatch(ref propertyValue, @"^,\s?"));
 }
Exemple #8
0
        internal static string GetCalcFormulaTableName(ref string propertyValue)
        {
            switch (propertyValue.StartsWith("\""))
            {
            case true:
                return(Parsing.MustMatch(ref propertyValue, @"\""([^\""]+)\""").Groups[1].Value);

            default:
                return(Parsing.MustMatch(ref propertyValue, @"([^\s\.]+)").Groups[1].Value);
            }
        }
Exemple #9
0
 internal static void SetQueryOrderByLinesProperty(this QueryOrderByLinesProperty property, string propertyValue)
 {
     //    OrderBy=Country_Region_Code=Ascending,
     //            VAT_Registration_No=Ascending;
     while (!string.IsNullOrEmpty(propertyValue))
     {
         var column    = Parsing.MustMatch(ref propertyValue, @"^([^=]+)=").Groups[1].Value;
         var direction = Parsing.MustMatch(ref propertyValue, @"(Ascending|Descending),?\s?").Groups[1].Value.ToEnum <QueryOrderByDirection>();
         property.Value.Add(new QueryOrderByLine(column, direction));
     }
 }
        internal static string GetTableRelationTableName(ref string propertyValue)
        {
            switch (propertyValue.StartsWith("\"", StringComparison.InvariantCulture))
            {
            case true:
                return(Parsing.MustMatch(ref propertyValue, @"\""([^\""]+)\""").Groups[1].Value);

            default:
                return(Parsing.MustMatch(ref propertyValue, @"([^\s\.]+)").Groups[1].Value);
            }
        }
Exemple #11
0
        internal static void SetNamespacesValue(this XmlPortNamespaces namespaces, string value)
        {
            value = RemoveSurroundingSquareBrackets(value);

            while (value.Length > 0)
            {
                var match      = Parsing.MustMatch(ref value, @"^([^=]*)=([^;]*);?");
                var prefix     = match.Groups[1].Value;
                var @namespace = match.Groups[2].Value;
                namespaces.Set(prefix, @namespace);
            }
        }
Exemple #12
0
        internal static void SetDataItemQueryElementTableFilter(this DataItemQueryElementTableFilterProperty property, string propertyValue)
        {
            // DataItemTableFilter=Type=CONST(Sale)

            do
            {
                var fieldName = Parsing.MustMatch(ref propertyValue, @"^([^=]+)=").Groups[1].Value;
                var type      = Parsing.MustMatch(ref propertyValue, @"^(CONST|FILTER)").Groups[1].Value.ToEnum <SimpleTableFilterType>();
                var value     = GetCalcFormulaFilterValue(ref propertyValue);
                property.Value.Add(new TableFilterLine(fieldName, type, value));
            }while (Parsing.TryMatch(ref propertyValue, @"^,\s?"));
        }
        internal static void SetMultiLanguageValue(this MultiLanguageValue multiLanguageValue, string value)
        {
            value = RemoveSurroundingSquareBrackets(value);
            while (value.Length > 0)
            {
                var languageCode  = Parsing.MustMatch(ref value, @"^([A-Z@]{3})=").Groups[1].Value;
                var languageValue = GetLanguageValue(ref value);
                multiLanguageValue.Set(languageCode, languageValue);

                Parsing.TryMatch(ref value, @"^;\s?");
            }
        }
Exemple #14
0
        internal static void SetColumnFilterProperty(this ColumnFilterProperty property, string propertyValue)
        {
            // ColumnFilter=Lot_No=FILTER(<>'');

            while (!string.IsNullOrEmpty(propertyValue))
            {
                var column = Parsing.MustMatch(ref propertyValue, @"^([^=]+)=").Groups[1].Value;
                var type   = Parsing.MustMatch(ref propertyValue, @"^(CONST|FILTER)").Groups[1].Value.ToEnum <SimpleTableFilterType>();
                var value  = Parsing.MustMatch(ref propertyValue, @"^\(([^\)]*)\)").Groups[1].Value;

                property.Value.Add(new TableFilterLine(column, type, value));
            }
        }
Exemple #15
0
        internal static string GetLanguageValue(ref string value)
        {
            switch (value.StartsWith("\""))
            {
            case true:
                Parsing.MustMatch(ref value, "^\"");
                // Parsing.MustMatch(ref value, @"\""([^\""]+)\""").Groups[1].Value;
                return(Parsing.MatchUntilSingle(ref value, '"'));

            default:
                return(Parsing.MustMatch(ref value, @"([^;]+)").Groups[1].Value);
            }
        }
Exemple #16
0
        internal static void SetDataItemLinkProperty(this QueryDataItemLinkProperty property, string propertyValue)
        {
            //Dimension Set ID=ValueEntry."Dimension Set ID",
            // Dimension Code=ItemAnalysisView."Dimension 1 Code" }

            while (!string.IsNullOrEmpty(propertyValue))
            {
                var field          = Parsing.MustMatch(ref propertyValue, @"^([^=]+)=").Groups[1].Value;
                var referenceTable = Parsing.MustMatch(ref propertyValue, @"^([^\.]+).").Groups[1].Value;
                var referenceField = Parsing.MustMatch(ref propertyValue, @"^([^,]+),?\s?").Groups[1].Value;

                property.Value.Add(new QueryDataItemLinkLine(field, referenceTable, referenceField));
            }
        }
Exemple #17
0
        internal static string GetCalcFormulaFieldName(ref string propertyValue)
        {
            if (!Parsing.TryMatch(ref propertyValue, @"^\."))
            {
                return(null);
            }

            switch (propertyValue.StartsWith("\""))
            {
            case true:
                return(Parsing.MustMatch(ref propertyValue, @"\""([^\""]+)\""").Groups[1].Value);

            default:
                return(Parsing.MustMatch(ref propertyValue, @"(\S+)").Groups[1].Value);
            }
        }
        internal static string GetTableRelationFieldName(ref string propertyValue)
        {
            if (!Parsing.TryMatch(ref propertyValue, @"^\."))
            {
                return(null);
            }

            switch (propertyValue.StartsWith("\"", StringComparison.InvariantCulture))
            {
            case true:
                return(Parsing.MustMatch(ref propertyValue, @"\""([^\""]+)\""").Groups[1].Value);

            default:
                return(Parsing.MustMatch(ref propertyValue, @"(\S+)").Groups[1].Value);
            }
        }
Exemple #19
0
        internal static void SetObjectLinkProperty(this RunObjectLinkProperty property, string propertyValue)
        {
            //			Payment Term=FIELD(Code);

            while (propertyValue.Length > 0)
            {
                var fieldName = Parsing.MustMatch(ref propertyValue, @"^([^=]+)=").Groups[1].Value;
                var type      = Parsing.MustMatch(ref propertyValue, @"(CONST|FILTER|FIELD)").Groups[1].Value.ToEnum <TableFilterType>();
                Parsing.MustMatch(ref propertyValue, @"^\(");
                var value = Parsing.MatchUntilUnnested(ref propertyValue, ')', '(');

                property.Value.Add(new RunObjectLinkLine(fieldName, type, value));

                Parsing.TryMatch(ref propertyValue, @"^,\s?");
            }
        }
        internal static string GetLanguageValue(ref string value)
        {
            if (value.StartsWith(";", StringComparison.InvariantCulture) || String.IsNullOrEmpty(value))
            {
                return(string.Empty);
            }

            switch (value.StartsWith("\"", StringComparison.InvariantCulture))
            {
            case true:
                Parsing.MustMatch(ref value, "^\"");
                // Parsing.MustMatch(ref value, @"\""([^\""]+)\""").Groups[1].Value;
                return(Parsing.MatchUntilSingle(ref value, '"'));

            default:
                return(Parsing.MustMatch(ref value, @"([^;]+)").Groups[1].Value);
            }
        }
Exemple #21
0
        internal static List <TableRelationFilterLine> GetTableRelationFilters(ref string propertyValue)
        {
            var result = new List <TableRelationFilterLine>();

            if (!Parsing.TryMatch(ref propertyValue, @"^\s?WHERE\s?\("))
            {
                return(result);
            }

            do
            {
                var fieldName = Parsing.MustMatch(ref propertyValue, @"^([^=]+)=").Groups[1].Value;
                var type      = Parsing.MustMatch(ref propertyValue, @"(CONST|FILTER|FIELD)").Groups[1].Value;
                Parsing.MustMatch(ref propertyValue, @"^\(");
                var value = Parsing.MatchUntilUnnested(ref propertyValue, ')', '(');
                // var value = Parsing.MustMatch(ref propertyValue, @"\(([^\)]*)\)").Groups[1].Value;
                result.Add(new TableRelationFilterLine(fieldName, type, value, false, false));
            }while (Parsing.TryMatch(ref propertyValue, @"^,\s?"));

            Parsing.MustMatch(ref propertyValue, @"^\)");

            return(result);
        }
Exemple #22
0
 internal static string GetCalcFormulaMethodText(ref string propertyValue)
 {
     return(Parsing.MustMatch(ref propertyValue, @"^([^\(]+)\(").Groups[1].Value);
 }