Exemplo n.º 1
0
        public string Search(string regName, string key, string ds, int?pageSize, int?pageIndex)
        {
            var pagination = new Pagination();

            pagination.PageSize  = pageSize ?? 28;
            pagination.PageIndex = pageIndex ?? 0;
            SetPostDataSet(ds);
            key = key ?? "";
            var dt = GetCodeTableInstance(regName);

            pagination.AppendToDataSet(PostDataSet, regName);
            var res = dt.Search(PostDataSet, key);
            //pagination.TotalCount = res.Count();
            SelectorModel model = new SelectorModel();

            model.List  = res.ToList();
            model.Index = pagination.PageIndex;
            model.Size  = pagination.PageSize;
            model.Total = PostDataSet.Tables[regName + "_PAGER"].Rows[0]["TotalCount"].Value <int>();

            //res = res.Skip((pagination.PageIndex - 1) * pagination.PageSize).Take(pagination.PageSize).ToList();
            return(ReturnJson(model == null ? new SelectorModel() : model));
        }