50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Data;
|
|
using System.Web;
|
|
using Zhaizj.Framework;
|
|
using Zhaizj.Framework.Data;
|
|
using Zhaizj.Framework.Web;
|
|
|
|
namespace Zhaizj.Framework.ORM.Operation {
|
|
|
|
internal class FindPageOperation {
|
|
|
|
private static readonly ILog logger = LogManager.GetLogger( typeof( FindPageOperation ) );
|
|
|
|
public static IList FindPage( ObjectInfo state ) {
|
|
return FindPage( state, "" );
|
|
}
|
|
|
|
public static IList FindPage( ObjectInfo state, String queryString ) {
|
|
|
|
// see: Zhaizj.Framework/Zhaizj.Framework/Web/Mvc/Routes/RouteTool.cs, line 211
|
|
|
|
if (state.Pager.getCurrent() <= 0) {
|
|
int page = CurrentRequest.getCurrentPage();
|
|
state.Pager.setCurrent( page );
|
|
}
|
|
|
|
if ( queryString != null && queryString.ToLower().StartsWith( "order " )) {
|
|
queryString = " " + queryString;
|
|
}
|
|
|
|
PageCondition pc = new PageCondition();
|
|
pc.ConditionStr = queryString;
|
|
pc.Property = state.Includer.SelectedProperty;
|
|
pc.CurrentPage = state.Pager.getCurrent();
|
|
pc.Size = state.Pager.getSize();
|
|
pc.OrderStr = state.Order;
|
|
pc.Pager = state.Pager;
|
|
|
|
String sql = new SqlBuilder( state.EntityInfo ).GetPageSql( pc );
|
|
return EntityPropertyUtil.FindList( state, sql );
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|