Example #1
0
        public WasteRecoveryViewModel(Guid notificationId,
                                      WasteRecoveryOverview wasteRecovery,
                                      WasteDisposalOverview wasteDisposal,
                                      NotificationApplicationCompletionProgress progress)
        {
            IsWasteRecoveryInformationCompleted = progress.HasRecoveryData;
            IsProvidedByImporter = progress.HasRecoveryData;
            NotificationId       = notificationId;

            if (wasteRecovery != null)
            {
                IsProvidedByImporter  = false;
                HasDisposalPortion    = wasteRecovery.PercentageRecoverable != 100;
                PercentageRecoverable = wasteRecovery.PercentageRecoverable;
                EstimatedUnit         = wasteRecovery.EstimatedValue.Unit;
                EstimatedAmount       = wasteRecovery.EstimatedValue.Amount;
                CostUnit   = wasteRecovery.RecoveryCost.Unit;
                CostAmount = wasteRecovery.RecoveryCost.Amount;

                if (HasDisposalPortion && wasteDisposal != null)
                {
                    MethodOfDisposal = wasteDisposal.DisposalMethod;
                    DisposalUnit     = wasteDisposal.DisposalCost.Unit;
                    DisposalAmount   = wasteDisposal.DisposalCost.Amount;
                }
            }
        }
