using System.Collections.Generic;
using System.Linq;
using System.Data.SqlClient;
using System.Data.Entity;
namespace GTek.Safe.BSite.BusinessModules.CommonClass
{
public class SqlPageService
{
public static Response<IEnumerable<T>> CommonPagedQuery<T>(DbContext context, string withSql, int pageIndex, int pageSize, ICollection<Sort> Sort, string whereSql = null, string extSelect = null, string extFrom = null)
{
Response<IEnumerable<T>> rs = new Response<IEnumerable<T>>();
withSql = string.Format(@"with tabs as (select t.*,row_number() over(order by {1}) as rowindex from ({0})t {2})",
withSql,
string.Join(",", Sort.Select(p => string.Format("{0} {1}", p.Key, p.Value))),
using System.Linq;
using System.Data.SqlClient;
using System.Data.Entity;
namespace GTek.Safe.BSite.BusinessModules.CommonClass
{
public class SqlPageService
{
public static Response<IEnumerable<T>> CommonPagedQuery<T>(DbContext context, string withSql, int pageIndex, int pageSize, ICollection<Sort> Sort, string whereSql = null, string extSelect = null, string extFrom = null)
{
Response<IEnumerable<T>> rs = new Response<IEnumerable<T>>();
withSql = string.Format(@"with tabs as (select t.*,row_number() over(order by {1}) as rowindex from ({0})t {2})",
withSql,
string.Join(",", Sort.Select(p => string.Format("{0} {1}", p.Key, p.Value))),