Exemplo n.º 1
0
        /// <summary>
        /// 获取EasyUIRequest对应的分页数据
        /// </summary>
        /// <param name="request"></param>
        /// <param name="args"></param>
        /// <param name="sql"></param>
        /// <returns></returns>
        public MVCPagerData GetPagerData(MVCRequest request, object args, string sql)
        {
            ExecSqlQuery queryEr = MVCNHibernateHelp.BuildPager(request, args, sql);

            queryEr.Sql = sql;
            return(GetPagerData(request, queryEr));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取所有数据
        /// </summary>
        /// <param name="request"></param>
        /// <param name="queryEr"></param>
        /// <param name="sql"></param>
        /// <returns></returns>
        public IList GetAllData(MVCRequest request, IDictionary <string, object> args, string sql)
        {
            ExecSqlQuery queryEr = MVCNHibernateHelp.BuildSqlQuery(args, sql);
            SqlPart      sqlPart = MVCNHibernateHelp.RefactorToSqlPart(request, sql);

            return(GetData(queryEr, sqlPart));
        }
        /// <summary>
        /// Build一个分页用的Pager
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static ExecSqlQuery BuildPager(MVCRequest request)
        {
            SqlPager queryEr = new SqlPager();

            queryEr.FirstResult = request.Offset;
            queryEr.MaxResults  = request.Rows;
            return(queryEr);
        }
        /// <summary>
        /// 将sql+request表达的部分,重新构建sql,考虑NHibernate参数为:的情况
        /// </summary>
        /// <param name="request"></param>
        /// <param name="sql"></param>
        /// <returns></returns>
        public static SqlPart RefactorToSqlPart(MVCRequest request, string sql)
        {
            string  sqlCopy = sql.Replace(":", "@");
            SqlPart sqlPart = MVCRequestHelp.RefactorToSqlPart(request, sqlCopy);

            sqlPart = ConvertSqlPart(sqlPart);
            return(sqlPart);
        }
Exemplo n.º 5
0
 /// <summary>
 /// 获取EasyUIRequest对应的分页数据
 /// </summary>
 /// <param name="request"></param>
 /// <param name="queryEr"></param>
 /// <returns></returns>
 public MVCPagerData GetPagerData(MVCRequest request, ExecSqlQuery queryEr)
 {
     #region 数据部分
     string  sql      = queryEr.Sql;
     SqlPart sqlPart  = MVCNHibernateHelp.RefactorToSqlPart(request, sql);
     IList   listData = GetData(queryEr, sqlPart);
     #endregion
     #region count行数部分
     //默认行数
     int total = GetCount(queryEr, sqlPart);
     #endregion
     return(new MVCPagerData {
         rows = listData, total = total
     });
 }
        /// <summary>
        /// Build一个分页用的Pager
        /// </summary>
        /// <param name="request"></param>
        /// <param name="args"></param>
        /// <param name="sql"></param>
        /// <param name="queryEr">默认是一个分页的SqlPager类型</param>
        /// <returns></returns>
        public static ExecSqlQuery BuildPager(MVCRequest request, object args, string sql = null)
        {
            ExecSqlQuery queryEr = BuildPager(request);

            return(BuildSqlQuery(args, sql, queryEr));
        }