Esempio n. 1
0
        /// <summary>
        /// 根据条件查询数据库,并返回DataTable集合(用于分页数据显示)
        /// </summary>
        /// <param name="condition">查询的条件</param>
        /// <param name="pagerInfo">分页实体</param>
        /// <param name="fieldToSort">排序字段</param>
        /// <param name="desc">是否降序</param>
        /// <returns>指定DataTable的集合</returns>
        public virtual DataTable FindToDataTableWithPager2(string condition, ref PagerInfo pagerInfo, string fieldToSort, bool desc)
        {
            var    action   = "FindToDataTableWithPager2";
            string url      = GetTokenUrl(action) + string.Format("&fieldToSort={0}&desc={1}&condition={2}", fieldToSort.UrlEncode(), desc, condition.UrlEncode());
            var    postData = pagerInfo.ToJson();

            DataTable     result = new DataTable();
            PageTableList list   = JsonHelper <PageTableList> .ConvertJson(url, postData);

            if (list != null)
            {
                pagerInfo.RecordCount = list.total_count;//修改总记录数
                result = list.list;
            }
            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// 根据条件,从视图里面获取记录
        /// </summary>
        /// <param name="viewName">视图名称</param>
        /// <param name="condition">查询条件</param>
        /// <param name="sortField">排序字段</param>
        /// <param name="isDescending">是否为降序</param>
        /// <param name="pagerInfo">分页条件</param>
        /// <returns></returns>
        public virtual DataTable FindByViewWithPager(string viewName, string condition, string sortField, bool isDescending, PagerInfo pagerInfo)
        {
            var    action   = "FindByViewWithPager";
            string url      = GetTokenUrl(action) + string.Format("&viewName={0}&condition={1}&sortField={2}&isDescending={3}", viewName.UrlEncode(), condition.UrlEncode(), sortField.UrlEncode(), isDescending);
            var    postData = pagerInfo.ToJson();

            DataTable     result = new DataTable();
            PageTableList list   = JsonHelper <PageTableList> .ConvertJson(url, postData);

            if (list != null)
            {
                pagerInfo.RecordCount = list.total_count;//修改总记录数
                result = list.list;
            }
            return(result);
        }
Esempio n. 3
0
        /// <summary>
        /// 根据分页条件,返回DataSet对象
        /// </summary>
        /// <param name="pagerInfo">分页条件</param>
        /// <returns></returns>
        public virtual DataTable GetAllToDataTableWithPager(ref PagerInfo pagerInfo)
        {
            var    action   = "GetAllToDataTableWithPager";
            string url      = GetTokenUrl(action);
            var    postData = pagerInfo.ToJson();

            DataTable     result = new DataTable();
            PageTableList list   = JsonHelper <PageTableList> .ConvertJson(url, postData);

            if (list != null)
            {
                pagerInfo.RecordCount = list.total_count;//修改总记录数
                result = list.list;
            }
            return(result);
        }