Exemplo n.º 1
0
        public DocumentPositionResponse Map(DocumentPosition documentPosition)
        {
            if (documentPosition == null)
            {
                return(null);
            }
            ;

            DocumentPositionResponse response = new DocumentPositionResponse
            {
                Id = documentPosition.Id,
                PositionNumberText = documentPosition.PositionNumberText,
                ArticleNameExtern  = documentPosition.ArticleNameExtern,
                Quantity           = documentPosition.Quantity,
                ScaleUnitQty       = documentPosition.ScaleUnitQty,
                ScaleUnitType      = documentPosition.ScaleUnitType,
                ScaleUnit          = documentPosition.ScaleUnit,
                DeliveryQty        = documentPosition.DeliveryQty,
                IsPartialDelivered = documentPosition.IsPartialDelivered,
                PriceBase          = documentPosition.PriceBase,
                PricePerUnit       = documentPosition.PricePerUnit,
                PriceTotal         = documentPosition.PricePerUnit,
                SalesTaxPercent    = documentPosition.SalesTaxPercent,

                ParentId   = (Guid)documentPosition.ParentId,
                Parent     = _documentPositionMapper.Map(documentPosition.Parent),
                DocumentId = documentPosition.DocumentId,
                Document   = _documentMapper.Map(documentPosition.Document),
                ArticleId  = documentPosition.ArticleId,
                Article    = _articleMapper.Map(documentPosition.Article),
            };

            return(response);
        }
Exemplo n.º 2
0
        public ArticleRangeResponse Map(ArticleRange articleRange)
        {
            if (articleRange == null)
            {
                return(null);
            }
            ;

            ArticleRangeResponse response = new ArticleRangeResponse
            {
                Id                    = articleRange.Id,
                Quantity              = articleRange.Quantity,
                NetPrice              = articleRange.NetPrice,
                Discount              = articleRange.Discount,
                Addition              = articleRange.Addition,
                Price                 = articleRange.Price,
                ArticleId             = articleRange.ArticleId,
                Article               = _articleMapper.Map(articleRange.Article),
                ArticlePriceListInId  = articleRange.ArticlePriceListInId,
                ArticlePriceListIn    = _articlepriceListInMapper.Map(articleRange.ArticlePriceListIn),
                ArticlePriceListOutId = articleRange.ArticlePriceListOutId,
                ArticlePriceListOut   = _articlepriceListOutMapper.Map(articleRange.ArticlePriceListOut)
            };

            return(response);
        }
Exemplo n.º 3
0
        public ArticlePriceListInResponse Map(ArticlePriceListIn articlePriceListIn)
        {
            if (articlePriceListIn == null)
            {
                return(null);
            }
            ;

            ArticlePriceListInResponse response = new ArticlePriceListInResponse
            {
                Id                 = articlePriceListIn.Id,
                ValidFrom          = articlePriceListIn.ValidFrom,
                Validto            = articlePriceListIn.Validto,
                ScaleUnitQty       = articlePriceListIn.ScaleUnitQty,
                ScaleUnitType      = articlePriceListIn.ScaleUnitType,
                UnitOrder          = articlePriceListIn.UnitOrder,
                MinOrderQty        = articlePriceListIn.MinOrderQty,
                IsMultipleOrderQty = articlePriceListIn.IsMultipleOrderQty,
                ArticleId          = articlePriceListIn.ArticleId,
                Article            = _articleMapper.Map(articlePriceListIn.Article),
                ArticleRanges      = articlePriceListIn.ArticleRanges.Select(x => _articleRangeMapper.Map(x)).ToList()
            };

            return(response);
        }
Exemplo n.º 4
0
        public async Task <RespContainer <ArticleResponse> > Handle(AddArticleCommand request, CancellationToken cancellationToken)
        {
            Models.Article article = _articleMapper.Map(request.Data);
            Models.Article result  = _articleRespository.Add(article);

            int modifiedRecords = await _articleRespository.UnitOfWork.SaveChangesAsync();

            _logger.LogInformation(Events.Add, Messages.NumberOfRecordAffected_modifiedRecords, modifiedRecords);
            _logger.LogInformation(Events.Add, Messages.ChangesApplied_id, result?.Id);

            return(RespContainer.Ok(_articleMapper.Map(result), "Article Created"));
        }
Exemplo n.º 5
0
        public async Task <ArticleResponse> AddArticleAsync(AddArticleRequest request)
        {
            Article article = _articleMapper.Map(request);
            Article result  = _articleRespository.Add(article);

            int modifiedRecords = await _articleRespository.UnitOfWork.SaveChangesAsync();

            _logger.LogInformation(Events.Add, Messages.NumberOfRecordAffected_modifiedRecords, modifiedRecords);
            _logger.LogInformation(Events.Add, Messages.ChangesApplied_id, result?.Id);

            return(_articleMapper.Map(result));
        }
Exemplo n.º 6
0
        public ArticleInventoryResponse Map(ArticleInventory articleInventory)
        {
            if (articleInventory == null)
            {
                return(null);
            }
            ;

            ArticleInventoryResponse response = new ArticleInventoryResponse
            {
                Id             = articleInventory.Id,
                ArticleId      = articleInventory.ArticleId,
                Article        = _articleMapper.Map(articleInventory.Article),
                ArticlePlaceId = articleInventory.ArticlePlaceId,
                ArticlePlace   = _articlePlaceMapper.Map(articleInventory.ArticlePlace)
            };

            return(response);
        }
        public void CreateArticle(ArticleDto articlesDto)
        {
            var article = _articleMapper.Map(articlesDto);

            _articleService.AddArticle(article);
        }