-
Notifications
You must be signed in to change notification settings - Fork 43
/
LoadUserItems.ashx.cs
68 lines (59 loc) · 1.85 KB
/
LoadUserItems.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
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 log4net;
using SqlDataProvider.Data;
using Bussiness;
using System.Reflection;
namespace Tank.Request
{
/// <summary>
/// Summary description for $codebehindclassname$
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class LoadUserItems : IHttpHandler
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public void ProcessRequest(HttpContext context)
{
bool value = false;
string message = "Fail!";
XElement result = new XElement("Result");
try
{
int userid = int.Parse(context.Request.Params["ID"]);
using (PlayerBussiness db = new PlayerBussiness())
{
ItemInfo[] items = db.GetUserItem(userid);
foreach (ItemInfo item in items)
{
result.Add(Road.Flash.FlashUtils.CreateGoodsInfo(item));
}
}
value = true;
message = "Success!";
}
catch (Exception ex)
{
log.Error("LoadUserItems", ex);
}
result.Add(new XAttribute("value", value));
result.Add(new XAttribute("message", message));
context.Response.ContentType = "text/plain";
context.Response.Write(result.ToString(false));
}
public bool IsReusable
{
get
{
return false;
}
}
}
}