Esempio n. 1
0
        public DateContext(NodeContext parent, TerminalNode node)
            : base(parent, node)
        {
            DateTime to = !string.IsNullOrEmpty(Node.Atts["To"]) ? DateTime.Parse(Node.Atts["To"]) : Root.Now;
            DateTime from  = !string.IsNullOrEmpty(Node.Atts["From"]) ? DateTime.Parse(Node.Atts["From"]) : Root.Now;

            TimeSpan diff = to.Subtract(from);
            DateTime dt = to.AddMilliseconds(Root.Rand.Next(diff.Milliseconds));

            val = new StaticNodeValue(dt.ToString(Node.Atts["Fmt"] ?? string.Empty));
        }
Esempio n. 2
0
 public virtual string TransformValue(FieldContext field, StaticNodeValue sv)
 {
     return QuoteStr(sv.Value);
 }