You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
3.0 KiB
C#

using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.CompilerServices;
using System.Web;
using System.Web.Script.Serialization;
using TradeData;
using TradeModel;
namespace TradeManage
{
public class GetOrder : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
string str4;
context.Response.ContentType = "text/plain";
string str = context.Request.QueryString["Method"];
int shopId = Convert.ToInt32(context.Request.QueryString["ShopId"]);
JavaScriptSerializer serializer = new JavaScriptSerializer();
string s = "";
SyncDataModel model = new SyncDataModel();
string str3 = new StreamReader(context.Request.InputStream).ReadToEnd();
if (str == "GetOrder")
{
List<API_OrderInfo> list = API_OrderInfoService.GetListForShop3(shopId);
List<API_OrderGoods> listOrderGoods = API_OrderInfoService.GetListOrderGoods(shopId);
if (list != null)
{
using (List<API_OrderInfo>.Enumerator enumerator = list.GetEnumerator())
{
Predicate<API_OrderGoods> match = null;
API_OrderInfo omd;
while (enumerator.MoveNext())
{
omd = enumerator.Current;
if (listOrderGoods != null)
{
if (match == null)
{
match = n => n.OrderId == omd.OrderId;
}
List<API_OrderGoods> list3 = listOrderGoods.FindAll(match);
if (list3 != null)
{
omd.ListModel = list3;
}
}
}
}
}
str4 = serializer.Serialize(list);
model.Result = "1";
model.Data = str4;
}
else if (str == "UpdateOrder")
{
API_OrderInfoService.UpdateOrderState(shopId);
str4 = "修改成功";
model.Result = "1";
model.Data = str4;
}
else
{
model.Result = "0";
model.Data = "没有找到Method参数的方法名";
}
s = serializer.Serialize(model);
context.Response.Write(s);
}
public bool IsReusable
{
get
{
return false;
}
}
public class SyncDataModel
{
public string Code { get; set; }
public string Data { get; set; }
public string Data2 { get; set; }
public string Result { get; set; }
}
}
}