Пример #1
0
        public void Testexpression(string expr)
        {
            var xbrlparser = new XbrlFormulaParser();
            var csparser   = new CSharpParser();

            var expr3      = this.ParseExpression(expr);
            var item3_xbrl = xbrlparser.Translate(expr3);
            var v4         = new LogicalModel.Validation.ValidationRule();

            v4.RootExpression = expr3;
            v4.ID             = "v3";
            var item4_xbrl = xbrlparser.Translate(expr3);
            var item4_cs   = csparser.GetFunction(v4);
        }
Пример #2
0
        public void Test()
        {
            var xbrlparser = new XbrlFormulaParser();
            var csparser   = new CSharpParser();
            var expr0      = this.ParseExpression(" $a = (xs:QName('eba_NC:A'), xs:QName('eba_NC:B'))");
            var expr1      = this.ParseExpression(" $a = (xs:QName('eba_NC:A'), xs:QName('eba_NC:B'))");
            var expr2      = this.ParseExpression("if ($ReportingLevel = 'con') then ($a = xs:QName('eba_SC:x7')) else (true())");
            var expr3      = this.ParseExpression("iaf:numeric-equal($a, iaf:numeric-divide((iaf:sum((iaf:max((iaf:sum((iaf:numeric-multiply($b, 0.18), iaf:numeric-multiply($c, 0.18), iaf:numeric-multiply($d, 0.12), iaf:numeric-multiply((iaf:sum(($e, $f, iaf:numeric-multiply($g, 0.035)))), 0.15), iaf:numeric-multiply((iaf:sum(($h, $i, iaf:numeric-multiply($j, 0.035)))), 0.12), iaf:numeric-multiply($k, 0.18), iaf:numeric-multiply($l, 0.15), iaf:numeric-multiply($m, 0.12))), 0)), iaf:max((iaf:sum((iaf:numeric-multiply($n, 0.18), iaf:numeric-multiply($o, 0.18), iaf:numeric-multiply($p, 0.12), iaf:numeric-multiply((iaf:sum(($q, $r, iaf:numeric-multiply($s, 0.035)))), 0.15), iaf:numeric-multiply((iaf:sum(($t, $u, iaf:numeric-multiply($v, 0.035)))), 0.12), iaf:numeric-multiply($w, 0.18), iaf:numeric-multiply($x, 0.15), iaf:numeric-multiply($y, 0.12))), 0)), iaf:max((iaf:sum((iaf:numeric-multiply($z, 0.18), iaf:numeric-multiply($aa, 0.18), iaf:numeric-multiply($bb, 0.12), iaf:numeric-multiply((iaf:sum(($cc, $dd, iaf:numeric-multiply($ee, 0.035)))), 0.15), iaf:numeric-multiply((iaf:sum(($ff, $gg, iaf:numeric-multiply($hh, 0.035)))), 0.12), iaf:numeric-multiply($ii, 0.18), iaf:numeric-multiply($jj, 0.15), iaf:numeric-multiply($kk, 0.12))), 0))))), 3))");


            var expr4 = this.ParseExpression("if ($a = xs:QName('s2c_CN:x1')) then iaf:numeric-equal($b,$c) else (true())");
            var v4    = new LogicalModel.Validation.ValidationRule();

            v4.RootExpression = expr3;
            v4.ID             = "v3";
            var item4_xbrl = xbrlparser.Translate(expr4);
            var item4_cs   = csparser.GetFunction(v4);

            var prs1 = GetParameters(expr1);
            var prs2 = GetParameters(expr2);
            var prs3 = GetParameters(expr3);

            var v1 = new LogicalModel.Validation.ValidationRule();

            v1.RootExpression = expr1;
            v1.ID             = "v1";
            foreach (var p in prs1)
            {
                var pm = new LogicalModel.Validation.ValidationParameter(p, v1.ID);
                pm.Type = LogicalModel.TypeEnum.Numeric;
                v1.Parameters.Add(pm);
            }

            var v2 = new LogicalModel.Validation.ValidationRule();

            v2.RootExpression = expr2;
            v2.ID             = "v2";
            foreach (var p in prs2)
            {
                var pm = new LogicalModel.Validation.ValidationParameter(p, v2.ID);
                pm.Type = LogicalModel.TypeEnum.Numeric;
                v2.Parameters.Add(pm);
            }

            var v3 = new LogicalModel.Validation.ValidationRule();

            v3.RootExpression = expr3;
            v3.ID             = "v3";
            foreach (var p in prs3)
            {
                var pm = new LogicalModel.Validation.ValidationParameter(p, v3.ID);
                pm.Type = LogicalModel.TypeEnum.Numeric;
                v3.Parameters.Add(pm);
            }


            var item1_xbrl = xbrlparser.Translate(expr1);
            var item1_cs   = csparser.GetFunction(v1);
            var item2_xbrl = xbrlparser.Translate(expr2);
            var item2_cs   = csparser.GetFunction(v2);
            var item3_xbrl = xbrlparser.Translate(expr3);
            var item3_cs   = csparser.GetFunction(v3);
            var test       = item1_cs + item2_cs + item3_cs;
        }