public static int GetAllVisitNumWhenInit() { int sysID = (int)LogCom.GetSystemID(); string serverIP = ClientServerInfo.ClientInfo.GetServerIPHost().IP; PageSerach <Log_SystemMonitor> baseSerach = new PageSerach <Log_SystemMonitor>() { Filter = a => (int)a.SystemID == sysID && a.ServerIP == serverIP && a.AllVisitors > 0, OrderBy = a => a.OrderByDescending(m => m.AllVisitors),//OrderBy = a => a.OrderByDescending(m => m.LogTime), 使用LogTime排序得到的结果不准确 PageIndex = 1, PageSize = 5 }; var dbAccessFac = new Log_SystemMonitorDBAccessFac().DBAccessFactory(); var res = dbAccessFac.GetAll(baseSerach); if (res.ErrCode != 0) { LogCom.WriteExceptToFile(res.ExBody, res.ErrMsg + "," + res.Module); return(0); } try { var maxNum = (res.ExeModel as IQueryable <Log_SystemMonitor>).Max(a => a.AllVisitors); return(maxNum); } catch { } return(0); }
protected override ExeResEdm WriteLog(Log_SystemMonitorMQ model) { if (model == null) { return(new ExeResEdm()); } // AdoSQLHelper<Log_SystemMonitor> sqlHelper = new AdoSQLHelper<Log_SystemMonitor>(); var dbAccessFac = new Log_SystemMonitorDBAccessFac().DBAccessFactory(); Log_SystemMonitor dbModel = AutoMapperConfig.GetLog_SystemMonitorModel(model); AddDBPara <Log_SystemMonitor> addDBPara = new AddDBPara <Log_SystemMonitor>() { DBType = DBType.LogMonitor, Model = dbModel, SkipCols = new string[] { "Id" }, TableName = "Log_SystemMonitor", }; try { var n = dbAccessFac.Add(addDBPara); return(n); } catch (Exception ex) { ExeResEdm dbResEdm = new ExeResEdm() { ErrCode = 1, ExBody = ex, Module = "WriteLog方法" }; return(dbResEdm); } }