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 void NewLogInformation(STATIONNAME StationName, DateTime LogDate, String Message, LogType LogCategory, long?UserID) { InformationLogs NewLog = new InformationLogs(); NewLog.LogID = (long)(DateTime.UtcNow - DateTime.MinValue).TotalMilliseconds; NewLog.UserID = UserID; NewLog.LogName = "Log from " + StationName.ToString(); NewLog.LogDate = LogDate; NewLog.LogValue = null; NewLog.LogMessage = Message; NewLog.LogCategory = LogCategory; NewLog.StationName = StationName; TTCSLogInformation.Add(NewLog); TTCSTempLogInformation.Add(NewLog); if (!TTCSLog.IsSearchByAllStation) { AddLogToGrid(StationName, LogDate, Message, LogCategory, null, UserID); } else if (TTCSLog.IsSearchByAllStation && LogDate >= StartDate && LogDate <= EndDate) { AddLogToGrid(StationName, LogDate, Message, LogCategory, null, UserID); } }