Exemplo n.º 1
0
    protected void btnRefund_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            com.Omei.BLL.Admin.AdminOrderBiz biz = new com.Omei.BLL.Admin.AdminOrderBiz();
            D_LoginUserInfo ui = Session["LoginUserInfo"] as D_LoginUserInfo;

            decimal amount = PageTools.ParseDecimal(txtRefund.Text);
            int chargeForId = PageTools.ParseInt(payEmp.SelectedValue);
            int orderId = PageTools.GetSavedId("OrderId", null);
            int payMethod = PageTools.ParseInt(chkPayMethod.SelectedValue);
            int r = biz.Refund( ui, orderId, amount, payMethod, chargeForId,
                "Refund by " + OmeiStatus.GetOmeiStatusText("PaymentMethod", payMethod, "en") + " " + txtRemark.Text);

            if (r >= 0)
            {
                if (payMethod == 5)
                {
                    // refund to credit voucher
                    VoucherBiz vbiz = new VoucherBiz();
                    int vid = vbiz.CreateVoucher(orderId, 0, amount, ui.userId);
                }
                Response.Redirect("OrderDetail.aspx");
            }
            else
                lbMsg.Text = "退款不成功,请检查订单状态和退款金额!";
        }
    }
Exemplo n.º 2
0
 protected void bntVoucher_Click(object sender, EventArgs e)
 {
     VoucherBiz biz = new VoucherBiz();
     DataSet ds = biz.GetVoucherDetail(PageTools.ParseInt(txtVoucherID.Text));
     if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
     {
         DataRow row = ds.Tables[0].Rows[0];
         lbVoucherAmount.Text = row["amount"].ToString();
         lbVoucherDetail.Text = "Refund by order:<a href='OrderDetail.aspx?id="+ row["refundOrder"].ToString() +"'>"+ row["refundOrder"].ToString() +"</a> (Expire:" +
             row["expireDate"].ToString() + ", Status:" +
             row["status"].ToString() + ")";
         txtVoucherAmount.Enabled = btnPayVoucher.Enabled = true;
     }
     else
     {
         lbVoucherAmount.Text = "No found!";
         lbVoucherAmount.ForeColor = System.Drawing.Color.Red;
         lbVoucherDetail.Text = "";
         txtVoucherAmount.Enabled = btnPayVoucher.Enabled = false;
     }
 }
Exemplo n.º 3
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 = "付款失敗,請檢查。";
     }
 }