public WasteRecoveryViewModel(NotificationApplication notification,
            WasteRecovery wasteRecovery,
            WasteDisposal wasteDisposal,
            WasteRecoveryFormatter wasteRecoveryFormatter)
        {
            if (notification == null)
            {
                return;
            }

            if (notification.WasteRecoveryInformationProvidedByImporter.GetValueOrDefault())
            {
                annexMessage = string.Empty;
                return;
            }

            if (wasteDisposal != null)
            {
                methodOfDisposal = wasteDisposal.Method ?? string.Empty;
            }
            
            if (wasteRecovery != null && wasteRecovery.PercentageRecoverable != null)
            {
                percentageRecoverable = wasteRecoveryFormatter.NullableDecimalAsPercentage(wasteRecovery.PercentageRecoverable.Value);
                percentageNonRecoverable =
                    wasteRecoveryFormatter.NullableDecimalAsPercentage(100 - wasteRecovery.PercentageRecoverable.Value);
            }

            estimatedAmountText = wasteRecoveryFormatter
                .CostAmountWithUnits(wasteRecovery, 
                    ri => ri.EstimatedValue);

            costAmountText = wasteRecoveryFormatter
                .CostAmountWithUnits(wasteRecovery,
                    ri => ri.RecoveryCost);

            disposalAmountText = wasteRecoveryFormatter
                .CostAmountWithUnits(wasteDisposal,
                    ri => ri.Cost);

            annexMessage = string.Empty;
        }
Пример #2
0
        public WasteRecoveryViewModel(NotificationApplication notification,
                                      WasteRecovery wasteRecovery,
                                      WasteDisposal wasteDisposal,
                                      WasteRecoveryFormatter wasteRecoveryFormatter)
        {
            if (notification == null)
            {
                return;
            }

            if (notification.WasteRecoveryInformationProvidedByImporter.GetValueOrDefault())
            {
                annexMessage = string.Empty;
                return;
            }

            if (wasteDisposal != null)
            {
                methodOfDisposal = wasteDisposal.Method ?? string.Empty;
            }

            if (wasteRecovery != null && wasteRecovery.PercentageRecoverable != null)
            {
                percentageRecoverable    = wasteRecoveryFormatter.NullableDecimalAsPercentage(wasteRecovery.PercentageRecoverable.Value);
                percentageNonRecoverable =
                    wasteRecoveryFormatter.NullableDecimalAsPercentage(100 - wasteRecovery.PercentageRecoverable.Value);
            }

            estimatedAmountText = wasteRecoveryFormatter
                                  .CostAmountWithUnits(wasteRecovery,
                                                       ri => ri.EstimatedValue);

            costAmountText = wasteRecoveryFormatter
                             .CostAmountWithUnits(wasteRecovery,
                                                  ri => ri.RecoveryCost);

            disposalAmountText = wasteRecoveryFormatter
                                 .CostAmountWithUnits(wasteDisposal,
                                                      ri => ri.Cost);

            annexMessage = string.Empty;
        }