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 static string GetRunningTime() { var timeSpan = LogCom.GetServerRunningTime(); //服务器上次启动到现在已运行时间 var timeLong = string.Format("{0}天{1}小时{2}分{3}秒", timeSpan.Days, timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds); return(timeLong); }
public ApplicationVisitCount() { try { _Application = (HttpApplicationState)ApplicationObj; } catch (Exception ex) { LogCom.WriteExceptToFile(ex, "ApplicationVisitCount构造函数"); } }