Ejemplo n.º 1
0
        public static DataTable dispOnePageLogs(int i_pagenum, int i_pagesize)
        {
            if (LogAPI.i_matchedLogs == 0)
            {
                return(null);
            }
            DataTable dataTable = new DataTable();

            dataTable.Columns.Add(EventLogLang.getMsg(LangRes.T1No, new string[0]), typeof(int));
            dataTable.Columns.Add(EventLogLang.getMsg(LangRes.T2DateTime, new string[0]), typeof(string));
            dataTable.Columns.Add(EventLogLang.getMsg(LangRes.T3Category, new string[0]), typeof(string));
            dataTable.Columns.Add(EventLogLang.getMsg(LangRes.T4Severity, new string[0]), typeof(string));
            dataTable.Columns.Add(EventLogLang.getMsg(LangRes.T5Event, new string[0]), typeof(string));
            dataTable.Columns.Add(EventLogLang.getMsg(LangRes.T6LogInfo, new string[0]), typeof(string));
            if (LogAPI.s_myKeyWord != null)
            {
                int num  = (i_pagenum - 1) * i_pagesize;
                int num2 = num + i_pagesize;
                if (num2 > LogAPI.i_matchedLogs)
                {
                    i_pagenum = LogAPI.i_matchedLogs / i_pagesize;
                    num       = i_pagenum * i_pagesize;
                    num2      = LogAPI.i_matchedLogs;
                }
                for (int i = num; i < num2; i++)
                {
                    dataTable.Rows.Add(new object[]
                    {
                        i - num + 1,
                        LogAPI.s_matchedLogs[i][0],
                        LogAPI.s_matchedLogs[i][1],
                        LogAPI.s_matchedLogs[i][2],
                        LogAPI.s_matchedLogs[i][3],
                        LogAPI.s_matchedLogs[i][4]
                    });
                }
            }
            else
            {
                DataTable searchResult = LogInfo.GetSearchResult(LogAPI.i_myRangeType, LogAPI.dt_myStart, LogAPI.dt_myEnd, i_pagenum, i_pagesize, LogAPI.i_foundLogs);
                for (int i = 0; i < searchResult.Rows.Count; i++)
                {
                    string[] oneRow = LogAPI.getOneRow(null, searchResult.Rows[i]);
                    if (oneRow != null)
                    {
                        dataTable.Rows.Add(new object[]
                        {
                            i + 1,
                            oneRow[0],
                            oneRow[1],
                            oneRow[2],
                            oneRow[3],
                            oneRow[4]
                        });
                    }
                }
            }
            return(dataTable);
        }
Ejemplo n.º 2
0
        public static DataTable getAllLogs()
        {
            DataTable dataTable = new DataTable();

            dataTable.Columns.Add(EventLogLang.getMsg(LangRes.T1No, new string[0]), typeof(int));
            dataTable.Columns.Add(EventLogLang.getMsg(LangRes.T2DateTime, new string[0]), typeof(string));
            dataTable.Columns.Add(EventLogLang.getMsg(LangRes.T3Category, new string[0]), typeof(string));
            dataTable.Columns.Add(EventLogLang.getMsg(LangRes.T4Severity, new string[0]), typeof(string));
            dataTable.Columns.Add(EventLogLang.getMsg(LangRes.T5Event, new string[0]), typeof(string));
            dataTable.Columns.Add(EventLogLang.getMsg(LangRes.T6LogInfo, new string[0]), typeof(string));
            if (LogAPI.i_matchedLogs == 0)
            {
                return(dataTable);
            }
            if (LogAPI.s_myKeyWord != null)
            {
                for (int i = 0; i < LogAPI.i_matchedLogs; i++)
                {
                    dataTable.Rows.Add(new object[]
                    {
                        i + 1,
                        LogAPI.s_matchedLogs[i][0],
                        LogAPI.s_matchedLogs[i][1],
                        LogAPI.s_matchedLogs[i][2],
                        LogAPI.s_matchedLogs[i][3],
                        LogAPI.s_matchedLogs[i][4]
                    });
                }
            }
            else
            {
                DataTable searchResult = LogInfo.GetSearchResult(LogAPI.i_myRangeType, LogAPI.dt_myStart, LogAPI.dt_myEnd, 0, 0, LogAPI.i_foundLogs);
                int       num          = 0;
                foreach (DataRow logData in searchResult.Rows)
                {
                    string[] oneRow = LogAPI.getOneRow(null, logData);
                    if (oneRow != null)
                    {
                        dataTable.Rows.Add(new object[]
                        {
                            num + 1,
                            oneRow[0],
                            oneRow[1],
                            oneRow[2],
                            oneRow[3],
                            oneRow[4]
                        });
                        num++;
                    }
                }
            }
            return(dataTable);
        }
Ejemplo n.º 3
0
 public static int searchLogs(string s_keyword, int i_range_type, DateTime dt_start, DateTime dt_end)
 {
     LogAPI.i_myRangeType = i_range_type;
     LogAPI.dt_myStart    = dt_start;
     if (i_range_type == 0)
     {
         LogAPI.dt_myEnd = DateTime.Now;
     }
     else
     {
         LogAPI.dt_myEnd = dt_end;
     }
     LogAPI.s_myKeyWord   = null;
     LogAPI.i_matchedLogs = 0;
     LogAPI.i_foundLogs   = LogInfo.GetRowCount(i_range_type, dt_start, dt_end);
     if (LogAPI.i_foundLogs > 0)
     {
         if (s_keyword != null)
         {
             LogAPI.s_myKeyWord   = s_keyword;
             LogAPI.s_matchedLogs = new string[LogAPI.i_foundLogs][];
             DataTable searchResult = LogInfo.GetSearchResult(i_range_type, dt_start, dt_end, 0, 0, LogAPI.i_foundLogs);
             for (int i = 0; i < searchResult.Rows.Count; i++)
             {
                 string[] oneRow = LogAPI.getOneRow(s_keyword, searchResult.Rows[i]);
                 if (oneRow != null)
                 {
                     LogAPI.s_matchedLogs[LogAPI.i_matchedLogs] = oneRow;
                     LogAPI.i_matchedLogs++;
                 }
             }
         }
         else
         {
             LogAPI.i_matchedLogs = LogAPI.i_foundLogs;
         }
     }
     return(LogAPI.i_matchedLogs);
 }