/// <summary> /// 获取加密狗日志 /// <param name="logId">日志编号</param> /// </summary> /// <returns>加密狗日志对象</returns> public TBUKeyLog Get(long logId) { TBUKeyLog tbUKeyLog = null; try { string strSQL = "select * from TBUKeyLog 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()) { tbUKeyLog = ReadData(dr); } } catch (Exception e) { throw e; } finally { db.Close(); } return(tbUKeyLog); }
/// <summary> /// 事务处理终端回收 /// </summary> /// <param name="tbTBUKeyList"></param> /// <param name="userId"></param> /// <param name="userName"></param> public void Recycle(List <TBUKey> tbTBUKeyList, string userId, string userName) { ComTransaction trans = null; try { db.Open(); trans = db.BeginTransaction(); foreach (var uKey in tbTBUKeyList) { uKey.status = ((int)UKeyStatus.InStore).ToString(); RecycleEdit(db, uKey); TBUKeyLog tbUKeyLog = new TBUKeyLog(); tbUKeyLog.uKeyId = uKey.uKeyId; //终端号 tbUKeyLog.operateType = "1"; //操作类型 tbUKeyLog.summary = "发放到[代理商编号:" + uKey.agentId + ",门店编号:" + uKey.siteId + "]"; tbUKeyLog.operateTime = DateTime.Now.ToString(); //操作时间 tbUKeyLog.operatorId = userId; //操作人编号 tbUKeyLog.operatorName = userName; //操作人名称 new TBUKeyLogDAO().Add(db, tbUKeyLog); } trans.Commit(); } catch (Exception e) { trans.Rollback(); throw e; } finally { db.Close(); } }
/// <summary> /// 加载指定加密狗日志 /// <param name="logId">日志编号</param> /// </summary> public void Load(long logId) { try { TBUKeyLog tbUKeyLog = tbUKeyLogDAO.Get(logId); WebJson.ToJson(context, tbUKeyLog); } catch (Exception e) { Message.error(context, e.Message); } }
/// <summary> /// 增加加密狗日志 /// <param name="tbUKeyLog">加密狗日志</param> /// </summary> public void Add(TBUKeyLog tbUKeyLog) { try { tbUKeyLogDAO.Add(tbUKeyLog); Message.success(context, "加密狗日志增加成功"); loginSession.Log("XXXXXX加密狗日志增加成功"); } catch (Exception e) { Message.error(context, "加密狗日志增加失败"); loginSession.Log(e.Message); } }
/// <summary> /// 增加加密狗日志 /// <param name="data">数据库连接</param> /// <param name="tbUKeyLog">加密狗日志</param> /// </summary> public override void Add(DataAccess data, TBUKeyLog tbUKeyLog) { string strSQL = "insert into TBUKeyLog (logId,uKeyId,operateType,summary,operatorId,operatorName) values (SUKeyLog_logId.Nextval,@uKeyId,@operateType,@summary,@operatorId,@operatorName)"; Param param = new Param(); param.Clear(); //param.Add("@logId", tbUKeyLog.logId);//日志编号 param.Add("@uKeyId", tbUKeyLog.uKeyId); //加密狗编号 param.Add("@operateType", tbUKeyLog.operateType); //操作类型 param.Add("@summary", tbUKeyLog.summary); //操作说明 param.Add("@operatorId", tbUKeyLog.operatorId); //操作人编号 param.Add("@operatorName", tbUKeyLog.operatorName); //操作人名称 data.ExecuteNonQuery(CommandType.Text, strSQL, param); }
/// <summary> /// 激活 /// </summary> /// <param name="uKeyId"></param> public void Activation(string uKeyId, string rowSiteId, string userId, string userName) { ComTransaction trans = null; try { Param param = null; List <TBUKey> ukeyList = GetList("select * from TBUKey where siteId=" + rowSiteId + " and status='" + (int)UKeyStatus.Activation + "' and ukeyId!='" + uKeyId + "'", param); TBUKey tbUKeyAc = Get(uKeyId); db.Open(); trans = db.BeginTransaction(); //讲已经激活的修改为已领并记录日志 foreach (var tbUKey in ukeyList) { tbUKey.status = ((int)UKeyStatus.Draw).ToString(); Edit(db, tbUKey); TBUKeyLog tbUKeyLog = new TBUKeyLog(); tbUKeyLog.uKeyId = tbUKey.uKeyId; //终端号 tbUKeyLog.operateType = "1"; //操作类型 tbUKeyLog.summary = "发放到[代理商编号:" + tbUKey.agentId + ",门店编号:" + tbUKey.siteId + "]"; tbUKeyLog.operateTime = DateTime.Now.ToString(); //操作时间 tbUKeyLog.operatorId = userId; //操作人编号 tbUKeyLog.operatorName = userName; //操作人名称 new TBUKeyLogDAO().Add(db, tbUKeyLog); } //激活 tbUKeyAc.status = ((int)UKeyStatus.Activation).ToString(); Edit(db, tbUKeyAc); TBUKeyLog tbUKeyLogA = new TBUKeyLog(); tbUKeyLogA.uKeyId = tbUKeyAc.uKeyId; //终端号 tbUKeyLogA.operateType = "1"; //操作类型 tbUKeyLogA.summary = "发放到[代理商编号:" + tbUKeyAc.agentId + ",门店编号:" + tbUKeyAc.siteId + "]"; tbUKeyLogA.operateTime = DateTime.Now.ToString(); //操作时间 tbUKeyLogA.operatorId = userId; //操作人编号 tbUKeyLogA.operatorName = userName; //操作人名称 new TBUKeyLogDAO().Add(db, tbUKeyLogA); trans.Commit(); } catch (Exception e) { trans.Rollback(); throw e; } finally { db.Close(); } }
/// <summary> /// 修改加密狗日志 /// <param name="data">数据库连接</param> /// <param name="tbUKeyLog">加密狗日志</param> /// </summary> public void Edit(DataAccess data, TBUKeyLog tbUKeyLog) { string strSQL = "update TBUKeyLog set uKeyId=:uKeyId,operateType=:operateType,summary=:summary,operateTime=To_date(:operateTime,'yyyy-mm-dd hh24:mi:ss'),operatorId=:operatorId,operatorName=:operatorName where logId=:logId"; Param param = new Param(); param.Clear(); param.Add(":uKeyId", tbUKeyLog.uKeyId); //加密狗编号 param.Add(":operateType", tbUKeyLog.operateType); //操作类型 param.Add(":summary", tbUKeyLog.summary); //操作说明 param.Add(":operateTime", tbUKeyLog.operateTime); //操作时间 param.Add(":operatorId", tbUKeyLog.operatorId); //操作人编号 param.Add(":operatorName", tbUKeyLog.operatorName); //操作人名称 param.Add(":logId", tbUKeyLog.logId); //日志编号 data.ExecuteNonQuery(CommandType.Text, strSQL, param); }
private DataAccess db = new DataAccess(DataAccess.DBConn);//数据库连接 #region 代码生成器自动生成 /// <summary> /// 增加加密狗日志 /// <param name="data">数据库连接</param> /// <param name="tbUKeyLog">加密狗日志</param> /// </summary> public void Add(DataAccess data, TBUKeyLog tbUKeyLog) { string strSQL = "insert into TBUKeyLog (logId,uKeyId,operateType,summary,operateTime,operatorId,operatorName) values (SUKeyLog_logId.Nextval,:uKeyId,:operateType,:summary,To_date(:operateTime,'yyyy-mm-dd hh24:mi:ss'),:operatorId,:operatorName)"; Param param = new Param(); param.Clear(); //param.Add(":logId", tbUKeyLog.logId);//日志编号 param.Add(":uKeyId", tbUKeyLog.uKeyId); //加密狗编号 param.Add(":operateType", tbUKeyLog.operateType); //操作类型 param.Add(":summary", tbUKeyLog.summary); //操作说明 param.Add(":operateTime", tbUKeyLog.operateTime); //操作时间 param.Add(":operatorId", tbUKeyLog.operatorId); //操作人编号 param.Add(":operatorName", tbUKeyLog.operatorName); //操作人名称 data.ExecuteNonQuery(CommandType.Text, strSQL, param); }
/// <summary> /// 修改加密狗日志 /// <param name="tbUKeyLog">加密狗日志</param> /// </summary> public void Edit(TBUKeyLog tbUKeyLog) { try { db.Open(); Edit(db, tbUKeyLog); } catch (Exception e) { throw e; } finally { db.Close(); } }
/// <summary> /// 增加加密狗日志 /// </summary> /// <param name="tbUKeyLog">加密狗日志</param> public virtual void Add(TBUKeyLog tbUKeyLog) { try { db.Open(); Add(db, tbUKeyLog); } catch (Exception e) { throw e; } finally { db.Close(); } }
/// <summary> /// 读取加密狗日志信息 /// <param name="dr">记录指针</param> /// </summary> /// <returns>加密狗日志对象</returns> private TBUKeyLog ReadData(ComDataReader dr) { TBUKeyLog tbUKeyLog = new TBUKeyLog(); tbUKeyLog.logId = long.Parse(dr["logId"].ToString()); //日志编号 tbUKeyLog.uKeyId = dr["uKeyId"].ToString(); //加密狗编号 tbUKeyLog.operateType = dr["operateType"].ToString(); //操作类型 tbUKeyLog.summary = dr["summary"].ToString(); //操作说明 if (dr["operateTime"] == null) { tbUKeyLog.operateTime = "";//操作时间 } else { tbUKeyLog.operateTime = string.Format("{0:yyyy-MM-dd HH:mm:ss}", dr["operateTime"]); //操作时间 } tbUKeyLog.operatorId = dr["operatorId"].ToString(); //操作人编号 tbUKeyLog.operatorName = dr["operatorName"].ToString(); //操作人名称 return(tbUKeyLog); }
public void ProcessRequest(HttpContext context) { try { LoginUser loginUser = new LoginUser(context, "UKeyLog"); if (!loginUser.Pass)//权限验证 { return; } //加载DataGrid if (context.Request["action"] == "gridLoad") { UKeyLogBLL bll = new UKeyLogBLL(context, loginUser); int page = int.Parse(context.Request["page"]); int rows = int.Parse(context.Request["rows"]); string uKeyId = context.Request["uKeyId"]; string startDate = context.Request["startDate"]; string endDate = context.Request["endDate"]; bll.LoadGrid(page, rows, uKeyId, startDate, endDate); return; } //加载信息 if (context.Request["action"] == "load") { UKeyLogBLL bll = new UKeyLogBLL(context, loginUser); long logId = long.Parse(context.Request["logId"]);//日志编号 bll.Load(logId); return; } //增加 if (context.Request["action"] == "add") { UKeyLogBLL bll = new UKeyLogBLL(context, loginUser); TBUKeyLog tbUKeyLog = new TBUKeyLog(); tbUKeyLog.logId = long.Parse(context.Request["logId"]); //日志编号 tbUKeyLog.uKeyId = context.Request["uKeyId"]; //加密狗编号 tbUKeyLog.operateType = context.Request["operateType"]; //操作类型 tbUKeyLog.summary = context.Request["summary"]; //操作说明 tbUKeyLog.operateTime = context.Request["operateTime"]; //操作时间 tbUKeyLog.operatorId = context.Request["operatorId"]; //操作人编号 tbUKeyLog.operatorName = context.Request["operatorName"]; //操作人名称 bll.Add(tbUKeyLog); return; } //修改 if (context.Request["action"] == "edit") { UKeyLogBLL bll = new UKeyLogBLL(context, loginUser); TBUKeyLog tbUKeyLog = new TBUKeyLog(); tbUKeyLog.logId = long.Parse(context.Request["logId"]); //日志编号 tbUKeyLog.uKeyId = context.Request["uKeyId"]; //加密狗编号 tbUKeyLog.operateType = context.Request["operateType"]; //操作类型 tbUKeyLog.summary = context.Request["summary"]; //操作说明 tbUKeyLog.operateTime = context.Request["operateTime"]; //操作时间 tbUKeyLog.operatorId = context.Request["operatorId"]; //操作人编号 tbUKeyLog.operatorName = context.Request["operatorName"]; //操作人名称 bll.Edit(tbUKeyLog); return; } //删除 if (context.Request["action"] == "delete") { UKeyLogBLL bll = new UKeyLogBLL(context, loginUser); long logId = long.Parse(context.Request["logId"]);//日志编号 bll.Delete(logId); return; } } catch (Exception e) { Message.error(context, e.Message); } }