public void FindOutWH() { string rows = Context.Request.Form["rows"]; string page = Context.Request.Form["page"]; int count = _bal.FindOrderDetailCount("2"); IList <OrderDetail> ods = _bal.FindOrderDetail(rows, page, "2"); if (ods != null & ods.Count > 0) { foreach (OrderDetail od in ods) { int inWH = od.InQuantity == null ? 0 : Convert.ToInt32(od.InQuantity); int outWH = od.OutQuantity == null ? 0 : Convert.ToInt32(od.OutQuantity); od.InQuantity = inWH; od.OutQuantity = outWH; int stock = inWH - outWH; od.MEMO = stock.ToString(); } } Dictionary <String, Object> map = new Dictionary <String, Object>(); map.Add("total", count); map.Add("rows", ods); Context.Response.Write(JsonConvert.SerializeObject(map)); }