Example #2
0
 public AmountsAndDatesViewModel(ShipmentOverview amountAndDatesInfo, NotificationApplicationCompletionProgress progress)
 {
     NotificationId               = amountAndDatesInfo.NotificationId;
     NotificationType             = amountAndDatesInfo.NotificationType;
     IsIntendedShipmentsCompleted = progress.HasShipmentInfo;
     IntendedShipmentData         = amountAndDatesInfo.IntendedShipmentData ?? new IntendedShipmentData();
 }
 public AmountsAndDatesViewModel(ShipmentOverview amountAndDatesInfo, NotificationApplicationCompletionProgress progress)
 {
     NotificationId = amountAndDatesInfo.NotificationId;
     NotificationType = amountAndDatesInfo.NotificationType;
     IsIntendedShipmentsCompleted = progress.HasShipmentInfo;
     IntendedShipmentData = amountAndDatesInfo.IntendedShipmentData ?? new IntendedShipmentData();
 }
        private NotificationApplicationCompletionProgress GetCompletetionProgress(NotificationProgressResult progressResult)
        {
            var progress = new NotificationApplicationCompletionProgress();

            progress.Id = progressResult.Notification.Id;
            progress.NotificationType   = progressResult.Notification.NotificationType;
            progress.CompetentAuthority = progressResult.Notification.CompetentAuthority;
            progress.NotificationNumber = progressResult.Notification.NotificationNumber;

            var organisationsInvolvedComplete = MapProgressForOrganisationsInvolved(progress, progressResult);
            var recoveryOperationComplete     = MapProgressForRecoveryOperation(progress, progressResult);
            var transportationComplete        = MapProgressForTransportation(progress, progressResult);
            var journeyComplete           = MapProgressForJourney(progress, progressResult);
            var amountsAndDatesComplete   = MapProgressForAmountsAndDates(progress, progressResult);
            var classifyYourWasteComplete = MapProgressForClassifyYourWaste(progress, progressResult);
            var wasteCodesComplete        = MapProgressForWasteCodes(progress, progressResult);
            var wasteRecoveryComplete     = MapProgressForWasteRecovery(progress, progressResult);

            progress.IsAllComplete = organisationsInvolvedComplete &&
                                     recoveryOperationComplete &&
                                     transportationComplete &&
                                     journeyComplete &&
                                     amountsAndDatesComplete &&
                                     classifyYourWasteComplete &&
                                     wasteCodesComplete &&
                                     (progress.NotificationType == NotificationType.Disposal || wasteRecoveryComplete);

            return(progress);
        }
        public WasteRecoveryViewModel(Guid notificationId,
            WasteRecoveryOverview wasteRecovery, 
            WasteDisposalOverview wasteDisposal, 
            NotificationApplicationCompletionProgress progress)
        {
            IsWasteRecoveryInformationCompleted = progress.HasRecoveryData;
            IsProvidedByImporter = progress.HasRecoveryData;
            NotificationId = notificationId;

            if (wasteRecovery != null)
            {
                IsProvidedByImporter = false;
                HasDisposalPortion = wasteRecovery.PercentageRecoverable != 100;
                PercentageRecoverable = wasteRecovery.PercentageRecoverable;
                EstimatedUnit = wasteRecovery.EstimatedValue.Unit;
                EstimatedAmount = wasteRecovery.EstimatedValue.Amount;
                CostUnit = wasteRecovery.RecoveryCost.Unit;
                CostAmount = wasteRecovery.RecoveryCost.Amount;

                if (HasDisposalPortion && wasteDisposal != null)
                {
                    MethodOfDisposal = wasteDisposal.DisposalMethod;
                    DisposalUnit = wasteDisposal.DisposalCost.Unit;
                    DisposalAmount = wasteDisposal.DisposalCost.Amount;
                }
            }
        }
        private NotificationApplicationCompletionProgress GetCompletetionProgress(NotificationProgressResult progressResult)
        {
            var progress = new NotificationApplicationCompletionProgress();

            progress.Id = progressResult.Notification.Id;
            progress.NotificationType = progressResult.Notification.NotificationType;
            progress.CompetentAuthority = progressResult.Notification.CompetentAuthority;
            progress.NotificationNumber = progressResult.Notification.NotificationNumber;

            var organisationsInvolvedComplete = MapProgressForOrganisationsInvolved(progress, progressResult);
            var recoveryOperationComplete = MapProgressForRecoveryOperation(progress, progressResult);
            var transportationComplete = MapProgressForTransportation(progress, progressResult);
            var journeyComplete = MapProgressForJourney(progress, progressResult);
            var amountsAndDatesComplete = MapProgressForAmountsAndDates(progress, progressResult);
            var classifyYourWasteComplete = MapProgressForClassifyYourWaste(progress, progressResult);
            var wasteCodesComplete = MapProgressForWasteCodes(progress, progressResult);
            var wasteRecoveryComplete = MapProgressForWasteRecovery(progress, progressResult);

            progress.IsAllComplete = organisationsInvolvedComplete
                && recoveryOperationComplete
                && transportationComplete
                && journeyComplete
                && amountsAndDatesComplete
                && classifyYourWasteComplete
                && wasteCodesComplete
                && (progress.NotificationType == NotificationType.Disposal || wasteRecoveryComplete);

            return progress;
        }
        private SubmitSideBarViewModel CreateModel(bool isComplete, NotificationStatus status, bool isInternalUser = false)
        {
            var submitSummaryData = new SubmitSummaryData
            {
                Status = status
            };

            var progress = new NotificationApplicationCompletionProgress
            {
                IsAllComplete = isComplete
            };

            var submitSideBarViewModel = new SubmitSideBarViewModel(submitSummaryData, 500, progress);

            if (isInternalUser)
            {
                submitSideBarViewModel.ShowResubmitButton = ((status.Equals(NotificationStatus.Unlocked) || (status.Equals(NotificationStatus.ConsentedUnlock))) ? true : false);
            }
            else
            {
                submitSideBarViewModel.ShowResubmitButton = (status.Equals(NotificationStatus.Unlocked) ? true : false);
            }
            submitSideBarViewModel.IsInternalUser = isInternalUser;

            return(submitSideBarViewModel);
        }
        private bool MapProgressForWasteRecovery(NotificationApplicationCompletionProgress progress, NotificationProgressResult progressResult)
        {
            progress.HasRecoveryData = progressResult.Notification.IsRecoveryPercentageDataProvidedByImporter.HasValue &&
                                       (progressResult.Notification.IsRecoveryPercentageDataProvidedByImporter.Value ||
                                        (progressResult.Notification.RecoveryInfoId.HasValue &&
                                         (progressResult.Notification.PercentageRecoverable == 100 || progressResult.Notification.DisposalInfoId.HasValue)));

            return(progress.HasRecoveryData);
        }
 public SubmitSideBarViewModel(SubmitSummaryData submitSummaryData, int notificationCharge, NotificationApplicationCompletionProgress progress)
 {
     NotificationId = submitSummaryData.NotificationId;
     CompetentAuthorityName = EnumHelper.GetDisplayName(submitSummaryData.CompetentAuthority);
     CreatedDate = submitSummaryData.CreatedDate;
     NotificationNumber = submitSummaryData.NotificationNumber;
     Charge = notificationCharge;
     Status = submitSummaryData.Status;
     IsNotificationComplete = progress.IsAllComplete;
     CompetentAuthority = submitSummaryData.CompetentAuthority;
 }
 public ClassifyYourWasteViewModel(WasteClassificationOverview classifyYourWasteInfo, NotificationApplicationCompletionProgress progress)
 {
     NotificationId = classifyYourWasteInfo.NotificationId;
     IsChemicalCompositionCompleted = progress.HasWasteType;
     IsProcessOfGenerationCompleted = progress.HasWasteGenerationProcess;
     ArePhysicalCharacteristicsCompleted = progress.HasPhysicalCharacteristics;
     ChemicalComposition = classifyYourWasteInfo.ChemicalComposition;
     ProcessOfGeneration = classifyYourWasteInfo.ProcessOfGeneration.IsDocumentAttached ? 
         "The details will be provided in a separate document" : classifyYourWasteInfo.ProcessOfGeneration.Process;
     PhysicalCharacteristics = classifyYourWasteInfo.PhysicalCharacteristics;
 }
        private bool MapProgressForTransportation(NotificationApplicationCompletionProgress progress, NotificationProgressResult progressResult)
        {
            progress.HasCarrier                     = progressResult.Notification.CarrierId.HasValue;
            progress.HasMeansOfTransport            = !string.IsNullOrWhiteSpace(progressResult.Notification.MeansOfTransport);
            progress.HasPackagingInfo               = progressResult.Notification.PackagingInfoId.HasValue;
            progress.HasSpecialHandlingRequirements = progressResult.Notification.HasSpecialHandlingRequirements.HasValue;

            return(progress.HasCarrier &&
                   progress.HasMeansOfTransport &&
                   progress.HasPackagingInfo &&
                   progress.HasSpecialHandlingRequirements);
        }
 public RecoveryOperationViewModel(RecoveryOperation recoveryOperationInfo, NotificationApplicationCompletionProgress progress)
 {
     NotificationId                = recoveryOperationInfo.NotificationId;
     NotificationType              = recoveryOperationInfo.NotificationType;
     IsPreconsentStatusChosen      = progress.HasPreconsentedInformation;
     AreOperationCodesChosen       = progress.HasOperationCodes;
     IsTechnologyEmployedCompleted = progress.HasTechnologyEmployed;
     IsReasonForExportCompleted    = progress.HasReasonForExport;
     PreconstedAnswer              = recoveryOperationInfo.PreconstedAnswer;
     OperationCodes                = recoveryOperationInfo.OperationCodes.OrderBy(c => c).Select(EnumHelper.GetDisplayName).ToList();
     TechnologyEmployed            = recoveryOperationInfo.TechnologyEmployed;
     ReasonForExport               = recoveryOperationInfo.ReasonForExport;
 }
 public TransportationViewModel(Transportation transportationInfo, NotificationApplicationCompletionProgress progress)
 {
     NotificationId = transportationInfo.NotificationId;
     NotificationType = transportationInfo.NotificationType;
     IsCarrierCompleted = progress.HasCarrier;
     IsMeansOfTransportCompleted = progress.HasMeansOfTransport;
     IsPackagingTypesCompleted = progress.HasPackagingInfo;
     IsSpecialHandlingCompleted = progress.HasSpecialHandlingRequirements;
     Carriers = transportationInfo.Carriers;
     MeanOfTransport = transportationInfo.MeanOfTransport;
     PackagingData = transportationInfo.PackagingData;
     SpecialHandlingDetails = transportationInfo.SpecialHandlingDetails;
 }
 public RecoveryOperationViewModel(RecoveryOperation recoveryOperationInfo, NotificationApplicationCompletionProgress progress)
 {
     NotificationId = recoveryOperationInfo.NotificationId;
     NotificationType = recoveryOperationInfo.NotificationType;
     IsPreconsentStatusChosen = progress.HasPreconsentedInformation;
     AreOperationCodesChosen = progress.HasOperationCodes;
     IsTechnologyEmployedCompleted = progress.HasTechnologyEmployed;
     IsReasonForExportCompleted = progress.HasReasonForExport;
     PreconstedAnswer = recoveryOperationInfo.PreconstedAnswer;
     OperationCodes = recoveryOperationInfo.OperationCodes.OrderBy(c => c).Select(EnumHelper.GetDisplayName).ToList();
     TechnologyEmployed = recoveryOperationInfo.TechnologyEmployed;
     ReasonForExport = recoveryOperationInfo.ReasonForExport;
 }
