Esempio 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 = "退款不成功,请检查订单状态和退款金额!";
        }
    }