Example #1
0
    protected void btnPay_Click(object sender, EventArgs e)
    {
        string remark = "";
        D_LoginUserInfo ui = Session["LoginUserInfo"] as D_LoginUserInfo;

        if (txtMethod.Value == "3")
        {
            remark = txtCheckNumber.Text;
        }

        AdminOrderBiz biz = new AdminOrderBiz();
        int orderId = PageTools.GetSavedId("OrderId",null);
        decimal amount = PageTools.ParseDecimal(txtPay.Text);

        int chargeForId = ui.userId;
        if ( payEmp.SelectedIndex>0 )
            chargeForId = int.Parse(payEmp.SelectedValue);

        int r = biz.Payment( Session["LoginUserInfo"],
            orderId, amount,
            int.Parse(txtMethod.Value), 0,
            chargeForId, ui.userId, remark);

        if (r < 0)
        {
            lbMsg.ForeColor = System.Drawing.Color.Red;
            switch (r)
            {
                case -1:
                    lbMsg.Text = "订单状态不能付款";
                    break;
                case -2:
                    lbMsg.Text = "付款金额超过应付额";
                    break;
                case -3:
                    lbMsg.Text = "订单不存在";
                    break;
                case -9:
                    lbMsg.Text = "金额不能为0";
                    break;
                default:
                    lbMsg.Text = "订单状态不确定";
                    break;
            }
        }
        else
        {
            lbMsg.Text = "付款成功.";
            lbMsg.ForeColor = System.Drawing.Color.DarkGreen;
            txtPay.Text = "0.00";
        }

        RefreshControl();

        if (m_afterPayment != null && m_afterPayment != "")
        {
            Delegate d = Delegate.CreateDelegate(typeof(EventHandler), Page, m_afterPayment);
            ((EventHandler)d)(this, null);
        }
    }
Example #2
0
        public bool CreditCardPayment(object loginUserInfo, int crId)
        {
            if (loginUserInfo == null || crId == 0) return false;

            D_LoginUserInfo ui = loginUserInfo as D_LoginUserInfo;

            DS_CreditCards.CCDetailDataTable dt = GetCreditDetail(crId);
            if (dt == null || dt.Rows.Count < 1) return false;

            DS_CreditCards.CCDetailRow row = dt.Rows[0] as DS_CreditCards.CCDetailRow;

            AdminOrderBiz biz = new AdminOrderBiz();
            int paymentId = biz.Payment( loginUserInfo,
                    row.orderId, row.totalAmount,
                    2, 0, ui.userId, ui.userId,
                    "[" + row.cardType + "] " + MaskedCardNumber(row.cardNumber));
            if (paymentId <= 0) return false;

            string sql = @"
            update CreditCard
            set paymentId=@paymentId, status=8, payDate=getdate()
            where crId=@crId;
            ";
            SqlParameter[] para = {
                new SqlParameter("@crId", crId),
                new SqlParameter("@paymentId", paymentId)
            };
            int i = m_dao.ExecuteNoQuery(sql, para);
            return (i == 1);
        }
Example #3
0
    private int DoPayment(string payAmountString, int paymentMethod, string remark)
    {
        decimal amount = PageTools.ParseDecimal(payAmountString);
        if (amount <= 0)
        {
            lbMsg.Text = "金額不能為0或負數!";
            return 0;
        }

        D_LoginUserInfo ui = Session["LoginUserInfo"] as D_LoginUserInfo;

        int orderId = PageTools.GetSavedId("OrderId", null);
        int chargeForId = ui.userId;
        if (payEmp.SelectedIndex > 0)
            chargeForId = int.Parse(payEmp.SelectedValue);

        AdminOrderBiz biz = new AdminOrderBiz();
        int r = biz.Payment(Session["LoginUserInfo"],
            orderId, amount,
            paymentMethod, 0,
            chargeForId, ui.userId, remark);

        if (r < 0)
        {
            lbMsg.ForeColor = System.Drawing.Color.Red;
            switch (r)
            {
                case -1:
                    lbMsg.Text = "订单状态不能付款";
                    break;
                case -2:
                    lbMsg.Text = "付款金额超过应付额";
                    break;
                case -3:
                    lbMsg.Text = "订单不存在";
                    break;
                case -9:
                    lbMsg.Text = "金额不能为0";
                    break;
                default:
                    lbMsg.Text = "订单状态不确定";
                    break;
            }
        }
        else
        {
            lbMsg.Text = "付款成功.";
            lbMsg.CssClass = "ok_message";
        }
        return r;
    }