private static void SetOutputEntities(GrassCoverErosionOutwardsWaveConditionsCalculationEntity entity, IEnumerable <WaveConditionsOutput> calculationOutput, GrassCoverErosionOutwardsWaveConditionsOutputType type, ref int i) { if (calculationOutput != null) { foreach (WaveConditionsOutput output in calculationOutput) { entity.GrassCoverErosionOutwardsWaveConditionsOutputEntities.Add(output.CreateGrassCoverErosionOutwardsWaveConditionsOutputEntity(type, i++)); } } }
/// <summary> /// Creates a <see cref="GrassCoverErosionOutwardsWaveConditionsOutputEntity"/> based on the information /// of the <see cref="WaveConditionsOutput"/>. /// </summary> /// <param name="output">The calculation output for grass cover erosion outwards failure mechanism to /// create a database entity for.</param> /// <param name="type">The type of <see cref="GrassCoverErosionOutwardsWaveConditionsOutputType"/>.</param> /// <param name="order">The position of <paramref name="output"/> in the list of all outputs.</param> /// <returns>A new <see cref="GrassCoverErosionOutwardsWaveConditionsOutputEntity"/>.</returns> internal static GrassCoverErosionOutwardsWaveConditionsOutputEntity CreateGrassCoverErosionOutwardsWaveConditionsOutputEntity( this WaveConditionsOutput output, GrassCoverErosionOutwardsWaveConditionsOutputType type, int order) { var entity = new GrassCoverErosionOutwardsWaveConditionsOutputEntity { Order = order, OutputType = Convert.ToByte(type), WaterLevel = output.WaterLevel.ToNaNAsNull(), WaveHeight = output.WaveHeight.ToNaNAsNull(), WavePeakPeriod = output.WavePeakPeriod.ToNaNAsNull(), WaveAngle = output.WaveAngle.ToNaNAsNull(), WaveDirection = output.WaveDirection.ToNaNAsNull(), TargetProbability = output.TargetProbability.ToNaNAsNull(), TargetReliability = output.TargetReliability.ToNaNAsNull(), CalculatedProbability = output.CalculatedProbability.ToNaNAsNull(), CalculatedReliability = output.CalculatedReliability.ToNaNAsNull(), CalculationConvergence = Convert.ToByte(output.CalculationConvergence) }; return(entity); }