Esempio n. 1
0
        public SortedList GetLogSources(string logName)
        {
            //Get a list of log sources fro the specified log name
            SortedList srcs = null;

            try {
                srcs = new SortedList();
                srcs.Add(SRCS_ALL, SRCS_ALL);
                DataSet ds = fillDataset(USP_LOG_GETLIST, TBL_LOG, new object[] { logName });
                if (ds != null)
                {
                    AppLogDS logDS = new AppLogDS();
                    logDS.Merge(ds);
                    for (int i = 0; i < logDS.AppLogTable.Rows.Count; i++)
                    {
                        string src = logDS.AppLogTable.Rows[i]["Source"].ToString();
                        if (src.Length > 0 && !srcs.ContainsKey(src))
                        {
                            srcs.Add(src, src);
                        }
                    }
                }
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while reading logs.", ex); }
            return(srcs);
        }
Esempio n. 2
0
        public AppLog GetAppLog(string logName, string source)
        {
            //Get the application log for the specified log name
            AppLog log = null;

            try {
                log = new AppLog(logName);
                AppLogDS logDS = new AppLogDS();
                DataSet  ds    = fillDataset(USP_LOG_GETLIST, TBL_LOG, new object[] { logName });
                if (ds != null)
                {
                    logDS.Merge(ds);
                    for (int i = 0; i < logDS.AppLogTable.Rows.Count; i++)
                    {
                        TraceMessage msg = new TraceMessage(logDS.AppLogTable[i]);
                        if (source == SRCS_ALL || msg.Source.Trim() == source.Trim())
                        {
                            log.Add(msg);
                        }
                    }
                }
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while reading the application log.", ex); }
            return(log);
        }
Esempio n. 3
0
        public SortedList GetLogNames()
        {
            //Get a list of logs
            SortedList logs = null;

            try {
                logs = new SortedList();
                DataSet ds = fillDataset(USP_LOG_GETLIST, TBL_LOG, new object[] { null });
                if (ds != null)
                {
                    AppLogDS logDS = new AppLogDS();
                    logDS.Merge(ds);
                    for (int i = 0; i < logDS.AppLogTable.Rows.Count; i++)
                    {
                        string log = logDS.AppLogTable.Rows[i]["Name"].ToString();
                        if (log.Length > 0 && !logs.ContainsKey(log))
                        {
                            logs.Add(log, log);
                        }
                    }
                }
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while reading logs.", ex); }
            return(logs);
        }