4
4
using System . Net ;
5
5
using System . Web ;
6
6
using YanZhiwei . DotNet3 . _5 . Utilities . Model ;
7
- using YanZhiwei . DotNet3 . _5 . Utilities . WebForm . JqueryPlugin ;
7
+ using YanZhiwei . DotNet3 . _5 . Utilities . WebForm . Jquery ;
8
8
using YanZhiwei . JavaScript . Utilities . Model ;
9
9
10
10
namespace YanZhiwei . JavaScript . Utilities . BackHandler
@@ -16,7 +16,7 @@ public class BaseHandler : IHttpHandler
16
16
{
17
17
public static IEnumerable < Person > GetPersons ( )
18
18
{
19
- for ( int i = 0 ; i < 57 ; i ++ )
19
+ for ( int i = 0 ; i < 57 ; i ++ )
20
20
{
21
21
yield return new Person
22
22
{
@@ -25,31 +25,28 @@ public static IEnumerable<Person> GetPersons()
25
25
} ;
26
26
}
27
27
}
28
-
28
+
29
29
public void ProcessRequest ( HttpContext context )
30
30
{
31
31
context . ExecutePageQuery < Person > ( ( pageLength , pageIndex , orderIndex , orderBy ) =>
32
32
{
33
33
var persons = GetPersons ( ) ;
34
34
Func < Person , object > order = p =>
35
35
{
36
- if ( orderIndex == 0 )
36
+ if ( orderIndex == 0 )
37
37
{
38
38
return p . Id ;
39
39
}
40
-
41
40
return p . Name ;
42
41
} ;
43
-
44
- if ( "desc" == orderBy )
42
+ if ( "desc" == orderBy )
45
43
{
46
44
persons = persons . OrderByDescending ( order ) ;
47
45
}
48
46
else
49
47
{
50
48
persons = persons . OrderBy ( order ) ;
51
49
}
52
-
53
50
//错误测试
54
51
//DataTablePageResult result = new DataTablePageResult();
55
52
//result.ExecuteMessage = "测试错误";
@@ -68,8 +65,10 @@ public void ProcessRequest(HttpContext context)
68
65
// var iDisplayStart = int.Parse(context.Request["iDisplayStart"]);
69
66
// var iSortCol = int.Parse(context.Request["iSortCol_0"]);
70
67
// var iSortDir = context.Request["sSortDir_0"];
68
+
71
69
// // Fetch the data from a repository (in my case in-memory)
72
70
// var persons = GetPersons();
71
+
73
72
// // Define an order function based on the iSortCol parameter
74
73
// Func<Person, object> order = p =>
75
74
// {
@@ -79,6 +78,7 @@ public void ProcessRequest(HttpContext context)
79
78
// }
80
79
// return p.Name;
81
80
// };
81
+
82
82
// // Define the order direction based on the iSortDir parameter
83
83
// if ("desc" == iSortDir)
84
84
// {
@@ -88,6 +88,7 @@ public void ProcessRequest(HttpContext context)
88
88
// {
89
89
// persons = persons.OrderBy(order);
90
90
// }
91
+
91
92
// // prepare an anonymous object for JSON serialization
92
93
// var result = new
93
94
// {
@@ -97,13 +98,14 @@ public void ProcessRequest(HttpContext context)
97
98
// .Skip(iDisplayStart)
98
99
// .Take(iDisplayLength)
99
100
// };
101
+
100
102
// //var serializer = new JavaScriptSerializer();
101
103
//// var json = SerializationHelper.JsonSerialize(result);// serializer.Serialize(result);
102
104
// context.CreateResponse(result, System.Net.HttpStatusCode.OK);
103
105
// //context.Response.ContentType = "application/json";
104
106
// //context.Response.Write(json);
105
107
}
106
-
108
+
107
109
public bool IsReusable
108
110
{
109
111
get
@@ -112,6 +114,6 @@ public bool IsReusable
112
114
}
113
115
}
114
116
}
115
-
116
-
117
+
118
+
117
119
}
0 commit comments