Example #15
0
 public TransportationViewModel(Transportation transportationInfo, NotificationApplicationCompletionProgress progress)
 {
     NotificationId              = transportationInfo.NotificationId;
     NotificationType            = transportationInfo.NotificationType;
     IsCarrierCompleted          = progress.HasCarrier;
     IsMeansOfTransportCompleted = progress.HasMeansOfTransport;
     IsPackagingTypesCompleted   = progress.HasPackagingInfo;
     IsSpecialHandlingCompleted  = progress.HasSpecialHandlingRequirements;
     Carriers               = transportationInfo.Carriers;
     MeanOfTransport        = transportationInfo.MeanOfTransport;
     PackagingData          = transportationInfo.PackagingData;
     SpecialHandlingDetails = transportationInfo.SpecialHandlingDetails;
 }
        private bool MapProgressForRecoveryOperation(NotificationApplicationCompletionProgress progress, NotificationProgressResult progressResult)
        {
            progress.HasPreconsentedInformation = progressResult.Notification.NotificationType == NotificationType.Disposal ||
                                                  progressResult.Notification.IsPreconsentedRecoveryFacility.HasValue;
            progress.HasOperationCodes     = progressResult.Notification.OperationCodesId.HasValue;
            progress.HasTechnologyEmployed = progressResult.Notification.TechnologyEmployedId.HasValue;
            progress.HasReasonForExport    = !string.IsNullOrWhiteSpace(progressResult.Notification.ReasonForExport);

            return(progress.HasPreconsentedInformation &&
                   progress.HasOperationCodes &&
                   progress.HasTechnologyEmployed &&
                   progress.HasReasonForExport);
        }
 public JourneyViewModel(Journey journeyInfo, NotificationApplicationCompletionProgress progress)
 {
     NotificationId = journeyInfo.NotificationId;
     IsStateOfExportCompleted = progress.HasStateOfExport;
     IsStateOfImportCompleted = progress.HasStateOfImport;
     AreTransitStatesCompleted = progress.HasTransitState;
     IsCustomsOfficeCompleted = progress.HasCustomsOffice;
     StateOfExportData = journeyInfo.TransportRoute.StateOfExport;
     TransitStates = journeyInfo.TransportRoute.TransitStates.ToList();
     StateOfImportData = journeyInfo.TransportRoute.StateOfImport;
     EntryCustomsOffice = journeyInfo.EntryCustomsOffice.CustomsOfficeData ?? new CustomsOfficeData();
     ExitCustomsOffice = journeyInfo.ExitCustomsOffice.CustomsOfficeData ?? new CustomsOfficeData();
 }
        private bool MapProgressForJourney(NotificationApplicationCompletionProgress progress, NotificationProgressResult progressResult)
        {
            progress.HasStateOfExport = progressResult.Notification.StateOfExportId.HasValue;
            progress.HasStateOfImport = progressResult.Notification.StateOfImportId.HasValue;
            progress.HasTransitState  = progressResult.Notification.TransitStateId.HasValue;

            if (progressResult.CustomsOffices.Any(co => co.ImportIsEuMember.HasValue && co.ExportIsEuMember.HasValue))
            {
                bool importIsEuMember     = progressResult.CustomsOffices.First().ImportIsEuMember.GetValueOrDefault();
                bool exportIsEuMember     = progressResult.CustomsOffices.First().ExportIsEuMember.GetValueOrDefault();
                bool allTransitStatsAreEu = progressResult.CustomsOffices.All(co => co.TransitIsEuMember.GetValueOrDefault(true));
                bool hasEntryOffice       = progressResult.CustomsOffices.First().EntryCustomsOfficeId.HasValue;
                bool hasExitOffice        = progressResult.CustomsOffices.First().ExitCustomsOfficeId.HasValue;

                bool allInEu           = importIsEuMember && exportIsEuMember && allTransitStatsAreEu;
                bool importOutsideEu   = !importIsEuMember && exportIsEuMember;
                bool transitsOutsideEu = importIsEuMember && exportIsEuMember && !allTransitStatsAreEu;

                progress.HasCustomsOffice = allInEu ||
                                            (importOutsideEu && hasExitOffice) ||
                                            (transitsOutsideEu && hasExitOffice && hasEntryOffice);
            }
            else
            {
                progress.HasCustomsOffice = false;
            }

            var exemptStatusList = new List <NotificationStatus>()
            {
                NotificationStatus.Transmitted,
                NotificationStatus.Withdrawn,
                NotificationStatus.Objected,
                NotificationStatus.Consented,
                NotificationStatus.ConsentWithdrawn,
                NotificationStatus.FileClosed
            };

            // Identify whether the notification is exempt from the customs office selections check
            // This is necessary as historic data does not have data present in the EntryExitCustomsSelection table
            bool exemptFromCheck = exemptStatusList.Contains(progressResult.Notification.NotificationStatus);

            progress.HasCustomsOfficeSelections = exemptFromCheck || (progressResult.CustomsOffices.Any() &&
                                                                      (progressResult.CustomsOffices.First().IsEntryCustomsOfficeRequired !=
                                                                       null &&
                                                                       progressResult.CustomsOffices.First().IsExitCustomsOfficeRequired !=
                                                                       null));

            return(progress.HasStateOfExport &&
                   progress.HasStateOfImport &&
                   progress.HasCustomsOfficeSelections);
        }
