示例#1
0
        public string 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)
        {
            pageIndex = pageIndex < 0 ? 1 : pageIndex;
            pageSize = pageSize < 0 ? 10 : pageSize;
            var dataProvider = new LoggingDataProvider();
            List<ExceptionLog> lst = dataProvider.GetExceptions(exceptionId, machineName, source,
                                                                             targetSite,
                                                                             exceptionType,
                                                                             appDomainName, message, timestampFrom,
                                                                             timestampTo,
                                                                             pageIndex,
                                                                             pageSize, searchText, sessionId,
                                                                             out totalRowCount);
            var flexigridObject = new FlexigridObject
            {
                page = pageIndex,
                total = totalRowCount,
                cellNames = new List<string>
                                                          {
                                                              "Id",
                                                              "SessionId",
                                                              "Title",
                                                              "Severity",
                                                              "Timestamp",
                                                              "MachineName",
                                                              "ExceptionType",
                                                              "Message",
                                                              "Source",
                                                              "AppDomainName",
                                                              "TargetSite",
                                                              "StackTrace",
                                                              "AdditionalInfo",
                                                              "InnerExceptions"
                                                          }
            };

            foreach (ExceptionLog x in lst)
            {
                var cell = new FlexigridRow
                {
                    id = x.ExceptionId.ToString(),
                    cell = new List<string>
                                              {
                                                  x.ExceptionId.ToString(),
                                                  x.SessionId,
                                                  x.Title,
                                                  x.Severity,
                                                  x.TimeStamp.ToString(),
                                                  x.MachineName,
                                                  x.Type,
                                                  x.Message,
                                                  x.Source,
                                                  x.AppDomainName,
                                                  x.TargetSite,
                                                  x.StackTrace,
                                                  x.AdditionalInfo,
                                                  x.InnerException
                                              },
                };

                flexigridObject.rows.Add(cell);
            }

            return Serializer.JSON.Serialize(flexigridObject);
        }