Esempio n. 1
0
        public virtual string ToExpression(JqDataTable request)
        {
            if (Regex)
            {
                throw new NotImplementedException("Regular Expression is not implemented");
            }

            string        comparison  = operators[Operator];
            List <string> expressions = new List <string>();

            foreach (var searchableColumn in request.Columns.Where(c => c.Searchable.HasValue && c.Searchable.Value))
            {
                if (Operator == "doesnotcontain")
                {
                    expressions.Add(string.Format("!{0}.ToString().{1}(\"{2}\")", searchableColumn.Data, comparison, Value));
                }
                else if (comparison == "StartsWith" || comparison == "EndsWith" || comparison == "Contains")
                {
                    expressions.Add(string.Format("{0}.ToString().{1}(\"{2}\")", searchableColumn.Data, comparison, Value));
                }
                else
                {
                    expressions.Add(string.Format("{0} {1} \"{2}\"", searchableColumn.Data, comparison, Value));
                }
            }
            return(string.Join(" or ", expressions));
        }
Esempio n. 2
0
 public string ToExpression(JqDataTable request)
 {
     return(string.Concat(request.Columns[Column.Value].Data, " ", Dir));
 }