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() + "!\"}"); } }
private void BindData() { //绑定菜单列表 IFood foodBiz = new FoodBiz(); var dt = foodBiz.GetFoodDataTable(RestaurantId); repeater2.DataSource = dt; repeater2.DataBind(); //绑定菜单类型列表 var strFoodId = string.Empty; var listFoodType = new List<FoodTypeEntity>(); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { if (!strFoodId.Contains(dr["FOOD_TYPE_ID"].ToString() + "|")) { strFoodId += dr["FOOD_TYPE_ID"].ToString() + "|"; listFoodType.Add(new FoodTypeEntity() { FOOD_TYPE_ID = base.ParseInt(dr["FOOD_TYPE_ID"].ToString()), FOOD_TYPE_NAME = dr["FOOD_TYPE_NAME"].ToString() }); } } } repeater1.DataSource = listFoodType; repeater1.DataBind(); //获取是否已经点过菜 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) this.hOrderId.Value = list[0].ORDER_ID.ToString(); }