/
ShopItemList.ashx.cs
78 lines (69 loc) · 2.13 KB
/
ShopItemList.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
73
74
75
76
77
78
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 System.Collections.Specialized;
using System.Collections.Generic;
using SqlDataProvider.Data;
using Bussiness;
using Road.Flash;
using System.IO;
namespace Tank.Request
{
/// <summary>
/// Summary description for $codebehindclassname$
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class ShopItemList : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
if (csFunction.ValidAdminIP(context.Request.UserHostAddress))
{
context.Response.Write(Bulid(context));
}
else
{
context.Response.Write("IP is not valid!");
}
}
public static string Bulid(HttpContext context)
{
bool value = false;
string message = "Fail!";
XElement result = new XElement("Result");
try
{
using (ProduceBussiness db = new ProduceBussiness())
{
XElement Store = new XElement("Store");
ShopItemInfo[] shop = db.GetALllShop();
foreach (ShopItemInfo s in shop)
{
Store.Add(FlashUtils.CreateShopInfo(s));
}
result.Add(Store);
value = true;
message = "Success!";
}
}
catch
{ }
result.Add(new XAttribute("value", value));
result.Add(new XAttribute("message", message));
return csFunction.CreateCompressXml(context, result, "ShopItemList", true);
}
public bool IsReusable
{
get
{
return false;
}
}
}
}