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); }
public ApplicationVisitCount() { try { _Application = (HttpApplicationState)ApplicationObj; } catch (Exception ex) { LogCom.WriteExceptToFile(ex, "ApplicationVisitCount构造函数"); } }