-
Notifications
You must be signed in to change notification settings - Fork 43
/
NPCInfoList.ashx.cs
72 lines (62 loc) · 1.88 KB
/
NPCInfoList.ashx.cs
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using System;
using System.Collections;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using Bussiness;
using Road.Flash;
using log4net;
using System.Reflection;
using SqlDataProvider.Data;
namespace Tank.Request
{
/// <summary>
/// Summary description for $codebehindclassname$
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class NPCInfoList : IHttpHandler
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public void ProcessRequest(HttpContext context)
{
context.Response.Write(Bulid(context));
}
public static string Bulid(HttpContext context)
{
bool value = false;
string message = "Fail!";
XElement result = new XElement("Result");
try
{
using (ProduceBussiness db = new ProduceBussiness())
{
NpcInfo[] infos = db.GetAllNPCInfo();
foreach (NpcInfo info in infos)
{
result.Add(FlashUtils.CreatNPCInfo(info));
}
value = true;
message = "Success!";
}
}
catch (Exception ex)
{
log.Error("Load NPCInfoList is fail!", ex);
}
result.Add(new XAttribute("value", value));
result.Add(new XAttribute("message", message));
return csFunction.CreateCompressXml(context, result, "NPCInfoList", true);
}
public bool IsReusable
{
get
{
return false;
}
}
}
}