コード例 #1
0
        public async Task <NotificationMovementsSummaryAndTable> HandleAsync(GetSummaryAndTable message)
        {
            var isInterimNotification = (await facilityRepository.GetByNotificationId((message.Id))).IsInterim.GetValueOrDefault();
            var summaryData           = await summaryRepository.GetById(message.Id);

            IEnumerable <Movement> notificationMovements;

            if (message.Status.HasValue)
            {
                notificationMovements = await movementRepository.GetPagedMovementsByStatus(message.Id, message.Status.Value, message.PageNumber, PageSize);
            }
            else
            {
                notificationMovements = await movementRepository.GetPagedMovements(message.Id, message.PageNumber, PageSize);
            }

            var data = mapper.Map <NotificationMovementsSummary, Movement[], NotificationMovementsSummaryAndTable>(summaryData, notificationMovements.ToArray());

            data.IsInterimNotification = isInterimNotification;

            data.PageSize          = PageSize;
            data.PageNumber        = message.PageNumber;
            data.NumberOfShipments = await movementRepository.GetTotalNumberOfMovements(message.Id, message.Status);

            return(data);
        }
コード例 #2
0
        public async Task <MovementSummary> HandleAsync(GetMovementSummary message)
        {
            var movement = await movementRepository
                           .GetById(message.Id);

            var summaryData = await summaryRepository
                              .GetById(movement.NotificationId);

            return(mapper.Map <MovementSummary>(summaryData, movement));
        }
コード例 #3
0
        public PrenotificationQuantityExceededRuleTests()
        {
            this.repo = A.Fake <INotificationMovementsSummaryRepository>();

            int intendedQuantity = 100;
            int quantityReceived = 80;

            A.CallTo(() => repo.GetById(notificationId))
            .Returns(NotificationMovementsSummary.Load(notificationId, string.Empty,
                                                       Core.Shared.NotificationType.Disposal, 10, 5, 10, 5, intendedQuantity, quantityReceived,
                                                       Core.Shared.ShipmentQuantityUnits.Kilograms,
                                                       Core.FinancialGuarantee.FinancialGuaranteeStatus.Approved,
                                                       Core.Notification.UKCompetentAuthority.England,
                                                       Core.NotificationAssessment.NotificationStatus.Consented,
                                                       new Domain.ShipmentQuantity(1, Core.Shared.ShipmentQuantityUnits.Kilograms)));
        }
コード例 #4
0
        public async Task <ContentRuleResult <BulkMovementContentRules> > GetResult(List <PrenotificationMovement> shipments, Guid notificationId)
        {
            var    excessiveShipmentsResult = MessageLevel.Success;
            var    excessiveShipmentNumbers = new List <string>();
            string errorMessage             = string.Empty;

            var movementSummary = await notificationMovementsSummaryRepository.GetById(notificationId);

            int remainingShipments = 1; //movementSummary.ActiveLoadsPermitted - movementSummary.CurrentActiveLoads;

            if (remainingShipments < shipments.Count)
            {
                excessiveShipmentsResult = MessageLevel.Error;
            }

            return(new ContentRuleResult <BulkMovementContentRules>(BulkMovementContentRules.ExcessiveShipments, excessiveShipmentsResult, excessiveShipmentNumbers, remainingShipments, shipments.Count));
        }
コード例 #5
0
        public PrenotificationOnlyNewShipmentsRuleTests()
        {
            this.repo = A.Fake <INotificationMovementsSummaryRepository>();

            var maxShipments     = 10;
            var currentShipments = 3;

            var movementSummary = NotificationMovementsSummary.Load(notificationId, string.Empty,
                                                                    Core.Shared.NotificationType.Disposal, maxShipments, currentShipments, 5, 3, 100, 10,
                                                                    Core.Shared.ShipmentQuantityUnits.Kilograms, Core.FinancialGuarantee.FinancialGuaranteeStatus.Approved,
                                                                    Core.Notification.UKCompetentAuthority.England, Core.NotificationAssessment.NotificationStatus.Consented,
                                                                    new Domain.ShipmentQuantity(1, Core.Shared.ShipmentQuantityUnits.Kilograms));

            A.CallTo(() => repo.GetById(notificationId)).Returns(movementSummary);

            rule = new PrenotificationInvalidShipmentNumberRule(repo);
        }
コード例 #6
0
        public async Task <InternalMovementSummary> HandleAsync(GetInternalMovementSummary message)
        {
            var summary = await repository.GetById(message.NotificationId);

            return(new InternalMovementSummary
            {
                NotificationId = summary.NotificationId,
                NotificationNumber = summary.NotificationNumber,
                TotalShipments = summary.CurrentTotalShipments,
                QuantityReceived = summary.QuantityReceived,
                QuantityRemaining = summary.QuantityRemaining,
                DisplayUnit = summary.Units,
                ActiveLoadsPermitted = summary.ActiveLoadsPermitted,
                CurrentActiveLoads = summary.CurrentActiveLoads,
                CompetentAuthority = summary.CompetentAuthority,
                FinancialGuaranteeStatus = summary.FinancialGuaranteeStatus,
                NotificationStatus = summary.NotificationStatus,
                TotalIntendedShipments = summary.IntendedTotalShipments,
                AverageTonnage = summary.AverageTonnage,
                AverageDataUnit = summary.AverageDataUnit
            });
        }
コード例 #7
0
        public async Task <BasicMovementSummary> HandleAsync(GetBasicMovementSummary message)
        {
            var summary = await repository.GetById(message.NotificationId);

            return(mapper.Map <BasicMovementSummary>(summary));
        }