Пример #1
0
        public IDynamicTableObject[] take(int count)
        {
            var query = new Kooboo.IndexedDB.Dynamic.Query(this.ktable.table);

            if (!string.IsNullOrEmpty(this.SearchCondition))
            {
                var filter = query.ParserFilter(this.SearchCondition);
                query.items = filter;
            }
            else
            {
                //throw new Exception("You do not any search condition");
            }

            if (!string.IsNullOrEmpty(this.OrderByField))
            {
                if (this.Ascending)
                {
                    query.OrderByAscending(this.OrderByField);
                }
                else
                {
                    query.OrderByDescending(this.OrderByField);
                }
            }

            var result = query.Skip(this.skipcount).Take(count).ToArray();

            return(DynamicTableObject.CreateList(result, this.ktable.table, this.ktable.context));
        }
Пример #2
0
        public IDynamicTableObject GetByLog(long LogId)
        {
            var log = this.table.OwnerDatabase.Log.Get(LogId);

            if (log != null)
            {
                var logdata = this.table.GetLogData(log);
                return(DynamicTableObject.Create(logdata, this.table, this.context));
            }
            return(null);
        }
Пример #3
0
        public static DynamicTableObject[] CreateList(IDictionary <string, object>[] list, Table TargetTable, RenderContext context)
        {
            int len = list.Length;

            DynamicTableObject[] result = new DynamicTableObject[len];

            for (int i = 0; i < len; i++)
            {
                result[i] = Create(list[i], TargetTable, context);
            }
            return(result);
        }
Пример #4
0
        public IDynamicTableObject[] all()
        {
            var all = this.table.All();

            return(DynamicTableObject.CreateList(all.ToArray(), this.table, this.context));
        }
Пример #5
0
        public IDynamicTableObject get(object id)
        {
            var obj = this.table.Get(id);

            return(DynamicTableObject.Create(obj, this.table, this.context));
        }
Пример #6
0
        public IDynamicTableObject[] findAll(string query)
        {
            var list = this.table.Query.FindAll(query);

            return(DynamicTableObject.CreateList(list.ToArray(), this.table, this.context));
        }
Пример #7
0
        public IDynamicTableObject[] findAll(string field, object value)
        {
            var list = this.table.Query.Where(field, Kooboo.IndexedDB.Query.Comparer.EqualTo, value).SelectAll();

            return(DynamicTableObject.CreateList(list.ToArray(), this.table, this.context));
        }
Пример #8
0
        public IDynamicTableObject find(string fieldName, object matchValue)
        {
            var obj = this.table.Query.Where(fieldName, Kooboo.IndexedDB.Query.Comparer.EqualTo, matchValue).FirstOrDefault();

            return(DynamicTableObject.Create(obj, this.table, this.context));
        }
Пример #9
0
        public IDynamicTableObject find(string query)
        {
            var result = this.table.Query.Find(query);

            return(DynamicTableObject.Create(result, this.table, this.context));
        }