Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Service/GrassCoverErosionOutwardsDataSynchronizationService.cs =================================================================== diff -u -r8a90c409545ce1b48e018d3b5d6b5982dbef926f -r65cec137f19d9ded25248ba376b2ea8d43c18c2c --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Service/GrassCoverErosionOutwardsDataSynchronizationService.cs (.../GrassCoverErosionOutwardsDataSynchronizationService.cs) (revision 8a90c409545ce1b48e018d3b5d6b5982dbef926f) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Service/GrassCoverErosionOutwardsDataSynchronizationService.cs (.../GrassCoverErosionOutwardsDataSynchronizationService.cs) (revision 65cec137f19d9ded25248ba376b2ea8d43c18c2c) @@ -20,6 +20,8 @@ // All rights reserved. using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; using Core.Common.Base; using Core.Common.Base.Data; @@ -78,5 +80,53 @@ return locationsAffected; } + + /// + /// Clears the and output for all the wave conditions calculations + /// in the . + /// + /// The + /// which contains the calculations. + /// An of calculations which are affected by + /// removal of data. + /// Thrown when + /// is null. + public static IEnumerable ClearAllCalculationOutputAndHydraulicBoundaryLocations(GrassCoverErosionOutwardsFailureMechanism failureMechanism) + { + if (failureMechanism == null) + { + throw new ArgumentNullException("failureMechanism"); + } + + Collection affectedItems = new Collection(); + foreach (var calculation in failureMechanism.Calculations.Cast()) + { + var calculationChanged = false; + + if (calculation.HasOutput) + { + ClearWaveConditionsCalculationOutput(calculation); + calculationChanged = true; + } + + if (calculation.InputParameters.HydraulicBoundaryLocation != null) + { + ClearHydraulicBoundaryLocation(calculation); + calculationChanged = true; + } + + if (calculationChanged) + { + affectedItems.Add(calculation); + } + } + + return affectedItems; + } + + private static void ClearHydraulicBoundaryLocation(GrassCoverErosionOutwardsWaveConditionsCalculation calculation) + { + calculation.InputParameters.HydraulicBoundaryLocation = null; + } } } \ No newline at end of file