/// <summary> /// 增加代理商充值 /// <param name="ttAgentRecharge">代理商充值</param> /// </summary> public void Add(DataAccess db, TTAgentTakeCash ttAgentTakeCash, TBAgent tbAgent) { try { //修改代理商信息表的当前余额 tbAgent.sumDraw = tbAgent.sumDraw + ttAgentTakeCash.fee; tbAgent.balanceValue = tbAgent.balanceValue - ttAgentTakeCash.fee; new TBAgentDAO().EditBalance(db, tbAgent); ttAgentTakeCash.agentName = tbAgent.agentName; //代理商名称 ttAgentTakeCash.lastBalance = tbAgent.balanceValue + ttAgentTakeCash.fee; //代理商上次余额 ttAgentTakeCash.balance = tbAgent.balanceValue; //代理商当前余额 Add(db, ttAgentTakeCash); //添加代理商提现账户明细 TTAgentAccDetailDAO ttAgentAccDetailDAO = new TTAgentAccDetailDAO(); TTAgentAccDetail ttAgentAccDetail = new TTAgentAccDetail(); ttAgentAccDetail.agentId = ttAgentTakeCash.agentId; ttAgentAccDetail.agentName = ttAgentTakeCash.agentName; ttAgentAccDetail.lastBalance = ttAgentTakeCash.lastBalance; ttAgentAccDetail.fee = 0 - ttAgentTakeCash.fee; ttAgentAccDetail.balance = ttAgentTakeCash.balance; ttAgentAccDetail.createTime = ttAgentTakeCash.createTime; ttAgentAccDetail.remark = ttAgentTakeCash.description; new TTAgentAccDetailDAO().Add(db, ttAgentAccDetail); } catch (Exception e) { throw e; } }
/// <summary> /// 增加代理商充值 /// <param name="ttAgentRecharge">代理商充值</param> /// </summary> public void Add(TTAgentRecharge ttAgentRecharge) { ComTransaction trans = null; try { db.Open(); trans = db.BeginTransaction(); TBAgentDAO tbAgentDAO = new TBAgentDAO(); TBAgent tbAgent = new TBAgent(); tbAgent = tbAgentDAO.Get(db, ttAgentRecharge.agentId); //获取代理商信息 ttAgentRecharge.agentName = tbAgent.agentName; //代理商名称 ttAgentRecharge.lastBalance = tbAgent.balanceValue; //代理商上次余额 ttAgentRecharge.balance = ttAgentRecharge.lastBalance + ttAgentRecharge.fee; //代理商当前余额 Add(db, ttAgentRecharge); //添加代理商充值账户明细 TTAgentAccDetailDAO ttAgentAccDetailDAO = new TTAgentAccDetailDAO(); TTAgentAccDetail ttAgentAccDetail = new TTAgentAccDetail(); ttAgentAccDetail.agentId = ttAgentRecharge.agentId; ttAgentAccDetail.agentName = ttAgentRecharge.agentName; ttAgentAccDetail.lastBalance = ttAgentRecharge.lastBalance; ttAgentAccDetail.fee = ttAgentRecharge.fee; ttAgentAccDetail.balance = ttAgentRecharge.balance; ttAgentAccDetail.createTime = ttAgentRecharge.createTime; ttAgentAccDetail.remark = ttAgentRecharge.description; new TTAgentAccDetailDAO().Add(db, ttAgentAccDetail); //修改代理商信息表的当前余额 tbAgent.sumRecharge = tbAgent.sumRecharge + ttAgentRecharge.fee; tbAgent.balanceValue = ttAgentRecharge.balance; new TBAgentDAO().EditBalance(db, tbAgent); trans.Commit(); } catch (Exception e) { trans.Rollback(); throw e; } finally { db.Close(); } }
/// <summary> /// 增加代理商充值 /// <param name="ttAgentRecharge">代理商充值</param> /// </summary> public void Add(DataAccess db, TTAgentTakeCash ttAgentTakeCash, TBAgent tbAgent) { //ComTransaction trans = null; try { //db.Open(); //trans = db.BeginTransaction(); ttAgentTakeCash.agentName = tbAgent.agentName; //代理商名称 ttAgentTakeCash.lastBalance = tbAgent.balanceValue; //代理商上次余额 ttAgentTakeCash.balance = ttAgentTakeCash.lastBalance - ttAgentTakeCash.fee; //代理商当前余额 Add(db, ttAgentTakeCash); //添加代理商提现账户明细 TTAgentAccDetailDAO ttAgentAccDetailDAO = new TTAgentAccDetailDAO(); TTAgentAccDetail ttAgentAccDetail = new TTAgentAccDetail(); ttAgentAccDetail.agentId = ttAgentTakeCash.agentId; ttAgentAccDetail.agentName = ttAgentTakeCash.agentName; ttAgentAccDetail.lastBalance = ttAgentTakeCash.lastBalance; ttAgentAccDetail.fee = 0 - ttAgentTakeCash.fee; ttAgentAccDetail.balance = ttAgentTakeCash.balance; ttAgentAccDetail.createTime = ttAgentTakeCash.createTime; ttAgentAccDetail.remark = ttAgentTakeCash.description; new TTAgentAccDetailDAO().Add(db, ttAgentAccDetail); //修改代理商信息表的当前余额 tbAgent.sumDraw = tbAgent.sumDraw + ttAgentTakeCash.fee; tbAgent.balanceValue = ttAgentTakeCash.balance; new TBAgentDAO().EditBalance(db, tbAgent); //trans.Commit(); } catch (Exception e) { //trans.Rollback(); throw e; } //finally //{ // db.Close(); //} }