/// <summary> /// 查询操作日志 /// </summary> /// <param name="ledSN">显示屏SN号,空串代表不限制</param> /// <param name="type">操作类型,<0代表不限制</param> /// <param name="source">操作源,<0代表不限制</param> /// <param name="minDT">时段起始时间</param> /// <param name="maxDT">时段结束时间</param> /// <returns></returns> public List <OprLog> GetOprLog(string ledSN, int type, int source, long minDT, long maxDT) { List <OprLog> oprList = new List <OprLog>(); string strTmp = "select sn,type,source,updatetime,content,condition from oprlog where"; string strSql = "select sn,type,source,updatetime,content,condition from oprlog where"; if (ledSN != string.Empty) { strSql += " sn=" + "'" + ledSN + "'"; } if (type >= 0) { if (strTmp == strSql) { strSql += " type=" + type; } else { strSql += " and type=" + type; } } if (source >= 0) { if (strTmp == strSql) { strSql += " source=" + source; } else { strSql += " and source=" + source; } } if (strTmp == strSql) { strSql += " updatetime between " + minDT + " and " + maxDT; } else { strSql += " and updatetime between " + minDT + " and " + maxDT; } strSql += ";"; DataTable dt = _idbRead.ExecuteDataTable(strSql); if (dt == null || dt.Rows.Count == 0) { return(oprList); } OprLog opLog; for (int i = 0; i < dt.Rows.Count; i++) { opLog = new OprLog(); opLog.Sn = (string)dt.Rows[i][0]; opLog.Type = (int)dt.Rows[i][1]; opLog.Source = (int)dt.Rows[i][2]; opLog.Updatetime = SystemHelper.GetTimeByUtcTicks((long)dt.Rows[i][3]); opLog.Content = (string)dt.Rows[i][4]; opLog.Condition = (string)dt.Rows[i][5]; oprList.Add(opLog); } return(oprList); }