public static void NewLogInformation(STATIONNAME StationName, DateTime LogDate, String LogName, Object[] Value, String Message, LogType LogCategory, long?UserID) { InformationLogs NewLog = new InformationLogs(); NewLog.LogID = (long)(DateTime.UtcNow - DateTime.MinValue).TotalMilliseconds; NewLog.UserID = UserID; NewLog.LogName = LogName; NewLog.LogDate = LogDate; NewLog.LogValue = Value != null?String.Join(", ", Value) : null; NewLog.LogMessage = Message; NewLog.LogCategory = LogCategory; NewLog.StationName = StationName; if (DateTime.UtcNow.Hour == 1) { TTCSTempLogInformation.Clear(); } TTCSLogInformation.Add(NewLog); TTCSTempLogInformation.Add(NewLog); if (!TTCSLog.IsSearchByAllStation) { AddLogToGrid(StationName, LogDate, Message, LogCategory, NewLog.LogValue, UserID); } else if (TTCSLog.IsSearchByAllStation && LogDate >= StartDate && LogDate <= EndDate) { AddLogToGrid(StationName, LogDate, Message, LogCategory, NewLog.LogValue, UserID); } }
public static ReturnLogInformation GetLogList() { List <InformationLogs> TempLogs = new List <InformationLogs>(); for (int i = 0; i < TTCSTempLogInformation.Count; i++) { TempLogs.Add(TTCSTempLogInformation[i]); } TTCSTempLogInformation.Clear(); return(ReturnLogInformation.DefineReturn(ReturnStatus.SUCESSFUL, null, TempLogs)); }