public void ListCartonInfo() { string rows = Context.Request.Form["rows"]; string page = Context.Request.Form["page"]; string cartonNo = Context.Request.Form["cartonNo"]; string startTime = Context.Request.Form["startTime"]; string endTime = Context.Request.Form["endTime"]; DateTime dtstart = DateTime.Today.AddDays(-7); DateTime dtend = DateTime.Now; if (!string.IsNullOrEmpty(startTime) && !string.IsNullOrEmpty(endTime)) { dtstart = Convert.ToDateTime(startTime); dtend = Convert.ToDateTime(endTime); } PagingResult <CartonInfo> cts = _bal.FindCartonInfo(cartonNo, "", "", dtstart, dtend, rows, page); Dictionary <String, Object> map = new Dictionary <String, Object>(); map.Add("total", cts.ResultCount); map.Add("rows", cts.ResultSet); Context.Response.Write(JsonConvert.SerializeObject(map)); //StringBuilder sb = new StringBuilder(); //sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //sb.Append("<rows>"); //string strstatus = string.Empty; //foreach (CartonInfo o in cts) //{ // sb.Append(string.Format("<row id='{0}'>", o.ID)); // sb.Append(string.Format("<cell>{0}</cell>", o.CSN)); // sb.Append(string.Format("<cell>{0}</cell>", o.OrderNumber)); // sb.Append(string.Format("<cell>{0}</cell>", o.PartsdrawingCode)); // sb.Append(string.Format("<cell>{0}</cell>", o.QualityCode)); // sb.Append(string.Format("<cell>{0}</cell>", o.QUANTITY.ToString())); // sb.Append(string.Format("<cell>{0}</cell>", o.UpdatedBy)); // sb.Append(string.Format("<cell>{0}</cell>", o.UpdatedDate == null ? o.CreatedDate : o.UpdatedDate)); // sb.Append("</row>"); //} //sb.Append("</rows>"); //return sb.ToString(); }