public HttpResponseBase GetCertificateCategory() { string json = string.Empty; int totalCount = 0; List<CertificateCategoryQuery> stores = new List<CertificateCategoryQuery>(); CertificateCategoryQuery query = new CertificateCategoryQuery(); try { if (!string.IsNullOrEmpty(Request.Params["searchcontent"])) { query.searchcon = Request.Params["searchcontent"].ToString().Trim(); } _inspectionReport = new InspectionReportMgr(mySqlConnectionString); stores = _inspectionReport.GetCertificateCategoryList(query, out totalCount); IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式 timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(stores, Newtonsoft.Json.Formatting.Indented, timeConverter) + "}";//返回json數據 } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }