Ejemplo n.º 1
0
 public object Evaluate(Token contextToken, List <ExpressionArgument> args, ExecutionState state)
 {
     foreach (ExpressionArgument arg in args)
     {
         string s = args[0].Expression.Evaluate(state, arg.Token) as string;
         if (FormValues.IsError(s))
         {
             return(FormValues.Get(s).Message);
         }
     }
     return("");
 }
Ejemplo n.º 2
0
        public object Evaluate(Token contextToken, List <ExpressionArgument> args, ExecutionState state)
        {
            if (args.Count != 2)
            {
                throw new InstructionExecutionException("CheckedAttribute requires two arguments; the name of the field and the default check state (true/false)", contextToken);
            }
            string fieldname = args[0].Expression.Evaluate(state, args[0].Token) as string;

            if (FormValues.HasValue(fieldname))
            {
                object s = FormValues.Get(fieldname).Value;
                return(BooleanExpression.False.Equals(s) ? "" : " checked");
            }
            object o = args[1].Expression.Evaluate(state, args[1].Token);

            return(BooleanExpression.True.Equals(o) ? " checked" : "");
        }
Ejemplo n.º 3
0
        public object Evaluate(Token contextToken, List <ExpressionArgument> args, ExecutionState state)
        {
            if (args.Count != 2)
            {
                throw new InstructionExecutionException("The FormField expression must take two arguments. The first is the name of the field, "
                                                        + "the second is the default value to use if no value has been preset for that field name.", contextToken);
            }
            string fieldname = args[0].Expression.Evaluate(state, args[0].Token) as string;

            if (FormValues.HasValue(fieldname))
            {
                return(FormValues.Get(fieldname));
            }
            FormValues.FormFieldInfo fld = new FormValues.FormFieldInfo();
            fld.IsError = false;
            fld.Message = "";
            fld.Name    = fieldname;
            fld.Value   = args[1].Expression.Evaluate(state, args[1].Token);
            return(fld);
        }