forked from jackieli123723/JavaScript.Utilities
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQueryHandler.ashx.cs
More file actions
45 lines (42 loc) · 1.33 KB
/
QueryHandler.ashx.cs
File metadata and controls
45 lines (42 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System.Collections.Generic;
using System.Web;
using YanZhiwei.DotNet.Newtonsoft.Json.Utilities;
using YanZhiwei.JavaScript.Utilities.Model;
namespace YanZhiwei.JavaScript.Utilities.BackHandler
{
/// <summary>
/// Summary description for QueryHandler
/// </summary>
public class QueryHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
string _action = context.Request.Params.Get("action");
HanlderQueryPerons(_action, context);
}
private void HanlderQueryPerons(string action, HttpContext context)
{
if (string.Compare(action, "queryperson", true) == 0)
{
List<Person> personList = new List<Person>();
for (ushort i = 0; i < 10; i++)
{
Person _person = new Person();
_person.Id = i;
_person.Age = i;
_person.Name = string.Concat("yanzhiwei", i);
personList.Add(_person);
}
string _jsonString = JsonHelper.Serialize(personList);
context.Response.Write(_jsonString);
}
}
public bool IsReusable
{
get
{
return false;
}
}
}
}