/// <summary> /// 加载指定代理账户明细 /// <param name="flowId">编号</param> /// </summary> public void Load(long flowId) { try { TTAgentAccDetail ttAgentAccDetail = ttAgentAccDetailDAO.Get(flowId); WebJson.ToJson(context, ttAgentAccDetail); } catch (Exception e) { Message.error(context, e.Message); } }
/// <summary> /// 增加代理账户明细 /// <param name="ttAgentAccDetail">代理账户明细</param> /// </summary> public void Add(TTAgentAccDetail ttAgentAccDetail) { try { ttAgentAccDetailDAO.Add(ttAgentAccDetail); Message.success(context, "代理账户明细增加成功"); loginSession.Log("XXXXXX代理账户明细增加成功"); } catch (Exception e) { Message.error(context, "代理账户明细增加失败"); loginSession.Log(e.Message); } }
/// <summary> /// 增加代理商充值 /// <param name="ttAgentRecharge">代理商充值</param> /// </summary> public void Add(TTAgentRecharge ttAgentRecharge, TTAgentPreRechg ttAgentPreRechg) { ComTransaction trans = null; try { db.Open(); trans = db.BeginTransaction(); TBAgentDAO tbAgentDAO = new TBAgentDAO(); TBAgent tbAgent = new TBAgent(); tbAgent = tbAgentDAO.Get(db, ttAgentRecharge.agentId);//获取代理商信息 //修改代理商信息表的当前余额 tbAgent.sumRecharge = tbAgent.sumRecharge + ttAgentRecharge.fee; tbAgent.balanceValue = tbAgent.balanceValue + ttAgentRecharge.fee; new TBAgentDAO().EditBalance(db, tbAgent); ttAgentRecharge.agentName = tbAgent.agentName; //代理商名称 ttAgentRecharge.lastBalance = tbAgent.balanceValue - ttAgentRecharge.fee; //代理商上次余额 ttAgentRecharge.balance = tbAgent.balanceValue; //代理商当前余额 Add(db, ttAgentRecharge); //添加代理商充值账户明细 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); new TTAgentPreRechgDAO().Edit(db, ttAgentPreRechg);//修改状态 trans.Commit(); } catch (Exception e) { trans.Rollback(); throw e; } finally { db.Close(); } }
/// <summary> /// 增加代理账户明细 /// <param name="data">数据库连接</param> /// <param name="ttAgentAccDetail">代理账户明细</param> /// </summary> public override void Add(DataAccess data, TTAgentAccDetail ttAgentAccDetail) { string strSQL = "insert into TTAgentAccDetail (flowId,agentId,agentName,lastBalance,fee,balance,remark) values (SAgentAccDetail_flowId.Nextval,@agentId,@agentName,@lastBalance,@fee,@balance,@remark)"; Param param = new Param(); param.Clear(); //param.Add("@flowId", ttAgentAccDetail.flowId);//流水号 param.Add("@agentId", ttAgentAccDetail.agentId); //代理商编号 param.Add("@agentName", ttAgentAccDetail.agentName); //代理商名称 param.Add("@lastBalance", ttAgentAccDetail.lastBalance); //上次余额 param.Add("@fee", ttAgentAccDetail.fee); //发生金额 param.Add("@balance", ttAgentAccDetail.balance); //当前余额 param.Add("@remark", ttAgentAccDetail.remark); //信息摘要 data.ExecuteNonQuery(CommandType.Text, strSQL, param); }
/// <summary> /// 修改代理账户明细 /// </summary> /// <param name="ttAgentAccDetail">代理账户明细</param> public virtual void Edit(TTAgentAccDetail ttAgentAccDetail) { try { db.Open(); Edit(db, ttAgentAccDetail); } catch (Exception e) { throw e; } finally { db.Close(); } }
/// <summary> /// 修改代理账户明细 /// </summary> /// <param name="data">数据库连接</param> /// <param name="ttAgentAccDetail">代理账户明细</param> public virtual void Edit(DataAccess data, TTAgentAccDetail ttAgentAccDetail) { string strSQL = "update TTAgentAccDetail set agentId=@agentId,agentName=@agentName,lastBalance=@lastBalance,fee=@fee,balance=@balance,createTime=To_date(@createTime,'yyyy-mm-dd hh24:mi:ss'),remark=@remark where flowId=@flowId"; Param param = new Param(); param.Clear(); param.Add("@agentId", ttAgentAccDetail.agentId); //代理商编号 param.Add("@agentName", ttAgentAccDetail.agentName); //代理商名称 param.Add("@lastBalance", ttAgentAccDetail.lastBalance); //上次余额 param.Add("@fee", ttAgentAccDetail.fee); //发生金额 param.Add("@balance", ttAgentAccDetail.balance); //当前余额 param.Add("@createTime", ttAgentAccDetail.createTime); //创建时间 param.Add("@remark", ttAgentAccDetail.remark); //信息摘要 param.Add("@flowId", ttAgentAccDetail.flowId); //流水号 data.ExecuteNonQuery(CommandType.Text, strSQL, param); }
protected DataAccess db = new DataAccess(DataAccess.DBConn);//数据库连接 #region 代码生成器自动生成 /// <summary> /// 增加代理账户明细 /// </summary> /// <param name="data">数据库连接</param> /// <param name="ttAgentAccDetail">代理账户明细</param> public virtual void Add(DataAccess data, TTAgentAccDetail ttAgentAccDetail) { string strSQL = "insert into TTAgentAccDetail (flowId,agentId,agentName,lastBalance,fee,balance,createTime,remark) values (@flowId,@agentId,@agentName,@lastBalance,@fee,@balance,To_date(@createTime,'yyyy-mm-dd hh24:mi:ss'),@remark)"; Param param = new Param(); param.Clear(); param.Add("@flowId", ttAgentAccDetail.flowId); //流水号 param.Add("@agentId", ttAgentAccDetail.agentId); //代理商编号 param.Add("@agentName", ttAgentAccDetail.agentName); //代理商名称 param.Add("@lastBalance", ttAgentAccDetail.lastBalance); //上次余额 param.Add("@fee", ttAgentAccDetail.fee); //发生金额 param.Add("@balance", ttAgentAccDetail.balance); //当前余额 param.Add("@createTime", ttAgentAccDetail.createTime); //创建时间 param.Add("@remark", ttAgentAccDetail.remark); //信息摘要 data.ExecuteNonQuery(CommandType.Text, strSQL, param); }
/// <summary> /// 增加代理账户明细 /// <param name="ttAgentAccDetail">代理账户明细</param> /// </summary> public void Add(TTAgentAccDetail ttAgentAccDetail) { try { db.Open(); Add(db, ttAgentAccDetail); } catch (Exception e) { throw e; } finally { db.Close(); } }
/// <summary> /// 读取代理账户明细信息 /// </summary> /// <param name="dr">记录指针</param> /// <returns>代理账户明细对象</returns> protected virtual TTAgentAccDetail ReadData(ComDataReader dr) { TTAgentAccDetail ttAgentAccDetail = new TTAgentAccDetail(); ttAgentAccDetail.flowId = long.Parse(dr["flowId"].ToString()); //流水号 ttAgentAccDetail.agentId = dr["agentId"].ToString(); //代理商编号 ttAgentAccDetail.agentName = dr["agentName"].ToString(); //代理商名称 ttAgentAccDetail.lastBalance = double.Parse(dr["lastBalance"].ToString()); //上次余额 ttAgentAccDetail.fee = double.Parse(dr["fee"].ToString()); //发生金额 ttAgentAccDetail.balance = double.Parse(dr["balance"].ToString()); //当前余额 if (dr["createTime"] == null) { ttAgentAccDetail.createTime = "";//创建时间 } else { ttAgentAccDetail.createTime = string.Format("{0:yyyy-MM-dd HH:mm:ss}", dr["createTime"]); //创建时间 } ttAgentAccDetail.remark = dr["remark"].ToString(); //信息摘要 return(ttAgentAccDetail); }
/// <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(); //} }