Пример #1
0
        public static HycValue Operate(String Name, Object Value, string Operators)
        {
            if (Name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (Value == null)
            {
                throw new ArgumentNullException("value");
            }
            HycSortedList SortedList = new HycSortedList();

            /*
             * switch(Operators.ToLower())
             * {
             * case "eq":
             *  SortedList.Add(Name,Value);
             *  break;
             * case "ne":
             * case "le":
             * case "lt":
             * case "ge":
             * case "gt":
             * case "in":
             * case "like":
             * case "start":
             * case "end":
             *  SortedList.Add(Name,"{ \"$"+Operators.ToLower()+"\" : \""+Value+"\" }");
             *  break;
             * }
             */
            SortedList.Add(Name, "{ \"$" + Operators.ToLower() + "\" : \"" + String2Json(Value.ToString()) + "\" }");
            return(new HycValue(SortedList));
        }
Пример #2
0
        public static HycValue Or(params HycValue[] Doc)
        {
            HycValue      tmp    = And(Doc);
            string        value  = tmp.ToJson();
            HycSortedList result = new HycSortedList();

            result.Add("$or", value);
            return(new HycValue(result));
        }
Пример #3
0
        public static HycValue And(params HycValue[] Doc)
        {
            HycSortedList result = new HycSortedList();

            foreach (HycValue d in Doc)
            {
                HycSortedList _dic = new HycSortedList();
                _dic = d.ToValue();

                foreach (DictionaryEntry de in _dic)
                {
                    result.Add(de.Key, de.Value);
                }
            }
            return(new HycValue(result));
        }
Пример #4
0
 public HycValue(HycSortedList v)
 {
     value = v;
 }