public ActionResult DownloadBillPage(string bill_type, DateTime?bill_date) { var dateStr = (bill_date.HasValue ? bill_date.Value : DateTime.Now).ToString("yyyyMMdd"); var alertMsg = new AlertMsg(); //调用下载对账单接口,如果内部出现异常则在页面上显示异常原因 try { string result = WxPayApiBiz.DownloadBill(dateStr, bill_type); 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(bill_date.Text)) { Response.Write("<script LANGUAGE='javascript'>alert('请输入对账单日期!');</script>"); return; } //调用下载对账单接口,如果内部出现异常则在页面上显示异常原因 try { string result = WxPayApiBiz.DownloadBill(bill_date.Text, bill_type.SelectedValue); 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>"); } }