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