• 多条件分页存储过程控制器写法


    public PageList<StudentsInfo> Page(string Name, string Start_Time, string End_Time, int Grade_TypeId, int id = 0)
            {
                ViewBag.Grade_Id = new SelectList(studentsbll.Grade_TypeList(), "Grade_Id", "Grade_Name");

                StringBuilder strb = new StringBuilder();
                strb.Append(" 1=1 ");
                if (!string.IsNullOrEmpty(Name))
                {
                    strb.Append(" and Name like '%" + Name + "%'");
                }
                if (!string.IsNullOrEmpty(Start_Time) && !string.IsNullOrEmpty(End_Time))
                {
                    strb.Append(" and(Start_Time between'" + Start_Time + "'and'" + End_Time + "')");
                }
                if (Grade_TypeId != 0)
                {
                    strb.Append(" and a.Grade_Id=" + Grade_TypeId);
                }
                ParamModel parammodel = new ParamModel()
                {
                    TableName = "StudentsInfo a inner join Grade_Type b on a.Grade_Id=b.Grade_Id",
                    IndexCol = "Id",
                    PageSize = 3,
                    PageIndex = id,
                    OrderCol = "Id desc",
                    StrWhere = strb.ToString(),
                    Columns = "*"
                };
                var list = studentsbll.GetStudentInfos(parammodel);
                ViewBag.PageIndex = id;
                ViewBag.TotalPage = list.TotalCount % parammodel.PageSize != 0 ? list.TotalCount / parammodel.PageSize + 1 : parammodel.PageSize;
                return list;
            }

  • 相关阅读:
    SQL SERVER XML 学习总结
    Azkaban2官方配置文档
    I.MX6 Android CAN 命令行测试
    nginx 静态网站配置
    nginx php 配置
    uwsgi 配置 初试
    django 初试
    Ubuntu Nginx uwsgi django 初试
    I.MX6 天嵌 E9 U-boot menu hacking
    Ubuntu 搭建 LAMP 服务器
  • 原文地址:https://www.cnblogs.com/jcy1/p/9524113.html
Copyright © 2020-2023  润新知