Exemplo n.º 1
0
        public DocumentQueryResponse GetDefaultDocument(DocumentQueryRequest request)
        {
            var response = new DocumentQueryResponse();

            try
            {
                var defaultDocument = _cacheManager.Retrieve <DocumentDto>("DefaultDocument");

                if (defaultDocument != null)
                {
                    response.Document = defaultDocument;
                }
                else
                {
                    var document = _documentRepository.GetDefaultDocument();

                    if (document != null)
                    {
                        var documentDto = Mapper.Map <Document, DocumentDto>(document);
                        _cacheManager.Store("DefaultDocument", documentDto);
                        response.Document = documentDto;
                    }
                }
            }
            catch (Exception exception)
            {
                response.Failed  = true;
                response.Message = DocumentQueryMessage.DocumentLoadingFaild;
                _logger.Log(exception);
            }

            return(response);
        }
Exemplo n.º 2
0
        public DocumentQueryResponse GetDocumentByStoreId(DocumentQueryRequest request)
        {
            var response = new DocumentQueryResponse();

            try
            {
                var document = _documentRepository.GetDocumentByStoreId(request.StoreId);
                response.Document = Mapper.Map <Document, DocumentDto>(document);
            }
            catch (Exception exception)
            {
                response.Failed  = true;
                response.Message = DocumentQueryMessage.DocumentLoadingFaild;
                _logger.Log(exception);
            }

            return(response);
        }