//條碼轉換為商品編號 public string Getprodbyupc(string jsonStr) { try { if (!string.IsNullOrEmpty(Request.Params["item_id"])) { string prodid = Request.Params["item_id"]; if (prodid.Length == 6) { jsonStr = prodid; } else { _IiplasMgr = new IplasMgr(mySqlConnectionString); DataTable dt = _IiplasMgr.Getprodbyupc(prodid); if (dt.Rows.Count > 0) { jsonStr = dt.Rows[0]["item_id"].ToString(); } else { jsonStr = string.Empty; } } } } 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); jsonStr = "{success:false}"; } return jsonStr; }