public static DataTable GetEventList() { DataTable dataTable = new DataTable(); DataColumn dataColumn = new DataColumn(); dataColumn.DataType = Type.GetType("System.String"); dataColumn.ColumnName = "eventid"; dataTable.Columns.Add(dataColumn); dataColumn = new DataColumn(); dataColumn.DataType = Type.GetType("System.Int32"); dataColumn.ColumnName = "logflag"; dataTable.Columns.Add(dataColumn); dataColumn = new DataColumn(); dataColumn.DataType = Type.GetType("System.Int32"); dataColumn.ColumnName = "mailflag"; dataTable.Columns.Add(dataColumn); dataColumn = new DataColumn(); dataColumn.DataType = Type.GetType("System.Int64"); dataColumn.ColumnName = "reserve"; dataTable.Columns.Add(dataColumn); try { Hashtable eventLogCache = DBCache.GetEventLogCache(); Hashtable eventMailCache = DBCache.GetEventMailCache(); if (eventLogCache != null && eventLogCache.Count > 0) { ICollection keys = eventLogCache.Keys; IEnumerator enumerator = keys.GetEnumerator(); try { while (enumerator.MoveNext()) { string text = (string)enumerator.Current; DataRow dataRow = dataTable.NewRow(); dataRow[0] = text; dataRow[1] = Convert.ToInt32(eventLogCache[text]); dataRow[2] = Convert.ToInt32(eventMailCache[text]); dataTable.Rows.Add(dataRow); } goto IL_17B; } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } } DebugCenter.GetInstance().appendToFile("DBERROR~~~~~~~~~~~Get LogEventList Error : Could not get data from DBCache"); IL_17B :; } catch (Exception ex) { DebugCenter.GetInstance().appendToFile("DBERROR~~~~~~~~~~~Get LogEventList Error : " + ex.Message + "\n" + ex.StackTrace); } dataTable = new DataView(dataTable) { Sort = "eventid ASC" }.ToTable(); return(dataTable); }
public static int InsertNewLog(ref int mailflag, string str_eventid, params string[] str_parameters) { int result = -1; int num = 1; int num2 = 1; try { Hashtable eventLogCache = DBCache.GetEventLogCache(); Hashtable eventMailCache = DBCache.GetEventMailCache(); if (eventLogCache != null && eventLogCache.Count > 0) { object obj = eventLogCache[str_eventid]; if (obj != null) { num = Convert.ToInt32(obj); } obj = eventMailCache[str_eventid]; if (obj != null) { num2 = Convert.ToInt32(obj); } } else { DebugCenter.GetInstance().appendToFile("DBERROR~~~~~~~~~~~Insert New Log Error : Could not get event log flag from DBCache"); } mailflag = num2; if (num < 1) { return(1); } if (LogInfo.lp_thread == null) { LogInfo.lp_thread = new LogProcess(); LogInfo.lp_thread.Start(); } List <string> list = new List <string>(); list.Add(str_eventid); list.Add(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); string str = ""; for (int i = 0; i < str_parameters.Length; i++) { list.Add(str_parameters[i]); if (i == str_parameters.Length - 1) { str += str_parameters[i]; } else { str = str + str_parameters[i] + "^|^"; } } LogInfo.lp_thread.PutLog(list); } catch (Exception ex) { DebugCenter.GetInstance().appendToFile("DBERROR~~~~~~~~~~~Insert New Log Error : " + ex.Message + "\n" + ex.StackTrace); } return(result); }