예제 #1
0
        public List<Log> GetLogs(int? id, DateTime? timestampFrom, DateTime? timestampTo, string machineName,
                                 string sessionId, string serviceName, string title, float timeTaken, string status,
                                 float? timeMin,
                                 float? timeMax, string searchText, int pageIndex, int pageSize, out int totalRowCount)
        {
            totalRowCount = 0;

            try
            {
                var db = new MySqlDatabase(LogConfig.LogDB);
                DataSet dataSet =
                    db.ExecuteQuery(LogDbCommandBuilder.BuildGetLogs(id, timestampFrom, timestampTo, machineName,
                                                                sessionId, serviceName, title, timeTaken, status,
                                                                timeMin,
                                                                timeMax, searchText, pageIndex, pageSize, db.Connection),
                                    "outtotalRowCount", out totalRowCount);
                return ParseLogs(dataSet).OrderByDescending(e => e.TimeStamp).ToList();
            }
            catch (Exception ex)
            {
                var exLog = new ExceptionLog(ex, "LoggingDataProvider", "GetLogs", Severity.Normal);
                SaveException(exLog);
            }
            return new List<Log>();
        }
예제 #2
0
        public List<ExceptionLog> GetExceptions(int? exceptionId, string machineName, string source, string targetSite,
                                                string exceptionType, string appDomainName, string message,
                                                DateTime? timestampFrom, DateTime? timestampTo,
                                                int pageIndex, int pageSize, string searchText, string sessionId,
                                                out int totalRowCount)
        {
            totalRowCount = 0;

            try
            {
                var db = new MySqlDatabase(LogConfig.LogDB);
                DataSet dataSet =
                    db.ExecuteQuery(LogDbCommandBuilder.BuildGetExceptions(exceptionId, machineName, source, targetSite,
                                                                      exceptionType, appDomainName, message,
                                                                      timestampFrom, timestampTo,
                                                                      pageIndex, pageSize, searchText, sessionId,
                                                                      db.Connection), "outtotalRowCount",
                                    out totalRowCount);
                var exceptions = ParseExceptionLogs(dataSet).OrderByDescending(e => e.TimeStamp).ToList();
                return exceptions;
            }
            catch (Exception ex)
            {
                var exLog = new ExceptionLog(ex, "LoggingDataProvider", "GetExceptions", Severity.Normal);
                SaveException(exLog);
            }
            return new List<ExceptionLog>();
        }
예제 #3
0
        public string GetRequestByLogId(int logId)
        {
            try
            {
                var db = new MySqlDatabase(LogConfig.LogDB);
                DataSet dataSet = db.ExecuteQuery(LogDbCommandBuilder.BuildGetRequestByLogId(logId, db.Connection));

                return dataSet != null && dataSet.Tables.Count == 1 && dataSet.Tables[0].Rows != null &&
                       dataSet.Tables[0].Rows.Count == 1
                           ? dataSet.Tables[0].Rows[0][0].ToString()
                           : "No Request Found";
            }
            catch (Exception ex)
            {
                var exLog = new ExceptionLog(ex, "LoggingDataProvider", "GetRequestByLogId", Severity.Normal);
                SaveException(exLog);
            }

            return "No Request Found";
        }
예제 #4
0
 public void SaveLog(Log log)
 {
     try
     {
         var db = new MySqlDatabase(LogConfig.LogDB);
         db.ExecuteNonQuery(LogDbCommandBuilder.BuildSaveLog(log, db.Connection));
     }
     catch (Exception ex)
     {
         var exLog = new ExceptionLog(ex, "LoggingDataProvider", "SaveLog", Severity.Critical);
         SaveException(exLog);
     }
 }
예제 #5
0
 public void SaveException(ExceptionLog exception)
 {
     try
     {
         var db = new MySqlDatabase(LogConfig.LogDB);
         db.ExecuteNonQuery(LogDbCommandBuilder.BuildSaveException(exception, db.Connection));
     }
     catch
     {
     }
 }