Esempio n. 1
0
        public void Generate_Return_Success()
        {
            Guid id  = Guid.NewGuid();
            var  dto = new GarmentSewingOutDto(new GarmentSewingOut(id, "sewingOutNo", new BuyerId(1), "BuyerCode", "BuyerName", new UnitDepartmentId(1), "unitToCode", "unitToName", "SewingTo", DateTimeOffset.Now, "RoNo", "Article", new UnitDepartmentId(1), "unitCode", "unitName", new GarmentComodityId(1), "comodityCode", "ComodityName", false));

            var garmentSewingOutItem = new GarmentSewingOutItem(id, id, id, id, new ProductId(1), "productCode", "productName", "designColor", new SizeId(1), "sizeName", 1, new UomId(1), "uomUnit", "Color", 1, 1, 1);
            var items = new List <GarmentSewingOutItemDto>()
            {
                new GarmentSewingOutItemDto(garmentSewingOutItem)
            };

            dto.GetType().GetProperty("Items").SetValue(dto, items);

            var result = GarmentSewingOutPDFTemplate.Generate(dto, "Buyer");

            Assert.NotNull(result);
        }
Esempio n. 2
0
        public async Task <IActionResult> GetPdf(string id, string buyer)
        {
            Guid guid = Guid.Parse(id);

            VerifyUser();

            int clientTimeZoneOffset = int.Parse(Request.Headers["x-timezone-offset"].First());
            GarmentSewingOutDto garmentSewingOutDto = _garmentSewingOutRepository.Find(o => o.Identity == guid).Select(sewOut => new GarmentSewingOutDto(sewOut)
            {
                Items = _garmentSewingOutItemRepository.Find(o => o.SewingOutId == sewOut.Identity).Select(sewOutItem => new GarmentSewingOutItemDto(sewOutItem)
                {
                    Details = _garmentSewingOutDetailRepository.Find(o => o.SewingOutItemId == sewOutItem.Identity).Select(sewOutDetail => new GarmentSewingOutDetailDto(sewOutDetail)
                    {
                    }).ToList()
                }).ToList()
            }
                                                                                                                       ).FirstOrDefault();
            var stream = GarmentSewingOutPDFTemplate.Generate(garmentSewingOutDto, buyer);

            return(new FileStreamResult(stream, "application/pdf")
            {
                FileDownloadName = $"{garmentSewingOutDto.SewingOutNo}.pdf"
            });
        }