public CreateOrder ( int restaurantId, int tableId, decimal price, List |
||
restaurantId | int | |
tableId | int | |
price | decimal | |
listOrderList | List |
|
Résultat | int |
public void ProcessRequest(HttpContext context) { try { var tableId = Helper.ParseInt(context.Request.QueryString["tid"]); var restaurantId = Helper.ParseInt(context.Request.QueryString["rid"]); var orderData = context.Request.Form["orderData"]; var price = Helper.ParseDecimal(context.Request.Form["price"]); IOrder orderBiz = new OrderBiz(); var condition = new OrderMainEntity(); condition.RESTAURANT_ID = restaurantId; condition.TABLE_ID = tableId; condition.ORDER_FLAG = "1"; var list = orderBiz.GetOrderMainEntityList(condition); if (list != null && list.Count > 0) { context.Response.Write("{\"success\":0,\"msg\":\"上个订单还未结束,不能创建新的订单,请重新重新刷新页面!\"}"); return; } var list2 = JsonToObjects(orderData); if (list2 != null && list2.Count > 0) { var orderId = orderBiz.CreateOrder(restaurantId, tableId, price, list2); context.Response.Write("{\"success\":1,\"id\":" + orderId.ToString() + "}"); } } catch (Exception ex) { context.Response.Write("{\"success\":0,\"msg\":\"订单数据有误,原因是" + ex.ToString() + "!\"}"); } }