/// <summary> /// 订单消费余额 /// </summary> /// <param name="customerSysNo">客户编号</param> /// <param name="orderSysNo">订单编号</param> /// <param name="amount">消费余额 不能为0</param> /// <param name="transactionSysNo">事务编号</param> /// <exception cref="Exception"></exception> /// <returns>void</returns> /// <remarks>2017-01-17 杨浩 创建</remarks> public void OrderDeductionBalance(int customerSysNo, int orderSysNo, decimal amount, string transactionSysNo) { if (amount == 0) { throw new Exception("会员余额不能为0."); } var balanceInfo = GetCrABalanceEntity(customerSysNo); if (balanceInfo == null) { throw new Hyt.Model.Exception.UserNotMatchException(customerSysNo); } if (balanceInfo.AvailableBalance < amount) { throw new Exception("会员余额不足."); } var model = new CrBalancePayOrderLog() { CustomerSysNo = customerSysNo, OrderSysNo = orderSysNo, PayAmount = amount, MemberBalance = balanceInfo.AvailableBalance - amount, State = 1, PayType = Hyt.Model.SystemPredefined.PaymentType.余额支付, PayTime = DateTime.Now, Remark = "订单交易使用,订单号:" + orderSysNo.ToString(), }; UpdateABalanceForPayOrder(amount, customerSysNo); CreateCrBalancePayOrderLog(model); }
/// <summary> /// 增加会员余额支付订单记录 /// </summary> /// <param name="model"></param> /// <returns></returns> public override int CreateCrBalancePayOrderLog(CrBalancePayOrderLog model) { return(Context.Insert <CrBalancePayOrderLog>("CrBalancePayOrderLog", model).AutoMap(x => x.SysNo).ExecuteReturnLastId <int>("SysNo")); }
/// <summary> /// 增加会员余额支付订单记录 /// </summary> /// <param name="model"></param> /// <returns></returns> public abstract int CreateCrBalancePayOrderLog(CrBalancePayOrderLog model);
/// <summary> /// 增加会员余额支付订单记录 /// </summary> /// <param name="model"></param> /// <returns></returns> public int CreateCrBalancePayOrderLog(CrBalancePayOrderLog model) { return(CrRechargeDao.Instance.CreateCrBalancePayOrderLog(model)); }