public HttpResponseBase GetProdName() { string json = string.Empty; try { _prodMgr = new ProductMgr(mySqlConnectionString); int isTranUint = 0; int pid = 0; int cid = 0; int bid = 0; if (!string.IsNullOrEmpty(Request.Params["product_id"]) && int.TryParse(Request.Params["product_id"], out isTranUint)) { pid = Convert.ToInt32(Request.Params["product_id"]); } if (!string.IsNullOrEmpty(Request.Params["class_id"]) && int.TryParse(Request.Params["class_id"], out isTranUint)) { cid = Convert.ToInt32(Request.Params["class_id"]); } if (!string.IsNullOrEmpty(Request.Params["brand_id"]) && int.TryParse(Request.Params["brand_id"], out isTranUint)) { bid = Convert.ToInt32(Request.Params["brand_id"]); } string prodName = _prodMgr.GetNameForID(pid, cid, bid); if (!string.IsNullOrEmpty(prodName)) { json = "{success:true,\"prod_name\":\"" + prodName + "\"}";//返回json數據 } else { json = "{success:false,\"prod_name\":\"\"}";//返回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,\"prod_name\":\"\"}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }