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 list = API_OrderInfoService.GetListForShop3(shopId); List listOrderGoods = API_OrderInfoService.GetListOrderGoods(shopId); if (list != null) { using (List.Enumerator enumerator = list.GetEnumerator()) { Predicate match = null; API_OrderInfo omd; while (enumerator.MoveNext()) { omd = enumerator.Current; if (listOrderGoods != null) { if (match == null) { match = n => n.OrderId == omd.OrderId; } List 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; } } } }