/// <summary> /// 获取代理系统日志 /// <param name="logId">日志编号</param> /// </summary> /// <returns>代理系统日志对象</returns> public TSAgentLog Get(long logId) { TSAgentLog tsAgentLog = null; try { string strSQL = "select * from TSAgentLog where logId=:logId"; Param param = new Param(); param.Clear(); param.Add(":logId", logId); db.Open(); ComDataReader dr = db.ExecuteReader(CommandType.Text, strSQL, param); if (dr.Read()) { tsAgentLog = ReadData(dr); } } catch (Exception e) { throw e; } finally { db.Close(); } return(tsAgentLog); }
/// <summary> /// 加载指定代理系统日志 /// <param name="logId">日志编号</param> /// </summary> public void Load(long logId) { try { TSAgentLog tsAgentLog = tsAgentLogDAO.Get(logId); WebJson.ToJson(context, tsAgentLog); } catch (Exception e) { Message.error(context, e.Message); } }
/// <summary> /// 增加代理系统日志 /// <param name="tsAgentLog">代理系统日志</param> /// </summary> public void Add(TSAgentLog tsAgentLog) { try { tsAgentLogDAO.Add(tsAgentLog); Message.success(context, "代理系统日志增加成功"); loginSession.Log("XXXXXX代理系统日志增加成功"); } catch (Exception e) { Message.error(context, "代理系统日志增加失败"); loginSession.Log(e.Message); } }
/// <summary> /// 增加代理系统日志 /// <param name="tsAgentLog">代理系统日志</param> /// </summary> public void Add(TSAgentLog tsAgentLog) { try { db.Open(); Add(db, tsAgentLog); } catch (Exception e) { throw e; } finally { db.Close(); } }
/// <summary> /// 修改代理系统日志 /// </summary> /// <param name="tsAgentLog">代理系统日志</param> public virtual void Edit(TSAgentLog tsAgentLog) { try { db.Open(); Edit(db, tsAgentLog); } catch (Exception e) { throw e; } finally { db.Close(); } }
/// <summary> /// 增加代理系统日志 /// <param name="data">数据库连接</param> /// <param name="tsAgentLog">代理系统日志</param> /// </summary> public override void Add(DataAccess data, TSAgentLog tsAgentLog) { string strSQL = "insert into TSAgentLog (logId,userId,userName,type,siteId,siteName,agentId,agentName,moduleName,userEvent) values (SAgentLog_logId.Nextval,@userId,@userName,@type,@siteId,@siteName,@agentId,@agentName,@moduleName,@userEvent)"; Param param = new Param(); param.Clear(); //param.Add("@logId", tsAgentLog.logId);//日志编号 param.Add("@userId", tsAgentLog.userId); //用户编号 param.Add("@userName", tsAgentLog.userName); //用户姓名 param.Add("@type", tsAgentLog.type); //角色类型 param.Add("@siteId", tsAgentLog.siteId); //门店编号 param.Add("@siteName", tsAgentLog.siteName); //门店名称 param.Add("@agentId", tsAgentLog.agentId); //代理商编号 param.Add("@agentName", tsAgentLog.agentName); //代理商名称 param.Add("@moduleName", tsAgentLog.moduleName); //模块名称 param.Add("@userEvent", tsAgentLog.userEvent); //操作事件 data.ExecuteNonQuery(CommandType.Text, strSQL, param); }
/// <summary> /// 增加代理系统日志 /// <param name="data">数据库连接</param> /// <param name="tsAgentLog">代理系统日志</param> /// </summary> public void Add(DataAccess data, TSAgentLog tsAgentLog) { string strSQL = "insert into TSAgentLog (logId,userId,userName,type,siteId,siteName,agentId,agentName,moduleName,userEvent) values (SAgentLog_logId.Nextval,:userId,:userName,:type,:siteId,:siteName,:agentId,:agentName,:moduleName,:userEvent)"; Param param = new Param(); param.Clear(); //param.Add(":logId", tsAgentLog.logId);//日志编号 param.Add(":userId", tsAgentLog.userId); //用户编号 param.Add(":userName", tsAgentLog.userName); //用户姓名 param.Add(":type", tsAgentLog.type); //角色类型 param.Add(":siteId", tsAgentLog.siteId); //门店编号 param.Add(":siteName", tsAgentLog.siteName); //门店名称 param.Add(":agentId", tsAgentLog.agentId); //代理商编号 param.Add(":agentName", tsAgentLog.agentName); //代理商名称 param.Add(":moduleName", tsAgentLog.moduleName); //模块名称 param.Add(":userEvent", tsAgentLog.userEvent); //操作事件 //param.Add(":createDate", tsAgentLog.createDate);//操作时间 data.ExecuteNonQuery(CommandType.Text, strSQL, param); }
/// <summary> /// 修改代理系统日志 /// <param name="data">数据库连接</param> /// <param name="tsAgentLog">代理系统日志</param> /// </summary> public void Edit(DataAccess data, TSAgentLog tsAgentLog) { string strSQL = "update TSAgentLog set userId=:userId,userName=:userName,type=:type,siteId=:siteId,siteName=:siteName,agentId=:agentId,agentName=:agentName,moduleName=:moduleName,userEvent=:userEvent,createDate=To_date(:createDate,'yyyy-mm-dd hh24:mi:ss') where logId=:logId"; Param param = new Param(); param.Clear(); param.Add(":userId", tsAgentLog.userId); //用户编号 param.Add(":userName", tsAgentLog.userName); //用户姓名 param.Add(":type", tsAgentLog.type); //角色类型 param.Add(":siteId", tsAgentLog.siteId); //门店编号 param.Add(":siteName", tsAgentLog.siteName); //门店名称 param.Add(":agentId", tsAgentLog.agentId); //代理商编号 param.Add(":agentName", tsAgentLog.agentName); //代理商名称 param.Add(":moduleName", tsAgentLog.moduleName); //模块名称 param.Add(":userEvent", tsAgentLog.userEvent); //操作事件 param.Add(":createDate", tsAgentLog.createDate); //操作时间 param.Add(":logId", tsAgentLog.logId); //日志编号 data.ExecuteNonQuery(CommandType.Text, strSQL, param); }
protected DataAccess db = new DataAccess(DataAccess.DBConn);//数据库连接 #region 代码生成器自动生成 /// <summary> /// 增加代理系统日志 /// </summary> /// <param name="data">数据库连接</param> /// <param name="tsAgentLog">代理系统日志</param> public virtual void Add(DataAccess data, TSAgentLog tsAgentLog) { string strSQL = "insert into TSAgentLog (logId,userId,userName,type,siteId,siteName,agentId,agentName,moduleName,userEvent,createDate) values (@logId,@userId,@userName,@type,@siteId,@siteName,@agentId,@agentName,@moduleName,@userEvent,To_date(@createDate,'yyyy-mm-dd hh24:mi:ss'))"; Param param = new Param(); param.Clear(); param.Add("@logId", tsAgentLog.logId); //日志编号 param.Add("@userId", tsAgentLog.userId); //用户编号 param.Add("@userName", tsAgentLog.userName); //用户姓名 param.Add("@type", tsAgentLog.type); //角色类型 param.Add("@siteId", tsAgentLog.siteId); //门店编号 param.Add("@siteName", tsAgentLog.siteName); //门店名称 param.Add("@agentId", tsAgentLog.agentId); //代理商编号 param.Add("@agentName", tsAgentLog.agentName); //代理商名称 param.Add("@moduleName", tsAgentLog.moduleName); //模块名称 param.Add("@userEvent", tsAgentLog.userEvent); //操作事件 param.Add("@createDate", tsAgentLog.createDate); //操作时间 data.ExecuteNonQuery(CommandType.Text, strSQL, param); }
/// <summary> /// 记录日志 /// </summary> /// <param name="userEvent">用户操作</param> public void Log(string userEvent) { try { TSAgentLog tsAgentLog = new TSAgentLog(); tsAgentLog.userId = this.userId; tsAgentLog.userName = this.userName; tsAgentLog.type = this.roleType; tsAgentLog.siteId = this.siteId; tsAgentLog.siteName = this.siteName; tsAgentLog.agentId = this.agentId; tsAgentLog.agentName = this.agentName; tsAgentLog.moduleName = this.moduleName; tsAgentLog.userEvent = userEvent; new TSAgentLogDAO().Add(tsAgentLog); } catch { } }
/// <summary> /// 读取代理系统日志信息 /// <param name="dr">记录指针</param> /// </summary> /// <returns>代理系统日志对象</returns> private TSAgentLog ReadData(ComDataReader dr) { TSAgentLog tsAgentLog = new TSAgentLog(); tsAgentLog.logId = long.Parse(dr["logId"].ToString()); //日志编号 tsAgentLog.userId = dr["userId"].ToString(); //用户编号 tsAgentLog.userName = dr["userName"].ToString(); //用户姓名 tsAgentLog.type = dr["type"].ToString(); //角色类型 tsAgentLog.siteId = dr["siteId"].ToString(); //门店编号 tsAgentLog.siteName = dr["siteName"].ToString(); //门店名称 tsAgentLog.agentId = dr["agentId"].ToString(); //代理商编号 tsAgentLog.agentName = dr["agentName"].ToString(); //代理商名称 tsAgentLog.moduleName = dr["moduleName"].ToString(); //模块名称 tsAgentLog.userEvent = dr["userEvent"].ToString(); //操作事件 if (dr["createDate"] == null) { tsAgentLog.createDate = "";//操作时间 } else { tsAgentLog.createDate = string.Format("{0:yyyy-MM-dd HH:mm:ss}", dr["createDate"]);//操作时间 } return(tsAgentLog); }