using System;
using System.Collections.Generic;
using LModel.DTO;
using Newtonsoft.Json;
using System.Data.SqlClient;
using System.Data;
using DBHelper;
 
namespace DAL
{
    public class PageCommon
    {
        public static PageInfo<T> GetPageInfo<T>(ParamModel model)
        {
            SqlParameter[] parms =
            {
                new SqlParameter("@tableName",model.tableName),
                new SqlParameter("@indexCol",model.IndexCol),
                new SqlParameter("@pageSize",model.PageSize),
                new SqlParameter("@pageIndex",model.PageIndex),
                new SqlParameter("@orderCol",model.OrderCol),
                new SqlParameter("@where",model.StrWhere),
                new SqlParameter("@columns",model.Columns),
            };
            ///调用存储过程
            DataSet ds = DbHelperSQL.ExecuteDataset(DbHelperSQL.ConnB2c,CommandType.StoredProcedure, "p_paging",parms);
            //转换类型
            var list = JsonConvert.DeserializeObject<List<T>>(JsonConvert.SerializeObject(ds.Tables[0]));
            //实例分页参数类
            PageInfo<T> pageinfo = new PageInfo<T>();
            pageinfo.listData = list;
            pageinfo.tCount = Convert.ToInt32(ds.Tables[1].Rows[0][0]);
 
            return pageinfo;
        }
    }
}

DAL分页的更多相关文章

  1. C#关于分页显示

    ---<PS:本人菜鸟,大手子还请高台贵手> 以下是我今天在做分页时所遇到的一个分页显示问题,使用拼写SQL的方式写的,同类型可参考哦~ ------------------------- ...

  2. MVC分页

    http://www.cnblogs.com/iamlilinfeng/p/4075292.html 目录 一.Contrl与View数据传递(多表数据) 二.分页控件介绍 三.MVC源码说明 四.源 ...

  3. Linq的分页

    真有趣. C#里面的List对象.set对象,都可以直接使用Linq(这是因为,它们都实现了接口IEnumable?),比如说:Where().OrderBy()什么的.假如有点SQL基础的人,一看这 ...

  4. asp.net sql 分页,,优化 排序 及分页,

    调用代码: <%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix ...

  5. 【转】AspNetPager分页控件用法

    AspNetPager分页控件解决了分页中的很多问题,直接采用该控件进行分页处理,会将繁琐的分页工作变得简单化,下面是我如何使用AspNetPager控件进行分页处理的详细代码: 1.首先到www.w ...

  6. EF 之 MVC 排序,查询,分页 Sorting, Filtering, and Paging For MVC About EF

    最近悟出来一个道理,在这儿分享给大家:学历代表你的过去,能力代表你的现在,学习代表你的将来. 十年河东十年河西,莫欺少年穷 学无止境,精益求精    上篇博客我们学习了EF CodeFirst增删改查 ...

  7. [渣译文] 使用 MVC 5 的 EF6 Code First 入门 系列:排序、筛选和分页

    这是微软官方教程Getting Started with Entity Framework 6 Code First using MVC 5 系列的翻译,这里是第三篇:排序.筛选和分页 原文:Sort ...

  8. 关于MySql的DBHelper类以及数据分页

    前端: <%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix=& ...

  9. 存储过程分页 Ado.Net分页 EF分页 满足90%以上

    存储过程分页: create proc PR_PagerDataByTop @pageIndex int, @pageSize int, @count int out as select top(@p ...

随机推荐

  1. ASP.NET C# 实现实时用户在线

    public static class UserOnline { /// <summary> /// 获取或设置在线列表 /// </summary> public stati ...

  2. 2.SSM整合_多表_一对一或多对一的增删改查

    一对一和多对一配置一样,这里就放到一起. 1.配置文件跟上一章一样,这里就不多写了,主要是Mapper映射文件 多 接口 public interface NewsMapper { public vo ...

  3. C# 对串口的操作

    初始化 串口 SerialPort sp = new SerialPort(); sp.PortName = BasicParameters.IniReadValue(strPath, "C ...

  4. anaconda安装opencv(python)

    1.win10 win10没有安装python,只安装了anaconda,然后使用pip安装opencv-python,版本很新,opencv_python4.0.0的. 网速有点莫名其妙,时快时慢 ...

  5. TCPDF说明文档

    TCPDF说明文档 一.首先调用TCPDF文件 require_once('tcpdf.php'); 二.实例化TCPDF类 页面方向(P =肖像,L =景观).测量(mm).页面格式 $pdf = ...

  6. 关于Tensorflow安装opencv和pygame

    1.安装opencv https://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv C:\ProgramData\Anaconda3\Lib\site-pack ...

  7. 【RL-TCPnet网络教程】第20章 RL-TCPnet之BSD Socket客户端

    第20章      RL-TCPnet之BSD Socket客户端 本章节为大家讲解RL-TCPnet的BSD Socket,学习本章节前,务必要优先学习第18章的Socket基础知识.有了这些基础知 ...

  8. Array.find()和Array.findIndex()

    ES6新增的两个方法,根据回调函数返回作为判断依据,按照数组顺序进行遍历,符合条件(为真)时find()返回该值.findIndex()返回下标. 1.语法 arr.find(callback[, t ...

  9. [Swift]LeetCode87. 扰乱字符串 | Scramble String

    Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrin ...

  10. [Swift]LeetCode503. 下一个更大元素 II | Next Greater Element II

    Given a circular array (the next element of the last element is the first element of the array), pri ...