/// <summary> /// 读取代理商充值信息 /// <param name="dr">记录指针</param> /// </summary> /// <returns>代理商充值对象</returns> private TTAgentRecharge ReadData(ComDataReader dr) { TTAgentRecharge ttAgentRecharge = new TTAgentRecharge(); ttAgentRecharge.flowId = long.Parse(dr["flowId"].ToString()); //流水号 ttAgentRecharge.agentId = dr["agentId"].ToString(); //代理商编号 ttAgentRecharge.agentName = dr["agentName"].ToString(); //代理商名称 ttAgentRecharge.lastBalance = double.Parse(dr["lastBalance"].ToString()); //上次余额 ttAgentRecharge.fee = double.Parse(dr["fee"].ToString()); //发生金额 ttAgentRecharge.balance = double.Parse(dr["balance"].ToString()); //当前余额 ttAgentRecharge.operatorId = dr["operatorId"].ToString(); //操作人编号 ttAgentRecharge.operatorName = dr["operatorName"].ToString(); //操作人名称 if (dr["createTime"] == null) { ttAgentRecharge.createTime = "";//创建时间 } else { ttAgentRecharge.createTime = string.Format("{0:yyyy-MM-dd HH:mm:ss}", dr["createTime"]); //创建时间 } ttAgentRecharge.handleMode = dr["handleMode"].ToString(); //充值方式 ttAgentRecharge.bankAccountId = dr["bankAccountId"].ToString(); //银行账号 ttAgentRecharge.bankFlowId = dr["bankFlowId"].ToString(); //银行流水号 ttAgentRecharge.description = dr["description"].ToString(); //说明 return(ttAgentRecharge); }
/// <summary> /// 获取代理商充值 /// <param name="flowId">流水号</param> /// </summary> /// <returns>代理商充值对象</returns> public TTAgentRecharge Get(long flowId) { TTAgentRecharge ttAgentRecharge = null; try { string strSQL = "select * from TTAgentRecharge where flowId=:flowId"; Param param = new Param(); param.Clear(); param.Add(":flowId", flowId); db.Open(); ComDataReader dr = db.ExecuteReader(CommandType.Text, strSQL, param); if (dr.Read()) { ttAgentRecharge = ReadData(dr); } } catch (Exception e) { throw e; } finally { db.Close(); } return(ttAgentRecharge); }
public void ProcessRequest(HttpContext context) { try { LoginUser loginUser = new LoginUser(context, "AgentRecharge"); if (!loginUser.Pass)//权限验证 { return; } //加载DataGrid if (context.Request["action"] == "gridLoad") { AgentBLL bll = new AgentBLL(context, loginUser); //加载DataGrid int page = int.Parse(context.Request["page"]); int rows = int.Parse(context.Request["rows"]); string agentId = context.Request["agentId"]; string agentName = context.Request["agentName"]; string bankCardId = context.Request["bankCardId"]; bll.LoadGrid(page, rows, agentName, agentId, bankCardId, ((int)AuditStauts.AuditSucces).ToString()); return; } if (context.Request["action"] == "load") { AgentBLL bll = new AgentBLL(context, loginUser); //加载信息 bll.Load(context.Request["agentId"]); } if (context.Request["action"] == "handleModeListLoad") { AgentRechargeBLL bll = new AgentRechargeBLL(context, loginUser); bll.HandleModeCombobox(); } //增加 if (context.Request["action"] == "add") { AgentRechargeBLL bll = new AgentRechargeBLL(context, loginUser); TTAgentRecharge ttAgentRecharge = new TTAgentRecharge(); ttAgentRecharge.agentId = context.Request["agentId"]; //代理商编号 ttAgentRecharge.fee = double.Parse(context.Request["fee"]); //发生金额 ttAgentRecharge.operatorId = loginUser.UserId;; //操作人编号 ttAgentRecharge.operatorName = loginUser.UserName; //操作人名称 ttAgentRecharge.createTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //创建时间 ttAgentRecharge.handleMode = context.Request["handleMode"]; //充值方式 ttAgentRecharge.bankAccountId = context.Request["bankCardId"]; //银行账号 ttAgentRecharge.bankFlowId = context.Request["bankFlowId"]; //银行流水号 ttAgentRecharge.description = context.Request["description"]; //说明 bll.Add(ttAgentRecharge); return; } } catch (Exception e) { Message.error(context, 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="ttAgentRecharge">代理商充值</param> /// </summary> public void Edit(TTAgentRecharge ttAgentRecharge) { try { db.Open(); Edit(db, ttAgentRecharge); } catch (Exception e) { throw e; } finally { db.Close(); } }
/// <summary> /// 增加代理商充值 /// </summary> /// <param name="ttAgentRecharge">代理商充值</param> public virtual void Add(TTAgentRecharge ttAgentRecharge) { try { db.Open(); Add(db, ttAgentRecharge); } catch (Exception e) { throw e; } finally { db.Close(); } }
/// <summary> /// 增加代理商充值 /// <param name="ttAgentRecharge">代理商充值</param> /// </summary> public void Add(TTAgentRecharge ttAgentRecharge, TTAgentPreRechg ttAgentPreRechg, double balanceValue) { try { if (ttAgentRecharge.fee < 0 && Math.Abs(ttAgentRecharge.fee) > balanceValue) { Message.success(context, "代理商账户余额不足"); return; } ttAgentRechargeDAO.Add(ttAgentRecharge, ttAgentPreRechg); Message.success(context, "代理商充值审批成功"); loginSession.Log(ttAgentRecharge.agentName + "代理商充值审批成功"); } catch (Exception e) { Message.error(context, "代理商充值审批失败"); loginSession.Log(e.Message); } }
/// <summary> /// 增加代理商充值 /// <param name="data">数据库连接</param> /// <param name="ttAgentRecharge">代理商充值</param> /// </summary> public override void Add(DataAccess data, TTAgentRecharge ttAgentRecharge) { string strSQL = "insert into TTAgentRecharge (flowId,agentId,agentName,lastBalance,fee,balance,operatorId,operatorName,handleMode,bankAccountId,bankFlowId,description) values (SAgentRecharge_flowId.Nextval,@agentId,@agentName,@lastBalance,@fee,@balance,@operatorId,@operatorName,@handleMode,@bankAccountId,@bankFlowId,@description)"; Param param = new Param(); param.Clear(); //param.Add("@flowId", ttAgentRecharge.flowId);//流水号 param.Add("@agentId", ttAgentRecharge.agentId); //代理商编号 param.Add("@agentName", ttAgentRecharge.agentName); //代理商名称 param.Add("@lastBalance", ttAgentRecharge.lastBalance); //上次余额 param.Add("@fee", ttAgentRecharge.fee); //发生金额 param.Add("@balance", ttAgentRecharge.balance); //当前余额 param.Add("@operatorId", ttAgentRecharge.operatorId); //操作人编号 param.Add("@operatorName", ttAgentRecharge.operatorName); //操作人名称 param.Add("@handleMode", ttAgentRecharge.handleMode); //充值方式 param.Add("@bankAccountId", ttAgentRecharge.bankAccountId); //银行账号 param.Add("@bankFlowId", ttAgentRecharge.bankFlowId); //银行流水号 param.Add("@description", ttAgentRecharge.description); //说明 data.ExecuteNonQuery(CommandType.Text, strSQL, param); }
/// <summary> /// 修改代理商充值 /// <param name="data">数据库连接</param> /// <param name="ttAgentRecharge">代理商充值</param> /// </summary> public void Edit(DataAccess data, TTAgentRecharge ttAgentRecharge) { string strSQL = "update TTAgentRecharge set agentId=:agentId,agentName=:agentName,lastBalance=:lastBalance,fee=:fee,balance=:balance,operatorId=:operatorId,operatorName=:operatorName,createTime=To_date(:createTime,'yyyy-mm-dd hh24:mi:ss'),handleMode=:handleMode,bankAccountId=:bankAccountId,bankFlowId=:bankFlowId,description=:description where flowId=:flowId"; Param param = new Param(); param.Clear(); param.Add(":agentId", ttAgentRecharge.agentId); //代理商编号 param.Add(":agentName", ttAgentRecharge.agentName); //代理商名称 param.Add(":lastBalance", ttAgentRecharge.lastBalance); //上次余额 param.Add(":fee", ttAgentRecharge.fee); //发生金额 param.Add(":balance", ttAgentRecharge.balance); //当前余额 param.Add(":operatorId", ttAgentRecharge.operatorId); //操作人编号 param.Add(":operatorName", ttAgentRecharge.operatorName); //操作人名称 param.Add(":createTime", ttAgentRecharge.createTime); //创建时间 param.Add(":handleMode", ttAgentRecharge.handleMode); //充值方式 param.Add(":bankAccountId", ttAgentRecharge.bankAccountId); //银行账号 param.Add(":bankFlowId", ttAgentRecharge.bankFlowId); //银行流水号 param.Add(":description", ttAgentRecharge.description); //说明 param.Add(":flowId", ttAgentRecharge.flowId); //流水号 data.ExecuteNonQuery(CommandType.Text, strSQL, param); }
private DataAccess db = new DataAccess(DataAccess.DBConn);//数据库连接 /// <summary> /// 增加代理商充值 /// <param name="data">数据库连接</param> /// <param name="ttAgentRecharge">代理商充值</param> /// </summary> public void Add(DataAccess data, TTAgentRecharge ttAgentRecharge) { string strSQL = "insert into TTAgentRecharge (flowId,agentId,agentName,lastBalance,fee,balance,operatorId,operatorName,createTime,handleMode,bankAccountId,bankFlowId,description) values (SAgentRecharge_flowId.Nextval,:agentId,:agentName,:lastBalance,:fee,:balance,:operatorId,:operatorName,To_date(:createTime,'yyyy-mm-dd hh24:mi:ss'),:handleMode,:bankAccountId,:bankFlowId,:description)"; Param param = new Param(); param.Clear(); //param.Add(":flowId", ttAgentRecharge.flowId);//流水号 param.Add(":agentId", ttAgentRecharge.agentId); //代理商编号 param.Add(":agentName", ttAgentRecharge.agentName); //代理商名称 param.Add(":lastBalance", ttAgentRecharge.lastBalance); //上次余额 param.Add(":fee", ttAgentRecharge.fee); //发生金额 param.Add(":balance", ttAgentRecharge.balance); //当前余额 param.Add(":operatorId", ttAgentRecharge.operatorId); //操作人编号 param.Add(":operatorName", ttAgentRecharge.operatorName); //操作人名称 param.Add(":createTime", ttAgentRecharge.createTime); //创建时间 param.Add(":handleMode", ttAgentRecharge.handleMode); //充值方式 param.Add(":bankAccountId", ttAgentRecharge.bankAccountId); //银行账号 param.Add(":bankFlowId", ttAgentRecharge.bankFlowId); //银行流水号 param.Add(":description", ttAgentRecharge.description); //说明 data.ExecuteNonQuery(CommandType.Text, strSQL, param); }
public void ProcessRequest(HttpContext context) { try { LoginUser loginUser = new LoginUser(context, "AgentRecharge"); AgentPreRechgBLL bll = new AgentPreRechgBLL(context, loginUser); if (!loginUser.Pass)//权限验证 { return; } //加载DataGrid if (context.Request["action"] == "gridLoad") { int page = int.Parse(context.Request["page"]); int rows = int.Parse(context.Request["rows"]); string agentId = context.Request["agentId"]; string auditStatus = context.Request["auditStatus"]; string startDate = context.Request["startDate"]; string endDate = context.Request["endDate"]; bll.LoadGrid(page, rows, agentId, auditStatus, startDate, endDate); return; } if (context.Request["action"] == "load") { //加载信息 bll.Load(long.Parse(context.Request["flowId"])); } if (context.Request["action"] == "handleModeListLoad") { Combobox com = new Combobox(context, loginUser); com.HandleModeCombobox(); } //审核 if (context.Request["action"] == "audit") { AgentRechargeBLL agentRechargeBLL = new AgentRechargeBLL(context, loginUser); long flowId = long.Parse(context.Request["flowId"]); string remark = context.Request["remark"]; TTAgentPreRechg ttAgentPreRechg = bll.Get(flowId);//预审 ttAgentPreRechg.auditStatus = context.Request["auditStatus"]; if (ttAgentPreRechg.auditStatus == "1") { TTAgentRecharge ttAgentRecharge = new TTAgentRecharge(); //充值明细 ttAgentRecharge.agentId = ttAgentPreRechg.agentId; //代理商编号 ttAgentRecharge.fee = ttAgentPreRechg.fee; //发生金额 ttAgentRecharge.operatorId = loginUser.UserId; //操作人编号 ttAgentRecharge.operatorName = loginUser.UserName; //操作人名称 ttAgentRecharge.handleMode = ttAgentPreRechg.handleMode; //充值方式 ttAgentRecharge.bankAccountId = ttAgentPreRechg.bankAccountId; //银行账号 ttAgentRecharge.bankFlowId = ttAgentPreRechg.bankFlowId; //银行流水号 if (remark.Trim() == "") { ttAgentRecharge.description = ttAgentPreRechg.description;//说明 } else { ttAgentRecharge.description = remark; } agentRechargeBLL.Add(ttAgentRecharge, ttAgentPreRechg, ttAgentPreRechg.fee); } else { bll.Edit(ttAgentPreRechg); } return; } } catch (Exception e) { Message.error(context, e.Message); } }