Example #19
0
 public JourneyViewModel(Journey journeyInfo, NotificationApplicationCompletionProgress progress)
 {
     NotificationId                 = journeyInfo.NotificationId;
     IsStateOfExportCompleted       = progress.HasStateOfExport;
     IsStateOfImportCompleted       = progress.HasStateOfImport;
     AreTransitStatesCompleted      = progress.HasTransitState;
     IsCustomsOfficeCompleted       = progress.HasCustomsOfficeSelections;
     StateOfExportData              = journeyInfo.TransportRoute.StateOfExport;
     TransitStates                  = journeyInfo.TransportRoute.TransitStates.ToList();
     StateOfImportData              = journeyInfo.TransportRoute.StateOfImport;
     EntryCustomsOffice             = journeyInfo.EntryCustomsOffice.CustomsOfficeData ?? new CustomsOfficeData();
     ExitCustomsOffice              = journeyInfo.ExitCustomsOffice.CustomsOfficeData ?? new CustomsOfficeData();
     IsNorthernIrelandCustomsOffice = progress.CompetentAuthority.Equals(UKCompetentAuthority.NorthernIreland);
 }
        private SubmitSideBarViewModel CreateModel(bool isComplete, NotificationStatus status)
        {
            var submitSummaryData = new SubmitSummaryData
            {
                Status = status
            };

            var progress = new NotificationApplicationCompletionProgress
            {
                IsAllComplete = isComplete
            };

            return new SubmitSideBarViewModel(submitSummaryData, 500, progress);
        }
        private bool MapProgressForClassifyYourWaste(NotificationApplicationCompletionProgress progress, NotificationProgressResult progressResult)
        {
            progress.HasWasteType = progressResult.Notification.WasteTypeId.HasValue &&
                                    (!string.IsNullOrWhiteSpace(progressResult.Notification.OtherWasteTypeDescription) ||
                                     progressResult.Notification.WasteTypeHasAnnex.GetValueOrDefault() ||
                                     progressResult.Notification.WasteAdditionalInformationId.HasValue);
            progress.HasWasteGenerationProcess = progressResult.Notification.IsWasteGenerationProcessAttached.GetValueOrDefault() ||
                                                 !string.IsNullOrWhiteSpace(progressResult.Notification.WasteGenerationProcess);
            progress.HasPhysicalCharacteristics = progressResult.Notification.PhysicalCharacteristicsId.HasValue;

            return(progress.HasWasteType &&
                   progress.HasWasteGenerationProcess &&
                   progress.HasPhysicalCharacteristics);
        }
 public OrganisationsInvolvedViewModel(OrganisationsInvolved info, NotificationApplicationCompletionProgress progress)
 {
     NotificationId = info.NotificationId;
     NotificationType = info.NotificationType;
     IsExporterCompleted = progress.HasExporter;
     HasSiteOfExport = progress.HasSiteOfExport;
     IsProducerCompleted = progress.HasProducer;
     IsImporterCompleted = progress.HasImporter;
     IsFacilityCompleted = progress.HasFacility;
     HasActualSiteOfTreatment = progress.HasActualSiteOfTreatment;
     Exporter = info.Exporter;
     Producers = info.Producers;
     Importer = info.Importer;
     Facilities = info.Facilities;
 }
 public OrganisationsInvolvedViewModel(OrganisationsInvolved info, NotificationApplicationCompletionProgress progress)
 {
     NotificationId           = info.NotificationId;
     NotificationType         = info.NotificationType;
     IsExporterCompleted      = progress.HasExporter;
     HasSiteOfExport          = progress.HasSiteOfExport;
     IsProducerCompleted      = progress.HasProducer;
     IsImporterCompleted      = progress.HasImporter;
     IsFacilityCompleted      = progress.HasFacility;
     HasActualSiteOfTreatment = progress.HasActualSiteOfTreatment;
     Exporter   = info.Exporter;
     Producers  = info.Producers;
     Importer   = info.Importer;
     Facilities = info.Facilities;
 }
        private bool MapProgressForOrganisationsInvolved(NotificationApplicationCompletionProgress progress, NotificationProgressResult progressResult)
        {
            progress.HasExporter              = progressResult.Notification.ExporterId.HasValue;
            progress.HasProducer              = progressResult.Producers.Any(p => p.Id.HasValue);
            progress.HasSiteOfExport          = progressResult.Producers.Any(p => p.IsSiteOfExport.GetValueOrDefault());
            progress.HasImporter              = progressResult.Notification.ImporterId.HasValue;
            progress.HasFacility              = progressResult.Facilities.Any(f => f.Id.HasValue);
            progress.HasActualSiteOfTreatment = progressResult.Facilities.Any(f => f.IsActualSiteOfTreatment.GetValueOrDefault());

            return(progress.HasExporter &&
                   progress.HasProducer &&
                   progress.HasSiteOfExport &&
                   progress.HasImporter &&
                   progress.HasFacility &&
                   progress.HasActualSiteOfTreatment);
        }
 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
     };
 }
