public HttpResponseBase Getfreight() { string json = string.Empty; Aseld q = new Aseld(); string fre; try { _iasdMgr = new AseldMgr(mySqlConnectionString); if (!String.IsNullOrEmpty(Request.Params["number"]))//如果是新增 { q.ord_id = Convert.ToInt32(Request.Params["number"]); } fre = _iasdMgr.Getfreight(q.ord_id.ToString()); if (!string.IsNullOrEmpty(fre)) { fre = fre.Substring(0, 1); } json = "{success:true,fre:'" + fre + "'}";//返回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; }