Esempio n. 1
0
 protected void QueryGridView_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "refund")
     {
         int    rowIndex = Convert.ToInt32(e.CommandArgument);
         string billNo   = bills[rowIndex].billNo;
         int    totalFee = bills[rowIndex].totalFee;
         if (typeChannel == "Ali")
         {
             BCRefundResult refundResult = BCPay.BCRefundByChannel(BCPay.RefundChannel.ALI.ToString(), DateTime.Today.ToString("yyyyMMdd") + BCUtil.GetUUID().Substring(0, 8), billNo, totalFee, null);
             if (refundResult.resultCode == 0)
             {
                 Response.Redirect(refundResult.url);
             }
             else
             {
                 Response.Write("<span style='color:#00CD00;font-size:20px'>" + refundResult.resultCode + "</span><br/>");
                 Response.Write("<span style='color:#00CD00;font-size:20px'>" + refundResult.resultMsg + "</span><br/>");
                 Response.Write("<span style='color:#00CD00;font-size:20px'>" + refundResult.errDetail + "</span><br/>");
             }
         }
         if (typeChannel == "WX")
         {
             BCRefundResult refundResult = BCPay.BCRefundByChannel(BCPay.RefundChannel.WX.ToString(), DateTime.Today.ToString("yyyyMMdd") + BCUtil.GetUUID().Substring(0, 8), billNo, totalFee, null);
             if (refundResult.resultCode == 0)
             {
                 Response.Write("<script>alert('退款成功!')</script>");
             }
             else
             {
                 Response.Write("<span style='color:#00CD00;font-size:20px'>" + refundResult.resultCode + "</span><br/>");
                 Response.Write("<span style='color:#00CD00;font-size:20px'>" + refundResult.resultMsg + "</span><br/>");
                 Response.Write("<span style='color:#00CD00;font-size:20px'>" + refundResult.errDetail + "</span><br/>");
             }
         }
         if (typeChannel == "UN")
         {
             BCRefundResult refundResult = BCPay.BCRefundByChannel(BCPay.RefundChannel.UN.ToString(), DateTime.Today.ToString("yyyyMMdd") + BCUtil.GetUUID().Substring(0, 8), billNo, totalFee, null);
             if (refundResult.resultCode == 0)
             {
                 Response.Write("<script>alert('退款成功!')</script>");
             }
             else
             {
                 Response.Write("<span style='color:#00CD00;font-size:20px'>" + refundResult.resultCode + "</span><br/>");
                 Response.Write("<span style='color:#00CD00;font-size:20px'>" + refundResult.resultMsg + "</span><br/>");
                 Response.Write("<span style='color:#00CD00;font-size:20px'>" + refundResult.errDetail + "</span><br/>");
             }
         }
     }
 }
Esempio n. 2
0
 protected void QueryGridView_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "refund")
     {
         int    rowIndex = Convert.ToInt32(e.CommandArgument);
         string billNo   = bills[rowIndex].billNo;
         int    totalFee = bills[rowIndex].totalFee;
         if (typeChannel == "Ali")
         {
             BCRefund refund = new BCRefund(billNo, DateTime.Today.ToString("yyyyMMdd") + BCUtil.GetUUID().Substring(0, 8), totalFee);
             refund.channel = BCPay.RefundChannel.ALI.ToString();
             try
             {
                 refund = BCPay.BCRefundByChannel(refund);
                 Response.Redirect(refund.url);
             }
             catch (Exception excption)
             {
                 Response.Write("<span style='color:#00CD00;font-size:20px'>" + excption.Message + "</span><br/>");
             }
         }
         if (typeChannel == "WX")
         {
             BCRefund refund = new BCRefund(billNo, DateTime.Today.ToString("yyyyMMdd") + BCUtil.GetUUID().Substring(0, 8), totalFee);
             refund.channel = BCPay.RefundChannel.WX.ToString();
             try
             {
                 refund = BCPay.BCRefundByChannel(refund);
                 Response.Write("<script>alert('退款成功!')</script>");
             }
             catch (Exception excption)
             {
                 Response.Write("<span style='color:#00CD00;font-size:20px'>" + excption.Message + "</span><br/>");
             }
         }
         if (typeChannel == "UN")
         {
             BCRefund refund = new BCRefund(billNo, DateTime.Today.ToString("yyyyMMdd") + BCUtil.GetUUID().Substring(0, 8), totalFee);
             refund.channel = BCPay.RefundChannel.UN.ToString();
             try
             {
                 refund = BCPay.BCRefundByChannel(refund);
                 Response.Write("<script>alert('退款成功!')</script>");
             }
             catch (Exception excption)
             {
                 Response.Write("<span style='color:#00CD00;font-size:20px'>" + excption.Message + "</span><br/>");
             }
         }
         if (typeChannel == "JD")
         {
             BCRefund refund = new BCRefund(billNo, DateTime.Today.ToString("yyyyMMdd") + BCUtil.GetUUID().Substring(0, 8), totalFee);
             refund.channel = BCPay.RefundChannel.JD.ToString();
             try
             {
                 refund = BCPay.BCRefundByChannel(refund);
                 Response.Write("<script>alert('退款成功!')</script>");
             }
             catch (Exception excption)
             {
                 Response.Write("<span style='color:#00CD00;font-size:20px'>" + excption.Message + "</span><br/>");
             }
         }
         if (typeChannel == "YEE")
         {
             BCRefund refund = new BCRefund(billNo, DateTime.Today.ToString("yyyyMMdd") + BCUtil.GetUUID().Substring(0, 8), totalFee);
             refund.channel = BCPay.RefundChannel.YEE.ToString();
             try
             {
                 refund = BCPay.BCRefundByChannel(refund);
                 Response.Write("<script>alert('退款成功!')</script>");
             }
             catch (Exception excption)
             {
                 Response.Write("<span style='color:#00CD00;font-size:20px'>" + excption.Message + "</span><br/>");
             }
         }
         if (typeChannel == "KUAIQIAN")
         {
             BCRefund refund = new BCRefund(billNo, DateTime.Today.ToString("yyyyMMdd") + BCUtil.GetUUID().Substring(0, 8), totalFee);
             refund.channel = BCPay.RefundChannel.KUAIQIAN.ToString();
             try
             {
                 refund = BCPay.BCRefundByChannel(refund);
                 Response.Write("<script>alert('退款成功!')</script>");
             }
             catch (Exception excption)
             {
                 Response.Write("<span style='color:#00CD00;font-size:20px'>" + excption.Message + "</span><br/>");
             }
         }
         if (typeChannel == "BC_GATEWAY")
         {
             BCRefund refund = new BCRefund(billNo, DateTime.Today.ToString("yyyyMMdd") + BCUtil.GetUUID().Substring(0, 8), totalFee);
             refund.channel = BCPay.RefundChannel.BC.ToString();
             try
             {
                 refund = BCPay.BCRefundByChannel(refund);
                 Response.Write("<script>alert('退款成功!')</script>");
             }
             catch (Exception excption)
             {
                 Response.Write("<span style='color:#00CD00;font-size:20px'>" + excption.Message + "</span><br/>");
             }
         }
     }
 }