protected object GetCalculateAgeExpression(TranslationContext context, object result) { var calculateAge = new SQLModel.CalculateAge(); calculateAge.Items.Add(result); var binaryExpression = new SQLModel.BinaryExpression(); // Returns as years, so multiply by days/year to get consistent results with the physical quantity translator binaryExpression.Operator = SQLModel.BinaryOperator.opMultiply; binaryExpression.OperatorSpecified = true; binaryExpression.Items.Add(calculateAge); var multiplier = new SQLModel.ValueExpression(); multiplier.Type = SQLModel.ValueType.Decimal; multiplier.TypeSpecified = true; multiplier.Value = Convert.ToString(365.25m); binaryExpression.Items.Add(multiplier); return binaryExpression; }
protected object GetCalculateAgeExpression(TranslationContext context, object result) { var calculateAge = new SQLModel.CalculateAge(); calculateAge.Items.Add(result); var binaryExpression = new SQLModel.BinaryExpression(); // Returns as years, so multiply by days/year to get consistent results with the physical quantity translator binaryExpression.Operator = SQLModel.BinaryOperator.opMultiply; binaryExpression.OperatorSpecified = true; binaryExpression.Items.Add(calculateAge); var multiplier = new SQLModel.ValueExpression(); multiplier.Type = SQLModel.ValueType.Decimal; multiplier.TypeSpecified = true; multiplier.Value = Convert.ToString(365.25m); binaryExpression.Items.Add(multiplier); return(binaryExpression); }