public async Task<NotificationApplication> CreateNew(NotificationType notificationType,
     UKCompetentAuthority competentAuthority)
 {
     var nextNotificationNumber = await numberGenerator.GetNextNotificationNumber(competentAuthority);
     var notification = new NotificationApplication(userContext.UserId, notificationType, competentAuthority,
         nextNotificationNumber);
     return notification;
 }
Пример #2
0
        public async Task <NotificationApplication> CreateNew(NotificationType notificationType,
                                                              UKCompetentAuthority competentAuthority)
        {
            var nextNotificationNumber = await numberGenerator.GetNextNotificationNumber(competentAuthority);

            var notification = new NotificationApplication(userContext.UserId, notificationType, competentAuthority,
                                                           nextNotificationNumber);

            return(notification);
        }
        private async Task<decimal> GetPrice(int numberOfShipments, NotificationApplication notification)
        {
            var facilityCollection = await facilityRepository.GetByNotificationId(notification.Id);
            bool isInterim = facilityCollection.IsInterim.HasValue ? facilityCollection.IsInterim.Value : facilityCollection.HasMultipleFacilities;

            var result = await pricingStructureRepository.GetExport(notification.CompetentAuthority, 
                notification.NotificationType,
                numberOfShipments, 
                isInterim);

            return result.Price;
        }
        public async Task SetForNotification(NotificationApplication notification, bool allFacilitiesPreconsented)
        {
            if (notification.NotificationType != Core.Shared.NotificationType.Recovery)
            {
                throw new InvalidOperationException(String.Format(
                    "Can't set pre-consented recovery facility as notification type is not Recovery for notification: {0}", notification.Id));
            }

            var facilityCollection = await facilityRepository.GetByNotificationId(notification.Id);

            facilityCollection.AllFacilitiesPreconsented = allFacilitiesPreconsented;
        }
        public async Task SetForNotification(NotificationApplication notification, bool allFacilitiesPreconsented)
        {
            if (notification.NotificationType != Core.Shared.NotificationType.Recovery)
            {
                throw new InvalidOperationException(String.Format(
                                                        "Can't set pre-consented recovery facility as notification type is not Recovery for notification: {0}", notification.Id));
            }

            var facilityCollection = await facilityRepository.GetByNotificationId(notification.Id);

            facilityCollection.AllFacilitiesPreconsented = allFacilitiesPreconsented;
        }
Пример #6
0
        private async Task <decimal> GetPrice(int numberOfShipments, NotificationApplication notification)
        {
            var facilityCollection = await facilityRepository.GetByNotificationId(notification.Id);

            bool isInterim = facilityCollection.IsInterim.HasValue ? facilityCollection.IsInterim.Value : facilityCollection.HasMultipleFacilities;

            var result = await pricingStructureRepository.GetExport(notification.CompetentAuthority,
                                                                    notification.NotificationType,
                                                                    numberOfShipments,
                                                                    isInterim);

            return(result.Price);
        }
        public Task<NotificationApplication> CreateLegacy(NotificationType notificationType,
            UKCompetentAuthority competentAuthority, int number)
        {
            Guard.ArgumentNotZeroOrNegative(() => number, number);

            if (!IsNumberValid(competentAuthority, number))
            {
                throw new ArgumentOutOfRangeException("number",
                    string.Format("{0} is out of range for a notification number for {1}", number, competentAuthority));
            }

            var notification = new NotificationApplication(userContext.UserId, notificationType, competentAuthority,
                number);
            return Task.FromResult(notification);
        }
Пример #8
0
        public Task <NotificationApplication> CreateLegacy(NotificationType notificationType,
                                                           UKCompetentAuthority competentAuthority, int number)
        {
            Guard.ArgumentNotZeroOrNegative(() => number, number);

            if (!IsNumberValid(competentAuthority, number))
            {
                throw new ArgumentOutOfRangeException("number",
                                                      string.Format("{0} is out of range for a notification number for {1}", number, competentAuthority));
            }

            var notification = new NotificationApplication(userContext.UserId, notificationType, competentAuthority,
                                                           number);

            return(Task.FromResult(notification));
        }
 public static NotificationApplicationOverview Load(NotificationApplication notification,
     NotificationAssessment assessment,
     WasteRecovery.WasteRecovery wasteRecovery,
     WasteDisposal wasteDisposal,
     Exporter.Exporter exporter,
     Importer.Importer importer,
     int charge,
     NotificationApplicationCompletionProgress progress)
 {
     return new NotificationApplicationOverview
     {
         Exporter = exporter,
         Importer = importer,
         Notification = notification,
         NotificationAssessment = assessment,
         WasteRecovery = wasteRecovery,
         WasteDisposal = wasteDisposal,
         Charge = charge,
         Progress = progress
     };
 }
Пример #10
0
 public static NotificationApplicationOverview Load(NotificationApplication notification,
                                                    NotificationAssessment assessment,
                                                    WasteRecovery.WasteRecovery wasteRecovery,
                                                    WasteDisposal wasteDisposal,
                                                    Exporter.Exporter exporter,
                                                    Importer.Importer importer,
                                                    int charge,
                                                    NotificationApplicationCompletionProgress progress)
 {
     return(new NotificationApplicationOverview
     {
         Exporter = exporter,
         Importer = importer,
         Notification = notification,
         NotificationAssessment = assessment,
         WasteRecovery = wasteRecovery,
         WasteDisposal = wasteDisposal,
         Charge = charge,
         Progress = progress
     });
 }
Пример #11
0
 public NotificationCreatedEvent(NotificationApplication notification)
 {
     Notification = notification;
 }
 public NotificationCreatedEvent(NotificationApplication notification)
 {
     Notification = notification;
 }