Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        internal static void SetTableRelationProperty(this TableRelationProperty property, string propertyValue)
        {
            while (propertyValue.Length > 0)
            {
                var conditions = GetTableRelationConditions(ref propertyValue);
                var tableName  = GetTableRelationTableName(ref propertyValue);
                var fieldName  = GetTableRelationFieldName(ref propertyValue);
                var filters    = GetTableRelationFilters(ref propertyValue);

                var tableRelationLine = property.Value.Add(new TableRelationLine(tableName));
                tableRelationLine.FieldName = fieldName;

                foreach (var condition in conditions)
                {
                    tableRelationLine.Conditions.Add(new TableRelationCondition(condition.FieldName, condition.Type.ToEnum <SimpleTableFilterType>(), condition.Value));
                }

                foreach (var filter in filters)
                {
                    tableRelationLine.TableFilter.Add(new TableRelationTableFilterLine(filter.FieldName, filter.Type.ToEnum <TableFilterType>(), filter.Value));
                }

                Parsing.TryMatch(ref propertyValue, @"^\sELSE\s");
            }
        }
Ejemplo n.º 3
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?");
            }
        }
Ejemplo n.º 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?"));
 }
Ejemplo n.º 6
0
        internal static string GetTableViewSorting(ref string propertyValue)
        {
            if (Parsing.TryMatch(ref propertyValue, @"^SORTING\("))
            {
                return(Parsing.MatchUntilUnnested(ref propertyValue, ')', '('));
            }

            return(null);
        }
Ejemplo n.º 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?"));
 }
Ejemplo n.º 8
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?");
            }
        }
Ejemplo n.º 10
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);
            }
        }
Ejemplo n.º 11
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 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);
            }
        }
Ejemplo n.º 13
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);
        }
Ejemplo n.º 14
0
 internal static bool GetCalcFormulaFilterOnlyMaxLimit(ref string value)
 {
     return(Parsing.TryMatch(ref value, @"^\(UPPERLIMIT"));
 }
Ejemplo n.º 15
0
 internal static bool GetCalcFormulaFilterValueIsFilter(ref string value)
 {
     return(Parsing.TryMatch(ref value, @"^\(FILTER"));
 }
Ejemplo n.º 16
0
 internal static bool GetCalcFormulaReverseSign(ref string propertyValue)
 {
     return(Parsing.TryMatch(ref propertyValue, @"^-"));
 }