Exemplo n.º 1
0
 protected void btnPayVoucher_Click(object sender, EventArgs e)
 {
     VoucherBiz biz = new VoucherBiz();
     int voucherID = PageTools.ParseInt(txtVoucherID.Text);
     decimal amount = PageTools.ParseDecimal(txtVoucherAmount.Text);
     int orderID = PageTools.GetSavedId("OrderId", null);
     if (biz.CheckVoucherPaymentValid(voucherID, amount))
     {
         int pid = DoPayment(txtVoucherAmount.Text, 5, "By Voucher: " + voucherID.ToString());
         if (pid > 0)
         {
             if (!biz.VoucherPayment(PageLogic.GetCurrentUserLogin(), voucherID, amount, orderID))
             {
                 lbMsg.Text = "Voucher Payment fail! Please check.";
             }
             lbVoucherAmount.Text = "";
             lbVoucherDetail.Text = "";
             txtVoucherAmount.Text = "0.0";
             txtVoucherID.Text = "";
             txtVoucherAmount.Enabled = btnPayVoucher.Enabled = false;
             RefreshControl();
             DoAfterPayment();
         }
     }
     else
     {
         lbMsg.Text = "付款失敗,請檢查。";
     }
 }