Example #1
0
 public override bool TryParseAndSet(Parser.QueryFieldValue value)
 {
     // Set the parsed value.
     value.Set(value.StringValue.ToLower());
     // Successful.
     return(true);
 }
Example #2
0
 public override bool TryParseAndSet(Parser.QueryFieldValue value)
 {
     value.Set(value.StringValue.ToLower());
     if (value.StringValue.StartsWith("/root"))
     {
         return(true);
     }
     return(false);
 }
Example #3
0
        public override void ConvertToTermValue(Parser.QueryFieldValue value)
        {
            var path = ((string)value.InputObject).ToLower();

            if (!path.StartsWith("/root"))
            {
                throw new ApplicationException(String.Concat("Invalid path: '", path, "'. It must be absolute: '/root' or '/root/...'."));
            }
            value.Set(path);
        }
Example #4
0
        public override bool TryParseAndSet(Parser.QueryFieldValue value)
        {
            Int32 intValue;

            if (!Int32.TryParse(value.StringValue, out intValue))
            {
                return(false);
            }
            value.Set(intValue);
            return(true);
        }
Example #5
0
        public override bool TryParseAndSet(Parser.QueryFieldValue value)
        {
            DateTime dateTimeValue;

            if (!DateTime.TryParse(value.StringValue, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTimeValue))
            {
                return(false);
            }
            value.Set(dateTimeValue.Ticks);
            return(true);
        }
Example #6
0
        public override bool TryParseAndSet(Parser.QueryFieldValue value)
        {
            Double doubleValue;

            if (!Double.TryParse(value.StringValue, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.CultureInfo.InvariantCulture, out doubleValue))
            {
                return(false);
            }
            value.Set(doubleValue);
            return(true);
        }
Example #7
0
 public override void ConvertToTermValue(Parser.QueryFieldValue value)
 {
     if (value.InputObject == null)
     {
         value.Set(String.Empty);
     }
     else
     {
         value.Set(((string)value.InputObject).ToLower());
     }
 }
Example #8
0
        public override bool TryParseAndSet(Parser.QueryFieldValue value)
        {
            int intValue;

            if (Int32.TryParse(value.StringValue, out intValue))
            {
                value.Set(intValue.ToString());
            }
            else
            {
                value.Set(LucQuery.NullReferenceValue);
            }
            return(true);
        }
Example #9
0
        public override void ConvertToTermValue(Parser.QueryFieldValue value)
        {
            if (value.InputObject == null)
            {
                value.Set(LucQuery.NullReferenceValue);
                return;
            }
            var node = value.InputObject as Node;

            if (node != null)
            {
                value.Set(node.Id.ToString());
                return;
            }
            var enumerable = value as System.Collections.IEnumerable;

            if (enumerable != null)
            {
                throw new NotImplementedException("ReferenceIndexHandler.ConvertToTermValue() isn't implemented when value is IEnumerable.");
            }
            throw new NotSupportedException(String.Format("Type {0} is not supported as value of ReferenceField", value.InputObject.GetType().ToString()));
        }
Example #10
0
        public override bool TryParseAndSet(Parser.QueryFieldValue value)
        {
            var v = value.StringValue.ToLower();

            if (YesList.Contains(v))
            {
                value.Set(YES);
                return(true);
            }
            if (NoList.Contains(v))
            {
                value.Set(NO);
                return(true);
            }
            bool b;

            if (Boolean.TryParse(v, out b))
            {
                value.Set(b ? YES : NO);
                return(true);
            }
            return(false);
        }
Example #11
0
 public override void ConvertToTermValue(Parser.QueryFieldValue value)
 {
     value.Set((string)value.InputObject);
 }
Example #12
0
 public override bool TryParseAndSet(Parser.QueryFieldValue value)
 {
     value.Set(value.StringValue);
     return(true);
 }
Example #13
0
 public override void ConvertToTermValue(Parser.QueryFieldValue value)
 {
     value.Set(((DateTime)value.InputObject).Ticks);
 }
Example #14
0
        public override void ConvertToTermValue(Parser.QueryFieldValue value)
        {
            var doubleValue = Convert.ToDouble(value.InputObject);

            value.Set(doubleValue);
        }
Example #15
0
 /// <summary>
 /// For LINQ
 /// </summary>
 /// <param name="value"></param>
 public abstract void ConvertToTermValue(Parser.QueryFieldValue value);
Example #16
0
 public override bool TryParseAndSet(Parser.QueryFieldValue value)
 {
     return(false);
 }
Example #17
0
 /// <summary>
 /// For SnLucParser
 /// </summary>
 /// <param name="value"></param>
 /// <returns></returns>
 public abstract bool TryParseAndSet(Parser.QueryFieldValue value);
Example #18
0
 public override void ConvertToTermValue(Parser.QueryFieldValue value)
 {
     value.Set(((bool)value.InputObject) ? YES : NO);
 }
Example #19
0
 public override void ConvertToTermValue(Parser.QueryFieldValue value)
 {
     value.Set(value.InputObject.ToString());
 }