Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Service/StabilityStoneCoverDataSynchronizationService.cs =================================================================== diff -u -r549f5bede77dd319526bf19dc63897b550972d0c -r859df1c0fea027dccd923d241240aad9f50f55c8 --- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Service/StabilityStoneCoverDataSynchronizationService.cs (.../StabilityStoneCoverDataSynchronizationService.cs) (revision 549f5bede77dd319526bf19dc63897b550972d0c) +++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Service/StabilityStoneCoverDataSynchronizationService.cs (.../StabilityStoneCoverDataSynchronizationService.cs) (revision 859df1c0fea027dccd923d241240aad9f50f55c8) @@ -20,6 +20,10 @@ // All rights reserved. using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using Ringtoets.HydraRing.Data; using Ringtoets.StabilityStoneCover.Data; namespace Ringtoets.StabilityStoneCover.Service @@ -45,5 +49,56 @@ calculation.Output = null; } + + /// + /// Clears the and output for all the wave conditions calculations + /// in the . + /// + /// The + /// which contains the calculations. + /// An of calculations which are affected by + /// removing data. + /// Thrown when + /// is null. + public static IEnumerable ClearAllWaveConditionsCalculationOutputAndHydraulicBoundaryLocations( + StabilityStoneCoverFailureMechanism 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(StabilityStoneCoverWaveConditionsCalculation calculation) + { + calculation.InputParameters.HydraulicBoundaryLocation = null; + } } } \ No newline at end of file