Example #1
0
        //public Decimal amount { get; set; }

        protected override XResp Execute()
        {
            var od = cu.x_order.FirstOrDefault(o => o.order_id == id);

            //if (od.status == 1 || od.status == 2)
            //    od.status = 6;
            //else
            //    throw new XExcep("T当前订单状态无法取消");
            if (od == null)
            {
                throw new XExcep("订单不存在");
            }
            if (od.status != 3 && od.status != 4 && !(od.status == 2 && od.pay_way == 2))
            {
                throw new XExcep("T当前订单状态不可退款");
            }

            var refundItem = new x_refund();

            refundItem.amount  = cu.x_order.FirstOrDefault(o => o.order_id == id).pay_amount;//默认用户全款申请
            refundItem.ctime   = DateTime.Now;
            refundItem.reason  = reason;
            refundItem.x_order = od;
            refundItem.status  = 1;

            od.x_refund.Add(refundItem);

            SubmitDBChanges();
            return(new XResp());
        }
Example #2
0
        //public Decimal amount { get; set; }

        protected override XResp Execute()
        {
            var od = cu.x_order.FirstOrDefault(o => o.order_id == id);

            if (od == null)
            {
                throw new XExcep("订单不存在");
            }
            if (od.pay_amount == 0)
            {
                throw new XExcep("0x0053");
            }
            if (!string.IsNullOrEmpty(od.send_man))
            {
                throw new XExcep("0x0053");
            }
            if (od.status != 2)
            {
                throw new XExcep("0x0053");
            }

            var refundItem = new x_refund();

            refundItem.amount  = cu.x_order.FirstOrDefault(o => o.order_id == id).pay_amount;//默认用户全款申请
            refundItem.ctime   = DateTime.Now;
            refundItem.reason  = reason;
            refundItem.rsource = (od.pay_way == 1 ? "微信支付" : "帐号余额");
            refundItem.x_order = od;
            refundItem.status  = 1;

            od.x_refund.Add(refundItem);

            SubmitDBChanges();
            return(new XResp());
        }