public ActionResult OrderQueryPage(string transaction_id, string out_trade_no) { if (string.IsNullOrEmpty(transaction_id) && string.IsNullOrEmpty(out_trade_no)) { return(Json(new AlertMsg("微信订单号和商户订单号至少填写一个,微信订单号优先!"))); } var alertMsg = new AlertMsg(); //调用订单查询接口,如果内部出现异常则在页面上显示异常原因 try { string result = WxPayApiBiz.OrderQuery(transaction_id, out_trade_no);//调用订单查询业务逻辑 alertMsg.IsSuccess = true; alertMsg.Message = result; } catch (WxPayException ex) { alertMsg.Message = ex.Message; } catch (Exception ex) { alertMsg.Message = ex.Message; } return(Json(alertMsg)); }
protected void submit_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(transaction_id.Text) && string.IsNullOrEmpty(out_trade_no.Text)) { Response.Write("<script LANGUAGE='javascript'>alert('微信订单号和商户订单号至少填写一个,微信订单号优先!');</script>"); return; } //调用订单查询接口,如果内部出现异常则在页面上显示异常原因 try { string result = WxPayApiBiz.OrderQuery(transaction_id.Text, out_trade_no.Text);//调用订单查询业务逻辑 Response.Write("<span style='color:#00CD00;font-size:20px'>" + result + "</span>"); } catch (WxPayException ex) { Response.Write("<span style='color:#FF0000;font-size:20px'>" + ex.ToString() + "</span>"); } catch (Exception ex) { Response.Write("<span style='color:#FF0000;font-size:20px'>" + ex.ToString() + "</span>"); } }