Ejemplo n.º 1
0
        /// <summary>
        /// 兑换订单提交
        /// </summary>
        /// <param name="userId">会员id</param>
        /// <param name="exId">兑换id</param>
        /// <param name="address">地址id</param>
        /// <param name="deposit">押金</param>
        /// <param name="method">兑换方式,0为会员兑换,1为身家兑换</param>
        /// <param name="total_fee">交易金额</param>
        private void ExchangeConfirm(string userId, string exId, string address, string deposit, string method, string total_fee)
        {
            using (TransactionScope ts = new TransactionScope())
            {
                //添加兑换人员表
                var ep = new Com.Cos.Models.ExchangePerson()
                {
                    UserId  = userId,
                    ExId    = exId,
                    AddTime = DateTime.Now,
                    Examine = "0",
                    Address = address,
                    Status  = 1
                };
                _exchangePersonService.Add(ep);
                //更新兑换表
                var ex = _exchangeService.Find(exId.ToInt32());
                ex.Examine        = "0"; //修改为已结束
                ex.ExchangePerson = userId;
                _exchangeService.Update(ex);
                //更新会员表
                var member = _memberService.Find(userId.ToInt32());
                member.Deposit = deposit.ToDecimal();
                if (method == "1")  //身家兑换
                {
                    member.Shenjia -= total_fee.ToDecimal() - deposit.ToDecimal();
                }
                _memberService.Update(member);

                ts.Complete();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 租借订单提交
        /// </summary>
        /// <param name="userId">会员id</param>
        /// <param name="exId">兑换id</param>
        /// <param name="address">地址id</param>
        /// <param name="deposit">押金</param>
        /// <param name="method">兑换方式,0为会员租赁,1为单次租赁</param>
        private void RentedConfirm(string userId, string exId, string address, string deposit, string method)
        {
            using (TransactionScope ts = new TransactionScope())
            {
                //添加兑换人员表
                var ep = new Com.Cos.Models.ExchangePerson()
                {
                    UserId  = userId,
                    ExId    = exId,
                    AddTime = DateTime.Now,
                    Examine = "0",
                    Address = address,
                    Status  = 1
                };
                _exchangePersonService.Add(ep);
                //更新兑换表
                var ex = _exchangeService.Find(exId.ToInt32());
                ex.Examine        = "4"; //修改为已兑换
                ex.ExchangePerson = userId;
                _exchangeService.Update(ex);
                //更新会员表
                var member = _memberService.Find(userId.ToInt32());
                member.Deposit = deposit.ToDecimal();
                if (method == "0")  //会员租赁
                {
                    member.RemainingConversions--;
                }
                if (method == "1")  //单次租赁
                {
                    member.Shenjia -= 50;
                }
                _memberService.Update(member);

                ts.Complete();
            }
        }