Example #1
0
        public tInputClause[] CreateDmnInputs(Dictionary <string, Dictionary <string, string> > inputsDictionary)
        {
            var inputs = new List <tInputClause>();

            foreach (var entry in inputsDictionary)
            {
                foreach (var inputValue in entry.Value)
                {
                    var inputId    = inputValue.Value;
                    var inputLable = inputValue.Key;

                    if (String.IsNullOrEmpty(inputId))
                    {
                        inputId = Regex.Replace(inputLable, @"\s+", "");
                        inputId = inputId.Length <= 10 ? inputId : inputId.Substring(0, 10);
                    }
                    var input = new tInputClause()
                    {
                        id    = inputId,
                        label = inputLable,

                        inputExpression = new tLiteralExpression()
                        {
                            id    = String.Concat("exp_", inputId),
                            label = String.Concat("label_", inputId),
                            Item  = inputId
                        }
                    };

                    inputs.Add(input);
                }
            }
            return(inputs.ToArray());
        }
Example #2
0
        private tInputClause[] CreateDmnInputs(Dictionary <string, Dictionary <string, string> > inputsDictionary, Dictionary <int, string> inputsTypes)
        {
            var inputs = new List <tInputClause>();
            int i      = 0;

            foreach (var inputValue in inputsDictionary)
            {
                var input       = inputValue.Value.FirstOrDefault();
                var inputId     = variableId(input, out var inputLable);
                var haveType    = inputsTypes.TryGetValue(i, out string type);
                var InputClause = new tInputClause()
                {
                    id    = inputId,
                    label = inputLable,

                    inputExpression = new tLiteralExpression()
                    {
                        id      = string.Concat("exp_", inputId),
                        label   = string.Concat("label_", inputId),
                        Item    = inputId,
                        typeRef = new XmlQualifiedName(type)
                    }
                };
                inputs.Add(InputClause);
                i++;
            }
            return(inputs.ToArray());
        }