public void Setup() { _uow = new UnitOfWork(); _orderService = new OrderConfirmationService(null, _uow, Root); _project = _uow.ProjectRepository.Get(p => p.ProjectNumber == "P2013-083").FirstOrDefault(); _relation = _project.Files.FirstOrDefault(f => f.File.Name == "R5942565_EU0028S_22104496 SO 10449601"); _parser = OrderConfirmationFactory.GetParser(Root, _relation.File); _orderConfirmation = _orderService.CreateFromProjectFile(_relation); }
public void Setup() { _uow = new UnitOfWork(); _orderService = new OrderConfirmationService(null, _uow, Root); _project = _uow.ProjectRepository.Get(p => p.ProjectNumber == "P2013-078").FirstOrDefault(); _relation = _project.Files.FirstOrDefault(f => f.File.Name == "Confirm_65225_0001622957"); _parser = OrderConfirmationFactory.GetParser(Root, _relation.File); _orderConfirmation = _orderService.CreateFromProjectFile(_relation); }
public OrderConfirmation CreateFromProjectFile(ProjectFile relation) { var file = UnitOfWork.FileRepository.GetByKey(relation.FileId); if (file == null) { throw new Exception("File with id " + relation.FileId + " not found in database."); } var parser = OrderConfirmationFactory.GetParser(_rootDirectory, file); if (parser != null) { var confirmation = parser.ExtractOrderConfirmationData(UnitOfWork); confirmation.ProjectId = relation.ProjectId; confirmation.FileId = relation.FileId; confirmation.Name = "Ordrebekreftelse " + confirmation.OrderNumber; // + " fra " + confirmation.Vendor.Name; Create(confirmation); return(confirmation); } return(null); }