예제 #1
0
파일: Roslyn.cs 프로젝트: merken/roslyn
 public IWelfareServiceBuilder AddWelfareRule(WelfareRule rule)
 {
     welfareRules.Add(rule);
     return(this);
 }
예제 #2
0
파일: Roslyn.cs 프로젝트: merken/roslyn
 private IfStatementSyntax GenerateIfStatement(WelfareRule rule)
 {
     return(IfStatement(
                BinaryExpression(
                    SyntaxKind.LogicalAndExpression,
                    BinaryExpression(
                        SyntaxKind.LogicalAndExpression,
                        BinaryExpression(
                            SyntaxKind.LogicalAndExpression,
                            BinaryExpression(
                                SyntaxKind.LogicalAndExpression,
                                BinaryExpression(
                                    SyntaxKind.LogicalAndExpression,
                                    BinaryExpression(
                                        SyntaxKind.LogicalAndExpression,
                                        BinaryExpression(
                                            SyntaxKind.EqualsExpression,
                                            IdentifierName("monthsOfUnemployment"),
                                            LiteralExpression(
                                                SyntaxKind.NumericLiteralExpression,
                                                Literal(rule.Month))),
                                        BinaryExpression(
                                            SyntaxKind.EqualsExpression,
                                            IdentifierName("maritalStatus"),
                                            LiteralExpression(
                                                SyntaxKind.NumericLiteralExpression,
                                                Literal(rule.IdMaritalStatus)))),
                                    BinaryExpression(
                                        SyntaxKind.EqualsExpression,
                                        IdentifierName("handicap"),
                                        LiteralExpression(
                                            SyntaxKind.NumericLiteralExpression,
                                            Literal(rule.IdHandicap)))),
                                BinaryExpression(
                                    SyntaxKind.EqualsExpression,
                                    IdentifierName("numberOfChildren"),
                                    LiteralExpression(
                                        SyntaxKind.NumericLiteralExpression,
                                        Literal(rule.NumberOfChildren)))),
                            BinaryExpression(
                                SyntaxKind.LessThanExpression,
                                LiteralExpression(
                                    SyntaxKind.NumericLiteralExpression,
                                    Literal(rule.BrutoStart)),
                                IdentifierName("brutowage"))),
                        BinaryExpression(
                            SyntaxKind.LessThanOrEqualExpression,
                            IdentifierName("brutowage"),
                            LiteralExpression(
                                SyntaxKind.NumericLiteralExpression,
                                Literal(rule.BrutoEnd)))),
                    BinaryExpression(
                        SyntaxKind.LessThanOrEqualExpression,
                        LiteralExpression(
                            SyntaxKind.NumericLiteralExpression,
                            Literal(rule.Age)),
                        IdentifierName("age"))),
                ReturnStatement(
                    LiteralExpression(
                        SyntaxKind.NumericLiteralExpression,
                        Literal(rule.Value)))));
 }