Example #26
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
     });
 }
 public WasteCodeOverviewViewModel(WasteCodesOverviewInfo classifyYourWasteInfo, NotificationApplicationCompletionProgress progress)
 {
     NotificationId = classifyYourWasteInfo.NotificationId;
     BaselOecdCode = classifyYourWasteInfo.BaselOecdCode;
     EwcCodes = classifyYourWasteInfo.EwcCodes;
     NationExportCode = classifyYourWasteInfo.NationExportCode;
     NationImportCode = classifyYourWasteInfo.NationImportCode;
     OtherCodes = classifyYourWasteInfo.OtherCodes;
     YCodes = classifyYourWasteInfo.YCodes;
     HCodes = classifyYourWasteInfo.HCodes;
     UnClass = classifyYourWasteInfo.UnClass;
     UnNumber = classifyYourWasteInfo.UnNumber;
     CustomCodes = classifyYourWasteInfo.CustomCodes;
     IsBaselOecdCodeCompleted = progress.HasBaselOecdCode;
     AreEwcCodesCompleted = progress.HasEwcCodes;
     AreYCodesCompleted = progress.HasYCodes;
     AreHCodesCompleted = progress.HasHCodes;
     AreUnClassesCompleted = progress.HasUnClasses;
     AreUnNumbersCompleted = progress.HasUnNumbers;
     AreOtherCodesCompleted = progress.HasOtherCodes;
 }
        private bool MapProgressForWasteCodes(NotificationApplicationCompletionProgress progress, NotificationProgressResult progressResult)
        {
            progress.HasBaselOecdCode = progressResult.WasteCodes.Any(wc =>
                                                                      wc.CodeType == CodeType.Basel ||
                                                                      wc.CodeType == CodeType.Oecd);
            progress.HasEwcCodes  = progressResult.WasteCodes.Any(wc => wc.CodeType == CodeType.Ewc);
            progress.HasYCodes    = progressResult.WasteCodes.Any(wc => wc.CodeType == CodeType.Y);
            progress.HasHCodes    = progressResult.WasteCodes.Any(wc => wc.CodeType == CodeType.H);
            progress.HasUnClasses = progressResult.WasteCodes.Any(wc => wc.CodeType == CodeType.Un);
            progress.HasUnNumbers = progressResult.WasteCodes.Any(wc => wc.CodeType == CodeType.UnNumber);

            var otherCodes = new[] { CodeType.CustomsCode, CodeType.ImportCode, CodeType.ExportCode, CodeType.OtherCode };

            progress.HasOtherCodes = otherCodes.All(oc =>
                                                    progressResult.WasteCodes.Select(wc => wc.CodeType).Contains(oc));

            return(progress.HasBaselOecdCode &&
                   progress.HasEwcCodes &&
                   progress.HasYCodes &&
                   progress.HasHCodes &&
                   progress.HasUnClasses &&
                   progress.HasUnNumbers &&
                   progress.HasOtherCodes);
        }
        private bool MapProgressForOrganisationsInvolved(NotificationApplicationCompletionProgress progress, NotificationProgressResult progressResult)
        {
            progress.HasExporter = progressResult.Notification.ExporterId.HasValue;
            progress.HasProducer = progressResult.Producers.Any(p => p.Id.HasValue);
            progress.HasSiteOfExport = progressResult.Producers.Any(p => p.IsSiteOfExport.GetValueOrDefault());
            progress.HasImporter = progressResult.Notification.ImporterId.HasValue;
            progress.HasFacility = progressResult.Facilities.Any(f => f.Id.HasValue);
            progress.HasActualSiteOfTreatment = progressResult.Facilities.Any(f => f.IsActualSiteOfTreatment.GetValueOrDefault());

            return progress.HasExporter
                && progress.HasProducer
                && progress.HasSiteOfExport
                && progress.HasImporter
                && progress.HasFacility
                && progress.HasActualSiteOfTreatment;
        }
        private bool MapProgressForAmountsAndDates(NotificationApplicationCompletionProgress progress, NotificationProgressResult progressResult)
        {
            progress.HasShipmentInfo = progressResult.Notification.ShipmentInfoId.HasValue;

            return(progress.HasShipmentInfo);
        }
        private bool MapProgressForWasteRecovery(NotificationApplicationCompletionProgress progress, NotificationProgressResult progressResult)
        {
            progress.HasRecoveryData = progressResult.Notification.IsRecoveryPercentageDataProvidedByImporter.HasValue
                && (progressResult.Notification.IsRecoveryPercentageDataProvidedByImporter.Value
                || (progressResult.Notification.RecoveryInfoId.HasValue 
                    && (progressResult.Notification.PercentageRecoverable == 100 || progressResult.Notification.DisposalInfoId.HasValue)));

            return progress.HasRecoveryData;
        }
        private bool MapProgressForWasteCodes(NotificationApplicationCompletionProgress progress, NotificationProgressResult progressResult)
        {
            progress.HasBaselOecdCode = progressResult.WasteCodes.Any(wc =>
                wc.CodeType == CodeType.Basel
                || wc.CodeType == CodeType.Oecd);
            progress.HasEwcCodes = progressResult.WasteCodes.Any(wc => wc.CodeType == CodeType.Ewc);
            progress.HasYCodes = progressResult.WasteCodes.Any(wc => wc.CodeType == CodeType.Y);
            progress.HasHCodes = progressResult.WasteCodes.Any(wc => wc.CodeType == CodeType.H);
            progress.HasUnClasses = progressResult.WasteCodes.Any(wc => wc.CodeType == CodeType.Un);
            progress.HasUnNumbers = progressResult.WasteCodes.Any(wc => wc.CodeType == CodeType.UnNumber);

            var otherCodes = new[] { CodeType.CustomsCode, CodeType.ImportCode, CodeType.ExportCode, CodeType.OtherCode };
            progress.HasOtherCodes = otherCodes.All(oc =>
                progressResult.WasteCodes.Select(wc => wc.CodeType).Contains(oc));

            return progress.HasBaselOecdCode
                && progress.HasEwcCodes
                && progress.HasYCodes
                && progress.HasHCodes
                && progress.HasUnClasses
                && progress.HasUnNumbers
                && progress.HasOtherCodes;
        }
        private bool MapProgressForClassifyYourWaste(NotificationApplicationCompletionProgress progress, NotificationProgressResult progressResult)
        {
            progress.HasWasteType = progressResult.Notification.WasteTypeId.HasValue
                && (!string.IsNullOrWhiteSpace(progressResult.Notification.OtherWasteTypeDescription)
                    || progressResult.Notification.WasteTypeHasAnnex.GetValueOrDefault()
                    || progressResult.Notification.WasteAdditionalInformationId.HasValue);
            progress.HasWasteGenerationProcess = progressResult.Notification.IsWasteGenerationProcessAttached.GetValueOrDefault()
                || !string.IsNullOrWhiteSpace(progressResult.Notification.WasteGenerationProcess);
            progress.HasPhysicalCharacteristics = progressResult.Notification.PhysicalCharacteristicsId.HasValue;

            return progress.HasWasteType
                && progress.HasWasteGenerationProcess
                && progress.HasPhysicalCharacteristics;
        }
        private bool MapProgressForJourney(NotificationApplicationCompletionProgress progress, NotificationProgressResult progressResult)
        {
            progress.HasStateOfExport = progressResult.Notification.StateOfExportId.HasValue;
            progress.HasStateOfImport = progressResult.Notification.StateOfImportId.HasValue;
            progress.HasTransitState = progressResult.Notification.TransitStateId.HasValue;

            if (progressResult.CustomsOffices.Any(co => co.ImportIsEuMember.HasValue && co.ExportIsEuMember.HasValue))
            {
                bool importIsEuMember = progressResult.CustomsOffices.First().ImportIsEuMember.GetValueOrDefault();
                bool exportIsEuMember = progressResult.CustomsOffices.First().ExportIsEuMember.GetValueOrDefault();
                bool allTransitStatsAreEu = progressResult.CustomsOffices.All(co => co.TransitIsEuMember.GetValueOrDefault(true));
                bool hasEntryOffice = progressResult.CustomsOffices.First().EntryCustomsOfficeId.HasValue;
                bool hasExitOffice = progressResult.CustomsOffices.First().ExitCustomsOfficeId.HasValue;

                bool allInEu = importIsEuMember && exportIsEuMember && allTransitStatsAreEu;
                bool importOutsideEu = !importIsEuMember && exportIsEuMember && allTransitStatsAreEu;
                bool importAndTransitsOutsideEu = !importIsEuMember && exportIsEuMember && !allTransitStatsAreEu;
                bool transitsOutsideEu = importIsEuMember && exportIsEuMember && !allTransitStatsAreEu;

                progress.HasCustomsOffice = allInEu
                    || (importOutsideEu && hasExitOffice)
                    || (importAndTransitsOutsideEu && hasEntryOffice)
                    || (transitsOutsideEu && hasExitOffice && hasEntryOffice);
            }
            else
            {
                progress.HasCustomsOffice = false;
            }

            return progress.HasStateOfExport
                && progress.HasStateOfImport;
        }
        private bool MapProgressForTransportation(NotificationApplicationCompletionProgress progress, NotificationProgressResult progressResult)
        {
            progress.HasCarrier = progressResult.Notification.CarrierId.HasValue;
            progress.HasMeansOfTransport = !string.IsNullOrWhiteSpace(progressResult.Notification.MeansOfTransport);
            progress.HasPackagingInfo = progressResult.Notification.PackagingInfoId.HasValue;
            progress.HasSpecialHandlingRequirements = progressResult.Notification.HasSpecialHandlingRequirements.HasValue;

            return progress.HasCarrier
                && progress.HasMeansOfTransport
                && progress.HasPackagingInfo
                && progress.HasSpecialHandlingRequirements;
        }
        private bool MapProgressForRecoveryOperation(NotificationApplicationCompletionProgress progress, NotificationProgressResult progressResult)
        {
            progress.HasPreconsentedInformation = progressResult.Notification.NotificationType == NotificationType.Disposal
                || progressResult.Notification.IsPreconsentedRecoveryFacility.HasValue;
            progress.HasOperationCodes = progressResult.Notification.OperationCodesId.HasValue;
            progress.HasTechnologyEmployed = progressResult.Notification.TechnologyEmployedId.HasValue;
            progress.HasReasonForExport = !string.IsNullOrWhiteSpace(progressResult.Notification.ReasonForExport);

            return progress.HasPreconsentedInformation
                && progress.HasOperationCodes
                && progress.HasTechnologyEmployed
                && progress.HasReasonForExport;
        }
 public ClassifyYourWasteViewModel(WasteClassificationOverview classifyYourWasteInfo, NotificationApplicationCompletionProgress progress)
 {
     NotificationId = classifyYourWasteInfo.NotificationId;
     IsChemicalCompositionCompleted      = progress.HasWasteType;
     IsProcessOfGenerationCompleted      = progress.HasWasteGenerationProcess;
     ArePhysicalCharacteristicsCompleted = progress.HasPhysicalCharacteristics;
     ChemicalComposition = classifyYourWasteInfo.ChemicalComposition;
     ProcessOfGeneration = classifyYourWasteInfo.ProcessOfGeneration.IsDocumentAttached ?
                           "The details will be provided in a separate document" : classifyYourWasteInfo.ProcessOfGeneration.Process;
     PhysicalCharacteristics = classifyYourWasteInfo.PhysicalCharacteristics;
 }
        private bool MapProgressForAmountsAndDates(NotificationApplicationCompletionProgress progress, NotificationProgressResult progressResult)
        {
            progress.HasShipmentInfo = progressResult.Notification.ShipmentInfoId.HasValue;

            return progress.HasShipmentInfo;
        }
 public WasteCodeOverviewViewModel(WasteCodesOverviewInfo classifyYourWasteInfo, NotificationApplicationCompletionProgress progress)
 {
     NotificationId   = classifyYourWasteInfo.NotificationId;
     BaselOecdCode    = classifyYourWasteInfo.BaselOecdCode;
     EwcCodes         = classifyYourWasteInfo.EwcCodes.OrderBy(w => w.Code).ToArray();
     NationExportCode = classifyYourWasteInfo.NationExportCode;
     NationImportCode = classifyYourWasteInfo.NationImportCode;
     OtherCodes       = classifyYourWasteInfo.OtherCodes;
     YCodes           = classifyYourWasteInfo.YCodes.OrderBy(w => Regex.Match(!string.IsNullOrEmpty(w.Code) ? w.Code : string.Empty, @"(\D+)").Value).ThenBy(w =>
     {
         double val;
         double.TryParse(Regex.Match(!string.IsNullOrEmpty(w.Code) ? w.Code : string.Empty, @"(\d+(\.\d*)?|\.\d+)").Value, out val);
         return(val);
     }).ToArray();
     HCodes = classifyYourWasteInfo.HCodes.OrderBy(w => Regex.Match(!string.IsNullOrEmpty(w.Code) ? w.Code : string.Empty, @"(\D+)").Value).ThenBy(w =>
     {
         double val;
         double.TryParse(Regex.Match(!string.IsNullOrEmpty(w.Code) ? w.Code : string.Empty, @"(\d+(\.\d*)?|\.\d+)").Value, out val);
         return(val);
     }).ToArray();
     UnClass     = classifyYourWasteInfo.UnClass.OrderBy(w => w.Code).ToArray();
     UnNumber    = classifyYourWasteInfo.UnNumber.OrderBy(w => w.Code).ToArray();
     CustomCodes = classifyYourWasteInfo.CustomCodes;
     IsBaselOecdCodeCompleted = progress.HasBaselOecdCode;
     AreEwcCodesCompleted     = progress.HasEwcCodes;
     AreYCodesCompleted       = progress.HasYCodes;
     AreHCodesCompleted       = progress.HasHCodes;
     AreUnClassesCompleted    = progress.HasUnClasses;
     AreUnNumbersCompleted    = progress.HasUnNumbers;
     AreOtherCodesCompleted   = progress.HasOtherCodes;
 }
Example #40
0
 public SubmitSideBarViewModel(SubmitSummaryData submitSummaryData, int notificationCharge, NotificationApplicationCompletionProgress progress)
 {
     NotificationId         = submitSummaryData.NotificationId;
     CompetentAuthorityName = EnumHelper.GetDisplayName(submitSummaryData.CompetentAuthority);
     CreatedDate            = submitSummaryData.CreatedDate;
     NotificationNumber     = submitSummaryData.NotificationNumber;
     Charge = notificationCharge;
     Status = submitSummaryData.Status;
     IsNotificationComplete = progress.IsAllComplete;
     CompetentAuthority     = submitSummaryData.CompetentAuthority;
 }