Ejemplo n.º 1
0
        public AmazonLog Add(AmazonLogType type, AmazonLogStatus status, Exception elmahError, MarketplaceWebService.Model.Error amazonError,
                             AmazonApiSection?apiSection, string apiOperation, AmazonOrder amazonOrder, AmazonListing amazonListing, AmazonListingGroup amazonListingGroup,
                             string message = "", string details = "")
        {
            var log = new AmazonLog
            {
                LogType            = type,
                LogStatus          = status,
                AmazonOrder        = amazonOrder,
                ApiSection         = apiSection,
                ApiOperation       = !String.IsNullOrWhiteSpace(apiOperation) ? apiOperation : null,
                AmazonListing      = amazonListing,
                AmazonListingGroup = amazonListingGroup,
                Message            = !String.IsNullOrWhiteSpace(message) ? message : null,
                Detail             = !String.IsNullOrWhiteSpace(details) ? details : null,
                Site = CurrentRequestData.CurrentSite
            };

            log.SetGuid(Guid.NewGuid());
            if (elmahError != null)
            {
                log.Message = elmahError.Message;
                log.Detail  = elmahError.StackTrace;
            }
            if (amazonError != null)
            {
                log.ErrorCode = amazonError.Code;
                log.ErrorType = amazonError.Type;
                log.Message   = amazonError.Message;
                log.Detail    = amazonError.Detail.ToString();
            }

            return(Save(log));
        }
Ejemplo n.º 2
0
        public AmazonLog Add(AmazonLogType type, AmazonLogStatus status, Exception elmahError, MarketplaceWebService.Model.Error amazonError,
            AmazonApiSection? apiSection, string apiOperation, AmazonOrder amazonOrder, AmazonListing amazonListing, AmazonListingGroup amazonListingGroup,
            string message = "", string details = "")
        {
            var log = new AmazonLog
                          {
                              LogType = type,
                              LogStatus = status,
                              AmazonOrder = amazonOrder,
                              ApiSection = apiSection,
                              ApiOperation = !String.IsNullOrWhiteSpace(apiOperation) ? apiOperation : null,
                              AmazonListing = amazonListing,
                              AmazonListingGroup = amazonListingGroup,
                              Message = !String.IsNullOrWhiteSpace(message) ? message : null,
                              Detail = !String.IsNullOrWhiteSpace(details) ? details : null,
                              Site = CurrentRequestData.CurrentSite
                          };
            log.SetGuid(Guid.NewGuid());
            if (elmahError != null)
            {
                log.Message = elmahError.Message;
                log.Detail = elmahError.StackTrace;
            }
            if (amazonError != null)
            {
                log.ErrorCode = amazonError.Code;
                log.ErrorType = amazonError.Type;
                log.Message = amazonError.Message;
                log.Detail = amazonError.Detail.ToString();
            }

            return Save(log);
        }
Ejemplo n.º 3
0
 public IPagedList<AmazonLog> GetEntriesPaged(int pageNum, AmazonLogType? type = null, AmazonLogStatus? status = null, int pageSize = 10)
 {
     if (type.HasValue)
         return _session.QueryOver<AmazonLog>()
                    .Where(entry => entry.Site == CurrentRequestData.CurrentSite
                        && (type == null || entry.LogType == type.Value))
                    .OrderBy(entry => entry.Id)
                    .Desc.Paged(pageNum, pageSize);
     if (status.HasValue)
         return _session.QueryOver<AmazonLog>()
                    .Where(entry => entry.Site == CurrentRequestData.CurrentSite
                        && (status == null || entry.LogStatus == status.Value))
                    .OrderBy(entry => entry.Id)
                    .Desc.Paged(pageNum, pageSize);
     return _session.QueryOver<AmazonLog>()
                    .Where(entry => entry.Site == CurrentRequestData.CurrentSite)
                    .OrderBy(entry => entry.Id)
                    .Desc.Paged(pageNum, pageSize);
 }