Index: Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/ClosingStructuresFailureMechanismResultViewOld.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/ClosingStructuresFailureMechanismResultViewOld.cs (.../ClosingStructuresFailureMechanismResultViewOld.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/ClosingStructuresFailureMechanismResultViewOld.cs (.../ClosingStructuresFailureMechanismResultViewOld.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -36,7 +36,7 @@ /// The view for a collection of for closing structures. /// public class ClosingStructuresFailureMechanismResultViewOld : FailureMechanismResultViewOld { @@ -92,14 +92,14 @@ calculationGroupObserver.Observable = observableGroup; } - protected override ClosingStructuresFailureMechanismSectionResultRow CreateFailureMechanismSectionResultRow(ClosingStructuresFailureMechanismSectionResultOld sectionResult) + protected override ClosingStructuresFailureMechanismSectionResultRowOld CreateFailureMechanismSectionResultRow(ClosingStructuresFailureMechanismSectionResultOld sectionResult) { - return new ClosingStructuresFailureMechanismSectionResultRow( + return new ClosingStructuresFailureMechanismSectionResultRowOld( sectionResult, FailureMechanism.Calculations.Cast>(), FailureMechanism, assessmentSection, - new ClosingStructuresFailureMechanismSectionResultRow.ConstructionProperties + new ClosingStructuresFailureMechanismSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = simpleAssessmentResultIndex, DetailedAssessmentResultIndex = detailedAssessmentResultIndex, @@ -127,55 +127,55 @@ { FailureMechanismSectionResultViewColumnBuilder.AddSectionNameColumn( DataGridViewControl, - nameof(ClosingStructuresFailureMechanismSectionResultRow.Name)); + nameof(ClosingStructuresFailureMechanismSectionResultRowOld.Name)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssessmentResultColumn( DataGridViewControl, - nameof(ClosingStructuresFailureMechanismSectionResultRow.SimpleAssessmentResult)); + nameof(ClosingStructuresFailureMechanismSectionResultRowOld.SimpleAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentProbabilityOnlyResultColumn( DataGridViewControl, - nameof(ClosingStructuresFailureMechanismSectionResultRow.DetailedAssessmentResult)); + nameof(ClosingStructuresFailureMechanismSectionResultRowOld.DetailedAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentProbabilityColumn( DataGridViewControl, - nameof(ClosingStructuresFailureMechanismSectionResultRow.DetailedAssessmentProbability)); + nameof(ClosingStructuresFailureMechanismSectionResultRowOld.DetailedAssessmentProbability)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentProbabilityCalculationResultColumn( DataGridViewControl, - nameof(ClosingStructuresFailureMechanismSectionResultRow.TailorMadeAssessmentResult)); + nameof(ClosingStructuresFailureMechanismSectionResultRowOld.TailorMadeAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentProbabilityColumn( DataGridViewControl, - nameof(ClosingStructuresFailureMechanismSectionResultRow.TailorMadeAssessmentProbability)); + nameof(ClosingStructuresFailureMechanismSectionResultRowOld.TailorMadeAssessmentProbability)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(ClosingStructuresFailureMechanismSectionResultRow.SimpleAssemblyCategoryGroup)); + nameof(ClosingStructuresFailureMechanismSectionResultRowOld.SimpleAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(ClosingStructuresFailureMechanismSectionResultRow.DetailedAssemblyCategoryGroup)); + nameof(ClosingStructuresFailureMechanismSectionResultRowOld.DetailedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(ClosingStructuresFailureMechanismSectionResultRow.TailorMadeAssemblyCategoryGroup)); + nameof(ClosingStructuresFailureMechanismSectionResultRowOld.TailorMadeAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddCombinedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(ClosingStructuresFailureMechanismSectionResultRow.CombinedAssemblyCategoryGroup)); + nameof(ClosingStructuresFailureMechanismSectionResultRowOld.CombinedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddCombinedAssemblyProbabilityColumn( DataGridViewControl, - nameof(ClosingStructuresFailureMechanismSectionResultRow.CombinedAssemblyProbability)); + nameof(ClosingStructuresFailureMechanismSectionResultRowOld.CombinedAssemblyProbability)); FailureMechanismSectionResultViewColumnBuilder.AddUseManualAssemblyColumn( DataGridViewControl, - nameof(ClosingStructuresFailureMechanismSectionResultRow.UseManualAssembly)); + nameof(ClosingStructuresFailureMechanismSectionResultRowOld.UseManualAssembly)); FailureMechanismSectionResultViewColumnBuilder.AddManualAssemblyProbabilityColumn( DataGridViewControl, - nameof(ClosingStructuresFailureMechanismSectionResultRow.ManualAssemblyProbability)); + nameof(ClosingStructuresFailureMechanismSectionResultRowOld.ManualAssemblyProbability)); } protected override void RefreshDataGrid() Fisheye: Tag ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b refers to a dead (removed) revision in file `Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/ClosingStructuresFailureMechanismSectionResultRow.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/ClosingStructuresFailureMechanismSectionResultRowOld.cs =================================================================== diff -u --- Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/ClosingStructuresFailureMechanismSectionResultRowOld.cs (revision 0) +++ Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/ClosingStructuresFailureMechanismSectionResultRowOld.cs (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -0,0 +1,497 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using Core.Common.Controls.DataGrid; +using Riskeer.AssemblyTool.Data; +using Riskeer.ClosingStructures.Data; +using Riskeer.Common.Data.AssessmentSection; +using Riskeer.Common.Data.Exceptions; +using Riskeer.Common.Data.Structures; +using Riskeer.Common.Forms.Helpers; +using Riskeer.Common.Forms.TypeConverters; +using Riskeer.Common.Forms.Views; +using Riskeer.Common.Primitives; + +namespace Riskeer.ClosingStructures.Forms.Views +{ + /// + /// This class represents a row of . + /// + public class ClosingStructuresFailureMechanismSectionResultRowOld : FailureMechanismSectionResultRowOld + { + private readonly int simpleAssessmentResultIndex; + private readonly int detailedAssessmentResultIndex; + private readonly int detailedAssessmentProbabilityIndex; + private readonly int tailorMadeAssessmentResultIndex; + private readonly int tailorMadeAssessmentProbabilityIndex; + private readonly int simpleAssemblyCategoryGroupIndex; + private readonly int detailedAssemblyCategoryGroupIndex; + private readonly int tailorMadeAssemblyCategoryGroupIndex; + private readonly int combinedAssemblyCategoryGroupIndex; + private readonly int combinedAssemblyProbabilityIndex; + private readonly int manualAssemblyProbabilityIndex; + + private readonly IEnumerable> calculationScenarios; + private readonly ClosingStructuresFailureMechanism failureMechanism; + private readonly IAssessmentSection assessmentSection; + + private FailureMechanismSectionAssemblyCategoryGroup simpleAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup detailedAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup combinedAssemblyCategoryGroup; + + /// + /// Creates a new instance of . + /// + /// The to wrap + /// so that it can be displayed as a row. + /// All calculation scenarios in the failure mechanism. + /// The failure mechanism the result belongs to. + /// The assessment section the result belongs to. + /// The property values required to create an instance of + /// . + /// Thrown when any parameter is null. + /// Thrown when + /// is a valid value, but unsupported. + internal ClosingStructuresFailureMechanismSectionResultRowOld(ClosingStructuresFailureMechanismSectionResultOld sectionResult, + IEnumerable> calculationScenarios, + ClosingStructuresFailureMechanism failureMechanism, + IAssessmentSection assessmentSection, + ConstructionProperties constructionProperties) + : base(sectionResult) + { + if (calculationScenarios == null) + { + throw new ArgumentNullException(nameof(calculationScenarios)); + } + + if (failureMechanism == null) + { + throw new ArgumentNullException(nameof(failureMechanism)); + } + + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + if (constructionProperties == null) + { + throw new ArgumentNullException(nameof(constructionProperties)); + } + + this.calculationScenarios = calculationScenarios; + this.failureMechanism = failureMechanism; + this.assessmentSection = assessmentSection; + + simpleAssessmentResultIndex = constructionProperties.SimpleAssessmentResultIndex; + detailedAssessmentResultIndex = constructionProperties.DetailedAssessmentResultIndex; + detailedAssessmentProbabilityIndex = constructionProperties.DetailedAssessmentProbabilityIndex; + tailorMadeAssessmentResultIndex = constructionProperties.TailorMadeAssessmentResultIndex; + tailorMadeAssessmentProbabilityIndex = constructionProperties.TailorMadeAssessmentProbabilityIndex; + simpleAssemblyCategoryGroupIndex = constructionProperties.SimpleAssemblyCategoryGroupIndex; + detailedAssemblyCategoryGroupIndex = constructionProperties.DetailedAssemblyCategoryGroupIndex; + tailorMadeAssemblyCategoryGroupIndex = constructionProperties.TailorMadeAssemblyCategoryGroupIndex; + combinedAssemblyCategoryGroupIndex = constructionProperties.CombinedAssemblyCategoryGroupIndex; + combinedAssemblyProbabilityIndex = constructionProperties.CombinedAssemblyProbabilityIndex; + manualAssemblyProbabilityIndex = constructionProperties.ManualAssemblyProbabilityIndex; + + CreateColumnStateDefinitions(); + + Update(); + } + + /// + /// Gets or sets the value representing the simple assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public SimpleAssessmentResultType SimpleAssessmentResult + { + get => SectionResult.SimpleAssessmentResult; + set + { + SectionResult.SimpleAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value representing the detailed assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentProbabilityOnlyResultType DetailedAssessmentResult + { + get => SectionResult.DetailedAssessmentResult; + set + { + SectionResult.DetailedAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets the value representing the detailed assessment probability. + /// + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double DetailedAssessmentProbability => SectionResult.GetDetailedAssessmentProbability(calculationScenarios); + + /// + /// Gets or sets the value representing the tailor made assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public TailorMadeAssessmentProbabilityCalculationResultType TailorMadeAssessmentResult + { + get => SectionResult.TailorMadeAssessmentResult; + set + { + SectionResult.TailorMadeAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value of the tailored assessment of safety. + /// + /// Thrown when is + /// not in the range [0,1]. + /// Thrown when + /// is a valid value, but unsupported. + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double TailorMadeAssessmentProbability + { + get => SectionResult.TailorMadeAssessmentProbability; + set + { + SectionResult.TailorMadeAssessmentProbability = value; + UpdateInternalData(); + } + } + + /// + /// Gets the simple assembly category group. + /// + public string SimpleAssemblyCategoryGroup => FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(simpleAssemblyCategoryGroup); + + /// + /// Gets the detailed assembly category group. + /// + public string DetailedAssemblyCategoryGroup => FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(detailedAssemblyCategoryGroup); + + /// + /// Gets the tailor made assembly category group. + /// + public string TailorMadeAssemblyCategoryGroup => FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(tailorMadeAssemblyCategoryGroup); + + /// + /// Gets the combined assembly category group. + /// + public string CombinedAssemblyCategoryGroup => FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(combinedAssemblyCategoryGroup); + + /// + /// Gets the combined assembly probability. + /// + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double CombinedAssemblyProbability { get; private set; } + + /// + /// Gets or sets the indicator whether the combined assembly probability + /// should be overwritten by . + /// + /// Thrown when + /// is a valid value, but unsupported. + public bool UseManualAssembly + { + get => SectionResult.UseManualAssembly; + set + { + SectionResult.UseManualAssembly = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the manually entered assembly probability. + /// + /// Thrown when is + /// not in the range [0,1]. + /// Thrown when + /// is a valid value, but unsupported. + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double ManualAssemblyProbability + { + get => SectionResult.ManualAssemblyProbability; + set + { + SectionResult.ManualAssemblyProbability = value; + UpdateInternalData(); + } + } + + public override void Update() + { + UpdateDerivedData(); + UpdateColumnStateDefinitions(); + UpdateDetailedAssessmentProbabilityError(); + } + + private void UpdateDetailedAssessmentProbabilityError() + { + if (FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(SimpleAssessmentResult) + || !FailureMechanismSectionResultRowHelper.DetailedAssessmentResultIsProbability(DetailedAssessmentResult) + || UseManualAssembly) + { + ColumnStateDefinitions[detailedAssessmentProbabilityIndex].ErrorText = string.Empty; + } + else + { + ColumnStateDefinitions[detailedAssessmentProbabilityIndex].ErrorText = FailureMechanismSectionResultRowHelper.GetDetailedAssessmentProbabilityError( + SectionResult.GetCalculationScenarios(calculationScenarios).ToArray(), + scenarios => SectionResult.GetTotalContribution(scenarios), + scenarios => SectionResult.GetDetailedAssessmentProbability(scenarios)); + } + } + + private void CreateColumnStateDefinitions() + { + ColumnStateDefinitions.Add(simpleAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentProbabilityIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssessmentProbabilityIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(simpleAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(combinedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(combinedAssemblyProbabilityIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(manualAssemblyProbabilityIndex, new DataGridViewColumnStateDefinition()); + } + + private void UpdateDerivedData() + { + ResetErrorTexts(); + TryGetSimpleAssemblyCategoryGroup(); + TryGetDetailedAssemblyCategoryGroup(); + TryGetTailorMadeAssemblyCategoryGroup(); + TryGetCombinedAssemblyCategoryGroup(); + } + + private void ResetErrorTexts() + { + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[combinedAssemblyProbabilityIndex].ErrorText = string.Empty; + } + + private void TryGetSimpleAssemblyCategoryGroup() + { + try + { + simpleAssemblyCategoryGroup = ClosingStructuresFailureMechanismAssemblyFactory.AssembleSimpleAssessment(SectionResult).Group; + } + catch (AssemblyException e) + { + simpleAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetDetailedAssemblyCategoryGroup() + { + try + { + detailedAssemblyCategoryGroup = ClosingStructuresFailureMechanismAssemblyFactory.AssembleDetailedAssessment( + SectionResult, + calculationScenarios, + failureMechanism, + assessmentSection).Group; + } + catch (AssemblyException e) + { + detailedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetTailorMadeAssemblyCategoryGroup() + { + try + { + tailorMadeAssemblyCategoryGroup = ClosingStructuresFailureMechanismAssemblyFactory.AssembleTailorMadeAssessment( + SectionResult, + failureMechanism, + assessmentSection).Group; + } + catch (AssemblyException e) + { + tailorMadeAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetCombinedAssemblyCategoryGroup() + { + try + { + FailureMechanismSectionAssembly combinedAssembly = + ClosingStructuresFailureMechanismAssemblyFactory.AssembleCombinedAssessment( + SectionResult, + calculationScenarios, + failureMechanism, + assessmentSection); + + combinedAssemblyCategoryGroup = combinedAssembly.Group; + CombinedAssemblyProbability = combinedAssembly.Probability; + } + catch (AssemblyException e) + { + combinedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + CombinedAssemblyProbability = double.NaN; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = e.Message; + ColumnStateDefinitions[combinedAssemblyProbabilityIndex].ErrorText = e.Message; + } + } + + /// + /// Updates the column state definitions. + /// + /// Thrown when + /// is a valid value, but unsupported. + private void UpdateColumnStateDefinitions() + { + bool simpleAssessmentSufficient = FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(SimpleAssessmentResult); + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[simpleAssessmentResultIndex], UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultIndex], simpleAssessmentSufficient + || UseManualAssembly); + if (simpleAssessmentSufficient + || !FailureMechanismSectionResultRowHelper.DetailedAssessmentResultIsProbability(DetailedAssessmentResult) + || UseManualAssembly) + { + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[detailedAssessmentProbabilityIndex]); + } + else + { + ColumnStateHelper.EnableColumn(ColumnStateDefinitions[detailedAssessmentProbabilityIndex], true); + } + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentResultIndex], + simpleAssessmentSufficient + || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentProbabilityIndex], + simpleAssessmentSufficient + || !FailureMechanismSectionResultRowHelper.TailorMadeAssessmentResultIsProbability(TailorMadeAssessmentResult) + || UseManualAssembly); + + if (UseManualAssembly) + { + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[combinedAssemblyProbabilityIndex]); + } + else + { + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex], + simpleAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex], + detailedAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex], + tailorMadeAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex], + combinedAssemblyCategoryGroup); + ColumnStateHelper.EnableColumn(ColumnStateDefinitions[combinedAssemblyProbabilityIndex], true); + } + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[manualAssemblyProbabilityIndex], !UseManualAssembly); + } + + /// + /// Class holding the various construction parameters for . + /// + public class ConstructionProperties + { + /// + /// Sets the simple assessment result index. + /// + public int SimpleAssessmentResultIndex { internal get; set; } + + /// + /// Sets the detailed assessment result index. + /// + public int DetailedAssessmentResultIndex { internal get; set; } + + /// + /// Sets the detailed assessment probability index. + /// + public int DetailedAssessmentProbabilityIndex { internal get; set; } + + /// + /// Sets the tailor made assessment result index. + /// + public int TailorMadeAssessmentResultIndex { internal get; set; } + + /// + /// Sets the tailor made assessment probability index. + /// + public int TailorMadeAssessmentProbabilityIndex { internal get; set; } + + /// + /// Sets the simple assembly category group index. + /// + public int SimpleAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the detailed assembly category group index. + /// + public int DetailedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the tailor made assembly category group index. + /// + public int TailorMadeAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly category group index. + /// + public int CombinedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly probability index. + /// + public int CombinedAssemblyProbabilityIndex { internal get; set; } + + /// + /// Sets the manual assembly category group index. + /// + public int ManualAssemblyProbabilityIndex { internal get; set; } + } + } +} \ No newline at end of file Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismResultViewTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismResultViewTest.cs (.../ClosingStructuresFailureMechanismResultViewTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismResultViewTest.cs (.../ClosingStructuresFailureMechanismResultViewTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -89,7 +89,7 @@ { // Assert Assert.IsInstanceOf>(view); Assert.IsNull(view.Data); @@ -248,7 +248,7 @@ using (ShowFailureMechanismResultsView(failureMechanism)) { DataGridView dataGridView = GetDataGridView(); - var row = (ClosingStructuresFailureMechanismSectionResultRow) dataGridView.Rows[0].DataBoundItem; + var row = (ClosingStructuresFailureMechanismSectionResultRowOld) dataGridView.Rows[0].DataBoundItem; var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; @@ -276,7 +276,7 @@ ClosingStructuresFailureMechanismResultViewOld, ClosingStructuresFailureMechanism, ClosingStructuresFailureMechanismSectionResultOld, - ClosingStructuresFailureMechanismSectionResultRow, + ClosingStructuresFailureMechanismSectionResultRowOld, StructuresCalculation> { protected override ClosingStructuresFailureMechanismResultViewOld CreateResultView(ClosingStructuresFailureMechanism failureMechanism) Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismSectionResultRowTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismSectionResultRowTest.cs (.../ClosingStructuresFailureMechanismSectionResultRowTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismSectionResultRowTest.cs (.../ClosingStructuresFailureMechanismSectionResultRowTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -51,8 +51,8 @@ [TestFixture] public class ClosingStructuresFailureMechanismSectionResultRowTest { - private static ClosingStructuresFailureMechanismSectionResultRow.ConstructionProperties ConstructionProperties => - new ClosingStructuresFailureMechanismSectionResultRow.ConstructionProperties + private static ClosingStructuresFailureMechanismSectionResultRowOld.ConstructionProperties ConstructionProperties => + new ClosingStructuresFailureMechanismSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = 1, DetailedAssessmentResultIndex = 2, @@ -79,7 +79,7 @@ var result = new ClosingStructuresFailureMechanismSectionResultOld(section); // Call - void Call() => new ClosingStructuresFailureMechanismSectionResultRow( + void Call() => new ClosingStructuresFailureMechanismSectionResultRowOld( result, null, new ClosingStructuresFailureMechanism(), assessmentSection, ConstructionProperties); @@ -101,7 +101,7 @@ var result = new ClosingStructuresFailureMechanismSectionResultOld(section); // Call - void Call() => new ClosingStructuresFailureMechanismSectionResultRow( + void Call() => new ClosingStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), null, assessmentSection, ConstructionProperties); @@ -119,7 +119,7 @@ var result = new ClosingStructuresFailureMechanismSectionResultOld(section); // Call - void Call() => new ClosingStructuresFailureMechanismSectionResultRow( + void Call() => new ClosingStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), new ClosingStructuresFailureMechanism(), null, ConstructionProperties); @@ -140,7 +140,7 @@ var result = new ClosingStructuresFailureMechanismSectionResultOld(section); // Call - void Call() => new ClosingStructuresFailureMechanismSectionResultRow( + void Call() => new ClosingStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), new ClosingStructuresFailureMechanism(), assessmentSection, null); @@ -171,11 +171,11 @@ // Call using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new ClosingStructuresFailureMechanismSectionResultRow( + var row = new ClosingStructuresFailureMechanismSectionResultRowOld( result, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert - Assert.IsInstanceOf>(row); + Assert.IsInstanceOf>(row); Assert.AreEqual(result.SimpleAssessmentResult, row.SimpleAssessmentResult); Assert.AreEqual(result.DetailedAssessmentResult, row.DetailedAssessmentResult); Assert.AreEqual(result.GetDetailedAssessmentProbability(calculationScenarios), row.DetailedAssessmentProbability); @@ -184,14 +184,14 @@ Assert.AreEqual(result.UseManualAssembly, row.UseManualAssembly); Assert.AreEqual(result.ManualAssemblyProbability, row.ManualAssemblyProbability); - TestHelper.AssertTypeConverter( - nameof(ClosingStructuresFailureMechanismSectionResultRow.DetailedAssessmentProbability)); - TestHelper.AssertTypeConverter( - nameof(ClosingStructuresFailureMechanismSectionResultRow.TailorMadeAssessmentProbability)); - TestHelper.AssertTypeConverter( - nameof(ClosingStructuresFailureMechanismSectionResultRow.CombinedAssemblyProbability)); - TestHelper.AssertTypeConverter( - nameof(ClosingStructuresFailureMechanismSectionResultRow.ManualAssemblyProbability)); + TestHelper.AssertTypeConverter( + nameof(ClosingStructuresFailureMechanismSectionResultRowOld.DetailedAssessmentProbability)); + TestHelper.AssertTypeConverter( + nameof(ClosingStructuresFailureMechanismSectionResultRowOld.TailorMadeAssessmentProbability)); + TestHelper.AssertTypeConverter( + nameof(ClosingStructuresFailureMechanismSectionResultRowOld.CombinedAssemblyProbability)); + TestHelper.AssertTypeConverter( + nameof(ClosingStructuresFailureMechanismSectionResultRowOld.ManualAssemblyProbability)); IDictionary columnStateDefinitions = row.ColumnStateDefinitions; Assert.AreEqual(11, columnStateDefinitions.Count); @@ -243,7 +243,7 @@ random.NextEnumValue()); // Call - var row = new ClosingStructuresFailureMechanismSectionResultRow(result, Enumerable.Empty>(), + var row = new ClosingStructuresFailureMechanismSectionResultRowOld(result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -278,7 +278,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new ClosingStructuresFailureMechanismSectionResultRow( + var row = new ClosingStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); bool originalValue = result.UseManualAssembly; @@ -316,7 +316,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new ClosingStructuresFailureMechanismSectionResultRow( + var row = new ClosingStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -349,7 +349,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new ClosingStructuresFailureMechanismSectionResultRow( + var row = new ClosingStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -393,7 +393,7 @@ calculator.CombinedAssemblyOutput = new FailureMechanismSectionAssembly( random.NextDouble(), random.NextEnumValue()); - var row = new ClosingStructuresFailureMechanismSectionResultRow(result, Enumerable.Empty>(), + var row = new ClosingStructuresFailureMechanismSectionResultRowOld(result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); // Precondition @@ -442,7 +442,7 @@ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; calculator.ThrowExceptionOnCalculate = true; - var row = new ClosingStructuresFailureMechanismSectionResultRow(result, Enumerable.Empty>(), + var row = new ClosingStructuresFailureMechanismSectionResultRowOld(result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); // Precondition @@ -502,7 +502,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new ClosingStructuresFailureMechanismSectionResultRow( + var row = new ClosingStructuresFailureMechanismSectionResultRowOld( result, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -550,7 +550,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new ClosingStructuresFailureMechanismSectionResultRow( + var row = new ClosingStructuresFailureMechanismSectionResultRowOld( result, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -587,7 +587,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new ClosingStructuresFailureMechanismSectionResultRow( + var row = new ClosingStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -626,7 +626,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new ClosingStructuresFailureMechanismSectionResultRow( + var row = new ClosingStructuresFailureMechanismSectionResultRowOld( result, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -693,7 +693,7 @@ calculator.CombinedAssemblyCategoryOutput = assemblyCategoryGroup; // Call - var row = new ClosingStructuresFailureMechanismSectionResultRow( + var row = new ClosingStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -738,7 +738,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new ClosingStructuresFailureMechanismSectionResultRow( + var resultRow = new ClosingStructuresFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -778,7 +778,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new ClosingStructuresFailureMechanismSectionResultRow( + var resultRow = new ClosingStructuresFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -822,7 +822,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new ClosingStructuresFailureMechanismSectionResultRow( + var resultRow = new ClosingStructuresFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -862,7 +862,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new ClosingStructuresFailureMechanismSectionResultRow( + var resultRow = new ClosingStructuresFailureMechanismSectionResultRowOld( sectionResult, Enumerable.Empty>(), failureMechanism, @@ -903,7 +903,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new ClosingStructuresFailureMechanismSectionResultRow( + var resultRow = new ClosingStructuresFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -942,7 +942,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new ClosingStructuresFailureMechanismSectionResultRow( + var resultRow = new ClosingStructuresFailureMechanismSectionResultRowOld( sectionResult, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -976,7 +976,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new ClosingStructuresFailureMechanismSectionResultRow( + var resultRow = new ClosingStructuresFailureMechanismSectionResultRowOld( sectionResult, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -1010,7 +1010,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new ClosingStructuresFailureMechanismSectionResultRow( + var resultRow = new ClosingStructuresFailureMechanismSectionResultRowOld( sectionResult, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -1044,7 +1044,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new ClosingStructuresFailureMechanismSectionResultRow( + var resultRow = new ClosingStructuresFailureMechanismSectionResultRowOld( sectionResult, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -1144,7 +1144,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new ClosingStructuresFailureMechanismSectionResultRow( + var row = new ClosingStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -1178,7 +1178,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new ClosingStructuresFailureMechanismSectionResultRow( + var row = new ClosingStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -1206,7 +1206,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new ClosingStructuresFailureMechanismSectionResultRow( + var resultRow = new ClosingStructuresFailureMechanismSectionResultRowOld( sectionResult, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -1239,7 +1239,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new ClosingStructuresFailureMechanismSectionResultRow( + var resultRow = new ClosingStructuresFailureMechanismSectionResultRowOld( sectionResult, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Call @@ -1269,7 +1269,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new ClosingStructuresFailureMechanismSectionResultRow( + var resultRow = new ClosingStructuresFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -1308,7 +1308,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new ClosingStructuresFailureMechanismSectionResultRow( + var resultRow = new ClosingStructuresFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -1348,7 +1348,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new ClosingStructuresFailureMechanismSectionResultRow( + var row = new ClosingStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -1384,7 +1384,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new ClosingStructuresFailureMechanismSectionResultRow( + var row = new ClosingStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -1417,7 +1417,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new ClosingStructuresFailureMechanismSectionResultRow( + var row = new ClosingStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); Index: Riskeer/Common/src/Riskeer.Common.Forms/Helpers/FailureMechanismSectionResultRowHelper.cs =================================================================== diff -u -r96ccefa48aa5c97c949f7a7858fcb4d3dc727a3a -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Common/src/Riskeer.Common.Forms/Helpers/FailureMechanismSectionResultRowHelper.cs (.../FailureMechanismSectionResultRowHelper.cs) (revision 96ccefa48aa5c97c949f7a7858fcb4d3dc727a3a) +++ Riskeer/Common/src/Riskeer.Common.Forms/Helpers/FailureMechanismSectionResultRowHelper.cs (.../FailureMechanismSectionResultRowHelper.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -35,7 +35,7 @@ { /// /// Helper class for updating states of a - /// in a . + /// in a . /// public static class FailureMechanismSectionResultRowHelper { Index: Riskeer/Common/src/Riskeer.Common.Forms/Views/FailureMechanismResultViewOld.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Common/src/Riskeer.Common.Forms/Views/FailureMechanismResultViewOld.cs (.../FailureMechanismResultViewOld.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Common/src/Riskeer.Common.Forms/Views/FailureMechanismResultViewOld.cs (.../FailureMechanismResultViewOld.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -46,7 +46,7 @@ /// The type of the assembly result control in this view. public abstract partial class FailureMechanismResultViewOld : UserControl, IView where TSectionResult : FailureMechanismSectionResultOld - where TSectionResultRow : FailureMechanismSectionResultRow + where TSectionResultRow : FailureMechanismSectionResultRowOld where TFailureMechanism : IHasSectionResults where TAssemblyResultControl : AssemblyResultControl, new() { Fisheye: Tag ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b refers to a dead (removed) revision in file `Riskeer/Common/src/Riskeer.Common.Forms/Views/FailureMechanismSectionResultRow.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Common/src/Riskeer.Common.Forms/Views/FailureMechanismSectionResultRowOld.cs =================================================================== diff -u --- Riskeer/Common/src/Riskeer.Common.Forms/Views/FailureMechanismSectionResultRowOld.cs (revision 0) +++ Riskeer/Common/src/Riskeer.Common.Forms/Views/FailureMechanismSectionResultRowOld.cs (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -0,0 +1,101 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using Core.Common.Controls.DataGrid; +using Riskeer.AssemblyTool.Data; +using Riskeer.Common.Data.FailureMechanism; + +namespace Riskeer.Common.Forms.Views +{ + /// + /// Base class for a wrapper of a , which takes care of the + /// representation of properties in a grid. + /// + public abstract class FailureMechanismSectionResultRowOld : IHasColumnStateDefinitions where T : FailureMechanismSectionResultOld + { + /// + /// Fired when the row has started updating. + /// + public event EventHandler RowUpdated; + + /// + /// Fired when the row has finished updating. + /// + public event EventHandler RowUpdateDone; + + /// + /// Creates a new instance of . + /// + /// The that is + /// the source of this row. + /// Throw when is + /// null. + protected FailureMechanismSectionResultRowOld(T sectionResult) + { + if (sectionResult == null) + { + throw new ArgumentNullException(nameof(sectionResult)); + } + + SectionResult = sectionResult; + ColumnStateDefinitions = new Dictionary(); + } + + /// + /// Gets the name of the failure mechanism section. + /// + public string Name + { + get + { + return SectionResult.Section.Name; + } + } + + public IDictionary ColumnStateDefinitions { get; } + + /// + /// Updates all data and states for the row. + /// + /// Thrown when + /// is a valid value, but unsupported. + public abstract void Update(); + + /// + /// Gets the that is the source of this row. + /// + protected T SectionResult { get; } + + /// + /// Updates all data and notifies the wrapped section result. + /// + protected void UpdateInternalData() + { + Update(); + + RowUpdated?.Invoke(this, EventArgs.Empty); + SectionResult.NotifyObservers(); + RowUpdateDone?.Invoke(this, EventArgs.Empty); + } + } +} \ No newline at end of file Index: Riskeer/Common/test/Riskeer.Common.Forms.Test/Views/FailureMechanismResultViewTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Common/test/Riskeer.Common.Forms.Test/Views/FailureMechanismResultViewTest.cs (.../FailureMechanismResultViewTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Common/test/Riskeer.Common.Forms.Test/Views/FailureMechanismResultViewTest.cs (.../FailureMechanismResultViewTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -672,7 +672,7 @@ private class TestAssemblyResultControl : AssemblyResultControl {} - private class TestRow : FailureMechanismSectionResultRow + private class TestRow : FailureMechanismSectionResultRowOld { private string testString; Index: Riskeer/Common/test/Riskeer.Common.Forms.Test/Views/FailureMechanismSectionResultRowTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Common/test/Riskeer.Common.Forms.Test/Views/FailureMechanismSectionResultRowTest.cs (.../FailureMechanismSectionResultRowTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Common/test/Riskeer.Common.Forms.Test/Views/FailureMechanismSectionResultRowTest.cs (.../FailureMechanismSectionResultRowTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -36,7 +36,7 @@ public void Constructor_WithoutSectionResult_ThrowsArgumentNullException() { // Call - TestDelegate test = () => new TestFailureMechanismSectionResultRow(null); + TestDelegate test = () => new TestFailureMechanismSectionResultRowOld(null); // Assert string paramName = Assert.Throws(test).ParamName; @@ -50,7 +50,7 @@ TestFailureMechanismSectionResultOld sectionResult = FailureMechanismSectionResultTestFactory.CreateFailureMechanismSectionResult(); // Call - var row = new TestFailureMechanismSectionResultRow(sectionResult); + var row = new TestFailureMechanismSectionResultRowOld(sectionResult); // Assert Assert.IsInstanceOf(row); @@ -70,7 +70,7 @@ TestFailureMechanismSectionResultOld sectionResult = FailureMechanismSectionResultTestFactory.CreateFailureMechanismSectionResult(); sectionResult.Attach(observer); - var row = new TestFailureMechanismSectionResultRow(sectionResult); + var row = new TestFailureMechanismSectionResultRowOld(sectionResult); var rowUpdated = false; row.RowUpdated += (sender, args) => rowUpdated = true; @@ -90,9 +90,9 @@ mocks.VerifyAll(); } - private class TestFailureMechanismSectionResultRow : FailureMechanismSectionResultRow + private class TestFailureMechanismSectionResultRowOld : FailureMechanismSectionResultRowOld { - public TestFailureMechanismSectionResultRow(TestFailureMechanismSectionResultOld sectionResult) : base(sectionResult) {} + public TestFailureMechanismSectionResultRowOld(TestFailureMechanismSectionResultOld sectionResult) : base(sectionResult) {} public bool Updated { get; private set; } Index: Riskeer/Common/test/Riskeer.Common.Forms.TestUtil/FailureMechanismAssemblyCategoryGroupControlTestFixture.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Common/test/Riskeer.Common.Forms.TestUtil/FailureMechanismAssemblyCategoryGroupControlTestFixture.cs (.../FailureMechanismAssemblyCategoryGroupControlTestFixture.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Common/test/Riskeer.Common.Forms.TestUtil/FailureMechanismAssemblyCategoryGroupControlTestFixture.cs (.../FailureMechanismAssemblyCategoryGroupControlTestFixture.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -48,7 +48,7 @@ where TView : FailureMechanismResultViewOld where TFailureMechanism : IFailureMechanism, IHasSectionResults, new() where TSectionResult : FailureMechanismSectionResultOld - where TResultRow : FailureMechanismSectionResultRow + where TResultRow : FailureMechanismSectionResultRowOld { private Form testForm; Index: Riskeer/Common/test/Riskeer.Common.Forms.TestUtil/FailureMechanismAssemblyResultWithProbabilityControlTestFixture.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Common/test/Riskeer.Common.Forms.TestUtil/FailureMechanismAssemblyResultWithProbabilityControlTestFixture.cs (.../FailureMechanismAssemblyResultWithProbabilityControlTestFixture.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Common/test/Riskeer.Common.Forms.TestUtil/FailureMechanismAssemblyResultWithProbabilityControlTestFixture.cs (.../FailureMechanismAssemblyResultWithProbabilityControlTestFixture.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -50,7 +50,7 @@ where TView : FailureMechanismResultViewOld where TFailureMechanism : IFailureMechanism, IHasSectionResults, ICalculatableFailureMechanism, new() where TSectionResult : FailureMechanismSectionResultOld - where TResultRow : FailureMechanismSectionResultRow + where TResultRow : FailureMechanismSectionResultRowOld where TCalculation : ICalculation { private Form testForm; Index: Riskeer/DuneErosion/src/Riskeer.DuneErosion.Forms/Views/DuneErosionFailureMechanismResultViewOld.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/DuneErosion/src/Riskeer.DuneErosion.Forms/Views/DuneErosionFailureMechanismResultViewOld.cs (.../DuneErosionFailureMechanismResultViewOld.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/DuneErosion/src/Riskeer.DuneErosion.Forms/Views/DuneErosionFailureMechanismResultViewOld.cs (.../DuneErosionFailureMechanismResultViewOld.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -32,7 +32,7 @@ /// public class DuneErosionFailureMechanismResultViewOld : FailureMechanismResultViewOld { @@ -58,11 +58,11 @@ DuneErosionFailureMechanism failureMechanism) : base(failureMechanismSectionResults, failureMechanism) {} - protected override DuneErosionSectionResultRow CreateFailureMechanismSectionResultRow(DuneErosionFailureMechanismSectionResultOld sectionResult) + protected override DuneErosionSectionResultRowOld CreateFailureMechanismSectionResultRow(DuneErosionFailureMechanismSectionResultOld sectionResult) { - return new DuneErosionSectionResultRow( + return new DuneErosionSectionResultRowOld( sectionResult, - new DuneErosionSectionResultRow.ConstructionProperties + new DuneErosionSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = simpleAssessmentResultIndex, DetailedAssessmentResultForFactorizedSignalingNormIndex = detailedAssessmentResultForFactorizedSignalingNormIndex, @@ -83,59 +83,59 @@ { FailureMechanismSectionResultViewColumnBuilder.AddSectionNameColumn( DataGridViewControl, - nameof(DuneErosionSectionResultRow.Name)); + nameof(DuneErosionSectionResultRowOld.Name)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssessmentValidityOnlyResultColumn( DataGridViewControl, - nameof(DuneErosionSectionResultRow.SimpleAssessmentResult)); + nameof(DuneErosionSectionResultRowOld.SimpleAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultForFactorizedSignalingNormColumn( DataGridViewControl, - nameof(DuneErosionSectionResultRow.DetailedAssessmentResultForFactorizedSignalingNorm)); + nameof(DuneErosionSectionResultRowOld.DetailedAssessmentResultForFactorizedSignalingNorm)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultForSignalingNormColumn( DataGridViewControl, - nameof(DuneErosionSectionResultRow.DetailedAssessmentResultForSignalingNorm)); + nameof(DuneErosionSectionResultRowOld.DetailedAssessmentResultForSignalingNorm)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultForMechanismSpecificLowerLimitNormColumn( DataGridViewControl, - nameof(DuneErosionSectionResultRow.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm)); + nameof(DuneErosionSectionResultRowOld.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultForLowerLimitNormColumn( DataGridViewControl, - nameof(DuneErosionSectionResultRow.DetailedAssessmentResultForLowerLimitNorm)); + nameof(DuneErosionSectionResultRowOld.DetailedAssessmentResultForLowerLimitNorm)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultForFactorizedLowerLimitNormColumn( DataGridViewControl, - nameof(DuneErosionSectionResultRow.DetailedAssessmentResultForFactorizedLowerLimitNorm)); + nameof(DuneErosionSectionResultRowOld.DetailedAssessmentResultForFactorizedLowerLimitNorm)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentCategoryGroupColumn( DataGridViewControl, - nameof(DuneErosionSectionResultRow.TailorMadeAssessmentResult)); + nameof(DuneErosionSectionResultRowOld.TailorMadeAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(DuneErosionSectionResultRow.SimpleAssemblyCategoryGroup)); + nameof(DuneErosionSectionResultRowOld.SimpleAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(DuneErosionSectionResultRow.DetailedAssemblyCategoryGroup)); + nameof(DuneErosionSectionResultRowOld.DetailedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(DuneErosionSectionResultRow.TailorMadeAssemblyCategoryGroup)); + nameof(DuneErosionSectionResultRowOld.TailorMadeAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddCombinedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(DuneErosionSectionResultRow.CombinedAssemblyCategoryGroup)); + nameof(DuneErosionSectionResultRowOld.CombinedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddUseManualAssemblyColumn( DataGridViewControl, - nameof(DuneErosionSectionResultRow.UseManualAssembly)); + nameof(DuneErosionSectionResultRowOld.UseManualAssembly)); FailureMechanismSectionResultViewColumnBuilder.AddSelectableAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(DuneErosionSectionResultRow.ManualAssemblyCategoryGroup)); + nameof(DuneErosionSectionResultRowOld.ManualAssemblyCategoryGroup)); } protected override void UpdateAssemblyResultControl() Fisheye: Tag ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b refers to a dead (removed) revision in file `Riskeer/DuneErosion/src/Riskeer.DuneErosion.Forms/Views/DuneErosionSectionResultRow.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/DuneErosion/src/Riskeer.DuneErosion.Forms/Views/DuneErosionSectionResultRowOld.cs =================================================================== diff -u --- Riskeer/DuneErosion/src/Riskeer.DuneErosion.Forms/Views/DuneErosionSectionResultRowOld.cs (revision 0) +++ Riskeer/DuneErosion/src/Riskeer.DuneErosion.Forms/Views/DuneErosionSectionResultRowOld.cs (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -0,0 +1,508 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Controls.DataGrid; +using Riskeer.AssemblyTool.Data; +using Riskeer.AssemblyTool.Forms; +using Riskeer.Common.Data.Exceptions; +using Riskeer.Common.Forms.Helpers; +using Riskeer.Common.Forms.Views; +using Riskeer.Common.Primitives; +using Riskeer.DuneErosion.Data; + +namespace Riskeer.DuneErosion.Forms.Views +{ + /// + /// Class for displaying as a row in a grid view. + /// + public class DuneErosionSectionResultRowOld : FailureMechanismSectionResultRowOld + { + private readonly int simpleAssessmentResultIndex; + private readonly int detailedAssessmentResultForFactorizedSignalingNormIndex; + private readonly int detailedAssessmentResultForSignalingNormIndex; + private readonly int detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex; + private readonly int detailedAssessmentResultForLowerLimitNormIndex; + private readonly int detailedAssessmentResultForFactorizedLowerLimitNormIndex; + private readonly int tailorMadeAssessmentResultIndex; + private readonly int simpleAssemblyCategoryGroupIndex; + private readonly int detailedAssemblyCategoryGroupIndex; + private readonly int tailorMadeAssemblyCategoryGroupIndex; + private readonly int combinedAssemblyCategoryGroupIndex; + private readonly int manualAssemblyCategoryGroupIndex; + + private FailureMechanismSectionAssemblyCategoryGroup simpleAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup detailedAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup combinedAssemblyCategoryGroup; + + /// + /// Creates a new instance of . + /// + /// The to wrap + /// so that it can be displayed as a row. + /// The property values required to create an instance of + /// . + /// Thrown when any parameter is null. + /// Thrown when + /// is a valid value, but unsupported. + internal DuneErosionSectionResultRowOld(DuneErosionFailureMechanismSectionResultOld sectionResult, + ConstructionProperties constructionProperties) + : base(sectionResult) + { + if (constructionProperties == null) + { + throw new ArgumentNullException(nameof(constructionProperties)); + } + + simpleAssessmentResultIndex = constructionProperties.SimpleAssessmentResultIndex; + detailedAssessmentResultForFactorizedSignalingNormIndex = constructionProperties.DetailedAssessmentResultForFactorizedSignalingNormIndex; + detailedAssessmentResultForSignalingNormIndex = constructionProperties.DetailedAssessmentResultForSignalingNormIndex; + detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex = constructionProperties.DetailedAssessmentResultForMechanismSpecificLowerLimitNormIndex; + detailedAssessmentResultForLowerLimitNormIndex = constructionProperties.DetailedAssessmentResultForLowerLimitNormIndex; + detailedAssessmentResultForFactorizedLowerLimitNormIndex = constructionProperties.DetailedAssessmentResultForFactorizedLowerLimitNormIndex; + tailorMadeAssessmentResultIndex = constructionProperties.TailorMadeAssessmentResultIndex; + simpleAssemblyCategoryGroupIndex = constructionProperties.SimpleAssemblyCategoryGroupIndex; + detailedAssemblyCategoryGroupIndex = constructionProperties.DetailedAssemblyCategoryGroupIndex; + tailorMadeAssemblyCategoryGroupIndex = constructionProperties.TailorMadeAssemblyCategoryGroupIndex; + combinedAssemblyCategoryGroupIndex = constructionProperties.CombinedAssemblyCategoryGroupIndex; + manualAssemblyCategoryGroupIndex = constructionProperties.ManualAssemblyCategoryGroupIndex; + + CreateColumnStateDefinitions(); + + Update(); + } + + /// + /// Gets or sets the value representing the simple assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public SimpleAssessmentValidityOnlyResultType SimpleAssessmentResult + { + get + { + return SectionResult.SimpleAssessmentResult; + } + set + { + SectionResult.SimpleAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value of the detailed assessment of safety per failure mechanism section + /// for the factorized signaling norm (Category boundary Iv). + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentResultType DetailedAssessmentResultForFactorizedSignalingNorm + { + get + { + return SectionResult.DetailedAssessmentResultForFactorizedSignalingNorm; + } + set + { + SectionResult.DetailedAssessmentResultForFactorizedSignalingNorm = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value of the detailed assessment of safety per failure mechanism section + /// for the signaling norm (Category boundary IIv). + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentResultType DetailedAssessmentResultForSignalingNorm + { + get + { + return SectionResult.DetailedAssessmentResultForSignalingNorm; + } + set + { + SectionResult.DetailedAssessmentResultForSignalingNorm = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value of the detailed assessment of safety per failure mechanism section + /// for the failure mechanism specific lower limit norm (Category boundary IIIv). + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentResultType DetailedAssessmentResultForMechanismSpecificLowerLimitNorm + { + get + { + return SectionResult.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm; + } + set + { + SectionResult.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value of the detailed assessment of safety per failure mechanism section + /// for the lower limit norm (Category boundary IVv). + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentResultType DetailedAssessmentResultForLowerLimitNorm + { + get + { + return SectionResult.DetailedAssessmentResultForLowerLimitNorm; + } + set + { + SectionResult.DetailedAssessmentResultForLowerLimitNorm = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value of the detailed assessment of safety per failure mechanism section + /// for the factorized lower limit norm (Category boundary Vv). + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentResultType DetailedAssessmentResultForFactorizedLowerLimitNorm + { + get + { + return SectionResult.DetailedAssessmentResultForFactorizedLowerLimitNorm; + } + set + { + SectionResult.DetailedAssessmentResultForFactorizedLowerLimitNorm = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the tailor made assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public TailorMadeAssessmentCategoryGroupResultType TailorMadeAssessmentResult + { + get + { + return SectionResult.TailorMadeAssessmentResult; + } + set + { + SectionResult.TailorMadeAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets the simple assembly category group. + /// + public string SimpleAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(simpleAssemblyCategoryGroup); + } + } + + /// + /// Gets the detailed assembly category group. + /// + public string DetailedAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(detailedAssemblyCategoryGroup); + } + } + + /// + /// Gets the tailor made assembly category group. + /// + public string TailorMadeAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(tailorMadeAssemblyCategoryGroup); + } + } + + /// + /// Gets the combined assembly category group. + /// + public string CombinedAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(combinedAssemblyCategoryGroup); + } + } + + /// + /// Gets or sets the indicator whether the combined assembly should be overwritten by . + /// + /// Thrown when + /// is a valid value, but unsupported. + public bool UseManualAssembly + { + get + { + return SectionResult.UseManualAssembly; + } + set + { + SectionResult.UseManualAssembly = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the manually selected assembly category group. + /// + /// Thrown when + /// is a valid value, but unsupported. + public SelectableFailureMechanismSectionAssemblyCategoryGroup ManualAssemblyCategoryGroup + { + get + { + return SelectableFailureMechanismSectionAssemblyCategoryGroupConverter.ConvertTo(SectionResult.ManualAssemblyCategoryGroup); + } + set + { + SectionResult.ManualAssemblyCategoryGroup = SelectableFailureMechanismSectionAssemblyCategoryGroupConverter.ConvertFrom(value); + UpdateInternalData(); + } + } + + public override void Update() + { + UpdateDerivedData(); + UpdateColumnStateDefinitionStates(); + } + + private void CreateColumnStateDefinitions() + { + ColumnStateDefinitions.Add(simpleAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultForFactorizedSignalingNormIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultForSignalingNormIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultForLowerLimitNormIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultForFactorizedLowerLimitNormIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(simpleAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(combinedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(manualAssemblyCategoryGroupIndex, new DataGridViewColumnStateDefinition()); + } + + private void UpdateDerivedData() + { + ResetErrorTexts(); + TryGetSimpleAssemblyCategoryGroup(); + TryGetDetailedAssemblyCategoryGroup(); + TryGetTailorMadeAssemblyCategoryGroup(); + TryGetCombinedAssemblyCategoryGroup(); + } + + private void ResetErrorTexts() + { + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + } + + private void TryGetSimpleAssemblyCategoryGroup() + { + try + { + simpleAssemblyCategoryGroup = DuneErosionFailureMechanismAssemblyFactory.AssembleSimpleAssessment(SectionResult); + } + catch (AssemblyException e) + { + simpleAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = e.InnerException.Message; + } + } + + private void TryGetDetailedAssemblyCategoryGroup() + { + try + { + detailedAssemblyCategoryGroup = DuneErosionFailureMechanismAssemblyFactory.AssembleDetailedAssessment(SectionResult); + } + catch (AssemblyException e) + { + detailedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = e.InnerException.Message; + } + } + + private void TryGetTailorMadeAssemblyCategoryGroup() + { + try + { + tailorMadeAssemblyCategoryGroup = DuneErosionFailureMechanismAssemblyFactory.AssembleTailorMadeAssessment(SectionResult); + } + catch (AssemblyException e) + { + tailorMadeAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = e.InnerException.Message; + } + } + + private void TryGetCombinedAssemblyCategoryGroup() + { + try + { + combinedAssemblyCategoryGroup = DuneErosionFailureMechanismAssemblyFactory.AssembleCombinedAssessment( + SectionResult); + } + catch (AssemblyException e) + { + combinedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = e.InnerException.Message; + } + } + + /// + /// Updates the column state definitions. + /// + /// Thrown when + /// is a valid value, but unsupported. + private void UpdateColumnStateDefinitionStates() + { + bool simpleAssessmentSufficient = FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(SimpleAssessmentResult); + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[simpleAssessmentResultIndex], UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultForFactorizedSignalingNormIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultForSignalingNormIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultForLowerLimitNormIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultForFactorizedLowerLimitNormIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentResultIndex], + simpleAssessmentSufficient || UseManualAssembly); + + if (UseManualAssembly) + { + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex]); + } + else + { + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex], + simpleAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex], + detailedAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex], + tailorMadeAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex], + combinedAssemblyCategoryGroup); + } + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[manualAssemblyCategoryGroupIndex], !UseManualAssembly); + } + + /// + /// Class holding the various construction parameters for . + /// + public class ConstructionProperties + { + /// + /// Sets the simple assessment result index. + /// + public int SimpleAssessmentResultIndex { internal get; set; } + + /// + /// Sets the detailed assessment result for factorized signaling norm index. + /// + public int DetailedAssessmentResultForFactorizedSignalingNormIndex { internal get; set; } + + /// + /// Sets the detailed assessment result for signaling norm index. + /// + public int DetailedAssessmentResultForSignalingNormIndex { internal get; set; } + + /// + /// Sets the detailed assessment result for mechanism specific lower limit norm index. + /// + public int DetailedAssessmentResultForMechanismSpecificLowerLimitNormIndex { internal get; set; } + + /// + /// Sets the detailed assessment result for lower limit norm index. + /// + public int DetailedAssessmentResultForLowerLimitNormIndex { internal get; set; } + + /// + /// Sets the detailed assessment result for factorized lower limit norm index. + /// + public int DetailedAssessmentResultForFactorizedLowerLimitNormIndex { internal get; set; } + + /// + /// Sets the tailor made assessment result index. + /// + public int TailorMadeAssessmentResultIndex { internal get; set; } + + /// + /// Sets the simple assembly category group index. + /// + public int SimpleAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the detailed assembly category group index. + /// + public int DetailedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the tailor made assembly category group index. + /// + public int TailorMadeAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly category group index. + /// + public int CombinedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the manual assembly category group index. + /// + public int ManualAssemblyCategoryGroupIndex { internal get; set; } + } + } +} \ No newline at end of file Index: Riskeer/DuneErosion/test/Riskeer.DuneErosion.Forms.Test/Views/DuneErosionFailureMechanismResultViewTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/DuneErosion/test/Riskeer.DuneErosion.Forms.Test/Views/DuneErosionFailureMechanismResultViewTest.cs (.../DuneErosionFailureMechanismResultViewTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/DuneErosion/test/Riskeer.DuneErosion.Forms.Test/Views/DuneErosionFailureMechanismResultViewTest.cs (.../DuneErosionFailureMechanismResultViewTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -83,7 +83,7 @@ { // Assert Assert.IsInstanceOf>(view); Assert.IsNull(view.Data); @@ -207,7 +207,7 @@ DuneErosionFailureMechanismResultViewOld, DuneErosionFailureMechanism, DuneErosionFailureMechanismSectionResultOld, - DuneErosionSectionResultRow> + DuneErosionSectionResultRowOld> { protected override DuneErosionFailureMechanismResultViewOld CreateResultView(DuneErosionFailureMechanism failureMechanism) { Index: Riskeer/DuneErosion/test/Riskeer.DuneErosion.Forms.Test/Views/DuneErosionSectionResultRowTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/DuneErosion/test/Riskeer.DuneErosion.Forms.Test/Views/DuneErosionSectionResultRowTest.cs (.../DuneErosionSectionResultRowTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/DuneErosion/test/Riskeer.DuneErosion.Forms.Test/Views/DuneErosionSectionResultRowTest.cs (.../DuneErosionSectionResultRowTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -46,11 +46,11 @@ [TestFixture] public class DuneErosionSectionResultRowTest { - private static DuneErosionSectionResultRow.ConstructionProperties ConstructionProperties + private static DuneErosionSectionResultRowOld.ConstructionProperties ConstructionProperties { get { - return new DuneErosionSectionResultRow.ConstructionProperties + return new DuneErosionSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = 1, DetailedAssessmentResultForFactorizedSignalingNormIndex = 2, @@ -76,7 +76,7 @@ var result = new DuneErosionFailureMechanismSectionResultOld(section); // Call - TestDelegate call = () => new DuneErosionSectionResultRow(result, null); + TestDelegate call = () => new DuneErosionSectionResultRowOld(result, null); // Assert var exception = Assert.Throws(call); @@ -91,10 +91,10 @@ FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); // Call - var row = new DuneErosionSectionResultRow(result, ConstructionProperties); + var row = new DuneErosionSectionResultRowOld(result, ConstructionProperties); // Assert - Assert.IsInstanceOf>(row); + Assert.IsInstanceOf>(row); Assert.AreEqual(result.SimpleAssessmentResult, row.SimpleAssessmentResult); Assert.AreEqual(result.DetailedAssessmentResultForFactorizedSignalingNorm, row.DetailedAssessmentResultForFactorizedSignalingNorm); Assert.AreEqual(result.DetailedAssessmentResultForSignalingNorm, row.DetailedAssessmentResultForSignalingNorm); @@ -144,7 +144,7 @@ calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue(); // Call - var row = new DuneErosionSectionResultRow(result, ConstructionProperties); + var row = new DuneErosionSectionResultRowOld(result, ConstructionProperties); // Assert Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(calculator.SimpleAssessmentAssemblyOutput.Group), row.SimpleAssemblyCategoryGroup); @@ -171,7 +171,7 @@ calculator.ThrowExceptionOnCalculate = true; // Call - var row = new DuneErosionSectionResultRow(result, ConstructionProperties); + var row = new DuneErosionSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -201,7 +201,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new DuneErosionSectionResultRow(result, ConstructionProperties); + var row = new DuneErosionSectionResultRowOld(result, ConstructionProperties); // Precondition Assert.IsFalse(result.UseManualAssembly); @@ -233,7 +233,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new DuneErosionSectionResultRow(result, ConstructionProperties); + var row = new DuneErosionSectionResultRowOld(result, ConstructionProperties); // Call row.ManualAssemblyCategoryGroup = newValue; @@ -264,7 +264,7 @@ calculator.TailorMadeAssemblyCategoryOutput = random.NextEnumValue(); calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue(); - var row = new DuneErosionSectionResultRow(result, ConstructionProperties); + var row = new DuneErosionSectionResultRowOld(result, ConstructionProperties); // Precondition Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(calculator.SimpleAssessmentAssemblyOutput.Group), @@ -302,7 +302,7 @@ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; calculator.ThrowExceptionOnCalculate = true; - var row = new DuneErosionSectionResultRow(result, ConstructionProperties); + var row = new DuneErosionSectionResultRowOld(result, ConstructionProperties); // Precondition IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -344,7 +344,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new DuneErosionSectionResultRow(result, ConstructionProperties); + var row = new DuneErosionSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -379,7 +379,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new DuneErosionSectionResultRow(result, ConstructionProperties); + var row = new DuneErosionSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -435,7 +435,7 @@ calculator.CombinedAssemblyCategoryOutput = assemblyCategoryGroup; // Call - var row = new DuneErosionSectionResultRow(result, ConstructionProperties); + var row = new DuneErosionSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -473,7 +473,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new DuneErosionSectionResultRow(result, ConstructionProperties); + var row = new DuneErosionSectionResultRowOld(result, ConstructionProperties); // Call row.SimpleAssessmentResult = newValue; @@ -502,7 +502,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new DuneErosionSectionResultRow(result, ConstructionProperties); + var row = new DuneErosionSectionResultRowOld(result, ConstructionProperties); // Call row.DetailedAssessmentResultForFactorizedSignalingNorm = newValue; @@ -531,7 +531,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new DuneErosionSectionResultRow(result, ConstructionProperties); + var row = new DuneErosionSectionResultRowOld(result, ConstructionProperties); // Call row.DetailedAssessmentResultForSignalingNorm = newValue; @@ -560,7 +560,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new DuneErosionSectionResultRow(result, ConstructionProperties); + var row = new DuneErosionSectionResultRowOld(result, ConstructionProperties); // Call row.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm = newValue; @@ -589,7 +589,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new DuneErosionSectionResultRow(result, ConstructionProperties); + var row = new DuneErosionSectionResultRowOld(result, ConstructionProperties); // Call row.DetailedAssessmentResultForLowerLimitNorm = newValue; @@ -618,7 +618,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new DuneErosionSectionResultRow(result, ConstructionProperties); + var row = new DuneErosionSectionResultRowOld(result, ConstructionProperties); // Call row.DetailedAssessmentResultForFactorizedLowerLimitNorm = newValue; @@ -647,7 +647,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new DuneErosionSectionResultRow(result, ConstructionProperties); + var row = new DuneErosionSectionResultRowOld(result, ConstructionProperties); // Call row.TailorMadeAssessmentResult = newValue; Index: Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismResultViewOld.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismResultViewOld.cs (.../GrassCoverErosionInwardsFailureMechanismResultViewOld.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismResultViewOld.cs (.../GrassCoverErosionInwardsFailureMechanismResultViewOld.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -36,7 +36,7 @@ /// public class GrassCoverErosionInwardsFailureMechanismResultViewOld : FailureMechanismResultViewOld { @@ -100,14 +100,14 @@ base.Dispose(disposing); } - protected override GrassCoverErosionInwardsFailureMechanismSectionResultRow CreateFailureMechanismSectionResultRow(GrassCoverErosionInwardsFailureMechanismSectionResultOld sectionResult) + protected override GrassCoverErosionInwardsFailureMechanismSectionResultRowOld CreateFailureMechanismSectionResultRow(GrassCoverErosionInwardsFailureMechanismSectionResultOld sectionResult) { - return new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + return new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( sectionResult, FailureMechanism.Calculations.Cast(), FailureMechanism, assessmentSection, - new GrassCoverErosionInwardsFailureMechanismSectionResultRow.ConstructionProperties + new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = simpleAssessmentResultIndex, DetailedAssessmentResultIndex = detailedAssessmentResultIndex, @@ -127,55 +127,55 @@ { FailureMechanismSectionResultViewColumnBuilder.AddSectionNameColumn( DataGridViewControl, - nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRow.Name)); + nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRowOld.Name)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssessmentValidityOnlyResultColumn( DataGridViewControl, - nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRow.SimpleAssessmentResult)); + nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRowOld.SimpleAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentProbabilityOnlyResultColumn( DataGridViewControl, - nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRow.DetailedAssessmentResult)); + nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRowOld.DetailedAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentProbabilityColumn( DataGridViewControl, - nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRow.DetailedAssessmentProbability)); + nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRowOld.DetailedAssessmentProbability)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentProbabilityCalculationResultColumn( DataGridViewControl, - nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRow.TailorMadeAssessmentResult)); + nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRowOld.TailorMadeAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentProbabilityColumn( DataGridViewControl, - nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRow.TailorMadeAssessmentProbability)); + nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRowOld.TailorMadeAssessmentProbability)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRow.SimpleAssemblyCategoryGroup)); + nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRowOld.SimpleAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRow.DetailedAssemblyCategoryGroup)); + nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRowOld.DetailedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRow.TailorMadeAssemblyCategoryGroup)); + nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRowOld.TailorMadeAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddCombinedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRow.CombinedAssemblyCategoryGroup)); + nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRowOld.CombinedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddCombinedAssemblyProbabilityColumn( DataGridViewControl, - nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRow.CombinedAssemblyProbability)); + nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRowOld.CombinedAssemblyProbability)); FailureMechanismSectionResultViewColumnBuilder.AddUseManualAssemblyColumn( DataGridViewControl, - nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRow.UseManualAssembly)); + nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRowOld.UseManualAssembly)); FailureMechanismSectionResultViewColumnBuilder.AddManualAssemblyProbabilityColumn( DataGridViewControl, - nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRow.ManualAssemblyProbability)); + nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRowOld.ManualAssemblyProbability)); } protected override void RefreshDataGrid() Fisheye: Tag ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b refers to a dead (removed) revision in file `Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismSectionResultRow.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismSectionResultRowOld.cs =================================================================== diff -u --- Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismSectionResultRowOld.cs (revision 0) +++ Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismSectionResultRowOld.cs (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -0,0 +1,495 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using Core.Common.Controls.DataGrid; +using Riskeer.AssemblyTool.Data; +using Riskeer.Common.Data.AssessmentSection; +using Riskeer.Common.Data.Exceptions; +using Riskeer.Common.Forms.Helpers; +using Riskeer.Common.Forms.TypeConverters; +using Riskeer.Common.Forms.Views; +using Riskeer.Common.Primitives; +using Riskeer.GrassCoverErosionInwards.Data; + +namespace Riskeer.GrassCoverErosionInwards.Forms.Views +{ + /// + /// Container of a , which takes care of the + /// representation of properties in a grid. + /// + public class GrassCoverErosionInwardsFailureMechanismSectionResultRowOld : FailureMechanismSectionResultRowOld + { + private readonly int simpleAssessmentResultIndex; + private readonly int detailedAssessmentResultIndex; + private readonly int detailedAssessmentProbabilityIndex; + private readonly int tailorMadeAssessmentResultIndex; + private readonly int tailorMadeAssessmentProbabilityIndex; + private readonly int simpleAssemblyCategoryGroupIndex; + private readonly int detailedAssemblyCategoryGroupIndex; + private readonly int tailorMadeAssemblyCategoryGroupIndex; + private readonly int combinedAssemblyCategoryGroupIndex; + private readonly int combinedAssemblyProbabilityIndex; + private readonly int manualAssemblyProbabilityIndex; + + private readonly IEnumerable calculationScenarios; + private readonly GrassCoverErosionInwardsFailureMechanism failureMechanism; + private readonly IAssessmentSection assessmentSection; + private FailureMechanismSectionAssemblyCategoryGroup simpleAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup detailedAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup combinedAssemblyCategoryGroup; + + /// + /// Creates a new instance of . + /// + /// The that is + /// the source of this row. + /// All calculation scenarios in the failure mechanism. + /// The failure mechanism the result belongs to. + /// The assessment section the result belongs to. + /// The property values required to create an instance of + /// . + /// Thrown when any parameter is null. + /// Thrown when + /// is a valid value, but unsupported. + internal GrassCoverErosionInwardsFailureMechanismSectionResultRowOld(GrassCoverErosionInwardsFailureMechanismSectionResultOld sectionResult, + IEnumerable calculationScenarios, + GrassCoverErosionInwardsFailureMechanism failureMechanism, + IAssessmentSection assessmentSection, + ConstructionProperties constructionProperties) + : base(sectionResult) + { + if (calculationScenarios == null) + { + throw new ArgumentNullException(nameof(calculationScenarios)); + } + + if (failureMechanism == null) + { + throw new ArgumentNullException(nameof(failureMechanism)); + } + + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + if (constructionProperties == null) + { + throw new ArgumentNullException(nameof(constructionProperties)); + } + + this.calculationScenarios = calculationScenarios; + this.failureMechanism = failureMechanism; + this.assessmentSection = assessmentSection; + + simpleAssessmentResultIndex = constructionProperties.SimpleAssessmentResultIndex; + detailedAssessmentResultIndex = constructionProperties.DetailedAssessmentResultIndex; + detailedAssessmentProbabilityIndex = constructionProperties.DetailedAssessmentProbabilityIndex; + tailorMadeAssessmentResultIndex = constructionProperties.TailorMadeAssessmentResultIndex; + tailorMadeAssessmentProbabilityIndex = constructionProperties.TailorMadeAssessmentProbabilityIndex; + simpleAssemblyCategoryGroupIndex = constructionProperties.SimpleAssemblyCategoryGroupIndex; + detailedAssemblyCategoryGroupIndex = constructionProperties.DetailedAssemblyCategoryGroupIndex; + tailorMadeAssemblyCategoryGroupIndex = constructionProperties.TailorMadeAssemblyCategoryGroupIndex; + combinedAssemblyCategoryGroupIndex = constructionProperties.CombinedAssemblyCategoryGroupIndex; + combinedAssemblyProbabilityIndex = constructionProperties.CombinedAssemblyProbabilityIndex; + manualAssemblyProbabilityIndex = constructionProperties.ManualAssemblyProbabilityIndex; + + CreateColumnStateDefinitions(); + + Update(); + } + + /// + /// Gets or sets the value representing the simple assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public SimpleAssessmentValidityOnlyResultType SimpleAssessmentResult + { + get => SectionResult.SimpleAssessmentResult; + set + { + SectionResult.SimpleAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value representing the detailed assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentProbabilityOnlyResultType DetailedAssessmentResult + { + get => SectionResult.DetailedAssessmentResult; + set + { + SectionResult.DetailedAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets the value representing the result of the detailed assessment. + /// + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double DetailedAssessmentProbability => SectionResult.GetDetailedAssessmentProbability(calculationScenarios); + + /// + /// Gets or sets the value representing the tailor made assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public TailorMadeAssessmentProbabilityCalculationResultType TailorMadeAssessmentResult + { + get => SectionResult.TailorMadeAssessmentResult; + set + { + SectionResult.TailorMadeAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the tailor made assessment probability of the . + /// + /// Thrown when is + /// not in the range [0,1]. + /// Thrown when + /// is a valid value, but unsupported. + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double TailorMadeAssessmentProbability + { + get => SectionResult.TailorMadeAssessmentProbability; + set + { + SectionResult.TailorMadeAssessmentProbability = value; + UpdateInternalData(); + } + } + + /// + /// Gets the simple assembly category group. + /// + public string SimpleAssemblyCategoryGroup => FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(simpleAssemblyCategoryGroup); + + /// + /// Gets the detailed assembly category group. + /// + public string DetailedAssemblyCategoryGroup => FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(detailedAssemblyCategoryGroup); + + /// + /// Gets the tailor made assembly category group. + /// + public string TailorMadeAssemblyCategoryGroup => FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(tailorMadeAssemblyCategoryGroup); + + /// + /// Gets the combined assembly category group. + /// + public string CombinedAssemblyCategoryGroup => FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(combinedAssemblyCategoryGroup); + + /// + /// Gets the combined assembly probability. + /// + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double CombinedAssemblyProbability { get; private set; } + + /// + /// Gets or sets the indicator whether the combined assembly probability + /// should be overwritten by . + /// + /// Thrown when + /// is a valid value, but unsupported. + public bool UseManualAssembly + { + get => SectionResult.UseManualAssembly; + set + { + SectionResult.UseManualAssembly = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the manually entered assembly probability. + /// + /// Thrown when is + /// not in the range [0,1]. + /// Thrown when + /// is a valid value, but unsupported. + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double ManualAssemblyProbability + { + get => SectionResult.ManualAssemblyProbability; + set + { + SectionResult.ManualAssemblyProbability = value; + UpdateInternalData(); + } + } + + public override void Update() + { + UpdateDerivedData(); + UpdateColumnDefinitionStates(); + UpdateDetailedAssessmentProbabilityError(); + } + + private void UpdateDetailedAssessmentProbabilityError() + { + if (FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(SimpleAssessmentResult) + || !FailureMechanismSectionResultRowHelper.DetailedAssessmentResultIsProbability(DetailedAssessmentResult) + || UseManualAssembly) + { + ColumnStateDefinitions[detailedAssessmentProbabilityIndex].ErrorText = string.Empty; + } + else + { + ColumnStateDefinitions[detailedAssessmentProbabilityIndex].ErrorText = FailureMechanismSectionResultRowHelper.GetDetailedAssessmentProbabilityError( + SectionResult.GetCalculationScenarios(calculationScenarios).ToArray(), + scenarios => SectionResult.GetTotalContribution(scenarios), + scenarios => SectionResult.GetDetailedAssessmentProbability(scenarios)); + } + } + + private void CreateColumnStateDefinitions() + { + ColumnStateDefinitions.Add(simpleAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentProbabilityIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssessmentProbabilityIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(simpleAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(combinedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(combinedAssemblyProbabilityIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(manualAssemblyProbabilityIndex, new DataGridViewColumnStateDefinition()); + } + + private void UpdateDerivedData() + { + ResetErrorTexts(); + TryGetSimpleAssemblyCategoryGroup(); + TryGetDetailedAssemblyCategoryGroup(); + TryGetTailorMadeAssemblyCategoryGroup(); + TryGetCombinedAssemblyCategoryGroup(); + } + + private void ResetErrorTexts() + { + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[combinedAssemblyProbabilityIndex].ErrorText = string.Empty; + } + + private void TryGetSimpleAssemblyCategoryGroup() + { + try + { + simpleAssemblyCategoryGroup = GrassCoverErosionInwardsFailureMechanismAssemblyFactory.AssembleSimpleAssessment(SectionResult).Group; + } + catch (AssemblyException e) + { + simpleAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetDetailedAssemblyCategoryGroup() + { + try + { + detailedAssemblyCategoryGroup = GrassCoverErosionInwardsFailureMechanismAssemblyFactory.AssembleDetailedAssessment( + SectionResult, + calculationScenarios, + failureMechanism, + assessmentSection).Group; + } + catch (AssemblyException e) + { + detailedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetTailorMadeAssemblyCategoryGroup() + { + try + { + tailorMadeAssemblyCategoryGroup = GrassCoverErosionInwardsFailureMechanismAssemblyFactory.AssembleTailorMadeAssessment( + SectionResult, + failureMechanism, + assessmentSection).Group; + } + catch (AssemblyException e) + { + tailorMadeAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetCombinedAssemblyCategoryGroup() + { + try + { + FailureMechanismSectionAssembly combinedAssembly = + GrassCoverErosionInwardsFailureMechanismAssemblyFactory.AssembleCombinedAssessment( + SectionResult, + calculationScenarios, + failureMechanism, + assessmentSection); + + combinedAssemblyCategoryGroup = combinedAssembly.Group; + CombinedAssemblyProbability = combinedAssembly.Probability; + } + catch (AssemblyException e) + { + combinedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + CombinedAssemblyProbability = double.NaN; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = e.Message; + ColumnStateDefinitions[combinedAssemblyProbabilityIndex].ErrorText = e.Message; + } + } + + /// + /// Updates the column state definitions. + /// + /// Thrown when + /// is a valid value, but unsupported. + private void UpdateColumnDefinitionStates() + { + bool simpleAssessmentSufficient = FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(SimpleAssessmentResult); + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[simpleAssessmentResultIndex], UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultIndex], + simpleAssessmentSufficient || UseManualAssembly); + if (simpleAssessmentSufficient + || !FailureMechanismSectionResultRowHelper.DetailedAssessmentResultIsProbability(DetailedAssessmentResult) + || UseManualAssembly) + { + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[detailedAssessmentProbabilityIndex]); + } + else + { + ColumnStateHelper.EnableColumn(ColumnStateDefinitions[detailedAssessmentProbabilityIndex], true); + } + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentResultIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentProbabilityIndex], + simpleAssessmentSufficient + || !FailureMechanismSectionResultRowHelper.TailorMadeAssessmentResultIsProbability(TailorMadeAssessmentResult) + || UseManualAssembly); + + if (UseManualAssembly) + { + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[combinedAssemblyProbabilityIndex]); + } + else + { + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex], + simpleAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex], + detailedAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex], + tailorMadeAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex], + combinedAssemblyCategoryGroup); + ColumnStateHelper.EnableColumn(ColumnStateDefinitions[combinedAssemblyProbabilityIndex], true); + } + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[manualAssemblyProbabilityIndex], !UseManualAssembly); + } + + /// + /// Class holding the various construction parameters for . + /// + public class ConstructionProperties + { + /// + /// Sets the simple assessment result index. + /// + public int SimpleAssessmentResultIndex { internal get; set; } + + /// + /// Sets the detailed assessment result index. + /// + public int DetailedAssessmentResultIndex { internal get; set; } + + /// + /// Sets the detailed assessment probability index. + /// + public int DetailedAssessmentProbabilityIndex { internal get; set; } + + /// + /// Sets the tailor made assessment result index. + /// + public int TailorMadeAssessmentResultIndex { internal get; set; } + + /// + /// Sets the tailor made assessment probability index. + /// + public int TailorMadeAssessmentProbabilityIndex { internal get; set; } + + /// + /// Sets the simple assembly category group index. + /// + public int SimpleAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the detailed assembly category group index. + /// + public int DetailedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the tailor made assembly category group index. + /// + public int TailorMadeAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly category group index. + /// + public int CombinedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly probability index. + /// + public int CombinedAssemblyProbabilityIndex { internal get; set; } + + /// + /// Sets the manual assembly category group index. + /// + public int ManualAssemblyProbabilityIndex { internal get; set; } + } + } +} \ No newline at end of file Index: Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismResultViewTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismResultViewTest.cs (.../GrassCoverErosionInwardsFailureMechanismResultViewTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismResultViewTest.cs (.../GrassCoverErosionInwardsFailureMechanismResultViewTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -88,7 +88,7 @@ { // Assert Assert.IsInstanceOf>(view); Assert.IsNull(view.Data); @@ -246,7 +246,7 @@ using (ShowFailureMechanismResultsView(failureMechanism)) { DataGridView dataGridView = GetDataGridView(); - var row = (GrassCoverErosionInwardsFailureMechanismSectionResultRow) dataGridView.Rows[0].DataBoundItem; + var row = (GrassCoverErosionInwardsFailureMechanismSectionResultRowOld) dataGridView.Rows[0].DataBoundItem; var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; @@ -274,7 +274,7 @@ GrassCoverErosionInwardsFailureMechanismResultViewOld, GrassCoverErosionInwardsFailureMechanism, GrassCoverErosionInwardsFailureMechanismSectionResultOld, - GrassCoverErosionInwardsFailureMechanismSectionResultRow, + GrassCoverErosionInwardsFailureMechanismSectionResultRowOld, GrassCoverErosionInwardsCalculation> { protected override GrassCoverErosionInwardsFailureMechanismResultViewOld CreateResultView(GrassCoverErosionInwardsFailureMechanism failureMechanism) Index: Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismSectionResultRowTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismSectionResultRowTest.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultRowTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismSectionResultRowTest.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultRowTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -50,8 +50,8 @@ [TestFixture] public class GrassCoverErosionInwardsFailureMechanismSectionResultRowTest { - private static GrassCoverErosionInwardsFailureMechanismSectionResultRow.ConstructionProperties ConstructionProperties => - new GrassCoverErosionInwardsFailureMechanismSectionResultRow.ConstructionProperties + private static GrassCoverErosionInwardsFailureMechanismSectionResultRowOld.ConstructionProperties ConstructionProperties => + new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = 1, DetailedAssessmentResultIndex = 2, @@ -78,7 +78,7 @@ var result = new GrassCoverErosionInwardsFailureMechanismSectionResultOld(section); // Call - void Call() => new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + void Call() => new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( result, null, new GrassCoverErosionInwardsFailureMechanism(), assessmentSection, ConstructionProperties); @@ -100,7 +100,7 @@ var result = new GrassCoverErosionInwardsFailureMechanismSectionResultOld(section); // Call - void Call() => new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + void Call() => new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), null, assessmentSection, ConstructionProperties); @@ -118,7 +118,7 @@ var result = new GrassCoverErosionInwardsFailureMechanismSectionResultOld(section); // Call - void Call() => new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + void Call() => new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), new GrassCoverErosionInwardsFailureMechanism(), null, ConstructionProperties); @@ -140,7 +140,7 @@ var result = new GrassCoverErosionInwardsFailureMechanismSectionResultOld(section); // Call - void Call() => new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + void Call() => new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), new GrassCoverErosionInwardsFailureMechanism(), assessmentSection, null); @@ -172,27 +172,27 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( result, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert - Assert.IsInstanceOf>(row); + Assert.IsInstanceOf>(row); Assert.AreEqual(result.SimpleAssessmentResult, row.SimpleAssessmentResult); Assert.AreEqual(result.DetailedAssessmentResult, row.DetailedAssessmentResult); Assert.AreEqual(result.TailorMadeAssessmentResult, row.TailorMadeAssessmentResult); Assert.AreEqual(result.TailorMadeAssessmentProbability, row.TailorMadeAssessmentProbability); Assert.AreEqual(result.UseManualAssembly, row.UseManualAssembly); Assert.AreEqual(result.ManualAssemblyProbability, row.ManualAssemblyProbability); - TestHelper.AssertTypeConverter( - nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRow.DetailedAssessmentProbability)); - TestHelper.AssertTypeConverter( - nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRow.TailorMadeAssessmentProbability)); - TestHelper.AssertTypeConverter( - nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRow.ManualAssemblyProbability)); + nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRowOld.ManualAssemblyProbability)); IDictionary columnStateDefinitions = row.ColumnStateDefinitions; Assert.AreEqual(11, columnStateDefinitions.Count); @@ -244,7 +244,7 @@ random.NextEnumValue()); // Call - var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRow(result, Enumerable.Empty(), + var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld(result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -280,7 +280,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); bool originalValue = result.UseManualAssembly; @@ -318,7 +318,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); @@ -351,7 +351,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); @@ -395,7 +395,7 @@ calculator.CombinedAssemblyOutput = new FailureMechanismSectionAssembly( random.NextDouble(), random.NextEnumValue()); - var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRow(result, Enumerable.Empty(), + var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld(result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); // Precondition @@ -447,7 +447,7 @@ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; calculator.ThrowExceptionOnCalculate = true; - var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRow(result, Enumerable.Empty(), + var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld(result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); // Precondition @@ -506,7 +506,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( result, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -554,7 +554,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( result, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -591,7 +591,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); @@ -630,7 +630,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( result, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -697,7 +697,7 @@ calculator.CombinedAssemblyCategoryOutput = assemblyCategoryGroup; // Call - var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRow(result, Enumerable.Empty(), + var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld(result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -741,7 +741,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -781,7 +781,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -825,7 +825,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -865,7 +865,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( sectionResult, Enumerable.Empty(), failureMechanism, @@ -905,7 +905,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -944,7 +944,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( sectionResult, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -978,7 +978,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( sectionResult, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -1012,7 +1012,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( sectionResult, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -1045,7 +1045,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( sectionResult, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); @@ -1112,7 +1112,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); @@ -1146,7 +1146,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); @@ -1174,7 +1174,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( sectionResult, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); @@ -1207,7 +1207,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( sectionResult, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Call @@ -1237,7 +1237,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -1276,7 +1276,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var resultRow = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( sectionResult, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Call @@ -1309,7 +1309,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); @@ -1345,7 +1345,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); @@ -1378,7 +1378,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRow( + var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); Index: Riskeer/GrassCoverErosionOutwards/src/Riskeer.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismResultViewOld.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/GrassCoverErosionOutwards/src/Riskeer.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismResultViewOld.cs (.../GrassCoverErosionOutwardsFailureMechanismResultViewOld.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/GrassCoverErosionOutwards/src/Riskeer.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismResultViewOld.cs (.../GrassCoverErosionOutwardsFailureMechanismResultViewOld.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -31,7 +31,7 @@ /// The view for a collection of . /// public class GrassCoverErosionOutwardsFailureMechanismResultViewOld : FailureMechanismResultViewOld { @@ -57,11 +57,11 @@ GrassCoverErosionOutwardsFailureMechanism failureMechanism) : base(failureMechanismSectionResults, failureMechanism) {} - protected override GrassCoverErosionOutwardsFailureMechanismSectionResultRow CreateFailureMechanismSectionResultRow(GrassCoverErosionOutwardsFailureMechanismSectionResultOld sectionResult) + protected override GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld CreateFailureMechanismSectionResultRow(GrassCoverErosionOutwardsFailureMechanismSectionResultOld sectionResult) { - return new GrassCoverErosionOutwardsFailureMechanismSectionResultRow( + return new GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld( sectionResult, - new GrassCoverErosionOutwardsFailureMechanismSectionResultRow.ConstructionProperties + new GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = simpleAssessmentResultIndex, DetailedAssessmentResultForFactorizedSignalingNormIndex = detailedAssessmentResultForFactorizedSignalingNormIndex, @@ -82,59 +82,59 @@ { FailureMechanismSectionResultViewColumnBuilder.AddSectionNameColumn( DataGridViewControl, - nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRow.Name)); + nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld.Name)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssessmentResultColumn( DataGridViewControl, - nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRow.SimpleAssessmentResult)); + nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld.SimpleAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultForFactorizedSignalingNormColumn( DataGridViewControl, - nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRow.DetailedAssessmentResultForFactorizedSignalingNorm)); + nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld.DetailedAssessmentResultForFactorizedSignalingNorm)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultForSignalingNormColumn( DataGridViewControl, - nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRow.DetailedAssessmentResultForSignalingNorm)); + nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld.DetailedAssessmentResultForSignalingNorm)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultForMechanismSpecificLowerLimitNormColumn( DataGridViewControl, - nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRow.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm)); + nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultForLowerLimitNormColumn( DataGridViewControl, - nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRow.DetailedAssessmentResultForLowerLimitNorm)); + nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld.DetailedAssessmentResultForLowerLimitNorm)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultForFactorizedLowerLimitNormColumn( DataGridViewControl, - nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRow.DetailedAssessmentResultForFactorizedLowerLimitNorm)); + nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld.DetailedAssessmentResultForFactorizedLowerLimitNorm)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentCategoryGroupColumn( DataGridViewControl, - nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRow.TailorMadeAssessmentResult)); + nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld.TailorMadeAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRow.SimpleAssemblyCategoryGroup)); + nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld.SimpleAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRow.DetailedAssemblyCategoryGroup)); + nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld.DetailedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRow.TailorMadeAssemblyCategoryGroup)); + nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld.TailorMadeAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddCombinedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRow.CombinedAssemblyCategoryGroup)); + nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld.CombinedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddUseManualAssemblyColumn( DataGridViewControl, - nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRow.UseManualAssembly)); + nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld.UseManualAssembly)); FailureMechanismSectionResultViewColumnBuilder.AddSelectableAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRow.ManualAssemblyCategoryGroup)); + nameof(GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld.ManualAssemblyCategoryGroup)); } protected override void UpdateAssemblyResultControl() Fisheye: Tag ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b refers to a dead (removed) revision in file `Riskeer/GrassCoverErosionOutwards/src/Riskeer.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismSectionResultRow.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/GrassCoverErosionOutwards/src/Riskeer.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld.cs =================================================================== diff -u --- Riskeer/GrassCoverErosionOutwards/src/Riskeer.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld.cs (revision 0) +++ Riskeer/GrassCoverErosionOutwards/src/Riskeer.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld.cs (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -0,0 +1,508 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Controls.DataGrid; +using Riskeer.AssemblyTool.Data; +using Riskeer.AssemblyTool.Forms; +using Riskeer.Common.Data.Exceptions; +using Riskeer.Common.Forms.Helpers; +using Riskeer.Common.Forms.Views; +using Riskeer.Common.Primitives; +using Riskeer.GrassCoverErosionOutwards.Data; + +namespace Riskeer.GrassCoverErosionOutwards.Forms.Views +{ + /// + /// Class for displaying as a row in a grid view. + /// + public class GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld : FailureMechanismSectionResultRowOld + { + private readonly int simpleAssessmentResultIndex; + private readonly int detailedAssessmentResultForFactorizedSignalingNormIndex; + private readonly int detailedAssessmentResultForSignalingNormIndex; + private readonly int detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex; + private readonly int detailedAssessmentResultForLowerLimitNormIndex; + private readonly int detailedAssessmentResultForFactorizedLowerLimitNormIndex; + private readonly int tailorMadeAssessmentResultIndex; + private readonly int simpleAssemblyCategoryGroupIndex; + private readonly int detailedAssemblyCategoryGroupIndex; + private readonly int tailorMadeAssemblyCategoryGroupIndex; + private readonly int combinedAssemblyCategoryGroupIndex; + private readonly int manualAssemblyCategoryGroupIndex; + + private FailureMechanismSectionAssemblyCategoryGroup simpleAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup detailedAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup combinedAssemblyCategoryGroup; + + /// + /// Creates a new instance of . + /// + /// The to wrap + /// so that it can be displayed as a row. + /// The property values required to create an instance of + /// . + /// Thrown when any parameter is null. + /// Thrown when + /// is a valid value, but unsupported. + internal GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld(GrassCoverErosionOutwardsFailureMechanismSectionResultOld sectionResult, + ConstructionProperties constructionProperties) + : base(sectionResult) + { + if (constructionProperties == null) + { + throw new ArgumentNullException(nameof(constructionProperties)); + } + + simpleAssessmentResultIndex = constructionProperties.SimpleAssessmentResultIndex; + detailedAssessmentResultForFactorizedSignalingNormIndex = constructionProperties.DetailedAssessmentResultForFactorizedSignalingNormIndex; + detailedAssessmentResultForSignalingNormIndex = constructionProperties.DetailedAssessmentResultForSignalingNormIndex; + detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex = constructionProperties.DetailedAssessmentResultForMechanismSpecificLowerLimitNormIndex; + detailedAssessmentResultForLowerLimitNormIndex = constructionProperties.DetailedAssessmentResultForLowerLimitNormIndex; + detailedAssessmentResultForFactorizedLowerLimitNormIndex = constructionProperties.DetailedAssessmentResultForFactorizedLowerLimitNormIndex; + tailorMadeAssessmentResultIndex = constructionProperties.TailorMadeAssessmentResultIndex; + simpleAssemblyCategoryGroupIndex = constructionProperties.SimpleAssemblyCategoryGroupIndex; + detailedAssemblyCategoryGroupIndex = constructionProperties.DetailedAssemblyCategoryGroupIndex; + tailorMadeAssemblyCategoryGroupIndex = constructionProperties.TailorMadeAssemblyCategoryGroupIndex; + combinedAssemblyCategoryGroupIndex = constructionProperties.CombinedAssemblyCategoryGroupIndex; + manualAssemblyCategoryGroupIndex = constructionProperties.ManualAssemblyCategoryGroupIndex; + + CreateColumnStateDefinitions(); + + Update(); + } + + /// + /// Gets or sets the value representing the simple assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public SimpleAssessmentResultType SimpleAssessmentResult + { + get + { + return SectionResult.SimpleAssessmentResult; + } + set + { + SectionResult.SimpleAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value of the detailed assessment of safety per failure mechanism section + /// for the factorized signaling norm (Category boundary Iv). + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentResultType DetailedAssessmentResultForFactorizedSignalingNorm + { + get + { + return SectionResult.DetailedAssessmentResultForFactorizedSignalingNorm; + } + set + { + SectionResult.DetailedAssessmentResultForFactorizedSignalingNorm = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value of the detailed assessment of safety per failure mechanism section + /// for the signaling norm (Category boundary IIv). + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentResultType DetailedAssessmentResultForSignalingNorm + { + get + { + return SectionResult.DetailedAssessmentResultForSignalingNorm; + } + set + { + SectionResult.DetailedAssessmentResultForSignalingNorm = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value of the detailed assessment of safety per failure mechanism section + /// for the failure mechanism specific lower limit norm (Category boundary IIIv). + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentResultType DetailedAssessmentResultForMechanismSpecificLowerLimitNorm + { + get + { + return SectionResult.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm; + } + set + { + SectionResult.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value of the detailed assessment of safety per failure mechanism section + /// for the lower limit norm (Category boundary IVv). + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentResultType DetailedAssessmentResultForLowerLimitNorm + { + get + { + return SectionResult.DetailedAssessmentResultForLowerLimitNorm; + } + set + { + SectionResult.DetailedAssessmentResultForLowerLimitNorm = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value of the detailed assessment of safety per failure mechanism section + /// for the factorized lower limit norm (Category boundary Vv). + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentResultType DetailedAssessmentResultForFactorizedLowerLimitNorm + { + get + { + return SectionResult.DetailedAssessmentResultForFactorizedLowerLimitNorm; + } + set + { + SectionResult.DetailedAssessmentResultForFactorizedLowerLimitNorm = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the tailor made assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public TailorMadeAssessmentCategoryGroupResultType TailorMadeAssessmentResult + { + get + { + return SectionResult.TailorMadeAssessmentResult; + } + set + { + SectionResult.TailorMadeAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets the simple assembly category group. + /// + public string SimpleAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(simpleAssemblyCategoryGroup); + } + } + + /// + /// Gets the detailed assembly category group. + /// + public string DetailedAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(detailedAssemblyCategoryGroup); + } + } + + /// + /// Gets the tailor made assembly category group. + /// + public string TailorMadeAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(tailorMadeAssemblyCategoryGroup); + } + } + + /// + /// Gets the combined assembly category group. + /// + public string CombinedAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(combinedAssemblyCategoryGroup); + } + } + + /// + /// Gets or sets the indicator whether the combined assembly should be overwritten by . + /// + /// Thrown when + /// is a valid value, but unsupported. + public bool UseManualAssembly + { + get + { + return SectionResult.UseManualAssembly; + } + set + { + SectionResult.UseManualAssembly = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the manually selected assembly category group. + /// + /// Thrown when + /// is a valid value, but unsupported. + public SelectableFailureMechanismSectionAssemblyCategoryGroup ManualAssemblyCategoryGroup + { + get + { + return SelectableFailureMechanismSectionAssemblyCategoryGroupConverter.ConvertTo(SectionResult.ManualAssemblyCategoryGroup); + } + set + { + SectionResult.ManualAssemblyCategoryGroup = SelectableFailureMechanismSectionAssemblyCategoryGroupConverter.ConvertFrom(value); + UpdateInternalData(); + } + } + + public override void Update() + { + UpdateDerivedData(); + UpdateColumnStateDefinitionStates(); + } + + private void CreateColumnStateDefinitions() + { + ColumnStateDefinitions.Add(simpleAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultForFactorizedSignalingNormIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultForSignalingNormIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultForLowerLimitNormIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultForFactorizedLowerLimitNormIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(simpleAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(combinedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(manualAssemblyCategoryGroupIndex, new DataGridViewColumnStateDefinition()); + } + + private void UpdateDerivedData() + { + ResetErrorTexts(); + TryGetSimpleAssemblyCategoryGroup(); + TryGetDetailedAssemblyCategoryGroup(); + TryGetTailorMadeAssemblyCategoryGroup(); + TryGetCombinedAssemblyCategoryGroup(); + } + + private void ResetErrorTexts() + { + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + } + + private void TryGetSimpleAssemblyCategoryGroup() + { + try + { + simpleAssemblyCategoryGroup = GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.AssembleSimpleAssessment(SectionResult); + } + catch (AssemblyException e) + { + simpleAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = e.InnerException.Message; + } + } + + private void TryGetDetailedAssemblyCategoryGroup() + { + try + { + detailedAssemblyCategoryGroup = GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.AssembleDetailedAssessment(SectionResult); + } + catch (AssemblyException e) + { + detailedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = e.InnerException.Message; + } + } + + private void TryGetTailorMadeAssemblyCategoryGroup() + { + try + { + tailorMadeAssemblyCategoryGroup = GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.AssembleTailorMadeAssessment(SectionResult); + } + catch (AssemblyException e) + { + tailorMadeAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = e.InnerException.Message; + } + } + + private void TryGetCombinedAssemblyCategoryGroup() + { + try + { + combinedAssemblyCategoryGroup = GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.AssembleCombinedAssessment( + SectionResult); + } + catch (AssemblyException e) + { + combinedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = e.InnerException.Message; + } + } + + /// + /// Updates the column state definitions. + /// + /// Thrown when + /// is a valid value, but unsupported. + private void UpdateColumnStateDefinitionStates() + { + bool simpleAssessmentSufficient = FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(SimpleAssessmentResult); + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[simpleAssessmentResultIndex], UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultForFactorizedSignalingNormIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultForSignalingNormIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultForLowerLimitNormIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultForFactorizedLowerLimitNormIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentResultIndex], + simpleAssessmentSufficient || UseManualAssembly); + + if (UseManualAssembly) + { + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex]); + } + else + { + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex], + simpleAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex], + detailedAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex], + tailorMadeAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex], + combinedAssemblyCategoryGroup); + } + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[manualAssemblyCategoryGroupIndex], !UseManualAssembly); + } + + /// + /// Class holding the various construction parameters for . + /// + public class ConstructionProperties + { + /// + /// Sets the simple assessment result index. + /// + public int SimpleAssessmentResultIndex { internal get; set; } + + /// + /// Sets the detailed assessment result for factorized signaling norm index. + /// + public int DetailedAssessmentResultForFactorizedSignalingNormIndex { internal get; set; } + + /// + /// Sets the detailed assessment result for signaling norm index. + /// + public int DetailedAssessmentResultForSignalingNormIndex { internal get; set; } + + /// + /// Sets the detailed assessment result for mechanism specific lower limit norm index. + /// + public int DetailedAssessmentResultForMechanismSpecificLowerLimitNormIndex { internal get; set; } + + /// + /// Sets the detailed assessment result for lower limit norm index. + /// + public int DetailedAssessmentResultForLowerLimitNormIndex { internal get; set; } + + /// + /// Sets the detailed assessment result for factorized lower limit norm index. + /// + public int DetailedAssessmentResultForFactorizedLowerLimitNormIndex { internal get; set; } + + /// + /// Sets the tailor made assessment result index. + /// + public int TailorMadeAssessmentResultIndex { internal get; set; } + + /// + /// Sets the simple assembly category group index. + /// + public int SimpleAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the detailed assembly category group index. + /// + public int DetailedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the tailor made assembly category group index. + /// + public int TailorMadeAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly category group index. + /// + public int CombinedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the manual assembly category group index. + /// + public int ManualAssemblyCategoryGroupIndex { internal get; set; } + } + } +} \ No newline at end of file Index: Riskeer/GrassCoverErosionOutwards/test/Riskeer.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailureMechanismResultViewTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/GrassCoverErosionOutwards/test/Riskeer.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailureMechanismResultViewTest.cs (.../GrassCoverErosionOutwardsFailureMechanismResultViewTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/GrassCoverErosionOutwards/test/Riskeer.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailureMechanismResultViewTest.cs (.../GrassCoverErosionOutwardsFailureMechanismResultViewTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -83,7 +83,7 @@ { // Assert Assert.IsInstanceOf>(view); Assert.IsNull(view.Data); @@ -207,7 +207,7 @@ GrassCoverErosionOutwardsFailureMechanismResultViewOld, GrassCoverErosionOutwardsFailureMechanism, GrassCoverErosionOutwardsFailureMechanismSectionResultOld, - GrassCoverErosionOutwardsFailureMechanismSectionResultRow> + GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld> { protected override GrassCoverErosionOutwardsFailureMechanismResultViewOld CreateResultView(GrassCoverErosionOutwardsFailureMechanism failureMechanism) { Index: Riskeer/GrassCoverErosionOutwards/test/Riskeer.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailureMechanismSectionResultRowTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/GrassCoverErosionOutwards/test/Riskeer.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailureMechanismSectionResultRowTest.cs (.../GrassCoverErosionOutwardsFailureMechanismSectionResultRowTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/GrassCoverErosionOutwards/test/Riskeer.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailureMechanismSectionResultRowTest.cs (.../GrassCoverErosionOutwardsFailureMechanismSectionResultRowTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -46,11 +46,11 @@ [TestFixture] public class GrassCoverErosionOutwardsFailureMechanismSectionResultRowTest { - private static GrassCoverErosionOutwardsFailureMechanismSectionResultRow.ConstructionProperties ConstructionProperties + private static GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld.ConstructionProperties ConstructionProperties { get { - return new GrassCoverErosionOutwardsFailureMechanismSectionResultRow.ConstructionProperties + return new GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = 1, DetailedAssessmentResultForFactorizedSignalingNormIndex = 2, @@ -78,10 +78,10 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Assert - Assert.IsInstanceOf>(row); + Assert.IsInstanceOf>(row); Assert.AreEqual(result.SimpleAssessmentResult, row.SimpleAssessmentResult); Assert.AreEqual(result.DetailedAssessmentResultForFactorizedSignalingNorm, row.DetailedAssessmentResultForFactorizedSignalingNorm); Assert.AreEqual(result.DetailedAssessmentResultForSignalingNorm, row.DetailedAssessmentResultForSignalingNorm); @@ -132,7 +132,7 @@ calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue(); // Call - var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Assert Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(calculator.SimpleAssessmentAssemblyOutput.Group), row.SimpleAssemblyCategoryGroup); @@ -159,7 +159,7 @@ calculator.ThrowExceptionOnCalculate = true; // Call - var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -189,7 +189,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Precondition Assert.IsFalse(result.UseManualAssembly); @@ -221,7 +221,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Call row.ManualAssemblyCategoryGroup = newValue; @@ -252,7 +252,7 @@ calculator.TailorMadeAssemblyCategoryOutput = random.NextEnumValue(); calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue(); - var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Precondition Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(calculator.SimpleAssessmentAssemblyOutput.Group), @@ -290,7 +290,7 @@ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; calculator.ThrowExceptionOnCalculate = true; - var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Precondition IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -333,7 +333,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -368,7 +368,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -424,7 +424,7 @@ calculator.CombinedAssemblyCategoryOutput = assemblyCategoryGroup; // Call - var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -462,7 +462,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Call row.SimpleAssessmentResult = newValue; @@ -491,7 +491,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Call row.DetailedAssessmentResultForFactorizedSignalingNorm = newValue; @@ -520,7 +520,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Call row.DetailedAssessmentResultForSignalingNorm = newValue; @@ -549,7 +549,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Call row.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm = newValue; @@ -578,7 +578,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Call row.DetailedAssessmentResultForLowerLimitNorm = newValue; @@ -607,7 +607,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Call row.DetailedAssessmentResultForFactorizedLowerLimitNorm = newValue; @@ -636,7 +636,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Call row.TailorMadeAssessmentResult = newValue; Index: Riskeer/HeightStructures/src/Riskeer.HeightStructures.Forms/Views/HeightStructuresFailureMechanismResultViewOld.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/HeightStructures/src/Riskeer.HeightStructures.Forms/Views/HeightStructuresFailureMechanismResultViewOld.cs (.../HeightStructuresFailureMechanismResultViewOld.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/HeightStructures/src/Riskeer.HeightStructures.Forms/Views/HeightStructuresFailureMechanismResultViewOld.cs (.../HeightStructuresFailureMechanismResultViewOld.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -37,7 +37,7 @@ /// public class HeightStructuresFailureMechanismResultViewOld : FailureMechanismResultViewOld { @@ -102,14 +102,14 @@ base.Dispose(disposing); } - protected override HeightStructuresFailureMechanismSectionResultRow CreateFailureMechanismSectionResultRow(HeightStructuresFailureMechanismSectionResultOld sectionResult) + protected override HeightStructuresFailureMechanismSectionResultRowOld CreateFailureMechanismSectionResultRow(HeightStructuresFailureMechanismSectionResultOld sectionResult) { - return new HeightStructuresFailureMechanismSectionResultRow( + return new HeightStructuresFailureMechanismSectionResultRowOld( sectionResult, FailureMechanism.Calculations.Cast>(), FailureMechanism, assessmentSection, - new HeightStructuresFailureMechanismSectionResultRow.ConstructionProperties + new HeightStructuresFailureMechanismSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = simpleAssessmentResultIndex, DetailedAssessmentResultIndex = detailedAssessmentResultIndex, @@ -129,55 +129,55 @@ { FailureMechanismSectionResultViewColumnBuilder.AddSectionNameColumn( DataGridViewControl, - nameof(HeightStructuresFailureMechanismSectionResultRow.Name)); + nameof(HeightStructuresFailureMechanismSectionResultRowOld.Name)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssessmentResultColumn( DataGridViewControl, - nameof(HeightStructuresFailureMechanismSectionResultRow.SimpleAssessmentResult)); + nameof(HeightStructuresFailureMechanismSectionResultRowOld.SimpleAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentProbabilityOnlyResultColumn( DataGridViewControl, - nameof(HeightStructuresFailureMechanismSectionResultRow.DetailedAssessmentResult)); + nameof(HeightStructuresFailureMechanismSectionResultRowOld.DetailedAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentProbabilityColumn( DataGridViewControl, - nameof(HeightStructuresFailureMechanismSectionResultRow.DetailedAssessmentProbability)); + nameof(HeightStructuresFailureMechanismSectionResultRowOld.DetailedAssessmentProbability)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentProbabilityCalculationResultColumn( DataGridViewControl, - nameof(HeightStructuresFailureMechanismSectionResultRow.TailorMadeAssessmentResult)); + nameof(HeightStructuresFailureMechanismSectionResultRowOld.TailorMadeAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentProbabilityColumn( DataGridViewControl, - nameof(HeightStructuresFailureMechanismSectionResultRow.TailorMadeAssessmentProbability)); + nameof(HeightStructuresFailureMechanismSectionResultRowOld.TailorMadeAssessmentProbability)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(HeightStructuresFailureMechanismSectionResultRow.SimpleAssemblyCategoryGroup)); + nameof(HeightStructuresFailureMechanismSectionResultRowOld.SimpleAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(HeightStructuresFailureMechanismSectionResultRow.DetailedAssemblyCategoryGroup)); + nameof(HeightStructuresFailureMechanismSectionResultRowOld.DetailedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(HeightStructuresFailureMechanismSectionResultRow.TailorMadeAssemblyCategoryGroup)); + nameof(HeightStructuresFailureMechanismSectionResultRowOld.TailorMadeAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddCombinedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(HeightStructuresFailureMechanismSectionResultRow.CombinedAssemblyCategoryGroup)); + nameof(HeightStructuresFailureMechanismSectionResultRowOld.CombinedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddCombinedAssemblyProbabilityColumn( DataGridViewControl, - nameof(HeightStructuresFailureMechanismSectionResultRow.CombinedAssemblyProbability)); + nameof(HeightStructuresFailureMechanismSectionResultRowOld.CombinedAssemblyProbability)); FailureMechanismSectionResultViewColumnBuilder.AddUseManualAssemblyColumn( DataGridViewControl, - nameof(HeightStructuresFailureMechanismSectionResultRow.UseManualAssembly)); + nameof(HeightStructuresFailureMechanismSectionResultRowOld.UseManualAssembly)); FailureMechanismSectionResultViewColumnBuilder.AddManualAssemblyProbabilityColumn( DataGridViewControl, - nameof(HeightStructuresFailureMechanismSectionResultRow.ManualAssemblyProbability)); + nameof(HeightStructuresFailureMechanismSectionResultRowOld.ManualAssemblyProbability)); } protected override void RefreshDataGrid() Fisheye: Tag ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b refers to a dead (removed) revision in file `Riskeer/HeightStructures/src/Riskeer.HeightStructures.Forms/Views/HeightStructuresFailureMechanismSectionResultRow.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/HeightStructures/src/Riskeer.HeightStructures.Forms/Views/HeightStructuresFailureMechanismSectionResultRowOld.cs =================================================================== diff -u --- Riskeer/HeightStructures/src/Riskeer.HeightStructures.Forms/Views/HeightStructuresFailureMechanismSectionResultRowOld.cs (revision 0) +++ Riskeer/HeightStructures/src/Riskeer.HeightStructures.Forms/Views/HeightStructuresFailureMechanismSectionResultRowOld.cs (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -0,0 +1,486 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using Core.Common.Controls.DataGrid; +using Riskeer.AssemblyTool.Data; +using Riskeer.Common.Data.AssessmentSection; +using Riskeer.Common.Data.Exceptions; +using Riskeer.Common.Data.Structures; +using Riskeer.Common.Forms.Helpers; +using Riskeer.Common.Forms.TypeConverters; +using Riskeer.Common.Forms.Views; +using Riskeer.Common.Primitives; +using Riskeer.HeightStructures.Data; + +namespace Riskeer.HeightStructures.Forms.Views +{ + /// + /// This class represents a row of for height structures. + /// + public class HeightStructuresFailureMechanismSectionResultRowOld : FailureMechanismSectionResultRowOld + { + private readonly int simpleAssessmentResultIndex; + private readonly int detailedAssessmentResultIndex; + private readonly int detailedAssessmentProbabilityIndex; + private readonly int tailorMadeAssessmentResultIndex; + private readonly int tailorMadeAssessmentProbabilityIndex; + private readonly int simpleAssemblyCategoryGroupIndex; + private readonly int detailedAssemblyCategoryGroupIndex; + private readonly int tailorMadeAssemblyCategoryGroupIndex; + private readonly int combinedAssemblyCategoryGroupIndex; + private readonly int combinedAssemblyProbabilityIndex; + private readonly int manualAssemblyProbabilityIndex; + private readonly HeightStructuresFailureMechanism failureMechanism; + private readonly IAssessmentSection assessmentSection; + + private readonly IEnumerable> calculationScenarios; + private FailureMechanismSectionAssemblyCategoryGroup simpleAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup detailedAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup combinedAssemblyCategoryGroup; + + /// + /// Creates a new instance of . + /// + /// The this row contains. + /// All calculation scenarios in the failure mechanism. + /// The failure mechanism the result belongs to. + /// The assessment section the result belongs to. + /// The property values required to create an instance of + /// . + /// Thrown when any parameter is null. + /// Thrown when + /// is a valid value, but unsupported. + internal HeightStructuresFailureMechanismSectionResultRowOld(HeightStructuresFailureMechanismSectionResultOld sectionResult, + IEnumerable> calculationScenarios, + HeightStructuresFailureMechanism failureMechanism, + IAssessmentSection assessmentSection, + ConstructionProperties constructionProperties) + : base(sectionResult) + { + if (calculationScenarios == null) + { + throw new ArgumentNullException(nameof(calculationScenarios)); + } + + if (failureMechanism == null) + { + throw new ArgumentNullException(nameof(failureMechanism)); + } + + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + if (constructionProperties == null) + { + throw new ArgumentNullException(nameof(constructionProperties)); + } + + this.calculationScenarios = calculationScenarios; + this.failureMechanism = failureMechanism; + this.assessmentSection = assessmentSection; + + simpleAssessmentResultIndex = constructionProperties.SimpleAssessmentResultIndex; + detailedAssessmentResultIndex = constructionProperties.DetailedAssessmentResultIndex; + detailedAssessmentProbabilityIndex = constructionProperties.DetailedAssessmentProbabilityIndex; + tailorMadeAssessmentResultIndex = constructionProperties.TailorMadeAssessmentResultIndex; + tailorMadeAssessmentProbabilityIndex = constructionProperties.TailorMadeAssessmentProbabilityIndex; + simpleAssemblyCategoryGroupIndex = constructionProperties.SimpleAssemblyCategoryGroupIndex; + detailedAssemblyCategoryGroupIndex = constructionProperties.DetailedAssemblyCategoryGroupIndex; + tailorMadeAssemblyCategoryGroupIndex = constructionProperties.TailorMadeAssemblyCategoryGroupIndex; + combinedAssemblyCategoryGroupIndex = constructionProperties.CombinedAssemblyCategoryGroupIndex; + combinedAssemblyProbabilityIndex = constructionProperties.CombinedAssemblyProbabilityIndex; + manualAssemblyProbabilityIndex = constructionProperties.ManualAssemblyProbabilityIndex; + + CreateColumnStateDefinitions(); + + Update(); + } + + /// + /// Gets or sets the value representing the simple assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public SimpleAssessmentResultType SimpleAssessmentResult + { + get => SectionResult.SimpleAssessmentResult; + set + { + SectionResult.SimpleAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value representing the detailed assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentProbabilityOnlyResultType DetailedAssessmentResult + { + get => SectionResult.DetailedAssessmentResult; + set + { + SectionResult.DetailedAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets the value representing the result of the detailed assessment. + /// + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double DetailedAssessmentProbability => SectionResult.GetDetailedAssessmentProbability(calculationScenarios); + + /// + /// Gets or sets the value representing the tailor made assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public TailorMadeAssessmentProbabilityCalculationResultType TailorMadeAssessmentResult + { + get => SectionResult.TailorMadeAssessmentResult; + set + { + SectionResult.TailorMadeAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the tailor made assessment probability of the . + /// + /// Thrown when is + /// not in the range [0,1]. + /// Thrown when + /// is a valid value, but unsupported. + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double TailorMadeAssessmentProbability + { + get => SectionResult.TailorMadeAssessmentProbability; + set + { + SectionResult.TailorMadeAssessmentProbability = value; + UpdateInternalData(); + } + } + + /// + /// Gets the simple assembly category group. + /// + public string SimpleAssemblyCategoryGroup => FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(simpleAssemblyCategoryGroup); + + /// + /// Gets the detailed assembly category group. + /// + public string DetailedAssemblyCategoryGroup => FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(detailedAssemblyCategoryGroup); + + /// + /// Gets the tailor made assembly category group. + /// + public string TailorMadeAssemblyCategoryGroup => FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(tailorMadeAssemblyCategoryGroup); + + /// + /// Gets the combined assembly category group. + /// + public string CombinedAssemblyCategoryGroup => FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(combinedAssemblyCategoryGroup); + + /// + /// Gets the combined assembly probability. + /// + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double CombinedAssemblyProbability { get; private set; } + + /// + /// Gets or sets the indicator whether the combined assembly probability + /// should be overwritten by . + /// + /// Thrown when + /// is a valid value, but unsupported. + public bool UseManualAssembly + { + get => SectionResult.UseManualAssembly; + set + { + SectionResult.UseManualAssembly = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the manually entered assembly probability. + /// + /// Thrown when is + /// not in the range [0,1]. + /// Thrown when + /// is a valid value, but unsupported. + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double ManualAssemblyProbability + { + get => SectionResult.ManualAssemblyProbability; + set + { + SectionResult.ManualAssemblyProbability = value; + UpdateInternalData(); + } + } + + public override void Update() + { + UpdateDerivedData(); + UpdateColumnDefinitionStates(); + UpdateDetailedAssessmentProbabilityError(); + } + + private void UpdateDetailedAssessmentProbabilityError() + { + if (FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(SimpleAssessmentResult) + || !FailureMechanismSectionResultRowHelper.DetailedAssessmentResultIsProbability(DetailedAssessmentResult) + || UseManualAssembly) + { + ColumnStateDefinitions[detailedAssessmentProbabilityIndex].ErrorText = string.Empty; + } + else + { + ColumnStateDefinitions[detailedAssessmentProbabilityIndex].ErrorText = FailureMechanismSectionResultRowHelper.GetDetailedAssessmentProbabilityError( + SectionResult.GetCalculationScenarios(calculationScenarios).ToArray(), + scenarios => SectionResult.GetTotalContribution(scenarios), + scenarios => SectionResult.GetDetailedAssessmentProbability(scenarios)); + } + } + + private void CreateColumnStateDefinitions() + { + ColumnStateDefinitions.Add(simpleAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentProbabilityIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssessmentProbabilityIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(simpleAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(combinedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(combinedAssemblyProbabilityIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(manualAssemblyProbabilityIndex, new DataGridViewColumnStateDefinition()); + } + + private void UpdateDerivedData() + { + ResetErrorTexts(); + TryGetSimpleAssemblyCategoryGroup(); + TryGetDetailedAssemblyCategoryGroup(); + TryGetTailorMadeAssemblyCategoryGroup(); + TryGetCombinedAssemblyCategoryGroup(); + } + + private void ResetErrorTexts() + { + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[combinedAssemblyProbabilityIndex].ErrorText = string.Empty; + } + + private void TryGetSimpleAssemblyCategoryGroup() + { + try + { + simpleAssemblyCategoryGroup = HeightStructuresFailureMechanismAssemblyFactory.AssembleSimpleAssessment(SectionResult).Group; + } + catch (AssemblyException e) + { + simpleAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetDetailedAssemblyCategoryGroup() + { + try + { + detailedAssemblyCategoryGroup = HeightStructuresFailureMechanismAssemblyFactory.AssembleDetailedAssessment( + SectionResult, calculationScenarios, failureMechanism, assessmentSection).Group; + } + catch (AssemblyException e) + { + detailedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetTailorMadeAssemblyCategoryGroup() + { + try + { + tailorMadeAssemblyCategoryGroup = HeightStructuresFailureMechanismAssemblyFactory.AssembleTailorMadeAssessment( + SectionResult, failureMechanism, assessmentSection).Group; + } + catch (AssemblyException e) + { + tailorMadeAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetCombinedAssemblyCategoryGroup() + { + try + { + FailureMechanismSectionAssembly combinedAssembly = + HeightStructuresFailureMechanismAssemblyFactory.AssembleCombinedAssessment( + SectionResult, calculationScenarios, failureMechanism, assessmentSection); + + combinedAssemblyCategoryGroup = combinedAssembly.Group; + CombinedAssemblyProbability = combinedAssembly.Probability; + } + catch (AssemblyException e) + { + combinedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + CombinedAssemblyProbability = double.NaN; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = e.Message; + ColumnStateDefinitions[combinedAssemblyProbabilityIndex].ErrorText = e.Message; + } + } + + /// + /// Updates the column state definitions. + /// + /// Thrown when + /// is a valid value, but unsupported. + private void UpdateColumnDefinitionStates() + { + bool simpleAssessmentSufficient = FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(SimpleAssessmentResult); + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[simpleAssessmentResultIndex], UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultIndex], + simpleAssessmentSufficient || UseManualAssembly); + if (simpleAssessmentSufficient + || !FailureMechanismSectionResultRowHelper.DetailedAssessmentResultIsProbability(DetailedAssessmentResult) + || UseManualAssembly) + { + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[detailedAssessmentProbabilityIndex]); + } + else + { + ColumnStateHelper.EnableColumn(ColumnStateDefinitions[detailedAssessmentProbabilityIndex], true); + } + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentResultIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentProbabilityIndex], + simpleAssessmentSufficient + || !FailureMechanismSectionResultRowHelper.TailorMadeAssessmentResultIsProbability(TailorMadeAssessmentResult) + || UseManualAssembly); + + if (UseManualAssembly) + { + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[combinedAssemblyProbabilityIndex]); + } + else + { + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex], + simpleAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex], + detailedAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex], + tailorMadeAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex], + combinedAssemblyCategoryGroup); + ColumnStateHelper.EnableColumn(ColumnStateDefinitions[combinedAssemblyProbabilityIndex], true); + } + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[manualAssemblyProbabilityIndex], !UseManualAssembly); + } + + /// + /// Class holding the various construction parameters for . + /// + public class ConstructionProperties + { + /// + /// Sets the simple assessment result index. + /// + public int SimpleAssessmentResultIndex { internal get; set; } + + /// + /// Sets the detailed assessment result index. + /// + public int DetailedAssessmentResultIndex { internal get; set; } + + /// + /// Sets the detailed assessment probability index. + /// + public int DetailedAssessmentProbabilityIndex { internal get; set; } + + /// + /// Sets the tailor made assessment result index. + /// + public int TailorMadeAssessmentResultIndex { internal get; set; } + + /// + /// Sets the tailor made assessment probability index. + /// + public int TailorMadeAssessmentProbabilityIndex { internal get; set; } + + /// + /// Sets the simple assembly category group index. + /// + public int SimpleAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the detailed assembly category group index. + /// + public int DetailedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the tailor made assembly category group index. + /// + public int TailorMadeAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly category group index. + /// + public int CombinedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly probability index. + /// + public int CombinedAssemblyProbabilityIndex { internal get; set; } + + /// + /// Sets the manual assembly category group index. + /// + public int ManualAssemblyProbabilityIndex { internal get; set; } + } + } +} \ No newline at end of file Index: Riskeer/HeightStructures/test/Riskeer.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismResultViewTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/HeightStructures/test/Riskeer.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismResultViewTest.cs (.../HeightStructuresFailureMechanismResultViewTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/HeightStructures/test/Riskeer.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismResultViewTest.cs (.../HeightStructuresFailureMechanismResultViewTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -89,7 +89,7 @@ { // Assert Assert.IsInstanceOf>(view); Assert.IsNull(view.Data); @@ -248,7 +248,7 @@ using (ShowFailureMechanismResultsView(failureMechanism)) { DataGridView dataGridView = GetDataGridView(); - var row = (HeightStructuresFailureMechanismSectionResultRow) dataGridView.Rows[0].DataBoundItem; + var row = (HeightStructuresFailureMechanismSectionResultRowOld) dataGridView.Rows[0].DataBoundItem; var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; @@ -276,7 +276,7 @@ HeightStructuresFailureMechanismResultViewOld, HeightStructuresFailureMechanism, HeightStructuresFailureMechanismSectionResultOld, - HeightStructuresFailureMechanismSectionResultRow, + HeightStructuresFailureMechanismSectionResultRowOld, StructuresCalculation> { protected override HeightStructuresFailureMechanismResultViewOld CreateResultView(HeightStructuresFailureMechanism failureMechanism) Index: Riskeer/HeightStructures/test/Riskeer.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismSectionResultRowTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/HeightStructures/test/Riskeer.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismSectionResultRowTest.cs (.../HeightStructuresFailureMechanismSectionResultRowTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/HeightStructures/test/Riskeer.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismSectionResultRowTest.cs (.../HeightStructuresFailureMechanismSectionResultRowTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -51,8 +51,8 @@ [TestFixture] public class HeightStructuresFailureMechanismSectionResultRowTest { - private static HeightStructuresFailureMechanismSectionResultRow.ConstructionProperties ConstructionProperties => - new HeightStructuresFailureMechanismSectionResultRow.ConstructionProperties + private static HeightStructuresFailureMechanismSectionResultRowOld.ConstructionProperties ConstructionProperties => + new HeightStructuresFailureMechanismSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = 1, DetailedAssessmentResultIndex = 2, @@ -79,7 +79,7 @@ var result = new HeightStructuresFailureMechanismSectionResultOld(section); // Call - void Call() => new HeightStructuresFailureMechanismSectionResultRow( + void Call() => new HeightStructuresFailureMechanismSectionResultRowOld( result, null, new HeightStructuresFailureMechanism(), assessmentSection, ConstructionProperties); @@ -101,7 +101,7 @@ var result = new HeightStructuresFailureMechanismSectionResultOld(section); // Call - void Call() => new HeightStructuresFailureMechanismSectionResultRow( + void Call() => new HeightStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), null, assessmentSection, ConstructionProperties); @@ -119,7 +119,7 @@ var result = new HeightStructuresFailureMechanismSectionResultOld(section); // Call - void Call() => new HeightStructuresFailureMechanismSectionResultRow( + void Call() => new HeightStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), new HeightStructuresFailureMechanism(), null, ConstructionProperties); @@ -140,7 +140,7 @@ var result = new HeightStructuresFailureMechanismSectionResultOld(section); // Call - void Call() => new HeightStructuresFailureMechanismSectionResultRow( + void Call() => new HeightStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), new HeightStructuresFailureMechanism(), assessmentSection, null); @@ -171,27 +171,27 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new HeightStructuresFailureMechanismSectionResultRow( + var row = new HeightStructuresFailureMechanismSectionResultRowOld( result, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert - Assert.IsInstanceOf>(row); + Assert.IsInstanceOf>(row); Assert.AreEqual(result.SimpleAssessmentResult, row.SimpleAssessmentResult); Assert.AreEqual(result.DetailedAssessmentResult, row.DetailedAssessmentResult); Assert.AreEqual(result.TailorMadeAssessmentResult, row.TailorMadeAssessmentResult); Assert.AreEqual(result.TailorMadeAssessmentProbability, row.TailorMadeAssessmentProbability); Assert.AreEqual(result.UseManualAssembly, row.UseManualAssembly); Assert.AreEqual(result.ManualAssemblyProbability, row.ManualAssemblyProbability); - TestHelper.AssertTypeConverter( - nameof(HeightStructuresFailureMechanismSectionResultRow.DetailedAssessmentProbability)); - TestHelper.AssertTypeConverter( - nameof(HeightStructuresFailureMechanismSectionResultRow.TailorMadeAssessmentProbability)); - TestHelper.AssertTypeConverter( - nameof(HeightStructuresFailureMechanismSectionResultRow.ManualAssemblyProbability)); + nameof(HeightStructuresFailureMechanismSectionResultRowOld.ManualAssemblyProbability)); IDictionary columnStateDefinitions = row.ColumnStateDefinitions; Assert.AreEqual(11, columnStateDefinitions.Count); @@ -229,7 +229,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new HeightStructuresFailureMechanismSectionResultRow( + var row = new HeightStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); bool originalValue = result.UseManualAssembly; @@ -267,7 +267,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new HeightStructuresFailureMechanismSectionResultRow( + var row = new HeightStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -300,7 +300,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new HeightStructuresFailureMechanismSectionResultRow( + var row = new HeightStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -345,7 +345,7 @@ random.NextDouble(), random.NextEnumValue()); - var row = new HeightStructuresFailureMechanismSectionResultRow( + var row = new HeightStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -398,7 +398,7 @@ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; calculator.ThrowExceptionOnCalculate = true; - var row = new HeightStructuresFailureMechanismSectionResultRow( + var row = new HeightStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -459,7 +459,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new HeightStructuresFailureMechanismSectionResultRow( + var row = new HeightStructuresFailureMechanismSectionResultRowOld( result, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -507,7 +507,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new HeightStructuresFailureMechanismSectionResultRow( + var row = new HeightStructuresFailureMechanismSectionResultRowOld( result, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -544,7 +544,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new HeightStructuresFailureMechanismSectionResultRow( + var row = new HeightStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -583,7 +583,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new HeightStructuresFailureMechanismSectionResultRow( + var row = new HeightStructuresFailureMechanismSectionResultRowOld( result, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -650,7 +650,7 @@ calculator.CombinedAssemblyCategoryOutput = assemblyCategoryGroup; // Call - var row = new HeightStructuresFailureMechanismSectionResultRow( + var row = new HeightStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -695,7 +695,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new HeightStructuresFailureMechanismSectionResultRow( + var resultRow = new HeightStructuresFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -735,7 +735,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new HeightStructuresFailureMechanismSectionResultRow( + var resultRow = new HeightStructuresFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -779,7 +779,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new HeightStructuresFailureMechanismSectionResultRow( + var resultRow = new HeightStructuresFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -819,7 +819,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new HeightStructuresFailureMechanismSectionResultRow( + var resultRow = new HeightStructuresFailureMechanismSectionResultRowOld( sectionResult, Enumerable.Empty>(), failureMechanism, @@ -860,7 +860,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new HeightStructuresFailureMechanismSectionResultRow( + var resultRow = new HeightStructuresFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -899,7 +899,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new HeightStructuresFailureMechanismSectionResultRow( + var resultRow = new HeightStructuresFailureMechanismSectionResultRowOld( sectionResult, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -933,7 +933,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new HeightStructuresFailureMechanismSectionResultRow( + var resultRow = new HeightStructuresFailureMechanismSectionResultRowOld( sectionResult, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -967,7 +967,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new HeightStructuresFailureMechanismSectionResultRow( + var resultRow = new HeightStructuresFailureMechanismSectionResultRowOld( sectionResult, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -1001,7 +1001,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new HeightStructuresFailureMechanismSectionResultRow( + var resultRow = new HeightStructuresFailureMechanismSectionResultRowOld( sectionResult, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -1101,7 +1101,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new HeightStructuresFailureMechanismSectionResultRow( + var row = new HeightStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -1135,7 +1135,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new HeightStructuresFailureMechanismSectionResultRow( + var row = new HeightStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -1163,7 +1163,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new HeightStructuresFailureMechanismSectionResultRow( + var resultRow = new HeightStructuresFailureMechanismSectionResultRowOld( sectionResult, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -1196,7 +1196,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new HeightStructuresFailureMechanismSectionResultRow( + var resultRow = new HeightStructuresFailureMechanismSectionResultRowOld( sectionResult, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Call @@ -1226,7 +1226,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new HeightStructuresFailureMechanismSectionResultRow( + var resultRow = new HeightStructuresFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -1265,7 +1265,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new HeightStructuresFailureMechanismSectionResultRow( + var resultRow = new HeightStructuresFailureMechanismSectionResultRowOld( sectionResult, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Call @@ -1298,7 +1298,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new HeightStructuresFailureMechanismSectionResultRow( + var row = new HeightStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -1334,7 +1334,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new HeightStructuresFailureMechanismSectionResultRow( + var row = new HeightStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -1367,7 +1367,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new HeightStructuresFailureMechanismSectionResultRow( + var row = new HeightStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); Fisheye: Tag ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b refers to a dead (removed) revision in file `Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/GrassCoverSlipOffInwardsSectionResultRow.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/GrassCoverSlipOffInwardsSectionResultRowOld.cs =================================================================== diff -u --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/GrassCoverSlipOffInwardsSectionResultRowOld.cs (revision 0) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/GrassCoverSlipOffInwardsSectionResultRowOld.cs (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -0,0 +1,390 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Controls.DataGrid; +using Riskeer.AssemblyTool.Data; +using Riskeer.Common.Data.Exceptions; +using Riskeer.Common.Forms.Helpers; +using Riskeer.Common.Forms.Views; +using Riskeer.Common.Primitives; +using Riskeer.Integration.Data.StandAlone.AssemblyFactories; +using Riskeer.Integration.Data.StandAlone.SectionResults; + +namespace Riskeer.Integration.Forms.Views.SectionResultRows +{ + /// + /// Class for displaying as a row in a grid view. + /// + public class GrassCoverSlipOffInwardsSectionResultRowOld : FailureMechanismSectionResultRowOld + { + private readonly int simpleAssessmentResultIndex; + private readonly int detailedAssessmentResultIndex; + private readonly int tailorMadeAssessmentResultIndex; + private readonly int simpleAssemblyCategoryGroupIndex; + private readonly int detailedAssemblyCategoryGroupIndex; + private readonly int tailorMadeAssemblyCategoryGroupIndex; + private readonly int combinedAssemblyCategoryGroupIndex; + private readonly int manualAssemblyCategoryGroupIndex; + + private FailureMechanismSectionAssemblyCategoryGroup simpleAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup detailedAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup combinedAssemblyCategoryGroup; + + /// + /// Creates a new instance of . + /// + /// The to wrap + /// so that it can be displayed as a row. + /// The property values required to create an instance of + /// . + /// Thrown when any parameter is null. + /// Thrown when + /// is a valid value, but unsupported. + internal GrassCoverSlipOffInwardsSectionResultRowOld(GrassCoverSlipOffInwardsFailureMechanismSectionResultOld sectionResult, + ConstructionProperties constructionProperties) + : base(sectionResult) + { + if (constructionProperties == null) + { + throw new ArgumentNullException(nameof(constructionProperties)); + } + + simpleAssessmentResultIndex = constructionProperties.SimpleAssessmentResultIndex; + detailedAssessmentResultIndex = constructionProperties.DetailedAssessmentResultIndex; + tailorMadeAssessmentResultIndex = constructionProperties.TailorMadeAssessmentResultIndex; + simpleAssemblyCategoryGroupIndex = constructionProperties.SimpleAssemblyCategoryGroupIndex; + detailedAssemblyCategoryGroupIndex = constructionProperties.DetailedAssemblyCategoryGroupIndex; + tailorMadeAssemblyCategoryGroupIndex = constructionProperties.TailorMadeAssemblyCategoryGroupIndex; + combinedAssemblyCategoryGroupIndex = constructionProperties.CombinedAssemblyCategoryGroupIndex; + manualAssemblyCategoryGroupIndex = constructionProperties.ManualAssemblyCategoryGroupIndex; + + CreateColumnStateDefinitions(); + + Update(); + } + + /// + /// Gets or sets the value representing the simple assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public SimpleAssessmentResultType SimpleAssessmentResult + { + get + { + return SectionResult.SimpleAssessmentResult; + } + set + { + SectionResult.SimpleAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value representing the detailed assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentResultType DetailedAssessmentResult + { + get + { + return SectionResult.DetailedAssessmentResult; + } + set + { + SectionResult.DetailedAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value representing the tailor made assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public TailorMadeAssessmentResultType TailorMadeAssessmentResult + { + get + { + return SectionResult.TailorMadeAssessmentResult; + } + set + { + SectionResult.TailorMadeAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets the simple assembly category group. + /// + public string SimpleAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(simpleAssemblyCategoryGroup); + } + } + + /// + /// Gets the detailed assembly category group. + /// + public string DetailedAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(detailedAssemblyCategoryGroup); + } + } + + /// + /// Gets the tailor made assembly category group. + /// + public string TailorMadeAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(tailorMadeAssemblyCategoryGroup); + } + } + + /// + /// Gets the combined assembly category group. + /// + public string CombinedAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(combinedAssemblyCategoryGroup); + } + } + + /// + /// Gets or sets the indicator whether the combined assembly should be overwritten by . + /// + /// Thrown when + /// is a valid value, but unsupported. + public bool UseManualAssembly + { + get + { + return SectionResult.UseManualAssembly; + } + set + { + SectionResult.UseManualAssembly = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the manually selected assembly category group. + /// + /// Thrown when + /// is a valid value, but unsupported. + public ManualFailureMechanismSectionAssemblyCategoryGroup ManualAssemblyCategoryGroup + { + get + { + return SectionResult.ManualAssemblyCategoryGroup; + } + set + { + SectionResult.ManualAssemblyCategoryGroup = value; + UpdateInternalData(); + } + } + + public override void Update() + { + UpdateDerivedData(); + UpdateColumnStateDefinitionStates(); + } + + private void CreateColumnStateDefinitions() + { + ColumnStateDefinitions.Add(simpleAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(simpleAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(combinedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(manualAssemblyCategoryGroupIndex, new DataGridViewColumnStateDefinition()); + } + + private void UpdateDerivedData() + { + ResetErrorTexts(); + TryGetSimpleAssemblyCategoryGroup(); + TryGetDetailedAssemblyCategoryGroup(); + TryGetTailorMadeAssemblyCategoryGroup(); + TryGetCombinedAssemblyCategoryGroup(); + } + + private void ResetErrorTexts() + { + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + } + + private void TryGetSimpleAssemblyCategoryGroup() + { + try + { + simpleAssemblyCategoryGroup = GrassCoverSlipOffInwardsFailureMechanismAssemblyFactory.AssembleSimpleAssessment(SectionResult); + } + catch (AssemblyException e) + { + simpleAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetDetailedAssemblyCategoryGroup() + { + try + { + detailedAssemblyCategoryGroup = GrassCoverSlipOffInwardsFailureMechanismAssemblyFactory.AssembleDetailedAssessment(SectionResult); + } + catch (AssemblyException e) + { + detailedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetTailorMadeAssemblyCategoryGroup() + { + try + { + tailorMadeAssemblyCategoryGroup = GrassCoverSlipOffInwardsFailureMechanismAssemblyFactory.AssembleTailorMadeAssessment(SectionResult); + } + catch (AssemblyException e) + { + tailorMadeAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetCombinedAssemblyCategoryGroup() + { + try + { + combinedAssemblyCategoryGroup = GrassCoverSlipOffInwardsFailureMechanismAssemblyFactory.AssembleCombinedAssessment(SectionResult); + } + catch (AssemblyException e) + { + combinedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + /// + /// Updates the column state definitions. + /// + /// Thrown when + /// is a valid value, but unsupported. + private void UpdateColumnStateDefinitionStates() + { + bool simpleAssessmentSufficient = FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(SimpleAssessmentResult); + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[simpleAssessmentResultIndex], UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentResultIndex], + simpleAssessmentSufficient || UseManualAssembly); + + if (UseManualAssembly) + { + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex]); + } + else + { + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex], + simpleAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex], + detailedAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex], + tailorMadeAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex], + combinedAssemblyCategoryGroup); + } + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[manualAssemblyCategoryGroupIndex], !UseManualAssembly); + } + + /// + /// Class holding the various construction parameters for . + /// + public class ConstructionProperties + { + /// + /// Sets the simple assessment result index. + /// + public int SimpleAssessmentResultIndex { internal get; set; } + + /// + /// Sets the detailed assessment result index. + /// + public int DetailedAssessmentResultIndex { internal get; set; } + + /// + /// Sets the tailor made assessment result index. + /// + public int TailorMadeAssessmentResultIndex { internal get; set; } + + /// + /// Sets the simple assembly category group index. + /// + public int SimpleAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the detailed assembly category group index. + /// + public int DetailedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the tailor made assembly category group index. + /// + public int TailorMadeAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly category group index. + /// + public int CombinedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the manual assembly category group index. + /// + public int ManualAssemblyCategoryGroupIndex { internal get; set; } + } + } +} \ No newline at end of file Fisheye: Tag ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b refers to a dead (removed) revision in file `Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/GrassCoverSlipOffOutwardsSectionResultRow.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/GrassCoverSlipOffOutwardsSectionResultRowOld.cs =================================================================== diff -u --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/GrassCoverSlipOffOutwardsSectionResultRowOld.cs (revision 0) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/GrassCoverSlipOffOutwardsSectionResultRowOld.cs (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -0,0 +1,390 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Controls.DataGrid; +using Riskeer.AssemblyTool.Data; +using Riskeer.Common.Data.Exceptions; +using Riskeer.Common.Forms.Helpers; +using Riskeer.Common.Forms.Views; +using Riskeer.Common.Primitives; +using Riskeer.Integration.Data.StandAlone.AssemblyFactories; +using Riskeer.Integration.Data.StandAlone.SectionResults; + +namespace Riskeer.Integration.Forms.Views.SectionResultRows +{ + /// + /// Class for displaying as a row in a grid view. + /// + public class GrassCoverSlipOffOutwardsSectionResultRowOld : FailureMechanismSectionResultRowOld + { + private readonly int simpleAssessmentResultIndex; + private readonly int detailedAssessmentResultIndex; + private readonly int tailorMadeAssessmentResultIndex; + private readonly int simpleAssemblyCategoryGroupIndex; + private readonly int detailedAssemblyCategoryGroupIndex; + private readonly int tailorMadeAssemblyCategoryGroupIndex; + private readonly int combinedAssemblyCategoryGroupIndex; + private readonly int manualAssemblyCategoryGroupIndex; + + private FailureMechanismSectionAssemblyCategoryGroup simpleAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup detailedAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup combinedAssemblyCategoryGroup; + + /// + /// Creates a new instance of . + /// + /// The to wrap + /// so that it can be displayed as a row. + /// The property values required to create an instance of + /// . + /// Thrown when any parameter is null. + /// Thrown when + /// is a valid value, but unsupported. + internal GrassCoverSlipOffOutwardsSectionResultRowOld(GrassCoverSlipOffOutwardsFailureMechanismSectionResultOld sectionResult, + ConstructionProperties constructionProperties) + : base(sectionResult) + { + if (constructionProperties == null) + { + throw new ArgumentNullException(nameof(constructionProperties)); + } + + simpleAssessmentResultIndex = constructionProperties.SimpleAssessmentResultIndex; + detailedAssessmentResultIndex = constructionProperties.DetailedAssessmentResultIndex; + tailorMadeAssessmentResultIndex = constructionProperties.TailorMadeAssessmentResultIndex; + simpleAssemblyCategoryGroupIndex = constructionProperties.SimpleAssemblyCategoryGroupIndex; + detailedAssemblyCategoryGroupIndex = constructionProperties.DetailedAssemblyCategoryGroupIndex; + tailorMadeAssemblyCategoryGroupIndex = constructionProperties.TailorMadeAssemblyCategoryGroupIndex; + combinedAssemblyCategoryGroupIndex = constructionProperties.CombinedAssemblyCategoryGroupIndex; + manualAssemblyCategoryGroupIndex = constructionProperties.ManualAssemblyCategoryGroupIndex; + + CreateColumnStateDefinitions(); + + Update(); + } + + /// + /// Gets or sets the value representing the simple assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public SimpleAssessmentResultType SimpleAssessmentResult + { + get + { + return SectionResult.SimpleAssessmentResult; + } + set + { + SectionResult.SimpleAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value representing the detailed assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentResultType DetailedAssessmentResult + { + get + { + return SectionResult.DetailedAssessmentResult; + } + set + { + SectionResult.DetailedAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value representing the tailor made assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public TailorMadeAssessmentResultType TailorMadeAssessmentResult + { + get + { + return SectionResult.TailorMadeAssessmentResult; + } + set + { + SectionResult.TailorMadeAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets the simple assembly category group. + /// + public string SimpleAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(simpleAssemblyCategoryGroup); + } + } + + /// + /// Gets the detailed assembly category group. + /// + public string DetailedAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(detailedAssemblyCategoryGroup); + } + } + + /// + /// Gets the tailor made assembly category group. + /// + public string TailorMadeAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(tailorMadeAssemblyCategoryGroup); + } + } + + /// + /// Gets the combined assembly category group. + /// + public string CombinedAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(combinedAssemblyCategoryGroup); + } + } + + /// + /// Gets or sets the indicator whether the combined assembly should be overwritten by . + /// + /// Thrown when + /// is a valid value, but unsupported. + public bool UseManualAssembly + { + get + { + return SectionResult.UseManualAssembly; + } + set + { + SectionResult.UseManualAssembly = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the manually selected assembly category group. + /// + /// Thrown when + /// is a valid value, but unsupported. + public ManualFailureMechanismSectionAssemblyCategoryGroup ManualAssemblyCategoryGroup + { + get + { + return SectionResult.ManualAssemblyCategoryGroup; + } + set + { + SectionResult.ManualAssemblyCategoryGroup = value; + UpdateInternalData(); + } + } + + public override void Update() + { + UpdateDerivedData(); + UpdateColumnStateDefinitionStates(); + } + + private void CreateColumnStateDefinitions() + { + ColumnStateDefinitions.Add(simpleAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(simpleAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(combinedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(manualAssemblyCategoryGroupIndex, new DataGridViewColumnStateDefinition()); + } + + private void UpdateDerivedData() + { + ResetErrorTexts(); + TryGetSimpleAssemblyCategoryGroup(); + TryGetDetailedAssemblyCategoryGroup(); + TryGetTailorMadeAssemblyCategoryGroup(); + TryGetCombinedAssemblyCategoryGroup(); + } + + private void ResetErrorTexts() + { + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + } + + private void TryGetSimpleAssemblyCategoryGroup() + { + try + { + simpleAssemblyCategoryGroup = GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.AssembleSimpleAssessment(SectionResult); + } + catch (AssemblyException e) + { + simpleAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetDetailedAssemblyCategoryGroup() + { + try + { + detailedAssemblyCategoryGroup = GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.AssembleDetailedAssessment(SectionResult); + } + catch (AssemblyException e) + { + detailedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetTailorMadeAssemblyCategoryGroup() + { + try + { + tailorMadeAssemblyCategoryGroup = GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.AssembleTailorMadeAssessment(SectionResult); + } + catch (AssemblyException e) + { + tailorMadeAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetCombinedAssemblyCategoryGroup() + { + try + { + combinedAssemblyCategoryGroup = GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.AssembleCombinedAssessment(SectionResult); + } + catch (AssemblyException e) + { + combinedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + /// + /// Updates the column state definitions. + /// + /// Thrown when + /// is a valid value, but unsupported. + private void UpdateColumnStateDefinitionStates() + { + bool simpleAssessmentSufficient = FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(SimpleAssessmentResult); + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[simpleAssessmentResultIndex], UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentResultIndex], + simpleAssessmentSufficient || UseManualAssembly); + + if (UseManualAssembly) + { + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex]); + } + else + { + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex], + simpleAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex], + detailedAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex], + tailorMadeAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex], + combinedAssemblyCategoryGroup); + } + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[manualAssemblyCategoryGroupIndex], !UseManualAssembly); + } + + /// + /// Class holding the various construction parameters for . + /// + public class ConstructionProperties + { + /// + /// Sets the simple assessment result index. + /// + public int SimpleAssessmentResultIndex { internal get; set; } + + /// + /// Sets the detailed assessment result index. + /// + public int DetailedAssessmentResultIndex { internal get; set; } + + /// + /// Sets the tailor made assessment result index. + /// + public int TailorMadeAssessmentResultIndex { internal get; set; } + + /// + /// Sets the simple assembly category group index. + /// + public int SimpleAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the detailed assembly category group index. + /// + public int DetailedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the tailor made assembly category group index. + /// + public int TailorMadeAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly category group index. + /// + public int CombinedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the manual assembly category group index. + /// + public int ManualAssemblyCategoryGroupIndex { internal get; set; } + } + } +} \ No newline at end of file Fisheye: Tag ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b refers to a dead (removed) revision in file `Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRow.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRowOld.cs =================================================================== diff -u --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRowOld.cs (revision 0) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRowOld.cs (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -0,0 +1,488 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.ComponentModel; +using Core.Common.Controls.DataGrid; +using Riskeer.AssemblyTool.Data; +using Riskeer.Common.Data.AssessmentSection; +using Riskeer.Common.Data.Exceptions; +using Riskeer.Common.Forms.Helpers; +using Riskeer.Common.Forms.TypeConverters; +using Riskeer.Common.Forms.Views; +using Riskeer.Common.Primitives; +using Riskeer.Integration.Data.StandAlone; +using Riskeer.Integration.Data.StandAlone.AssemblyFactories; +using Riskeer.Integration.Data.StandAlone.SectionResults; + +namespace Riskeer.Integration.Forms.Views.SectionResultRows +{ + /// + /// Class for displaying as a row in a grid view. + /// + public class MacroStabilityOutwardsSectionResultRowOld : FailureMechanismSectionResultRowOld + { + private readonly int simpleAssessmentResultIndex; + private readonly int detailedAssessmentResultIndex; + private readonly int detailedAssessmentProbabilityIndex; + private readonly int tailorMadeAssessmentResultIndex; + private readonly int tailorMadeAssessmentProbabilityIndex; + private readonly int simpleAssemblyCategoryGroupIndex; + private readonly int detailedAssemblyCategoryGroupIndex; + private readonly int tailorMadeAssemblyCategoryGroupIndex; + private readonly int combinedAssemblyCategoryGroupIndex; + private readonly int manualAssemblyCategoryGroupIndex; + + private readonly MacroStabilityOutwardsFailureMechanism failureMechanism; + private readonly IAssessmentSection assessmentSection; + private FailureMechanismSectionAssemblyCategoryGroup simpleAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup detailedAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup combinedAssemblyCategoryGroup; + + /// + /// Creates a new instance of . + /// + /// The to wrap + /// so that it can be displayed as a row. + /// The failure mechanism the section result belongs to. + /// The assessment section the section result belongs to. + /// The property values required to create an instance of + /// . + /// Thrown when any parameter is null. + /// Thrown when + /// is a valid value, but unsupported. + internal MacroStabilityOutwardsSectionResultRowOld(MacroStabilityOutwardsFailureMechanismSectionResultOld sectionResult, + MacroStabilityOutwardsFailureMechanism failureMechanism, + IAssessmentSection assessmentSection, + ConstructionProperties constructionProperties) + : base(sectionResult) + { + if (failureMechanism == null) + { + throw new ArgumentNullException(nameof(failureMechanism)); + } + + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + if (constructionProperties == null) + { + throw new ArgumentNullException(nameof(constructionProperties)); + } + + this.failureMechanism = failureMechanism; + this.assessmentSection = assessmentSection; + + simpleAssessmentResultIndex = constructionProperties.SimpleAssessmentResultIndex; + detailedAssessmentResultIndex = constructionProperties.DetailedAssessmentResultIndex; + detailedAssessmentProbabilityIndex = constructionProperties.DetailedAssessmentProbabilityIndex; + tailorMadeAssessmentResultIndex = constructionProperties.TailorMadeAssessmentResultIndex; + tailorMadeAssessmentProbabilityIndex = constructionProperties.TailorMadeAssessmentProbabilityIndex; + simpleAssemblyCategoryGroupIndex = constructionProperties.SimpleAssemblyCategoryGroupIndex; + detailedAssemblyCategoryGroupIndex = constructionProperties.DetailedAssemblyCategoryGroupIndex; + tailorMadeAssemblyCategoryGroupIndex = constructionProperties.TailorMadeAssemblyCategoryGroupIndex; + combinedAssemblyCategoryGroupIndex = constructionProperties.CombinedAssemblyCategoryGroupIndex; + manualAssemblyCategoryGroupIndex = constructionProperties.ManualAssemblyCategoryGroupIndex; + + CreateColumnStateDefinitions(); + + Update(); + } + + /// + /// Gets or sets the value representing the simple assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public SimpleAssessmentResultType SimpleAssessmentResult + { + get + { + return SectionResult.SimpleAssessmentResult; + } + set + { + SectionResult.SimpleAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value representing the detailed assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentProbabilityOnlyResultType DetailedAssessmentResult + { + get + { + return SectionResult.DetailedAssessmentResult; + } + set + { + SectionResult.DetailedAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the detailed assessment probability of the . + /// + /// Thrown when is + /// not in the range [0,1]. + /// Thrown when + /// is a valid value, but unsupported. + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double DetailedAssessmentProbability + { + get + { + return SectionResult.DetailedAssessmentProbability; + } + set + { + SectionResult.DetailedAssessmentProbability = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value representing the tailor made assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public TailorMadeAssessmentProbabilityAndDetailedCalculationResultType TailorMadeAssessmentResult + { + get + { + return SectionResult.TailorMadeAssessmentResult; + } + set + { + SectionResult.TailorMadeAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the tailor made assessment probability of the . + /// + /// Thrown when is + /// not in the range [0,1]. + /// Thrown when + /// is a valid value, but unsupported. + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double TailorMadeAssessmentProbability + { + get + { + return SectionResult.TailorMadeAssessmentProbability; + } + set + { + SectionResult.TailorMadeAssessmentProbability = value; + UpdateInternalData(); + } + } + + /// + /// Gets the simple assembly category group. + /// + public string SimpleAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(simpleAssemblyCategoryGroup); + } + } + + /// + /// Gets the detailed assembly category group. + /// + public string DetailedAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(detailedAssemblyCategoryGroup); + } + } + + /// + /// Gets the tailor made assembly category group. + /// + public string TailorMadeAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(tailorMadeAssemblyCategoryGroup); + } + } + + /// + /// Gets the combined assembly category group. + /// + public string CombinedAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(combinedAssemblyCategoryGroup); + } + } + + /// + /// Gets or sets the indicator whether the combined assembly should be overwritten by . + /// + /// Thrown when + /// is a valid value, but unsupported. + public bool UseManualAssembly + { + get + { + return SectionResult.UseManualAssembly; + } + set + { + SectionResult.UseManualAssembly = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the manually selected assembly category group. + /// + /// Thrown when + /// is a valid value, but unsupported. + public ManualFailureMechanismSectionAssemblyCategoryGroup ManualAssemblyCategoryGroup + { + get + { + return SectionResult.ManualAssemblyCategoryGroup; + } + set + { + SectionResult.ManualAssemblyCategoryGroup = value; + UpdateInternalData(); + } + } + + public override void Update() + { + UpdateDerivedData(); + UpdateColumnStateDefinitionStates(); + } + + private void CreateColumnStateDefinitions() + { + ColumnStateDefinitions.Add(simpleAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentProbabilityIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssessmentProbabilityIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(simpleAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(combinedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(manualAssemblyCategoryGroupIndex, new DataGridViewColumnStateDefinition()); + } + + private void UpdateDerivedData() + { + ResetErrorTexts(); + TryGetSimpleAssemblyCategoryGroup(); + TryGetDetailedAssemblyCategoryGroup(); + TryGetTailorMadeAssemblyCategoryGroup(); + TryGetCombinedAssemblyCategoryGroup(); + } + + private void ResetErrorTexts() + { + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + } + + private void TryGetSimpleAssemblyCategoryGroup() + { + try + { + simpleAssemblyCategoryGroup = MacroStabilityOutwardsFailureMechanismAssemblyFactory.AssembleSimpleAssessment(SectionResult); + } + catch (AssemblyException e) + { + simpleAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetDetailedAssemblyCategoryGroup() + { + try + { + detailedAssemblyCategoryGroup = MacroStabilityOutwardsFailureMechanismAssemblyFactory.AssembleDetailedAssessment( + SectionResult, + failureMechanism, + assessmentSection); + } + catch (AssemblyException e) + { + detailedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetTailorMadeAssemblyCategoryGroup() + { + try + { + tailorMadeAssemblyCategoryGroup = MacroStabilityOutwardsFailureMechanismAssemblyFactory.AssembleTailorMadeAssessment( + SectionResult, + failureMechanism, + assessmentSection); + } + catch (AssemblyException e) + { + tailorMadeAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetCombinedAssemblyCategoryGroup() + { + try + { + combinedAssemblyCategoryGroup = MacroStabilityOutwardsFailureMechanismAssemblyFactory.AssembleCombinedAssessment( + SectionResult, + failureMechanism, + assessmentSection); + } + catch (AssemblyException e) + { + combinedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + /// + /// Updates the column state definitions. + /// + /// Thrown when + /// is a valid value, but unsupported. + private void UpdateColumnStateDefinitionStates() + { + bool simpleAssessmentSufficient = FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(SimpleAssessmentResult); + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[simpleAssessmentResultIndex], UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentProbabilityIndex], + simpleAssessmentSufficient + || !FailureMechanismSectionResultRowHelper.DetailedAssessmentResultIsProbability(DetailedAssessmentResult) + || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentResultIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentProbabilityIndex], + simpleAssessmentSufficient + || !FailureMechanismSectionResultRowHelper.TailorMadeAssessmentResultIsProbability(TailorMadeAssessmentResult) + || UseManualAssembly); + + if (UseManualAssembly) + { + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex]); + } + else + { + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex], + simpleAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex], + detailedAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex], + tailorMadeAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex], + combinedAssemblyCategoryGroup); + } + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[manualAssemblyCategoryGroupIndex], !UseManualAssembly); + } + + /// + /// Class holding the various construction parameters for . + /// + public class ConstructionProperties + { + /// + /// Sets the simple assessment result index. + /// + public int SimpleAssessmentResultIndex { internal get; set; } + + /// + /// Sets the detailed assessment result index. + /// + public int DetailedAssessmentResultIndex { internal get; set; } + + /// + /// Sets the detailed assessment probability index. + /// + public int DetailedAssessmentProbabilityIndex { internal get; set; } + + /// + /// Sets the tailor made assessment result index. + /// + public int TailorMadeAssessmentResultIndex { internal get; set; } + + /// + /// Sets the tailor made assessment probability index. + /// + public int TailorMadeAssessmentProbabilityIndex { internal get; set; } + + /// + /// Sets the simple assembly category group index. + /// + public int SimpleAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the detailed assembly category group index. + /// + public int DetailedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the tailor made assembly category group index. + /// + public int TailorMadeAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly category group index. + /// + public int CombinedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the manual assembly category group index. + /// + public int ManualAssemblyCategoryGroupIndex { internal get; set; } + } + } +} \ No newline at end of file Fisheye: Tag ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b refers to a dead (removed) revision in file `Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/MicrostabilitySectionResultRow.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/MicrostabilitySectionResultRowOld.cs =================================================================== diff -u --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/MicrostabilitySectionResultRowOld.cs (revision 0) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/MicrostabilitySectionResultRowOld.cs (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -0,0 +1,391 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Controls.DataGrid; +using Riskeer.AssemblyTool.Data; +using Riskeer.Common.Data.Exceptions; +using Riskeer.Common.Forms.Helpers; +using Riskeer.Common.Forms.Views; +using Riskeer.Common.Primitives; +using Riskeer.Integration.Data.StandAlone.AssemblyFactories; +using Riskeer.Integration.Data.StandAlone.SectionResults; + +namespace Riskeer.Integration.Forms.Views.SectionResultRows +{ + /// + /// Class for displaying + /// as a row in a grid view. + /// + public class MicrostabilitySectionResultRowOld : FailureMechanismSectionResultRowOld + { + private readonly int simpleAssessmentResultIndex; + private readonly int detailedAssessmentResultIndex; + private readonly int tailorMadeAssessmentResultIndex; + private readonly int simpleAssemblyCategoryGroupIndex; + private readonly int detailedAssemblyCategoryGroupIndex; + private readonly int tailorMadeAssemblyCategoryGroupIndex; + private readonly int combinedAssemblyCategoryGroupIndex; + private readonly int manualAssemblyCategoryGroupIndex; + + private FailureMechanismSectionAssemblyCategoryGroup simpleAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup detailedAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup combinedAssemblyCategoryGroup; + + /// + /// Creates a new instance of . + /// + /// The to wrap + /// so that it can be displayed as a row. + /// The property values required to create an instance of + /// . + /// Thrown when any parameter is null. + /// Thrown when + /// is a valid value, but unsupported. + internal MicrostabilitySectionResultRowOld(MicrostabilityFailureMechanismSectionResultOld sectionResult, + ConstructionProperties constructionProperties) + : base(sectionResult) + { + if (constructionProperties == null) + { + throw new ArgumentNullException(nameof(constructionProperties)); + } + + simpleAssessmentResultIndex = constructionProperties.SimpleAssessmentResultIndex; + detailedAssessmentResultIndex = constructionProperties.DetailedAssessmentResultIndex; + tailorMadeAssessmentResultIndex = constructionProperties.TailorMadeAssessmentResultIndex; + simpleAssemblyCategoryGroupIndex = constructionProperties.SimpleAssemblyCategoryGroupIndex; + detailedAssemblyCategoryGroupIndex = constructionProperties.DetailedAssemblyCategoryGroupIndex; + tailorMadeAssemblyCategoryGroupIndex = constructionProperties.TailorMadeAssemblyCategoryGroupIndex; + combinedAssemblyCategoryGroupIndex = constructionProperties.CombinedAssemblyCategoryGroupIndex; + manualAssemblyCategoryGroupIndex = constructionProperties.ManualAssemblyCategoryGroupIndex; + + CreateColumnStateDefinitions(); + + Update(); + } + + /// + /// Gets or sets the value representing the simple assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public SimpleAssessmentResultType SimpleAssessmentResult + { + get + { + return SectionResult.SimpleAssessmentResult; + } + set + { + SectionResult.SimpleAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value representing the detailed assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentResultType DetailedAssessmentResult + { + get + { + return SectionResult.DetailedAssessmentResult; + } + set + { + SectionResult.DetailedAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value representing the tailor made assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public TailorMadeAssessmentResultType TailorMadeAssessmentResult + { + get + { + return SectionResult.TailorMadeAssessmentResult; + } + set + { + SectionResult.TailorMadeAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets the simple assembly category group. + /// + public string SimpleAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(simpleAssemblyCategoryGroup); + } + } + + /// + /// Gets the detailed assembly category group. + /// + public string DetailedAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(detailedAssemblyCategoryGroup); + } + } + + /// + /// Gets the tailor made assembly category group. + /// + public string TailorMadeAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(tailorMadeAssemblyCategoryGroup); + } + } + + /// + /// Gets the combined assembly category group. + /// + public string CombinedAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(combinedAssemblyCategoryGroup); + } + } + + /// + /// Gets or sets the indicator whether the combined assembly should be overwritten by . + /// + /// Thrown when + /// is a valid value, but unsupported. + public bool UseManualAssembly + { + get + { + return SectionResult.UseManualAssembly; + } + set + { + SectionResult.UseManualAssembly = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the manually selected assembly category group. + /// + /// Thrown when + /// is a valid value, but unsupported. + public ManualFailureMechanismSectionAssemblyCategoryGroup ManualAssemblyCategoryGroup + { + get + { + return SectionResult.ManualAssemblyCategoryGroup; + } + set + { + SectionResult.ManualAssemblyCategoryGroup = value; + UpdateInternalData(); + } + } + + public override void Update() + { + UpdateDerivedData(); + UpdateColumnStateDefinitionStates(); + } + + private void CreateColumnStateDefinitions() + { + ColumnStateDefinitions.Add(simpleAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(simpleAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(combinedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(manualAssemblyCategoryGroupIndex, new DataGridViewColumnStateDefinition()); + } + + private void UpdateDerivedData() + { + ResetErrorTexts(); + TryGetSimpleAssemblyCategoryGroup(); + TryGetDetailedAssemblyCategoryGroup(); + TryGetTailorMadeAssemblyCategoryGroup(); + TryGetCombinedAssemblyCategoryGroup(); + } + + private void ResetErrorTexts() + { + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + } + + private void TryGetSimpleAssemblyCategoryGroup() + { + try + { + simpleAssemblyCategoryGroup = MicrostabilityFailureMechanismAssemblyFactory.AssembleSimpleAssessment(SectionResult); + } + catch (AssemblyException e) + { + simpleAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetDetailedAssemblyCategoryGroup() + { + try + { + detailedAssemblyCategoryGroup = MicrostabilityFailureMechanismAssemblyFactory.AssembleDetailedAssessment(SectionResult); + } + catch (AssemblyException e) + { + detailedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetTailorMadeAssemblyCategoryGroup() + { + try + { + tailorMadeAssemblyCategoryGroup = MicrostabilityFailureMechanismAssemblyFactory.AssembleTailorMadeAssessment(SectionResult); + } + catch (AssemblyException e) + { + tailorMadeAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetCombinedAssemblyCategoryGroup() + { + try + { + combinedAssemblyCategoryGroup = MicrostabilityFailureMechanismAssemblyFactory.AssembleCombinedAssessment(SectionResult); + } + catch (AssemblyException e) + { + combinedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + /// + /// Updates the column state definitions. + /// + /// Thrown when + /// is a valid value, but unsupported. + private void UpdateColumnStateDefinitionStates() + { + bool simpleAssessmentSufficient = FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(SimpleAssessmentResult); + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[simpleAssessmentResultIndex], UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentResultIndex], + simpleAssessmentSufficient || UseManualAssembly); + + if (UseManualAssembly) + { + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex]); + } + else + { + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex], + simpleAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex], + detailedAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex], + tailorMadeAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex], + combinedAssemblyCategoryGroup); + } + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[manualAssemblyCategoryGroupIndex], !UseManualAssembly); + } + + /// + /// Class holding the various construction parameters for . + /// + public class ConstructionProperties + { + /// + /// Sets the simple assessment result index. + /// + public int SimpleAssessmentResultIndex { internal get; set; } + + /// + /// Sets the detailed assessment result index. + /// + public int DetailedAssessmentResultIndex { internal get; set; } + + /// + /// Sets the tailor made assessment result index. + /// + public int TailorMadeAssessmentResultIndex { internal get; set; } + + /// + /// Sets the simple assembly category group index. + /// + public int SimpleAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the detailed assembly category group index. + /// + public int DetailedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the tailor made assembly category group index. + /// + public int TailorMadeAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly category group index. + /// + public int CombinedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the manual assembly category group index. + /// + public int ManualAssemblyCategoryGroupIndex { internal get; set; } + } + } +} \ No newline at end of file Fisheye: Tag ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b refers to a dead (removed) revision in file `Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/PipingStructureSectionResultRow.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/PipingStructureSectionResultRowOld.cs =================================================================== diff -u --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/PipingStructureSectionResultRowOld.cs (revision 0) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/PipingStructureSectionResultRowOld.cs (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -0,0 +1,390 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Controls.DataGrid; +using Riskeer.AssemblyTool.Data; +using Riskeer.Common.Data.Exceptions; +using Riskeer.Common.Forms.Helpers; +using Riskeer.Common.Forms.Views; +using Riskeer.Common.Primitives; +using Riskeer.Integration.Data.StandAlone.AssemblyFactories; +using Riskeer.Integration.Data.StandAlone.SectionResults; + +namespace Riskeer.Integration.Forms.Views.SectionResultRows +{ + /// + /// Class for displaying as a row in a grid view. + /// + public class PipingStructureSectionResultRowOld : FailureMechanismSectionResultRowOld + { + private readonly int simpleAssessmentResultIndex; + private readonly int detailedAssessmentResultIndex; + private readonly int tailorMadeAssessmentResultIndex; + private readonly int simpleAssemblyCategoryGroupIndex; + private readonly int detailedAssemblyCategoryGroupIndex; + private readonly int tailorMadeAssemblyCategoryGroupIndex; + private readonly int combinedAssemblyCategoryGroupIndex; + private readonly int manualAssemblyCategoryGroupIndex; + + private FailureMechanismSectionAssemblyCategoryGroup simpleAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup detailedAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup combinedAssemblyCategoryGroup; + + /// + /// Creates a new instance of . + /// + /// The to wrap + /// so that it can be displayed as a row. + /// The property values required to create an instance of + /// . + /// Thrown when any parameter is null. + /// Thrown when + /// is a valid value, but unsupported. + internal PipingStructureSectionResultRowOld(PipingStructureFailureMechanismSectionResultOld sectionResult, + ConstructionProperties constructionProperties) + : base(sectionResult) + { + if (constructionProperties == null) + { + throw new ArgumentNullException(nameof(constructionProperties)); + } + + simpleAssessmentResultIndex = constructionProperties.SimpleAssessmentResultIndex; + detailedAssessmentResultIndex = constructionProperties.DetailedAssessmentResultIndex; + tailorMadeAssessmentResultIndex = constructionProperties.TailorMadeAssessmentResultIndex; + simpleAssemblyCategoryGroupIndex = constructionProperties.SimpleAssemblyCategoryGroupIndex; + detailedAssemblyCategoryGroupIndex = constructionProperties.DetailedAssemblyCategoryGroupIndex; + tailorMadeAssemblyCategoryGroupIndex = constructionProperties.TailorMadeAssemblyCategoryGroupIndex; + combinedAssemblyCategoryGroupIndex = constructionProperties.CombinedAssemblyCategoryGroupIndex; + manualAssemblyCategoryGroupIndex = constructionProperties.ManualAssemblyCategoryGroupIndex; + + CreateColumnStateDefinitions(); + + Update(); + } + + /// + /// Gets or sets the value representing the simple assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public SimpleAssessmentResultType SimpleAssessmentResult + { + get + { + return SectionResult.SimpleAssessmentResult; + } + set + { + SectionResult.SimpleAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value representing the detailed assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentResultType DetailedAssessmentResult + { + get + { + return SectionResult.DetailedAssessmentResult; + } + set + { + SectionResult.DetailedAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value representing the tailor made assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public TailorMadeAssessmentResultType TailorMadeAssessmentResult + { + get + { + return SectionResult.TailorMadeAssessmentResult; + } + set + { + SectionResult.TailorMadeAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets the simple assembly category group. + /// + public string SimpleAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(simpleAssemblyCategoryGroup); + } + } + + /// + /// Gets the detailed assembly category group. + /// + public string DetailedAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(detailedAssemblyCategoryGroup); + } + } + + /// + /// Gets the tailor made assembly category group. + /// + public string TailorMadeAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(tailorMadeAssemblyCategoryGroup); + } + } + + /// + /// Gets the combined assembly category group. + /// + public string CombinedAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(combinedAssemblyCategoryGroup); + } + } + + /// + /// Gets or sets the indicator whether the combined assembly should be overwritten by . + /// + /// Thrown when + /// is a valid value, but unsupported. + public bool UseManualAssembly + { + get + { + return SectionResult.UseManualAssembly; + } + set + { + SectionResult.UseManualAssembly = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the manually selected assembly category group. + /// + /// Thrown when + /// is a valid value, but unsupported. + public ManualFailureMechanismSectionAssemblyCategoryGroup ManualAssemblyCategoryGroup + { + get + { + return SectionResult.ManualAssemblyCategoryGroup; + } + set + { + SectionResult.ManualAssemblyCategoryGroup = value; + UpdateInternalData(); + } + } + + public override void Update() + { + UpdateDerivedData(); + UpdateColumnStateDefinitionStates(); + } + + private void CreateColumnStateDefinitions() + { + ColumnStateDefinitions.Add(simpleAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(simpleAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(combinedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(manualAssemblyCategoryGroupIndex, new DataGridViewColumnStateDefinition()); + } + + private void UpdateDerivedData() + { + ResetErrorTexts(); + TryGetSimpleAssemblyCategoryGroup(); + TryGetDetailedAssemblyCategoryGroup(); + TryGetTailorMadeAssemblyCategoryGroup(); + TryGetCombinedAssemblyCategoryGroup(); + } + + private void ResetErrorTexts() + { + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + } + + private void TryGetSimpleAssemblyCategoryGroup() + { + try + { + simpleAssemblyCategoryGroup = PipingStructureFailureMechanismAssemblyFactory.AssembleSimpleAssessment(SectionResult); + } + catch (AssemblyException e) + { + simpleAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetDetailedAssemblyCategoryGroup() + { + try + { + detailedAssemblyCategoryGroup = PipingStructureFailureMechanismAssemblyFactory.AssembleDetailedAssessment(SectionResult); + } + catch (AssemblyException e) + { + detailedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetTailorMadeAssemblyCategoryGroup() + { + try + { + tailorMadeAssemblyCategoryGroup = PipingStructureFailureMechanismAssemblyFactory.AssembleTailorMadeAssessment(SectionResult); + } + catch (AssemblyException e) + { + tailorMadeAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetCombinedAssemblyCategoryGroup() + { + try + { + combinedAssemblyCategoryGroup = PipingStructureFailureMechanismAssemblyFactory.AssembleCombinedAssessment(SectionResult); + } + catch (AssemblyException e) + { + combinedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + /// + /// Updates the column state definitions. + /// + /// Thrown when + /// is a valid value, but unsupported. + private void UpdateColumnStateDefinitionStates() + { + bool simpleAssessmentSufficient = FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(SimpleAssessmentResult); + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[simpleAssessmentResultIndex], UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentResultIndex], + simpleAssessmentSufficient || UseManualAssembly); + + if (UseManualAssembly) + { + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex]); + } + else + { + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex], + simpleAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex], + detailedAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex], + tailorMadeAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex], + combinedAssemblyCategoryGroup); + } + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[manualAssemblyCategoryGroupIndex], !UseManualAssembly); + } + + /// + /// Class holding the various construction parameters for . + /// + public class ConstructionProperties + { + /// + /// Sets the simple assessment result index. + /// + public int SimpleAssessmentResultIndex { internal get; set; } + + /// + /// Sets the detailed assessment result index. + /// + public int DetailedAssessmentResultIndex { internal get; set; } + + /// + /// Sets the tailor made assessment result index. + /// + public int TailorMadeAssessmentResultIndex { internal get; set; } + + /// + /// Sets the simple assembly category group index. + /// + public int SimpleAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the detailed assembly category group index. + /// + public int DetailedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the tailor made assembly category group index. + /// + public int TailorMadeAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly category group index. + /// + public int CombinedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the manual assembly category group index. + /// + public int ManualAssemblyCategoryGroupIndex { internal get; set; } + } + } +} \ No newline at end of file Fisheye: Tag ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b refers to a dead (removed) revision in file `Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/StrengthStabilityLengthwiseConstructionSectionResultRow.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/StrengthStabilityLengthwiseConstructionSectionResultRowOld.cs =================================================================== diff -u --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/StrengthStabilityLengthwiseConstructionSectionResultRowOld.cs (revision 0) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/StrengthStabilityLengthwiseConstructionSectionResultRowOld.cs (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -0,0 +1,325 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Controls.DataGrid; +using Riskeer.AssemblyTool.Data; +using Riskeer.Common.Data.Exceptions; +using Riskeer.Common.Forms.Helpers; +using Riskeer.Common.Forms.Views; +using Riskeer.Common.Primitives; +using Riskeer.Integration.Data.StandAlone.AssemblyFactories; +using Riskeer.Integration.Data.StandAlone.SectionResults; + +namespace Riskeer.Integration.Forms.Views.SectionResultRows +{ + /// + /// Class for displaying as a row in a grid view. + /// + public class StrengthStabilityLengthwiseConstructionSectionResultRowOld + : FailureMechanismSectionResultRowOld + { + private readonly int simpleAssessmentResultIndex; + private readonly int tailorMadeAssessmentResultIndex; + private readonly int simpleAssemblyCategoryGroupIndex; + private readonly int tailorMadeAssemblyCategoryGroupIndex; + private readonly int combinedAssemblyCategoryGroupIndex; + private readonly int manualAssemblyCategoryGroupIndex; + + private FailureMechanismSectionAssemblyCategoryGroup simpleAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup combinedAssemblyCategoryGroup; + + /// + /// Creates a new instance of . + /// + /// The to wrap + /// so that it can be displayed as a row. + /// The property values required to create an instance of + /// . + /// Thrown when any parameter is null. + /// Thrown when + /// is a valid value, but unsupported. + internal StrengthStabilityLengthwiseConstructionSectionResultRowOld(StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultOld sectionResult, + ConstructionProperties constructionProperties) + : base(sectionResult) + { + if (constructionProperties == null) + { + throw new ArgumentNullException(nameof(constructionProperties)); + } + + simpleAssessmentResultIndex = constructionProperties.SimpleAssessmentResultIndex; + tailorMadeAssessmentResultIndex = constructionProperties.TailorMadeAssessmentResultIndex; + simpleAssemblyCategoryGroupIndex = constructionProperties.SimpleAssemblyCategoryGroupIndex; + tailorMadeAssemblyCategoryGroupIndex = constructionProperties.TailorMadeAssemblyCategoryGroupIndex; + combinedAssemblyCategoryGroupIndex = constructionProperties.CombinedAssemblyCategoryGroupIndex; + manualAssemblyCategoryGroupIndex = constructionProperties.ManualAssemblyCategoryGroupIndex; + + CreateColumnStateDefinitions(); + + Update(); + } + + /// + /// Gets or sets the value representing the simple assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public SimpleAssessmentResultType SimpleAssessmentResult + { + get + { + return SectionResult.SimpleAssessmentResult; + } + set + { + SectionResult.SimpleAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value representing the tailor made assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public TailorMadeAssessmentResultType TailorMadeAssessmentResult + { + get + { + return SectionResult.TailorMadeAssessmentResult; + } + set + { + SectionResult.TailorMadeAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets the simple assembly category group. + /// + public string SimpleAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(simpleAssemblyCategoryGroup); + } + } + + /// + /// Gets the tailor made assembly category group. + /// + public string TailorMadeAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(tailorMadeAssemblyCategoryGroup); + } + } + + /// + /// Gets the combined assembly category group. + /// + public string CombinedAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(combinedAssemblyCategoryGroup); + } + } + + /// + /// Gets or sets the indicator whether the combined assembly should be overwritten by . + /// + /// Thrown when + /// is a valid value, but unsupported. + public bool UseManualAssembly + { + get + { + return SectionResult.UseManualAssembly; + } + set + { + SectionResult.UseManualAssembly = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the manually selected assembly category group. + /// + /// Thrown when + /// is a valid value, but unsupported. + public ManualFailureMechanismSectionAssemblyCategoryGroup ManualAssemblyCategoryGroup + { + get + { + return SectionResult.ManualAssemblyCategoryGroup; + } + set + { + SectionResult.ManualAssemblyCategoryGroup = value; + UpdateInternalData(); + } + } + + public override void Update() + { + UpdateDerivedData(); + UpdateColumnStateDefinitionStates(); + } + + private void CreateColumnStateDefinitions() + { + ColumnStateDefinitions.Add(simpleAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(simpleAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(combinedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(manualAssemblyCategoryGroupIndex, new DataGridViewColumnStateDefinition()); + } + + private void UpdateDerivedData() + { + ResetErrorTexts(); + TryGetSimpleAssemblyCategoryGroup(); + TryGetTailorMadeAssemblyCategoryGroup(); + TryGetCombinedAssemblyCategoryGroup(); + } + + private void ResetErrorTexts() + { + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + } + + private void TryGetSimpleAssemblyCategoryGroup() + { + try + { + simpleAssemblyCategoryGroup = StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.AssembleSimpleAssessment(SectionResult); + } + catch (AssemblyException e) + { + simpleAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetTailorMadeAssemblyCategoryGroup() + { + try + { + tailorMadeAssemblyCategoryGroup = StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.AssembleTailorMadeAssessment(SectionResult); + } + catch (AssemblyException e) + { + tailorMadeAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetCombinedAssemblyCategoryGroup() + { + try + { + combinedAssemblyCategoryGroup = StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.AssembleCombinedAssessment(SectionResult); + } + catch (AssemblyException e) + { + combinedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + /// + /// Updates the column state definitions. + /// + /// Thrown when + /// is a valid value, but unsupported. + private void UpdateColumnStateDefinitionStates() + { + bool simpleAssessmentSufficient = FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(SimpleAssessmentResult); + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[simpleAssessmentResultIndex], UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentResultIndex], + simpleAssessmentSufficient || UseManualAssembly); + + if (UseManualAssembly) + { + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex]); + } + else + { + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex], + simpleAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex], + tailorMadeAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex], + combinedAssemblyCategoryGroup); + } + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[manualAssemblyCategoryGroupIndex], !UseManualAssembly); + } + + /// + /// Class holding the various construction parameters for . + /// + public class ConstructionProperties + { + /// + /// Sets the simple assessment result index. + /// + public int SimpleAssessmentResultIndex { internal get; set; } + + /// + /// Sets the tailor made assessment result index. + /// + public int TailorMadeAssessmentResultIndex { internal get; set; } + + /// + /// Sets the simple assembly category group index. + /// + public int SimpleAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the tailor made assembly category group index. + /// + public int TailorMadeAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly category group index. + /// + public int CombinedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the manual assembly category group index. + /// + public int ManualAssemblyCategoryGroupIndex { internal get; set; } + } + } +} \ No newline at end of file Fisheye: Tag ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b refers to a dead (removed) revision in file `Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/TechnicalInnovationSectionResultRow.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/TechnicalInnovationSectionResultRowOld.cs =================================================================== diff -u --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/TechnicalInnovationSectionResultRowOld.cs (revision 0) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/TechnicalInnovationSectionResultRowOld.cs (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -0,0 +1,324 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Controls.DataGrid; +using Riskeer.AssemblyTool.Data; +using Riskeer.Common.Data.Exceptions; +using Riskeer.Common.Forms.Helpers; +using Riskeer.Common.Forms.Views; +using Riskeer.Common.Primitives; +using Riskeer.Integration.Data.StandAlone.AssemblyFactories; +using Riskeer.Integration.Data.StandAlone.SectionResults; + +namespace Riskeer.Integration.Forms.Views.SectionResultRows +{ + /// + /// Class for displaying as a row in a grid view. + /// + public class TechnicalInnovationSectionResultRowOld : FailureMechanismSectionResultRowOld + { + private readonly int simpleAssessmentResultIndex; + private readonly int tailorMadeAssessmentResultIndex; + private readonly int simpleAssemblyCategoryGroupIndex; + private readonly int tailorMadeAssemblyCategoryGroupIndex; + private readonly int combinedAssemblyCategoryGroupIndex; + private readonly int manualAssemblyCategoryGroupIndex; + + private FailureMechanismSectionAssemblyCategoryGroup simpleAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup combinedAssemblyCategoryGroup; + + /// + /// Creates a new instance of . + /// + /// The to wrap + /// so that it can be displayed as a row. + /// The property values required to create an instance of + /// . + /// Thrown when any parameter is null. + /// Thrown when + /// is a valid value, but unsupported. + internal TechnicalInnovationSectionResultRowOld(TechnicalInnovationFailureMechanismSectionResultOld sectionResult, + ConstructionProperties constructionProperties) + : base(sectionResult) + { + if (constructionProperties == null) + { + throw new ArgumentNullException(nameof(constructionProperties)); + } + + simpleAssessmentResultIndex = constructionProperties.SimpleAssessmentResultIndex; + tailorMadeAssessmentResultIndex = constructionProperties.TailorMadeAssessmentResultIndex; + simpleAssemblyCategoryGroupIndex = constructionProperties.SimpleAssemblyCategoryGroupIndex; + tailorMadeAssemblyCategoryGroupIndex = constructionProperties.TailorMadeAssemblyCategoryGroupIndex; + combinedAssemblyCategoryGroupIndex = constructionProperties.CombinedAssemblyCategoryGroupIndex; + manualAssemblyCategoryGroupIndex = constructionProperties.ManualAssemblyCategoryGroupIndex; + + CreateColumnStateDefinitions(); + + Update(); + } + + /// + /// Gets or sets the value representing the simple assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public SimpleAssessmentResultType SimpleAssessmentResult + { + get + { + return SectionResult.SimpleAssessmentResult; + } + set + { + SectionResult.SimpleAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value representing the tailor made assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public TailorMadeAssessmentResultType TailorMadeAssessmentResult + { + get + { + return SectionResult.TailorMadeAssessmentResult; + } + set + { + SectionResult.TailorMadeAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets the simple assembly category group. + /// + public string SimpleAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(simpleAssemblyCategoryGroup); + } + } + + /// + /// Gets the tailor made assembly category group. + /// + public string TailorMadeAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(tailorMadeAssemblyCategoryGroup); + } + } + + /// + /// Gets the combined assembly category group. + /// + public string CombinedAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(combinedAssemblyCategoryGroup); + } + } + + /// + /// Gets or sets the indicator whether the combined assembly should be overwritten by . + /// + /// Thrown when + /// is a valid value, but unsupported. + public bool UseManualAssembly + { + get + { + return SectionResult.UseManualAssembly; + } + set + { + SectionResult.UseManualAssembly = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the manually selected assembly category group. + /// + /// Thrown when + /// is a valid value, but unsupported. + public ManualFailureMechanismSectionAssemblyCategoryGroup ManualAssemblyCategoryGroup + { + get + { + return SectionResult.ManualAssemblyCategoryGroup; + } + set + { + SectionResult.ManualAssemblyCategoryGroup = value; + UpdateInternalData(); + } + } + + public override void Update() + { + UpdateDerivedData(); + UpdateColumnStateDefinitionStates(); + } + + private void CreateColumnStateDefinitions() + { + ColumnStateDefinitions.Add(simpleAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(simpleAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(combinedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(manualAssemblyCategoryGroupIndex, new DataGridViewColumnStateDefinition()); + } + + private void UpdateDerivedData() + { + ResetErrorTexts(); + TryGetSimpleAssemblyCategoryGroup(); + TryGetTailorMadeAssemblyCategoryGroup(); + TryGetCombinedAssemblyCategoryGroup(); + } + + private void ResetErrorTexts() + { + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + } + + private void TryGetSimpleAssemblyCategoryGroup() + { + try + { + simpleAssemblyCategoryGroup = TechnicalInnovationFailureMechanismAssemblyFactory.AssembleSimpleAssessment(SectionResult); + } + catch (AssemblyException e) + { + simpleAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetTailorMadeAssemblyCategoryGroup() + { + try + { + tailorMadeAssemblyCategoryGroup = TechnicalInnovationFailureMechanismAssemblyFactory.AssembleTailorMadeAssessment(SectionResult); + } + catch (AssemblyException e) + { + tailorMadeAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetCombinedAssemblyCategoryGroup() + { + try + { + combinedAssemblyCategoryGroup = TechnicalInnovationFailureMechanismAssemblyFactory.AssembleCombinedAssessment(SectionResult); + } + catch (AssemblyException e) + { + combinedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + /// + /// Updates the column state definitions. + /// + /// Thrown when + /// is a valid value, but unsupported. + private void UpdateColumnStateDefinitionStates() + { + bool simpleAssessmentSufficient = FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(SimpleAssessmentResult); + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[simpleAssessmentResultIndex], UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentResultIndex], + simpleAssessmentSufficient || UseManualAssembly); + + if (UseManualAssembly) + { + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex]); + } + else + { + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex], + simpleAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex], + tailorMadeAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex], + combinedAssemblyCategoryGroup); + } + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[manualAssemblyCategoryGroupIndex], !UseManualAssembly); + } + + /// + /// Class holding the various construction parameters for . + /// + public class ConstructionProperties + { + /// + /// Sets the simple assessment result index. + /// + public int SimpleAssessmentResultIndex { internal get; set; } + + /// + /// Sets the tailor made assessment result index. + /// + public int TailorMadeAssessmentResultIndex { internal get; set; } + + /// + /// Sets the simple assembly category group index. + /// + public int SimpleAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the tailor made assembly category group index. + /// + public int TailorMadeAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly category group index. + /// + public int CombinedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the manual assembly category group index. + /// + public int ManualAssemblyCategoryGroupIndex { internal get; set; } + } + } +} \ No newline at end of file Fisheye: Tag ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b refers to a dead (removed) revision in file `Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/WaterPressureAsphaltCoverSectionResultRow.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/WaterPressureAsphaltCoverSectionResultRowOld.cs =================================================================== diff -u --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/WaterPressureAsphaltCoverSectionResultRowOld.cs (revision 0) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultRows/WaterPressureAsphaltCoverSectionResultRowOld.cs (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -0,0 +1,324 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Controls.DataGrid; +using Riskeer.AssemblyTool.Data; +using Riskeer.Common.Data.Exceptions; +using Riskeer.Common.Forms.Helpers; +using Riskeer.Common.Forms.Views; +using Riskeer.Common.Primitives; +using Riskeer.Integration.Data.StandAlone.AssemblyFactories; +using Riskeer.Integration.Data.StandAlone.SectionResults; + +namespace Riskeer.Integration.Forms.Views.SectionResultRows +{ + /// + /// Class for displaying as a row in a grid view. + /// + public class WaterPressureAsphaltCoverSectionResultRowOld : FailureMechanismSectionResultRowOld + { + private readonly int simpleAssessmentResultIndex; + private readonly int tailorMadeAssessmentResultIndex; + private readonly int simpleAssemblyCategoryGroupIndex; + private readonly int tailorMadeAssemblyCategoryGroupIndex; + private readonly int combinedAssemblyCategoryGroupIndex; + private readonly int manualAssemblyCategoryGroupIndex; + + private FailureMechanismSectionAssemblyCategoryGroup simpleAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup combinedAssemblyCategoryGroup; + + /// + /// Creates a new instance of . + /// + /// The to wrap + /// so that it can be displayed as a row. + /// The property values required to create an instance of + /// . + /// Thrown when any parameter is null. + /// Thrown when + /// is a valid value, but unsupported. + internal WaterPressureAsphaltCoverSectionResultRowOld(WaterPressureAsphaltCoverFailureMechanismSectionResultOld sectionResult, + ConstructionProperties constructionProperties) + : base(sectionResult) + { + if (constructionProperties == null) + { + throw new ArgumentNullException(nameof(constructionProperties)); + } + + simpleAssessmentResultIndex = constructionProperties.SimpleAssessmentResultIndex; + tailorMadeAssessmentResultIndex = constructionProperties.TailorMadeAssessmentResultIndex; + simpleAssemblyCategoryGroupIndex = constructionProperties.SimpleAssemblyCategoryGroupIndex; + tailorMadeAssemblyCategoryGroupIndex = constructionProperties.TailorMadeAssemblyCategoryGroupIndex; + combinedAssemblyCategoryGroupIndex = constructionProperties.CombinedAssemblyCategoryGroupIndex; + manualAssemblyCategoryGroupIndex = constructionProperties.ManualAssemblyCategoryGroupIndex; + + CreateColumnStateDefinitions(); + + Update(); + } + + /// + /// Gets or sets the value representing the simple assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public SimpleAssessmentResultType SimpleAssessmentResult + { + get + { + return SectionResult.SimpleAssessmentResult; + } + set + { + SectionResult.SimpleAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value representing the tailor made assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public TailorMadeAssessmentResultType TailorMadeAssessmentResult + { + get + { + return SectionResult.TailorMadeAssessmentResult; + } + set + { + SectionResult.TailorMadeAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets the simple assembly category group. + /// + public string SimpleAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(simpleAssemblyCategoryGroup); + } + } + + /// + /// Gets the tailor made assembly category group. + /// + public string TailorMadeAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(tailorMadeAssemblyCategoryGroup); + } + } + + /// + /// Gets the combined assembly category group. + /// + public string CombinedAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(combinedAssemblyCategoryGroup); + } + } + + /// + /// Gets or sets the indicator whether the combined assembly should be overwritten by . + /// + /// Thrown when + /// is a valid value, but unsupported. + public bool UseManualAssembly + { + get + { + return SectionResult.UseManualAssembly; + } + set + { + SectionResult.UseManualAssembly = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the manually selected assembly category group. + /// + /// Thrown when + /// is a valid value, but unsupported. + public ManualFailureMechanismSectionAssemblyCategoryGroup ManualAssemblyCategoryGroup + { + get + { + return SectionResult.ManualAssemblyCategoryGroup; + } + set + { + SectionResult.ManualAssemblyCategoryGroup = value; + UpdateInternalData(); + } + } + + public override void Update() + { + UpdateDerivedData(); + UpdateColumnStateDefinitionStates(); + } + + private void CreateColumnStateDefinitions() + { + ColumnStateDefinitions.Add(simpleAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(simpleAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(combinedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(manualAssemblyCategoryGroupIndex, new DataGridViewColumnStateDefinition()); + } + + private void UpdateDerivedData() + { + ResetErrorTexts(); + TryGetSimpleAssemblyCategoryGroup(); + TryGetTailorMadeAssemblyCategoryGroup(); + TryGetCombinedAssemblyCategoryGroup(); + } + + private void ResetErrorTexts() + { + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + } + + private void TryGetSimpleAssemblyCategoryGroup() + { + try + { + simpleAssemblyCategoryGroup = WaterPressureAsphaltCoverFailureMechanismAssemblyFactory.AssembleSimpleAssessment(SectionResult); + } + catch (AssemblyException e) + { + simpleAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetTailorMadeAssemblyCategoryGroup() + { + try + { + tailorMadeAssemblyCategoryGroup = WaterPressureAsphaltCoverFailureMechanismAssemblyFactory.AssembleTailorMadeAssessment(SectionResult); + } + catch (AssemblyException e) + { + tailorMadeAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetCombinedAssemblyCategoryGroup() + { + try + { + combinedAssemblyCategoryGroup = WaterPressureAsphaltCoverFailureMechanismAssemblyFactory.AssembleCombinedAssessment(SectionResult); + } + catch (AssemblyException e) + { + combinedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + /// + /// Updates the column state definitions. + /// + /// Thrown when + /// is a valid value, but unsupported. + private void UpdateColumnStateDefinitionStates() + { + bool simpleAssessmentSufficient = FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(SimpleAssessmentResult); + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[simpleAssessmentResultIndex], UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentResultIndex], + simpleAssessmentSufficient || UseManualAssembly); + + if (UseManualAssembly) + { + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex]); + } + else + { + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex], + simpleAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex], + tailorMadeAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex], + combinedAssemblyCategoryGroup); + } + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[manualAssemblyCategoryGroupIndex], !UseManualAssembly); + } + + /// + /// Class holding the various construction parameters for . + /// + public class ConstructionProperties + { + /// + /// Sets the simple assessment result index. + /// + public int SimpleAssessmentResultIndex { internal get; set; } + + /// + /// Sets the tailor made assessment result index. + /// + public int TailorMadeAssessmentResultIndex { internal get; set; } + + /// + /// Sets the simple assembly category group index. + /// + public int SimpleAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the tailor made assembly category group index. + /// + public int TailorMadeAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly category group index. + /// + public int CombinedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the manual assembly category group index. + /// + public int ManualAssemblyCategoryGroupIndex { internal get; set; } + } + } +} \ No newline at end of file Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultViews/GrassCoverSlipOffInwardsResultViewOld.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultViews/GrassCoverSlipOffInwardsResultViewOld.cs (.../GrassCoverSlipOffInwardsResultViewOld.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultViews/GrassCoverSlipOffInwardsResultViewOld.cs (.../GrassCoverSlipOffInwardsResultViewOld.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -34,7 +34,7 @@ /// The view for a collection of . /// public class GrassCoverSlipOffInwardsResultViewOld : FailureMechanismResultViewOld { @@ -55,12 +55,12 @@ GrassCoverSlipOffInwardsFailureMechanism failureMechanism) : base(failureMechanismSectionResults, failureMechanism) {} - protected override GrassCoverSlipOffInwardsSectionResultRow CreateFailureMechanismSectionResultRow( + protected override GrassCoverSlipOffInwardsSectionResultRowOld CreateFailureMechanismSectionResultRow( GrassCoverSlipOffInwardsFailureMechanismSectionResultOld sectionResult) { - return new GrassCoverSlipOffInwardsSectionResultRow( + return new GrassCoverSlipOffInwardsSectionResultRowOld( sectionResult, - new GrassCoverSlipOffInwardsSectionResultRow.ConstructionProperties + new GrassCoverSlipOffInwardsSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = simpleAssessmentResultIndex, DetailedAssessmentResultIndex = detailedAssessmentResultIndex, @@ -77,43 +77,43 @@ { FailureMechanismSectionResultViewColumnBuilder.AddSectionNameColumn( DataGridViewControl, - nameof(GrassCoverSlipOffInwardsSectionResultRow.Name)); + nameof(GrassCoverSlipOffInwardsSectionResultRowOld.Name)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssessmentResultColumn( DataGridViewControl, - nameof(GrassCoverSlipOffInwardsSectionResultRow.SimpleAssessmentResult)); + nameof(GrassCoverSlipOffInwardsSectionResultRowOld.SimpleAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultColumn( DataGridViewControl, - nameof(GrassCoverSlipOffInwardsSectionResultRow.DetailedAssessmentResult)); + nameof(GrassCoverSlipOffInwardsSectionResultRowOld.DetailedAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentResultColumn( DataGridViewControl, - nameof(GrassCoverSlipOffInwardsSectionResultRow.TailorMadeAssessmentResult)); + nameof(GrassCoverSlipOffInwardsSectionResultRowOld.TailorMadeAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(GrassCoverSlipOffInwardsSectionResultRow.SimpleAssemblyCategoryGroup)); + nameof(GrassCoverSlipOffInwardsSectionResultRowOld.SimpleAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(GrassCoverSlipOffInwardsSectionResultRow.DetailedAssemblyCategoryGroup)); + nameof(GrassCoverSlipOffInwardsSectionResultRowOld.DetailedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(GrassCoverSlipOffInwardsSectionResultRow.TailorMadeAssemblyCategoryGroup)); + nameof(GrassCoverSlipOffInwardsSectionResultRowOld.TailorMadeAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddCombinedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(GrassCoverSlipOffInwardsSectionResultRow.CombinedAssemblyCategoryGroup)); + nameof(GrassCoverSlipOffInwardsSectionResultRowOld.CombinedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddUseManualAssemblyColumn( DataGridViewControl, - nameof(GrassCoverSlipOffInwardsSectionResultRow.UseManualAssembly)); + nameof(GrassCoverSlipOffInwardsSectionResultRowOld.UseManualAssembly)); FailureMechanismSectionResultViewColumnBuilder.AddManualAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(GrassCoverSlipOffInwardsSectionResultRow.ManualAssemblyCategoryGroup)); + nameof(GrassCoverSlipOffInwardsSectionResultRowOld.ManualAssemblyCategoryGroup)); } protected override void UpdateAssemblyResultControl() Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultViews/GrassCoverSlipOffOutwardsResultViewOld.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultViews/GrassCoverSlipOffOutwardsResultViewOld.cs (.../GrassCoverSlipOffOutwardsResultViewOld.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultViews/GrassCoverSlipOffOutwardsResultViewOld.cs (.../GrassCoverSlipOffOutwardsResultViewOld.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -34,7 +34,7 @@ /// The view for a collection of . /// public class GrassCoverSlipOffOutwardsResultViewOld : FailureMechanismResultViewOld { @@ -56,11 +56,11 @@ GrassCoverSlipOffOutwardsFailureMechanism failureMechanism) : base(failureMechanismSectionResults, failureMechanism) {} - protected override GrassCoverSlipOffOutwardsSectionResultRow CreateFailureMechanismSectionResultRow(GrassCoverSlipOffOutwardsFailureMechanismSectionResultOld sectionResult) + protected override GrassCoverSlipOffOutwardsSectionResultRowOld CreateFailureMechanismSectionResultRow(GrassCoverSlipOffOutwardsFailureMechanismSectionResultOld sectionResult) { - return new GrassCoverSlipOffOutwardsSectionResultRow( + return new GrassCoverSlipOffOutwardsSectionResultRowOld( sectionResult, - new GrassCoverSlipOffOutwardsSectionResultRow.ConstructionProperties + new GrassCoverSlipOffOutwardsSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = simpleAssessmentResultIndex, DetailedAssessmentResultIndex = detailedAssessmentResultIndex, @@ -77,43 +77,43 @@ { FailureMechanismSectionResultViewColumnBuilder.AddSectionNameColumn( DataGridViewControl, - nameof(GrassCoverSlipOffOutwardsSectionResultRow.Name)); + nameof(GrassCoverSlipOffOutwardsSectionResultRowOld.Name)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssessmentResultColumn( DataGridViewControl, - nameof(GrassCoverSlipOffOutwardsSectionResultRow.SimpleAssessmentResult)); + nameof(GrassCoverSlipOffOutwardsSectionResultRowOld.SimpleAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultColumn( DataGridViewControl, - nameof(GrassCoverSlipOffOutwardsSectionResultRow.DetailedAssessmentResult)); + nameof(GrassCoverSlipOffOutwardsSectionResultRowOld.DetailedAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentResultColumn( DataGridViewControl, - nameof(GrassCoverSlipOffOutwardsSectionResultRow.TailorMadeAssessmentResult)); + nameof(GrassCoverSlipOffOutwardsSectionResultRowOld.TailorMadeAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(GrassCoverSlipOffOutwardsSectionResultRow.SimpleAssemblyCategoryGroup)); + nameof(GrassCoverSlipOffOutwardsSectionResultRowOld.SimpleAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(GrassCoverSlipOffOutwardsSectionResultRow.DetailedAssemblyCategoryGroup)); + nameof(GrassCoverSlipOffOutwardsSectionResultRowOld.DetailedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(GrassCoverSlipOffOutwardsSectionResultRow.TailorMadeAssemblyCategoryGroup)); + nameof(GrassCoverSlipOffOutwardsSectionResultRowOld.TailorMadeAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddCombinedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(GrassCoverSlipOffOutwardsSectionResultRow.CombinedAssemblyCategoryGroup)); + nameof(GrassCoverSlipOffOutwardsSectionResultRowOld.CombinedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddUseManualAssemblyColumn( DataGridViewControl, - nameof(GrassCoverSlipOffOutwardsSectionResultRow.UseManualAssembly)); + nameof(GrassCoverSlipOffOutwardsSectionResultRowOld.UseManualAssembly)); FailureMechanismSectionResultViewColumnBuilder.AddManualAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(GrassCoverSlipOffOutwardsSectionResultRow.ManualAssemblyCategoryGroup)); + nameof(GrassCoverSlipOffOutwardsSectionResultRowOld.ManualAssemblyCategoryGroup)); } protected override void UpdateAssemblyResultControl() Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultViews/MacroStabilityOutwardsResultViewOld.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultViews/MacroStabilityOutwardsResultViewOld.cs (.../MacroStabilityOutwardsResultViewOld.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultViews/MacroStabilityOutwardsResultViewOld.cs (.../MacroStabilityOutwardsResultViewOld.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -36,7 +36,7 @@ /// The view for a collection of . /// public class MacroStabilityOutwardsResultViewOld : FailureMechanismResultViewOld { @@ -74,11 +74,11 @@ this.assessmentSection = assessmentSection; } - protected override MacroStabilityOutwardsSectionResultRow CreateFailureMechanismSectionResultRow(MacroStabilityOutwardsFailureMechanismSectionResultOld sectionResult) + protected override MacroStabilityOutwardsSectionResultRowOld CreateFailureMechanismSectionResultRow(MacroStabilityOutwardsFailureMechanismSectionResultOld sectionResult) { - return new MacroStabilityOutwardsSectionResultRow( + return new MacroStabilityOutwardsSectionResultRowOld( sectionResult, FailureMechanism, assessmentSection, - new MacroStabilityOutwardsSectionResultRow.ConstructionProperties + new MacroStabilityOutwardsSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = simpleAssessmentResultIndex, DetailedAssessmentResultIndex = detailedAssessmentResultIndex, @@ -97,51 +97,51 @@ { FailureMechanismSectionResultViewColumnBuilder.AddSectionNameColumn( DataGridViewControl, - nameof(MacroStabilityOutwardsSectionResultRow.Name)); + nameof(MacroStabilityOutwardsSectionResultRowOld.Name)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssessmentResultColumn( DataGridViewControl, - nameof(MacroStabilityOutwardsSectionResultRow.SimpleAssessmentResult)); + nameof(MacroStabilityOutwardsSectionResultRowOld.SimpleAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentProbabilityOnlyResultColumn( DataGridViewControl, - nameof(MacroStabilityOutwardsSectionResultRow.DetailedAssessmentResult)); + nameof(MacroStabilityOutwardsSectionResultRowOld.DetailedAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentProbabilityColumn( DataGridViewControl, - nameof(MacroStabilityOutwardsSectionResultRow.DetailedAssessmentProbability)); + nameof(MacroStabilityOutwardsSectionResultRowOld.DetailedAssessmentProbability)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentProbabilityAndDetailedCalculationResultColumn( DataGridViewControl, - nameof(MacroStabilityOutwardsSectionResultRow.TailorMadeAssessmentResult)); + nameof(MacroStabilityOutwardsSectionResultRowOld.TailorMadeAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentProbabilityColumn( DataGridViewControl, - nameof(MacroStabilityOutwardsSectionResultRow.TailorMadeAssessmentProbability)); + nameof(MacroStabilityOutwardsSectionResultRowOld.TailorMadeAssessmentProbability)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(MacroStabilityOutwardsSectionResultRow.SimpleAssemblyCategoryGroup)); + nameof(MacroStabilityOutwardsSectionResultRowOld.SimpleAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(MacroStabilityOutwardsSectionResultRow.DetailedAssemblyCategoryGroup)); + nameof(MacroStabilityOutwardsSectionResultRowOld.DetailedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(MacroStabilityOutwardsSectionResultRow.TailorMadeAssemblyCategoryGroup)); + nameof(MacroStabilityOutwardsSectionResultRowOld.TailorMadeAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddCombinedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(MacroStabilityOutwardsSectionResultRow.CombinedAssemblyCategoryGroup)); + nameof(MacroStabilityOutwardsSectionResultRowOld.CombinedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddUseManualAssemblyColumn( DataGridViewControl, - nameof(MacroStabilityOutwardsSectionResultRow.UseManualAssembly)); + nameof(MacroStabilityOutwardsSectionResultRowOld.UseManualAssembly)); FailureMechanismSectionResultViewColumnBuilder.AddManualAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(MacroStabilityOutwardsSectionResultRow.ManualAssemblyCategoryGroup)); + nameof(MacroStabilityOutwardsSectionResultRowOld.ManualAssemblyCategoryGroup)); } protected override void UpdateAssemblyResultControl() Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultViews/MicrostabilityResultViewOld.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultViews/MicrostabilityResultViewOld.cs (.../MicrostabilityResultViewOld.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultViews/MicrostabilityResultViewOld.cs (.../MicrostabilityResultViewOld.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -34,7 +34,7 @@ /// The view for a collection of . /// public class MicrostabilityResultViewOld : FailureMechanismResultViewOld { @@ -55,11 +55,11 @@ MicrostabilityFailureMechanism failureMechanism) : base(failureMechanismSectionResults, failureMechanism) {} - protected override MicrostabilitySectionResultRow CreateFailureMechanismSectionResultRow(MicrostabilityFailureMechanismSectionResultOld sectionResult) + protected override MicrostabilitySectionResultRowOld CreateFailureMechanismSectionResultRow(MicrostabilityFailureMechanismSectionResultOld sectionResult) { - return new MicrostabilitySectionResultRow( + return new MicrostabilitySectionResultRowOld( sectionResult, - new MicrostabilitySectionResultRow.ConstructionProperties + new MicrostabilitySectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = simpleAssessmentResultIndex, DetailedAssessmentResultIndex = detailedAssessmentResultIndex, @@ -76,43 +76,43 @@ { FailureMechanismSectionResultViewColumnBuilder.AddSectionNameColumn( DataGridViewControl, - nameof(MicrostabilitySectionResultRow.Name)); + nameof(MicrostabilitySectionResultRowOld.Name)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssessmentResultColumn( DataGridViewControl, - nameof(MicrostabilitySectionResultRow.SimpleAssessmentResult)); + nameof(MicrostabilitySectionResultRowOld.SimpleAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultColumn( DataGridViewControl, - nameof(MicrostabilitySectionResultRow.DetailedAssessmentResult)); + nameof(MicrostabilitySectionResultRowOld.DetailedAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentResultColumn( DataGridViewControl, - nameof(MicrostabilitySectionResultRow.TailorMadeAssessmentResult)); + nameof(MicrostabilitySectionResultRowOld.TailorMadeAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(MicrostabilitySectionResultRow.SimpleAssemblyCategoryGroup)); + nameof(MicrostabilitySectionResultRowOld.SimpleAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(MicrostabilitySectionResultRow.DetailedAssemblyCategoryGroup)); + nameof(MicrostabilitySectionResultRowOld.DetailedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(MicrostabilitySectionResultRow.TailorMadeAssemblyCategoryGroup)); + nameof(MicrostabilitySectionResultRowOld.TailorMadeAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddCombinedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(MicrostabilitySectionResultRow.CombinedAssemblyCategoryGroup)); + nameof(MicrostabilitySectionResultRowOld.CombinedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddUseManualAssemblyColumn( DataGridViewControl, - nameof(MicrostabilitySectionResultRow.UseManualAssembly)); + nameof(MicrostabilitySectionResultRowOld.UseManualAssembly)); FailureMechanismSectionResultViewColumnBuilder.AddManualAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(MicrostabilitySectionResultRow.ManualAssemblyCategoryGroup)); + nameof(MicrostabilitySectionResultRowOld.ManualAssemblyCategoryGroup)); } protected override void UpdateAssemblyResultControl() Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultViews/PipingStructureResultViewOld.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultViews/PipingStructureResultViewOld.cs (.../PipingStructureResultViewOld.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultViews/PipingStructureResultViewOld.cs (.../PipingStructureResultViewOld.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -34,7 +34,7 @@ /// The view for a collection of . /// public class PipingStructureResultViewOld : FailureMechanismResultViewOld { @@ -55,11 +55,11 @@ PipingStructureFailureMechanism failureMechanism) : base(failureMechanismSectionResults, failureMechanism) {} - protected override PipingStructureSectionResultRow CreateFailureMechanismSectionResultRow(PipingStructureFailureMechanismSectionResultOld sectionResult) + protected override PipingStructureSectionResultRowOld CreateFailureMechanismSectionResultRow(PipingStructureFailureMechanismSectionResultOld sectionResult) { - return new PipingStructureSectionResultRow( + return new PipingStructureSectionResultRowOld( sectionResult, - new PipingStructureSectionResultRow.ConstructionProperties + new PipingStructureSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = simpleAssessmentResultIndex, DetailedAssessmentResultIndex = detailedAssessmentResultIndex, @@ -76,43 +76,43 @@ { FailureMechanismSectionResultViewColumnBuilder.AddSectionNameColumn( DataGridViewControl, - nameof(PipingStructureSectionResultRow.Name)); + nameof(PipingStructureSectionResultRowOld.Name)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssessmentResultColumn( DataGridViewControl, - nameof(PipingStructureSectionResultRow.SimpleAssessmentResult)); + nameof(PipingStructureSectionResultRowOld.SimpleAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultColumn( DataGridViewControl, - nameof(PipingStructureSectionResultRow.DetailedAssessmentResult)); + nameof(PipingStructureSectionResultRowOld.DetailedAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentResultColumn( DataGridViewControl, - nameof(PipingStructureSectionResultRow.TailorMadeAssessmentResult)); + nameof(PipingStructureSectionResultRowOld.TailorMadeAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(PipingStructureSectionResultRow.SimpleAssemblyCategoryGroup)); + nameof(PipingStructureSectionResultRowOld.SimpleAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(PipingStructureSectionResultRow.DetailedAssemblyCategoryGroup)); + nameof(PipingStructureSectionResultRowOld.DetailedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(PipingStructureSectionResultRow.TailorMadeAssemblyCategoryGroup)); + nameof(PipingStructureSectionResultRowOld.TailorMadeAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddCombinedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(PipingStructureSectionResultRow.CombinedAssemblyCategoryGroup)); + nameof(PipingStructureSectionResultRowOld.CombinedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddUseManualAssemblyColumn( DataGridViewControl, - nameof(PipingStructureSectionResultRow.UseManualAssembly)); + nameof(PipingStructureSectionResultRowOld.UseManualAssembly)); FailureMechanismSectionResultViewColumnBuilder.AddManualAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(PipingStructureSectionResultRow.ManualAssemblyCategoryGroup)); + nameof(PipingStructureSectionResultRowOld.ManualAssemblyCategoryGroup)); } protected override void UpdateAssemblyResultControl() Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultViews/StrengthStabilityLengthwiseConstructionResultViewOld.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultViews/StrengthStabilityLengthwiseConstructionResultViewOld.cs (.../StrengthStabilityLengthwiseConstructionResultViewOld.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultViews/StrengthStabilityLengthwiseConstructionResultViewOld.cs (.../StrengthStabilityLengthwiseConstructionResultViewOld.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -35,7 +35,7 @@ /// public class StrengthStabilityLengthwiseConstructionResultViewOld : FailureMechanismResultViewOld { @@ -55,12 +55,12 @@ StrengthStabilityLengthwiseConstructionFailureMechanism failureMechanism) : base(failureMechanismSectionResults, failureMechanism) {} - protected override StrengthStabilityLengthwiseConstructionSectionResultRow CreateFailureMechanismSectionResultRow( + protected override StrengthStabilityLengthwiseConstructionSectionResultRowOld CreateFailureMechanismSectionResultRow( StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultOld sectionResult) { - return new StrengthStabilityLengthwiseConstructionSectionResultRow( + return new StrengthStabilityLengthwiseConstructionSectionResultRowOld( sectionResult, - new StrengthStabilityLengthwiseConstructionSectionResultRow.ConstructionProperties + new StrengthStabilityLengthwiseConstructionSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = simpleAssessmentResultIndex, TailorMadeAssessmentResultIndex = tailorMadeAssessmentResultIndex, @@ -75,35 +75,35 @@ { FailureMechanismSectionResultViewColumnBuilder.AddSectionNameColumn( DataGridViewControl, - nameof(StrengthStabilityLengthwiseConstructionSectionResultRow.Name)); + nameof(StrengthStabilityLengthwiseConstructionSectionResultRowOld.Name)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssessmentResultColumn( DataGridViewControl, - nameof(StrengthStabilityLengthwiseConstructionSectionResultRow.SimpleAssessmentResult)); + nameof(StrengthStabilityLengthwiseConstructionSectionResultRowOld.SimpleAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentResultColumn( DataGridViewControl, - nameof(StrengthStabilityLengthwiseConstructionSectionResultRow.TailorMadeAssessmentResult)); + nameof(StrengthStabilityLengthwiseConstructionSectionResultRowOld.TailorMadeAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(StrengthStabilityLengthwiseConstructionSectionResultRow.SimpleAssemblyCategoryGroup)); + nameof(StrengthStabilityLengthwiseConstructionSectionResultRowOld.SimpleAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(StrengthStabilityLengthwiseConstructionSectionResultRow.TailorMadeAssemblyCategoryGroup)); + nameof(StrengthStabilityLengthwiseConstructionSectionResultRowOld.TailorMadeAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddCombinedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(StrengthStabilityLengthwiseConstructionSectionResultRow.CombinedAssemblyCategoryGroup)); + nameof(StrengthStabilityLengthwiseConstructionSectionResultRowOld.CombinedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddUseManualAssemblyColumn( DataGridViewControl, - nameof(StrengthStabilityLengthwiseConstructionSectionResultRow.UseManualAssembly)); + nameof(StrengthStabilityLengthwiseConstructionSectionResultRowOld.UseManualAssembly)); FailureMechanismSectionResultViewColumnBuilder.AddManualAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(StrengthStabilityLengthwiseConstructionSectionResultRow.ManualAssemblyCategoryGroup)); + nameof(StrengthStabilityLengthwiseConstructionSectionResultRowOld.ManualAssemblyCategoryGroup)); } protected override void UpdateAssemblyResultControl() Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultViews/TechnicalInnovationResultViewOld.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultViews/TechnicalInnovationResultViewOld.cs (.../TechnicalInnovationResultViewOld.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultViews/TechnicalInnovationResultViewOld.cs (.../TechnicalInnovationResultViewOld.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -34,7 +34,7 @@ /// The view for a collection of . /// public class TechnicalInnovationResultViewOld : FailureMechanismResultViewOld { @@ -54,11 +54,11 @@ TechnicalInnovationFailureMechanism failureMechanism) : base(failureMechanismSectionResults, failureMechanism) {} - protected override TechnicalInnovationSectionResultRow CreateFailureMechanismSectionResultRow(TechnicalInnovationFailureMechanismSectionResultOld sectionResult) + protected override TechnicalInnovationSectionResultRowOld CreateFailureMechanismSectionResultRow(TechnicalInnovationFailureMechanismSectionResultOld sectionResult) { - return new TechnicalInnovationSectionResultRow( + return new TechnicalInnovationSectionResultRowOld( sectionResult, - new TechnicalInnovationSectionResultRow.ConstructionProperties + new TechnicalInnovationSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = simpleAssessmentResultIndex, TailorMadeAssessmentResultIndex = tailorMadeAssessmentResultIndex, @@ -73,35 +73,35 @@ { FailureMechanismSectionResultViewColumnBuilder.AddSectionNameColumn( DataGridViewControl, - nameof(TechnicalInnovationSectionResultRow.Name)); + nameof(TechnicalInnovationSectionResultRowOld.Name)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssessmentResultColumn( DataGridViewControl, - nameof(TechnicalInnovationSectionResultRow.SimpleAssessmentResult)); + nameof(TechnicalInnovationSectionResultRowOld.SimpleAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentResultColumn( DataGridViewControl, - nameof(TechnicalInnovationSectionResultRow.TailorMadeAssessmentResult)); + nameof(TechnicalInnovationSectionResultRowOld.TailorMadeAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(TechnicalInnovationSectionResultRow.SimpleAssemblyCategoryGroup)); + nameof(TechnicalInnovationSectionResultRowOld.SimpleAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(TechnicalInnovationSectionResultRow.TailorMadeAssemblyCategoryGroup)); + nameof(TechnicalInnovationSectionResultRowOld.TailorMadeAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddCombinedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(TechnicalInnovationSectionResultRow.CombinedAssemblyCategoryGroup)); + nameof(TechnicalInnovationSectionResultRowOld.CombinedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddUseManualAssemblyColumn( DataGridViewControl, - nameof(TechnicalInnovationSectionResultRow.UseManualAssembly)); + nameof(TechnicalInnovationSectionResultRowOld.UseManualAssembly)); FailureMechanismSectionResultViewColumnBuilder.AddManualAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(TechnicalInnovationSectionResultRow.ManualAssemblyCategoryGroup)); + nameof(TechnicalInnovationSectionResultRowOld.ManualAssemblyCategoryGroup)); } protected override void UpdateAssemblyResultControl() Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultViews/WaterPressureAsphaltCoverResultViewOld.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultViews/WaterPressureAsphaltCoverResultViewOld.cs (.../WaterPressureAsphaltCoverResultViewOld.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SectionResultViews/WaterPressureAsphaltCoverResultViewOld.cs (.../WaterPressureAsphaltCoverResultViewOld.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -34,7 +34,7 @@ /// The view for a collection of . /// public class WaterPressureAsphaltCoverResultViewOld : FailureMechanismResultViewOld { @@ -54,11 +54,11 @@ WaterPressureAsphaltCoverFailureMechanism failureMechanism) : base(failureMechanismSectionResults, failureMechanism) {} - protected override WaterPressureAsphaltCoverSectionResultRow CreateFailureMechanismSectionResultRow(WaterPressureAsphaltCoverFailureMechanismSectionResultOld sectionResult) + protected override WaterPressureAsphaltCoverSectionResultRowOld CreateFailureMechanismSectionResultRow(WaterPressureAsphaltCoverFailureMechanismSectionResultOld sectionResult) { - return new WaterPressureAsphaltCoverSectionResultRow( + return new WaterPressureAsphaltCoverSectionResultRowOld( sectionResult, - new WaterPressureAsphaltCoverSectionResultRow.ConstructionProperties + new WaterPressureAsphaltCoverSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = simpleAssessmentResultIndex, TailorMadeAssessmentResultIndex = tailorMadeAssessmentResultIndex, @@ -73,35 +73,35 @@ { FailureMechanismSectionResultViewColumnBuilder.AddSectionNameColumn( DataGridViewControl, - nameof(WaterPressureAsphaltCoverSectionResultRow.Name)); + nameof(WaterPressureAsphaltCoverSectionResultRowOld.Name)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssessmentResultColumn( DataGridViewControl, - nameof(WaterPressureAsphaltCoverSectionResultRow.SimpleAssessmentResult)); + nameof(WaterPressureAsphaltCoverSectionResultRowOld.SimpleAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentResultColumn( DataGridViewControl, - nameof(WaterPressureAsphaltCoverSectionResultRow.TailorMadeAssessmentResult)); + nameof(WaterPressureAsphaltCoverSectionResultRowOld.TailorMadeAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(WaterPressureAsphaltCoverSectionResultRow.SimpleAssemblyCategoryGroup)); + nameof(WaterPressureAsphaltCoverSectionResultRowOld.SimpleAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(WaterPressureAsphaltCoverSectionResultRow.TailorMadeAssemblyCategoryGroup)); + nameof(WaterPressureAsphaltCoverSectionResultRowOld.TailorMadeAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddCombinedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(WaterPressureAsphaltCoverSectionResultRow.CombinedAssemblyCategoryGroup)); + nameof(WaterPressureAsphaltCoverSectionResultRowOld.CombinedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddUseManualAssemblyColumn( DataGridViewControl, - nameof(WaterPressureAsphaltCoverSectionResultRow.UseManualAssembly)); + nameof(WaterPressureAsphaltCoverSectionResultRowOld.UseManualAssembly)); FailureMechanismSectionResultViewColumnBuilder.AddManualAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(WaterPressureAsphaltCoverSectionResultRow.ManualAssemblyCategoryGroup)); + nameof(WaterPressureAsphaltCoverSectionResultRowOld.ManualAssemblyCategoryGroup)); } protected override void UpdateAssemblyResultControl() Index: Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -498,7 +498,7 @@ GrassCoverSlipOffInwardsFailureMechanism, GrassCoverSlipOffInwardsFailureMechanismSectionResultOld, GrassCoverSlipOffInwardsResultViewOld, - GrassCoverSlipOffInwardsSectionResultRow, + GrassCoverSlipOffInwardsSectionResultRowOld, FailureMechanismAssemblyCategoryGroupControl>( context => new GrassCoverSlipOffInwardsResultViewOld( context.WrappedData, @@ -508,7 +508,7 @@ GrassCoverSlipOffOutwardsFailureMechanism, GrassCoverSlipOffOutwardsFailureMechanismSectionResultOld, GrassCoverSlipOffOutwardsResultViewOld, - GrassCoverSlipOffOutwardsSectionResultRow, + GrassCoverSlipOffOutwardsSectionResultRowOld, FailureMechanismAssemblyCategoryGroupControl>( context => new GrassCoverSlipOffOutwardsResultViewOld( context.WrappedData, @@ -518,7 +518,7 @@ MicrostabilityFailureMechanism, MicrostabilityFailureMechanismSectionResultOld, MicrostabilityResultViewOld, - MicrostabilitySectionResultRow, + MicrostabilitySectionResultRowOld, FailureMechanismAssemblyCategoryGroupControl>( context => new MicrostabilityResultViewOld( context.WrappedData, @@ -528,7 +528,7 @@ PipingStructureFailureMechanism, PipingStructureFailureMechanismSectionResultOld, PipingStructureResultViewOld, - PipingStructureSectionResultRow, + PipingStructureSectionResultRowOld, FailureMechanismAssemblyCategoryGroupControl>( context => new PipingStructureResultViewOld( context.WrappedData, @@ -538,7 +538,7 @@ TechnicalInnovationFailureMechanism, TechnicalInnovationFailureMechanismSectionResultOld, TechnicalInnovationResultViewOld, - TechnicalInnovationSectionResultRow, + TechnicalInnovationSectionResultRowOld, FailureMechanismAssemblyCategoryGroupControl>( context => new TechnicalInnovationResultViewOld( context.WrappedData, @@ -548,7 +548,7 @@ StrengthStabilityLengthwiseConstructionFailureMechanism, StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultOld, StrengthStabilityLengthwiseConstructionResultViewOld, - StrengthStabilityLengthwiseConstructionSectionResultRow, + StrengthStabilityLengthwiseConstructionSectionResultRowOld, FailureMechanismAssemblyCategoryGroupControl>( context => new StrengthStabilityLengthwiseConstructionResultViewOld( context.WrappedData, @@ -558,7 +558,7 @@ WaterPressureAsphaltCoverFailureMechanism, WaterPressureAsphaltCoverFailureMechanismSectionResultOld, WaterPressureAsphaltCoverResultViewOld, - WaterPressureAsphaltCoverSectionResultRow, + WaterPressureAsphaltCoverSectionResultRowOld, FailureMechanismAssemblyCategoryGroupControl>( context => new WaterPressureAsphaltCoverResultViewOld( context.WrappedData, @@ -573,7 +573,7 @@ CloseForData = CloseFailureMechanismResultViewForData, GetViewData = context => context.WrappedData, CreateInstance = context => new MacroStabilityOutwardsResultViewOld( @@ -1307,7 +1307,7 @@ where TResult : FailureMechanismSectionResultOld where TView : FailureMechanismResultViewOld where TFailureMechanism : FailureMechanismBase, IHasSectionResults - where TResultRow : FailureMechanismSectionResultRow + where TResultRow : FailureMechanismSectionResultRowOld where TAssemblyResultControl : AssemblyResultControl, new() { return new RiskeerViewInfo< @@ -1652,7 +1652,7 @@ where TView : FailureMechanismResultViewOld where TFailureMechanism : FailureMechanismBase, IHasSectionResults where TResult : FailureMechanismSectionResultOld - where TResultRow : FailureMechanismSectionResultRow + where TResultRow : FailureMechanismSectionResultRowOld where TAssemblyResultControl : AssemblyResultControl, new() { if (dataToCloseFor is IAssessmentSection assessmentSection) Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultRows/GrassCoverSlipOffInwardsSectionResultRowTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultRows/GrassCoverSlipOffInwardsSectionResultRowTest.cs (.../GrassCoverSlipOffInwardsSectionResultRowTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultRows/GrassCoverSlipOffInwardsSectionResultRowTest.cs (.../GrassCoverSlipOffInwardsSectionResultRowTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -46,11 +46,11 @@ public class GrassCoverSlipOffInwardsSectionResultRowTest { - private static GrassCoverSlipOffInwardsSectionResultRow.ConstructionProperties ConstructionProperties + private static GrassCoverSlipOffInwardsSectionResultRowOld.ConstructionProperties ConstructionProperties { get { - return new GrassCoverSlipOffInwardsSectionResultRow.ConstructionProperties + return new GrassCoverSlipOffInwardsSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = 1, DetailedAssessmentResultIndex = 2, @@ -72,7 +72,7 @@ var result = new GrassCoverSlipOffInwardsFailureMechanismSectionResultOld(section); // Call - TestDelegate test = () => new GrassCoverSlipOffInwardsSectionResultRow(result, null); + TestDelegate test = () => new GrassCoverSlipOffInwardsSectionResultRowOld(result, null); // Assert var exception = Assert.Throws(test); @@ -89,10 +89,10 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new GrassCoverSlipOffInwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffInwardsSectionResultRowOld(result, ConstructionProperties); // Assert - Assert.IsInstanceOf>(row); + Assert.IsInstanceOf>(row); Assert.AreEqual(result.SimpleAssessmentResult, row.SimpleAssessmentResult); Assert.AreEqual(result.DetailedAssessmentResult, row.DetailedAssessmentResult); Assert.AreEqual(result.TailorMadeAssessmentResult, row.TailorMadeAssessmentResult); @@ -133,7 +133,7 @@ calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue(); // Call - var row = new GrassCoverSlipOffInwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffInwardsSectionResultRowOld(result, ConstructionProperties); // Assert Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(calculator.SimpleAssessmentAssemblyOutput.Group), @@ -161,7 +161,7 @@ calculator.ThrowExceptionOnCalculate = true; // Call - var row = new GrassCoverSlipOffInwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffInwardsSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -191,7 +191,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverSlipOffInwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffInwardsSectionResultRowOld(result, ConstructionProperties); // Precondition Assert.IsFalse(result.UseManualAssembly); @@ -223,7 +223,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverSlipOffInwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffInwardsSectionResultRowOld(result, ConstructionProperties); // Call row.ManualAssemblyCategoryGroup = newValue; @@ -253,7 +253,7 @@ calculator.TailorMadeAssemblyCategoryOutput = random.NextEnumValue(); calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue(); - var row = new GrassCoverSlipOffInwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffInwardsSectionResultRowOld(result, ConstructionProperties); // Precondition Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(calculator.SimpleAssessmentAssemblyOutput.Group), @@ -291,7 +291,7 @@ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; calculator.ThrowExceptionOnCalculate = true; - var row = new GrassCoverSlipOffInwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffInwardsSectionResultRowOld(result, ConstructionProperties); // Precondition IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -334,7 +334,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new GrassCoverSlipOffInwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffInwardsSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -361,7 +361,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new GrassCoverSlipOffInwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffInwardsSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -410,7 +410,7 @@ calculator.CombinedAssemblyCategoryOutput = assemblyCategoryGroup; // Call - var row = new GrassCoverSlipOffInwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffInwardsSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -448,7 +448,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverSlipOffInwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffInwardsSectionResultRowOld(result, ConstructionProperties); // Call row.SimpleAssessmentResult = newValue; @@ -477,7 +477,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverSlipOffInwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffInwardsSectionResultRowOld(result, ConstructionProperties); // Call row.DetailedAssessmentResult = newValue; @@ -506,7 +506,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverSlipOffInwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffInwardsSectionResultRowOld(result, ConstructionProperties); // Call row.TailorMadeAssessmentResult = newValue; Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultRows/GrassCoverSlipOffOutwardsSectionResultRowTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultRows/GrassCoverSlipOffOutwardsSectionResultRowTest.cs (.../GrassCoverSlipOffOutwardsSectionResultRowTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultRows/GrassCoverSlipOffOutwardsSectionResultRowTest.cs (.../GrassCoverSlipOffOutwardsSectionResultRowTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -45,11 +45,11 @@ [TestFixture] public class GrassCoverSlipOffOutwardsSectionResultRowTest { - private static GrassCoverSlipOffOutwardsSectionResultRow.ConstructionProperties ConstructionProperties + private static GrassCoverSlipOffOutwardsSectionResultRowOld.ConstructionProperties ConstructionProperties { get { - return new GrassCoverSlipOffOutwardsSectionResultRow.ConstructionProperties + return new GrassCoverSlipOffOutwardsSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = 1, DetailedAssessmentResultIndex = 2, @@ -71,7 +71,7 @@ var result = new GrassCoverSlipOffOutwardsFailureMechanismSectionResultOld(section); // Call - TestDelegate test = () => new GrassCoverSlipOffOutwardsSectionResultRow(result, null); + TestDelegate test = () => new GrassCoverSlipOffOutwardsSectionResultRowOld(result, null); // Assert var exception = Assert.Throws(test); @@ -88,10 +88,10 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new GrassCoverSlipOffOutwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffOutwardsSectionResultRowOld(result, ConstructionProperties); // Assert - Assert.IsInstanceOf>(row); + Assert.IsInstanceOf>(row); Assert.AreEqual(result.SimpleAssessmentResult, row.SimpleAssessmentResult); Assert.AreEqual(result.DetailedAssessmentResult, row.DetailedAssessmentResult); Assert.AreEqual(result.TailorMadeAssessmentResult, row.TailorMadeAssessmentResult); @@ -132,7 +132,7 @@ calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue(); // Call - var row = new GrassCoverSlipOffOutwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffOutwardsSectionResultRowOld(result, ConstructionProperties); // Assert Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(calculator.SimpleAssessmentAssemblyOutput.Group), @@ -160,7 +160,7 @@ calculator.ThrowExceptionOnCalculate = true; // Call - var row = new GrassCoverSlipOffOutwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffOutwardsSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -190,7 +190,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverSlipOffOutwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffOutwardsSectionResultRowOld(result, ConstructionProperties); // Precondition Assert.IsFalse(result.UseManualAssembly); @@ -222,7 +222,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverSlipOffOutwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffOutwardsSectionResultRowOld(result, ConstructionProperties); // Call row.ManualAssemblyCategoryGroup = newValue; @@ -252,7 +252,7 @@ calculator.TailorMadeAssemblyCategoryOutput = random.NextEnumValue(); calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue(); - var row = new GrassCoverSlipOffOutwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffOutwardsSectionResultRowOld(result, ConstructionProperties); // Precondition Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(calculator.SimpleAssessmentAssemblyOutput.Group), @@ -290,7 +290,7 @@ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; calculator.ThrowExceptionOnCalculate = true; - var row = new GrassCoverSlipOffOutwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffOutwardsSectionResultRowOld(result, ConstructionProperties); // Precondition IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -333,7 +333,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new GrassCoverSlipOffOutwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffOutwardsSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -360,7 +360,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new GrassCoverSlipOffOutwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffOutwardsSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -409,7 +409,7 @@ calculator.CombinedAssemblyCategoryOutput = assemblyCategoryGroup; // Call - var row = new GrassCoverSlipOffOutwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffOutwardsSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -447,7 +447,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverSlipOffOutwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffOutwardsSectionResultRowOld(result, ConstructionProperties); // Call row.SimpleAssessmentResult = newValue; @@ -476,7 +476,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverSlipOffOutwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffOutwardsSectionResultRowOld(result, ConstructionProperties); // Call row.DetailedAssessmentResult = newValue; @@ -505,7 +505,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new GrassCoverSlipOffOutwardsSectionResultRow(result, ConstructionProperties); + var row = new GrassCoverSlipOffOutwardsSectionResultRowOld(result, ConstructionProperties); // Call row.TailorMadeAssessmentResult = newValue; Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRowTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRowTest.cs (.../MacroStabilityOutwardsSectionResultRowTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRowTest.cs (.../MacroStabilityOutwardsSectionResultRowTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -48,11 +48,11 @@ [TestFixture] public class MacroStabilityOutwardsSectionResultRowTest { - private static MacroStabilityOutwardsSectionResultRow.ConstructionProperties ConstructionProperties + private static MacroStabilityOutwardsSectionResultRowOld.ConstructionProperties ConstructionProperties { get { - return new MacroStabilityOutwardsSectionResultRow.ConstructionProperties + return new MacroStabilityOutwardsSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = 1, DetailedAssessmentResultIndex = 2, @@ -80,7 +80,7 @@ var result = new MacroStabilityOutwardsFailureMechanismSectionResultOld(section); // Call - TestDelegate test = () => new MacroStabilityOutwardsSectionResultRow(result, null, assessmentSection, + TestDelegate test = () => new MacroStabilityOutwardsSectionResultRowOld(result, null, assessmentSection, ConstructionProperties); // Assert @@ -97,7 +97,7 @@ var result = new MacroStabilityOutwardsFailureMechanismSectionResultOld(section); // Call - TestDelegate test = () => new MacroStabilityOutwardsSectionResultRow(result, new MacroStabilityOutwardsFailureMechanism(), null, + TestDelegate test = () => new MacroStabilityOutwardsSectionResultRowOld(result, new MacroStabilityOutwardsFailureMechanism(), null, ConstructionProperties); // Assert @@ -117,7 +117,7 @@ var result = new MacroStabilityOutwardsFailureMechanismSectionResultOld(section); // Call - TestDelegate test = () => new MacroStabilityOutwardsSectionResultRow(result, new MacroStabilityOutwardsFailureMechanism(), assessmentSection, null); + TestDelegate test = () => new MacroStabilityOutwardsSectionResultRowOld(result, new MacroStabilityOutwardsFailureMechanism(), assessmentSection, null); // Assert var exception = Assert.Throws(test); @@ -141,11 +141,11 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + var row = new MacroStabilityOutwardsSectionResultRowOld(result, failureMechanism, assessmentSection, ConstructionProperties); // Assert - Assert.IsInstanceOf>(row); + Assert.IsInstanceOf>(row); Assert.AreEqual(result.SimpleAssessmentResult, row.SimpleAssessmentResult); Assert.AreEqual(result.DetailedAssessmentResult, row.DetailedAssessmentResult); Assert.AreEqual(result.DetailedAssessmentProbability, row.DetailedAssessmentProbability); @@ -154,12 +154,12 @@ Assert.AreEqual(result.UseManualAssembly, row.UseManualAssembly); Assert.AreEqual(result.ManualAssemblyCategoryGroup, row.ManualAssemblyCategoryGroup); - TestHelper.AssertTypeConverter( - nameof(MacroStabilityOutwardsSectionResultRow.DetailedAssessmentProbability)); - TestHelper.AssertTypeConverter( - nameof(MacroStabilityOutwardsSectionResultRow.TailorMadeAssessmentProbability)); + nameof(MacroStabilityOutwardsSectionResultRowOld.TailorMadeAssessmentProbability)); IDictionary columnStateDefinitions = row.ColumnStateDefinitions; Assert.AreEqual(10, columnStateDefinitions.Count); @@ -208,7 +208,7 @@ calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue(); // Call - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + var row = new MacroStabilityOutwardsSectionResultRowOld(result, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -244,7 +244,7 @@ calculator.ThrowExceptionOnCalculate = true; // Call - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + var row = new MacroStabilityOutwardsSectionResultRowOld(result, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -280,7 +280,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + var row = new MacroStabilityOutwardsSectionResultRowOld(result, failureMechanism, assessmentSection, ConstructionProperties); // Precondition @@ -316,7 +316,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + var row = new MacroStabilityOutwardsSectionResultRowOld(result, failureMechanism, assessmentSection, ConstructionProperties); // Call @@ -357,7 +357,7 @@ random.NextEnumValue()); calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue(); - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + var row = new MacroStabilityOutwardsSectionResultRowOld(result, failureMechanism, assessmentSection, ConstructionProperties); // Precondition @@ -404,7 +404,7 @@ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; calculator.ThrowExceptionOnCalculate = true; - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + var row = new MacroStabilityOutwardsSectionResultRowOld(result, failureMechanism, assessmentSection, ConstructionProperties); // Precondition @@ -457,7 +457,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + var row = new MacroStabilityOutwardsSectionResultRowOld(result, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -498,7 +498,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + var row = new MacroStabilityOutwardsSectionResultRowOld(result, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -537,7 +537,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + var row = new MacroStabilityOutwardsSectionResultRowOld(result, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -571,7 +571,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + var row = new MacroStabilityOutwardsSectionResultRowOld(result, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -636,7 +636,7 @@ calculator.CombinedAssemblyCategoryOutput = assemblyCategoryGroup; // Call - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + var row = new MacroStabilityOutwardsSectionResultRowOld(result, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -680,7 +680,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + var row = new MacroStabilityOutwardsSectionResultRowOld(result, failureMechanism, assessmentSection, ConstructionProperties); // Call @@ -713,7 +713,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + var row = new MacroStabilityOutwardsSectionResultRowOld(result, failureMechanism, assessmentSection, ConstructionProperties); // Call @@ -748,7 +748,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + var row = new MacroStabilityOutwardsSectionResultRowOld(result, failureMechanism, assessmentSection, ConstructionProperties); // Call @@ -780,7 +780,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + var row = new MacroStabilityOutwardsSectionResultRowOld(result, failureMechanism, assessmentSection, ConstructionProperties); // Call @@ -814,7 +814,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + var row = new MacroStabilityOutwardsSectionResultRowOld(result, failureMechanism, assessmentSection, ConstructionProperties); // Call @@ -849,7 +849,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + var row = new MacroStabilityOutwardsSectionResultRowOld(result, failureMechanism, assessmentSection, ConstructionProperties); // Call @@ -881,7 +881,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection, + var row = new MacroStabilityOutwardsSectionResultRowOld(result, failureMechanism, assessmentSection, ConstructionProperties); // Call Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultRows/MicrostabilitySectionResultRowTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultRows/MicrostabilitySectionResultRowTest.cs (.../MicrostabilitySectionResultRowTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultRows/MicrostabilitySectionResultRowTest.cs (.../MicrostabilitySectionResultRowTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -46,11 +46,11 @@ public class MicrostabilitySectionResultRowTest { - private static MicrostabilitySectionResultRow.ConstructionProperties ConstructionProperties + private static MicrostabilitySectionResultRowOld.ConstructionProperties ConstructionProperties { get { - return new MicrostabilitySectionResultRow.ConstructionProperties + return new MicrostabilitySectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = 1, DetailedAssessmentResultIndex = 2, @@ -72,7 +72,7 @@ var result = new MicrostabilityFailureMechanismSectionResultOld(section); // Call - TestDelegate test = () => new MicrostabilitySectionResultRow(result, null); + TestDelegate test = () => new MicrostabilitySectionResultRowOld(result, null); // Assert var exception = Assert.Throws(test); @@ -89,10 +89,10 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new MicrostabilitySectionResultRow(result, ConstructionProperties); + var row = new MicrostabilitySectionResultRowOld(result, ConstructionProperties); // Assert - Assert.IsInstanceOf>(row); + Assert.IsInstanceOf>(row); Assert.AreEqual(result.SimpleAssessmentResult, row.SimpleAssessmentResult); Assert.AreEqual(result.DetailedAssessmentResult, row.DetailedAssessmentResult); Assert.AreEqual(result.TailorMadeAssessmentResult, row.TailorMadeAssessmentResult); @@ -133,7 +133,7 @@ calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue(); // Call - var row = new MicrostabilitySectionResultRow(result, ConstructionProperties); + var row = new MicrostabilitySectionResultRowOld(result, ConstructionProperties); // Assert Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(calculator.SimpleAssessmentAssemblyOutput.Group), @@ -161,7 +161,7 @@ calculator.ThrowExceptionOnCalculate = true; // Call - var row = new MicrostabilitySectionResultRow(result, ConstructionProperties); + var row = new MicrostabilitySectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -191,7 +191,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MicrostabilitySectionResultRow(result, ConstructionProperties); + var row = new MicrostabilitySectionResultRowOld(result, ConstructionProperties); // Precondition Assert.IsFalse(result.UseManualAssembly); @@ -223,7 +223,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MicrostabilitySectionResultRow(result, ConstructionProperties); + var row = new MicrostabilitySectionResultRowOld(result, ConstructionProperties); // Call row.ManualAssemblyCategoryGroup = newValue; @@ -253,7 +253,7 @@ calculator.TailorMadeAssemblyCategoryOutput = random.NextEnumValue(); calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue(); - var row = new MicrostabilitySectionResultRow(result, ConstructionProperties); + var row = new MicrostabilitySectionResultRowOld(result, ConstructionProperties); // Precondition Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(calculator.SimpleAssessmentAssemblyOutput.Group), @@ -291,7 +291,7 @@ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; calculator.ThrowExceptionOnCalculate = true; - var row = new MicrostabilitySectionResultRow(result, ConstructionProperties); + var row = new MicrostabilitySectionResultRowOld(result, ConstructionProperties); // Precondition IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -334,7 +334,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new MicrostabilitySectionResultRow(result, ConstructionProperties); + var row = new MicrostabilitySectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -361,7 +361,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new MicrostabilitySectionResultRow(result, ConstructionProperties); + var row = new MicrostabilitySectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -410,7 +410,7 @@ calculator.CombinedAssemblyCategoryOutput = assemblyCategoryGroup; // Call - var row = new MicrostabilitySectionResultRow(result, ConstructionProperties); + var row = new MicrostabilitySectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -448,7 +448,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MicrostabilitySectionResultRow(result, ConstructionProperties); + var row = new MicrostabilitySectionResultRowOld(result, ConstructionProperties); // Call row.SimpleAssessmentResult = newValue; @@ -477,7 +477,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MicrostabilitySectionResultRow(result, ConstructionProperties); + var row = new MicrostabilitySectionResultRowOld(result, ConstructionProperties); // Call row.DetailedAssessmentResult = newValue; @@ -506,7 +506,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MicrostabilitySectionResultRow(result, ConstructionProperties); + var row = new MicrostabilitySectionResultRowOld(result, ConstructionProperties); // Call row.TailorMadeAssessmentResult = newValue; Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultRows/PipingStructureSectionResultRowTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultRows/PipingStructureSectionResultRowTest.cs (.../PipingStructureSectionResultRowTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultRows/PipingStructureSectionResultRowTest.cs (.../PipingStructureSectionResultRowTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -46,11 +46,11 @@ public class PipingStructureSectionResultRowTest { - private static PipingStructureSectionResultRow.ConstructionProperties ConstructionProperties + private static PipingStructureSectionResultRowOld.ConstructionProperties ConstructionProperties { get { - return new PipingStructureSectionResultRow.ConstructionProperties + return new PipingStructureSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = 1, DetailedAssessmentResultIndex = 2, @@ -72,7 +72,7 @@ var result = new PipingStructureFailureMechanismSectionResultOld(section); // Call - TestDelegate test = () => new PipingStructureSectionResultRow(result, null); + TestDelegate test = () => new PipingStructureSectionResultRowOld(result, null); // Assert var exception = Assert.Throws(test); @@ -89,10 +89,10 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new PipingStructureSectionResultRow(result, ConstructionProperties); + var row = new PipingStructureSectionResultRowOld(result, ConstructionProperties); // Assert - Assert.IsInstanceOf>(row); + Assert.IsInstanceOf>(row); Assert.AreEqual(result.SimpleAssessmentResult, row.SimpleAssessmentResult); Assert.AreEqual(result.DetailedAssessmentResult, row.DetailedAssessmentResult); Assert.AreEqual(result.TailorMadeAssessmentResult, row.TailorMadeAssessmentResult); @@ -133,7 +133,7 @@ calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue(); // Call - var row = new PipingStructureSectionResultRow(result, ConstructionProperties); + var row = new PipingStructureSectionResultRowOld(result, ConstructionProperties); // Assert Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(calculator.SimpleAssessmentAssemblyOutput.Group), @@ -161,7 +161,7 @@ calculator.ThrowExceptionOnCalculate = true; // Call - var row = new PipingStructureSectionResultRow(result, ConstructionProperties); + var row = new PipingStructureSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -191,7 +191,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new PipingStructureSectionResultRow(result, ConstructionProperties); + var row = new PipingStructureSectionResultRowOld(result, ConstructionProperties); // Precondition Assert.IsFalse(result.UseManualAssembly); @@ -223,7 +223,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new PipingStructureSectionResultRow(result, ConstructionProperties); + var row = new PipingStructureSectionResultRowOld(result, ConstructionProperties); // Call row.ManualAssemblyCategoryGroup = newValue; @@ -253,7 +253,7 @@ calculator.TailorMadeAssemblyCategoryOutput = random.NextEnumValue(); calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue(); - var row = new PipingStructureSectionResultRow(result, ConstructionProperties); + var row = new PipingStructureSectionResultRowOld(result, ConstructionProperties); // Precondition Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(calculator.SimpleAssessmentAssemblyOutput.Group), @@ -291,7 +291,7 @@ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; calculator.ThrowExceptionOnCalculate = true; - var row = new PipingStructureSectionResultRow(result, ConstructionProperties); + var row = new PipingStructureSectionResultRowOld(result, ConstructionProperties); // Precondition IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -334,7 +334,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new PipingStructureSectionResultRow(result, ConstructionProperties); + var row = new PipingStructureSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -361,7 +361,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new PipingStructureSectionResultRow(result, ConstructionProperties); + var row = new PipingStructureSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -410,7 +410,7 @@ calculator.CombinedAssemblyCategoryOutput = assemblyCategoryGroup; // Call - var row = new PipingStructureSectionResultRow(result, ConstructionProperties); + var row = new PipingStructureSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -448,7 +448,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new PipingStructureSectionResultRow(result, ConstructionProperties); + var row = new PipingStructureSectionResultRowOld(result, ConstructionProperties); // Call row.SimpleAssessmentResult = newValue; @@ -477,7 +477,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new PipingStructureSectionResultRow(result, ConstructionProperties); + var row = new PipingStructureSectionResultRowOld(result, ConstructionProperties); // Call row.DetailedAssessmentResult = newValue; @@ -506,7 +506,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new PipingStructureSectionResultRow(result, ConstructionProperties); + var row = new PipingStructureSectionResultRowOld(result, ConstructionProperties); // Call row.TailorMadeAssessmentResult = newValue; Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultRows/StrengthStabilityLengthwiseConstructionSectionResultRowTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultRows/StrengthStabilityLengthwiseConstructionSectionResultRowTest.cs (.../StrengthStabilityLengthwiseConstructionSectionResultRowTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultRows/StrengthStabilityLengthwiseConstructionSectionResultRowTest.cs (.../StrengthStabilityLengthwiseConstructionSectionResultRowTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -45,11 +45,11 @@ [TestFixture] public class StrengthStabilityLengthwiseConstructionSectionResultRowTest { - private static StrengthStabilityLengthwiseConstructionSectionResultRow.ConstructionProperties ConstructionProperties + private static StrengthStabilityLengthwiseConstructionSectionResultRowOld.ConstructionProperties ConstructionProperties { get { - return new StrengthStabilityLengthwiseConstructionSectionResultRow.ConstructionProperties + return new StrengthStabilityLengthwiseConstructionSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = 1, TailorMadeAssessmentResultIndex = 2, @@ -69,7 +69,7 @@ var result = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultOld(section); // Call - TestDelegate test = () => new StrengthStabilityLengthwiseConstructionSectionResultRow(result, null); + TestDelegate test = () => new StrengthStabilityLengthwiseConstructionSectionResultRowOld(result, null); // Assert var exception = Assert.Throws(test); @@ -86,10 +86,10 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new StrengthStabilityLengthwiseConstructionSectionResultRow(result, ConstructionProperties); + var row = new StrengthStabilityLengthwiseConstructionSectionResultRowOld(result, ConstructionProperties); // Assert - Assert.IsInstanceOf>(row); + Assert.IsInstanceOf>(row); Assert.AreEqual(result.SimpleAssessmentResult, row.SimpleAssessmentResult); Assert.AreEqual(result.TailorMadeAssessmentResult, row.TailorMadeAssessmentResult); Assert.AreEqual(result.UseManualAssembly, row.UseManualAssembly); @@ -126,7 +126,7 @@ calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue(); // Call - var row = new StrengthStabilityLengthwiseConstructionSectionResultRow(result, ConstructionProperties); + var row = new StrengthStabilityLengthwiseConstructionSectionResultRowOld(result, ConstructionProperties); // Assert Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(calculator.SimpleAssessmentAssemblyOutput.Group), @@ -152,7 +152,7 @@ calculator.ThrowExceptionOnCalculate = true; // Call - var row = new StrengthStabilityLengthwiseConstructionSectionResultRow(result, ConstructionProperties); + var row = new StrengthStabilityLengthwiseConstructionSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -181,7 +181,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new StrengthStabilityLengthwiseConstructionSectionResultRow(result, ConstructionProperties); + var row = new StrengthStabilityLengthwiseConstructionSectionResultRowOld(result, ConstructionProperties); // Precondition Assert.IsFalse(result.UseManualAssembly); @@ -213,7 +213,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new StrengthStabilityLengthwiseConstructionSectionResultRow(result, ConstructionProperties); + var row = new StrengthStabilityLengthwiseConstructionSectionResultRowOld(result, ConstructionProperties); // Call row.ManualAssemblyCategoryGroup = newValue; @@ -242,7 +242,7 @@ calculator.TailorMadeAssemblyCategoryOutput = random.NextEnumValue(); calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue(); - var row = new StrengthStabilityLengthwiseConstructionSectionResultRow(result, ConstructionProperties); + var row = new StrengthStabilityLengthwiseConstructionSectionResultRowOld(result, ConstructionProperties); // Precondition Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(calculator.SimpleAssessmentAssemblyOutput.Group), @@ -277,7 +277,7 @@ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; calculator.ThrowExceptionOnCalculate = true; - var row = new StrengthStabilityLengthwiseConstructionSectionResultRow(result, ConstructionProperties); + var row = new StrengthStabilityLengthwiseConstructionSectionResultRowOld(result, ConstructionProperties); // Precondition IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -318,7 +318,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new StrengthStabilityLengthwiseConstructionSectionResultRow(result, ConstructionProperties); + var row = new StrengthStabilityLengthwiseConstructionSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -343,7 +343,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new StrengthStabilityLengthwiseConstructionSectionResultRow(result, ConstructionProperties); + var row = new StrengthStabilityLengthwiseConstructionSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -388,7 +388,7 @@ calculator.CombinedAssemblyCategoryOutput = assemblyCategoryGroup; // Call - var row = new StrengthStabilityLengthwiseConstructionSectionResultRow(result, ConstructionProperties); + var row = new StrengthStabilityLengthwiseConstructionSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -424,7 +424,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new StrengthStabilityLengthwiseConstructionSectionResultRow(result, ConstructionProperties); + var row = new StrengthStabilityLengthwiseConstructionSectionResultRowOld(result, ConstructionProperties); // Call row.SimpleAssessmentResult = newValue; @@ -453,7 +453,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new StrengthStabilityLengthwiseConstructionSectionResultRow(result, ConstructionProperties); + var row = new StrengthStabilityLengthwiseConstructionSectionResultRowOld(result, ConstructionProperties); // Call row.TailorMadeAssessmentResult = newValue; Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultRows/TechnicalInnovationSectionResultRowTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultRows/TechnicalInnovationSectionResultRowTest.cs (.../TechnicalInnovationSectionResultRowTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultRows/TechnicalInnovationSectionResultRowTest.cs (.../TechnicalInnovationSectionResultRowTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -45,11 +45,11 @@ [TestFixture] public class TechnicalInnovationSectionResultRowTest { - private static TechnicalInnovationSectionResultRow.ConstructionProperties ConstructionProperties + private static TechnicalInnovationSectionResultRowOld.ConstructionProperties ConstructionProperties { get { - return new TechnicalInnovationSectionResultRow.ConstructionProperties + return new TechnicalInnovationSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = 1, TailorMadeAssessmentResultIndex = 2, @@ -69,7 +69,7 @@ var result = new TechnicalInnovationFailureMechanismSectionResultOld(section); // Call - TestDelegate test = () => new TechnicalInnovationSectionResultRow(result, null); + TestDelegate test = () => new TechnicalInnovationSectionResultRowOld(result, null); // Assert var exception = Assert.Throws(test); @@ -86,10 +86,10 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new TechnicalInnovationSectionResultRow(result, ConstructionProperties); + var row = new TechnicalInnovationSectionResultRowOld(result, ConstructionProperties); // Assert - Assert.IsInstanceOf>(row); + Assert.IsInstanceOf>(row); Assert.AreEqual(result.SimpleAssessmentResult, row.SimpleAssessmentResult); Assert.AreEqual(result.TailorMadeAssessmentResult, row.TailorMadeAssessmentResult); Assert.AreEqual(result.UseManualAssembly, row.UseManualAssembly); @@ -126,7 +126,7 @@ calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue(); // Call - var row = new TechnicalInnovationSectionResultRow(result, ConstructionProperties); + var row = new TechnicalInnovationSectionResultRowOld(result, ConstructionProperties); // Assert Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(calculator.SimpleAssessmentAssemblyOutput.Group), @@ -152,7 +152,7 @@ calculator.ThrowExceptionOnCalculate = true; // Call - var row = new TechnicalInnovationSectionResultRow(result, ConstructionProperties); + var row = new TechnicalInnovationSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -181,7 +181,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new TechnicalInnovationSectionResultRow(result, ConstructionProperties); + var row = new TechnicalInnovationSectionResultRowOld(result, ConstructionProperties); // Precondition Assert.IsFalse(result.UseManualAssembly); @@ -213,7 +213,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new TechnicalInnovationSectionResultRow(result, ConstructionProperties); + var row = new TechnicalInnovationSectionResultRowOld(result, ConstructionProperties); // Call row.ManualAssemblyCategoryGroup = newValue; @@ -243,7 +243,7 @@ calculator.TailorMadeAssemblyCategoryOutput = random.NextEnumValue(); calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue(); - var row = new TechnicalInnovationSectionResultRow(result, ConstructionProperties); + var row = new TechnicalInnovationSectionResultRowOld(result, ConstructionProperties); // Precondition Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(calculator.SimpleAssessmentAssemblyOutput.Group), @@ -278,7 +278,7 @@ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; calculator.ThrowExceptionOnCalculate = true; - var row = new TechnicalInnovationSectionResultRow(result, ConstructionProperties); + var row = new TechnicalInnovationSectionResultRowOld(result, ConstructionProperties); // Precondition IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -319,7 +319,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new TechnicalInnovationSectionResultRow(result, ConstructionProperties); + var row = new TechnicalInnovationSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -344,7 +344,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new TechnicalInnovationSectionResultRow(result, ConstructionProperties); + var row = new TechnicalInnovationSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -389,7 +389,7 @@ calculator.CombinedAssemblyCategoryOutput = assemblyCategoryGroup; // Call - var row = new TechnicalInnovationSectionResultRow(result, ConstructionProperties); + var row = new TechnicalInnovationSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -425,7 +425,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new TechnicalInnovationSectionResultRow(result, ConstructionProperties); + var row = new TechnicalInnovationSectionResultRowOld(result, ConstructionProperties); // Call row.SimpleAssessmentResult = newValue; @@ -454,7 +454,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new TechnicalInnovationSectionResultRow(result, ConstructionProperties); + var row = new TechnicalInnovationSectionResultRowOld(result, ConstructionProperties); // Call row.TailorMadeAssessmentResult = newValue; Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultRows/WaterPressureAsphaltCoverSectionResultRowTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultRows/WaterPressureAsphaltCoverSectionResultRowTest.cs (.../WaterPressureAsphaltCoverSectionResultRowTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultRows/WaterPressureAsphaltCoverSectionResultRowTest.cs (.../WaterPressureAsphaltCoverSectionResultRowTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -45,11 +45,11 @@ [TestFixture] public class WaterPressureAsphaltCoverSectionResultRowTest { - private static WaterPressureAsphaltCoverSectionResultRow.ConstructionProperties ConstructionProperties + private static WaterPressureAsphaltCoverSectionResultRowOld.ConstructionProperties ConstructionProperties { get { - return new WaterPressureAsphaltCoverSectionResultRow.ConstructionProperties + return new WaterPressureAsphaltCoverSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = 1, TailorMadeAssessmentResultIndex = 2, @@ -69,7 +69,7 @@ var result = new WaterPressureAsphaltCoverFailureMechanismSectionResultOld(section); // Call - TestDelegate test = () => new WaterPressureAsphaltCoverSectionResultRow(result, null); + TestDelegate test = () => new WaterPressureAsphaltCoverSectionResultRowOld(result, null); // Assert var exception = Assert.Throws(test); @@ -86,10 +86,10 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new WaterPressureAsphaltCoverSectionResultRow(result, ConstructionProperties); + var row = new WaterPressureAsphaltCoverSectionResultRowOld(result, ConstructionProperties); // Assert - Assert.IsInstanceOf>(row); + Assert.IsInstanceOf>(row); Assert.AreEqual(result.SimpleAssessmentResult, row.SimpleAssessmentResult); Assert.AreEqual(result.TailorMadeAssessmentResult, row.TailorMadeAssessmentResult); Assert.AreEqual(result.UseManualAssembly, row.UseManualAssembly); @@ -126,7 +126,7 @@ calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue(); // Call - var row = new WaterPressureAsphaltCoverSectionResultRow(result, ConstructionProperties); + var row = new WaterPressureAsphaltCoverSectionResultRowOld(result, ConstructionProperties); // Assert Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(calculator.SimpleAssessmentAssemblyOutput.Group), @@ -152,7 +152,7 @@ calculator.ThrowExceptionOnCalculate = true; // Call - var row = new WaterPressureAsphaltCoverSectionResultRow(result, ConstructionProperties); + var row = new WaterPressureAsphaltCoverSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -181,7 +181,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new WaterPressureAsphaltCoverSectionResultRow(result, ConstructionProperties); + var row = new WaterPressureAsphaltCoverSectionResultRowOld(result, ConstructionProperties); // Precondition Assert.IsFalse(result.UseManualAssembly); @@ -213,7 +213,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new WaterPressureAsphaltCoverSectionResultRow(result, ConstructionProperties); + var row = new WaterPressureAsphaltCoverSectionResultRowOld(result, ConstructionProperties); // Call row.ManualAssemblyCategoryGroup = newValue; @@ -243,7 +243,7 @@ calculator.TailorMadeAssemblyCategoryOutput = random.NextEnumValue(); calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue(); - var row = new WaterPressureAsphaltCoverSectionResultRow(result, ConstructionProperties); + var row = new WaterPressureAsphaltCoverSectionResultRowOld(result, ConstructionProperties); // Precondition Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(calculator.SimpleAssessmentAssemblyOutput.Group), @@ -278,7 +278,7 @@ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; calculator.ThrowExceptionOnCalculate = true; - var row = new WaterPressureAsphaltCoverSectionResultRow(result, ConstructionProperties); + var row = new WaterPressureAsphaltCoverSectionResultRowOld(result, ConstructionProperties); // Precondition IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -319,7 +319,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new WaterPressureAsphaltCoverSectionResultRow(result, ConstructionProperties); + var row = new WaterPressureAsphaltCoverSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -344,7 +344,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new WaterPressureAsphaltCoverSectionResultRow(result, ConstructionProperties); + var row = new WaterPressureAsphaltCoverSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -389,7 +389,7 @@ calculator.CombinedAssemblyCategoryOutput = assemblyCategoryGroup; // Call - var row = new WaterPressureAsphaltCoverSectionResultRow(result, ConstructionProperties); + var row = new WaterPressureAsphaltCoverSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -425,7 +425,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new WaterPressureAsphaltCoverSectionResultRow(result, ConstructionProperties); + var row = new WaterPressureAsphaltCoverSectionResultRowOld(result, ConstructionProperties); // Call row.SimpleAssessmentResult = newValue; @@ -454,7 +454,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new WaterPressureAsphaltCoverSectionResultRow(result, ConstructionProperties); + var row = new WaterPressureAsphaltCoverSectionResultRowOld(result, ConstructionProperties); // Call row.TailorMadeAssessmentResult = newValue; Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultViews/GrassCoverSlipOffInwardsResultViewTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultViews/GrassCoverSlipOffInwardsResultViewTest.cs (.../GrassCoverSlipOffInwardsResultViewTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultViews/GrassCoverSlipOffInwardsResultViewTest.cs (.../GrassCoverSlipOffInwardsResultViewTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -80,7 +80,7 @@ { // Assert Assert.IsInstanceOf>(view); Assert.IsNull(view.Data); @@ -204,7 +204,7 @@ GrassCoverSlipOffInwardsResultViewOld, GrassCoverSlipOffInwardsFailureMechanism, GrassCoverSlipOffInwardsFailureMechanismSectionResultOld, - GrassCoverSlipOffInwardsSectionResultRow> + GrassCoverSlipOffInwardsSectionResultRowOld> { protected override GrassCoverSlipOffInwardsResultViewOld CreateResultView(GrassCoverSlipOffInwardsFailureMechanism failureMechanism) { Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultViews/GrassCoverSlipOffOutwardsResultViewTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultViews/GrassCoverSlipOffOutwardsResultViewTest.cs (.../GrassCoverSlipOffOutwardsResultViewTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultViews/GrassCoverSlipOffOutwardsResultViewTest.cs (.../GrassCoverSlipOffOutwardsResultViewTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -80,7 +80,7 @@ { // Assert Assert.IsInstanceOf>(view); Assert.IsNull(view.Data); @@ -204,7 +204,7 @@ GrassCoverSlipOffOutwardsResultViewOld, GrassCoverSlipOffOutwardsFailureMechanism, GrassCoverSlipOffOutwardsFailureMechanismSectionResultOld, - GrassCoverSlipOffOutwardsSectionResultRow> + GrassCoverSlipOffOutwardsSectionResultRowOld> { protected override GrassCoverSlipOffOutwardsResultViewOld CreateResultView(GrassCoverSlipOffOutwardsFailureMechanism failureMechanism) { Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultViews/MacroStabilityOutwardsResultViewTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultViews/MacroStabilityOutwardsResultViewTest.cs (.../MacroStabilityOutwardsResultViewTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultViews/MacroStabilityOutwardsResultViewTest.cs (.../MacroStabilityOutwardsResultViewTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -103,7 +103,7 @@ { // Assert Assert.IsInstanceOf>(view); Assert.IsNull(view.Data); @@ -236,7 +236,7 @@ MacroStabilityOutwardsResultViewOld, MacroStabilityOutwardsFailureMechanism, MacroStabilityOutwardsFailureMechanismSectionResultOld, - MacroStabilityOutwardsSectionResultRow> + MacroStabilityOutwardsSectionResultRowOld> { protected override MacroStabilityOutwardsResultViewOld CreateResultView(MacroStabilityOutwardsFailureMechanism failureMechanism) { Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultViews/MicrostabilityResultViewTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultViews/MicrostabilityResultViewTest.cs (.../MicrostabilityResultViewTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultViews/MicrostabilityResultViewTest.cs (.../MicrostabilityResultViewTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -80,7 +80,7 @@ { // Assert Assert.IsInstanceOf>(view); Assert.IsNull(view.Data); @@ -204,7 +204,7 @@ MicrostabilityResultViewOld, MicrostabilityFailureMechanism, MicrostabilityFailureMechanismSectionResultOld, - MicrostabilitySectionResultRow> + MicrostabilitySectionResultRowOld> { protected override MicrostabilityResultViewOld CreateResultView(MicrostabilityFailureMechanism failureMechanism) { Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultViews/PipingStructureResultViewTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultViews/PipingStructureResultViewTest.cs (.../PipingStructureResultViewTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultViews/PipingStructureResultViewTest.cs (.../PipingStructureResultViewTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -80,7 +80,7 @@ { // Assert Assert.IsInstanceOf>(view); Assert.IsNull(view.Data); @@ -204,7 +204,7 @@ PipingStructureResultViewOld, PipingStructureFailureMechanism, PipingStructureFailureMechanismSectionResultOld, - PipingStructureSectionResultRow> + PipingStructureSectionResultRowOld> { protected override PipingStructureResultViewOld CreateResultView(PipingStructureFailureMechanism failureMechanism) { Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultViews/StrengthStabilityLengthwiseConstructionResultViewTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultViews/StrengthStabilityLengthwiseConstructionResultViewTest.cs (.../StrengthStabilityLengthwiseConstructionResultViewTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultViews/StrengthStabilityLengthwiseConstructionResultViewTest.cs (.../StrengthStabilityLengthwiseConstructionResultViewTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -78,7 +78,7 @@ { // Assert Assert.IsInstanceOf>(view); Assert.IsNull(view.Data); @@ -194,7 +194,7 @@ StrengthStabilityLengthwiseConstructionResultViewOld, StrengthStabilityLengthwiseConstructionFailureMechanism, StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultOld, - StrengthStabilityLengthwiseConstructionSectionResultRow> + StrengthStabilityLengthwiseConstructionSectionResultRowOld> { protected override StrengthStabilityLengthwiseConstructionResultViewOld CreateResultView(StrengthStabilityLengthwiseConstructionFailureMechanism failureMechanism) { Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultViews/TechnicalInnovationResultViewTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultViews/TechnicalInnovationResultViewTest.cs (.../TechnicalInnovationResultViewTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultViews/TechnicalInnovationResultViewTest.cs (.../TechnicalInnovationResultViewTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -78,7 +78,7 @@ { // Assert Assert.IsInstanceOf>(view); Assert.IsNull(view.Data); @@ -194,7 +194,7 @@ TechnicalInnovationResultViewOld, TechnicalInnovationFailureMechanism, TechnicalInnovationFailureMechanismSectionResultOld, - TechnicalInnovationSectionResultRow> + TechnicalInnovationSectionResultRowOld> { protected override TechnicalInnovationResultViewOld CreateResultView(TechnicalInnovationFailureMechanism failureMechanism) { Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultViews/WaterPressureAsphaltCoverResultViewTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultViews/WaterPressureAsphaltCoverResultViewTest.cs (.../WaterPressureAsphaltCoverResultViewTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SectionResultViews/WaterPressureAsphaltCoverResultViewTest.cs (.../WaterPressureAsphaltCoverResultViewTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -78,7 +78,7 @@ { // Assert Assert.IsInstanceOf>(view); Assert.IsNull(view.Data); @@ -194,7 +194,7 @@ WaterPressureAsphaltCoverResultViewOld, WaterPressureAsphaltCoverFailureMechanism, WaterPressureAsphaltCoverFailureMechanismSectionResultOld, - WaterPressureAsphaltCoverSectionResultRow> + WaterPressureAsphaltCoverSectionResultRowOld> { protected override WaterPressureAsphaltCoverResultViewOld CreateResultView(WaterPressureAsphaltCoverFailureMechanism failureMechanism) { Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFailureMechanismResultViewOld.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFailureMechanismResultViewOld.cs (.../MacroStabilityInwardsFailureMechanismResultViewOld.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFailureMechanismResultViewOld.cs (.../MacroStabilityInwardsFailureMechanismResultViewOld.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -35,7 +35,7 @@ /// The view for the . /// public class MacroStabilityInwardsFailureMechanismResultViewOld : FailureMechanismResultViewOld { @@ -98,15 +98,15 @@ base.Dispose(disposing); } - protected override MacroStabilityInwardsFailureMechanismSectionResultRow CreateFailureMechanismSectionResultRow( + protected override MacroStabilityInwardsFailureMechanismSectionResultRowOld CreateFailureMechanismSectionResultRow( MacroStabilityInwardsFailureMechanismSectionResultOld sectionResult) { - return new MacroStabilityInwardsFailureMechanismSectionResultRow( + return new MacroStabilityInwardsFailureMechanismSectionResultRowOld( sectionResult, FailureMechanism.Calculations.Cast(), FailureMechanism, assessmentSection, - new MacroStabilityInwardsFailureMechanismSectionResultRow.ConstructionProperties + new MacroStabilityInwardsFailureMechanismSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = simpleAssessmentResultIndex, DetailedAssessmentResultIndex = detailedAssessmentResultIndex, @@ -126,55 +126,55 @@ { FailureMechanismSectionResultViewColumnBuilder.AddSectionNameColumn( DataGridViewControl, - nameof(MacroStabilityInwardsFailureMechanismSectionResultRow.Name)); + nameof(MacroStabilityInwardsFailureMechanismSectionResultRowOld.Name)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssessmentResultColumn( DataGridViewControl, - nameof(MacroStabilityInwardsFailureMechanismSectionResultRow.SimpleAssessmentResult)); + nameof(MacroStabilityInwardsFailureMechanismSectionResultRowOld.SimpleAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentProbabilityOnlyResultColumn( DataGridViewControl, - nameof(MacroStabilityInwardsFailureMechanismSectionResultRow.DetailedAssessmentResult)); + nameof(MacroStabilityInwardsFailureMechanismSectionResultRowOld.DetailedAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentProbabilityColumn( DataGridViewControl, - nameof(MacroStabilityInwardsFailureMechanismSectionResultRow.DetailedAssessmentProbability)); + nameof(MacroStabilityInwardsFailureMechanismSectionResultRowOld.DetailedAssessmentProbability)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentProbabilityCalculationResultColumn( DataGridViewControl, - nameof(MacroStabilityInwardsFailureMechanismSectionResultRow.TailorMadeAssessmentResult)); + nameof(MacroStabilityInwardsFailureMechanismSectionResultRowOld.TailorMadeAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentProbabilityColumn( DataGridViewControl, - nameof(MacroStabilityInwardsFailureMechanismSectionResultRow.TailorMadeAssessmentProbability)); + nameof(MacroStabilityInwardsFailureMechanismSectionResultRowOld.TailorMadeAssessmentProbability)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(MacroStabilityInwardsFailureMechanismSectionResultRow.SimpleAssemblyCategoryGroup)); + nameof(MacroStabilityInwardsFailureMechanismSectionResultRowOld.SimpleAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(MacroStabilityInwardsFailureMechanismSectionResultRow.DetailedAssemblyCategoryGroup)); + nameof(MacroStabilityInwardsFailureMechanismSectionResultRowOld.DetailedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(MacroStabilityInwardsFailureMechanismSectionResultRow.TailorMadeAssemblyCategoryGroup)); + nameof(MacroStabilityInwardsFailureMechanismSectionResultRowOld.TailorMadeAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddCombinedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(MacroStabilityInwardsFailureMechanismSectionResultRow.CombinedAssemblyCategoryGroup)); + nameof(MacroStabilityInwardsFailureMechanismSectionResultRowOld.CombinedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddCombinedAssemblyProbabilityColumn( DataGridViewControl, - nameof(MacroStabilityInwardsFailureMechanismSectionResultRow.CombinedAssemblyProbability)); + nameof(MacroStabilityInwardsFailureMechanismSectionResultRowOld.CombinedAssemblyProbability)); FailureMechanismSectionResultViewColumnBuilder.AddUseManualAssemblyColumn( DataGridViewControl, - nameof(MacroStabilityInwardsFailureMechanismSectionResultRow.UseManualAssembly)); + nameof(MacroStabilityInwardsFailureMechanismSectionResultRowOld.UseManualAssembly)); FailureMechanismSectionResultViewColumnBuilder.AddManualAssemblyProbabilityColumn( DataGridViewControl, - nameof(MacroStabilityInwardsFailureMechanismSectionResultRow.ManualAssemblyProbability)); + nameof(MacroStabilityInwardsFailureMechanismSectionResultRowOld.ManualAssemblyProbability)); } protected override void RefreshDataGrid() Fisheye: Tag ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b refers to a dead (removed) revision in file `Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFailureMechanismSectionResultRow.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFailureMechanismSectionResultRowOld.cs =================================================================== diff -u --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFailureMechanismSectionResultRowOld.cs (revision 0) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFailureMechanismSectionResultRowOld.cs (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -0,0 +1,496 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using Core.Common.Controls.DataGrid; +using Riskeer.AssemblyTool.Data; +using Riskeer.Common.Data.AssessmentSection; +using Riskeer.Common.Data.Exceptions; +using Riskeer.Common.Forms.Helpers; +using Riskeer.Common.Forms.TypeConverters; +using Riskeer.Common.Forms.Views; +using Riskeer.Common.Primitives; +using Riskeer.MacroStabilityInwards.Data; + +namespace Riskeer.MacroStabilityInwards.Forms.Views +{ + /// + /// Container of a , which takes care of the + /// representation of properties in a grid. + /// + public class MacroStabilityInwardsFailureMechanismSectionResultRowOld : FailureMechanismSectionResultRowOld + { + private readonly int simpleAssessmentResultIndex; + private readonly int detailedAssessmentResultIndex; + private readonly int detailedAssessmentProbabilityIndex; + private readonly int tailorMadeAssessmentResultIndex; + private readonly int tailorMadeAssessmentProbabilityIndex; + private readonly int simpleAssemblyCategoryGroupIndex; + private readonly int detailedAssemblyCategoryGroupIndex; + private readonly int tailorMadeAssemblyCategoryGroupIndex; + private readonly int combinedAssemblyCategoryGroupIndex; + private readonly int combinedAssemblyProbabilityIndex; + private readonly int manualAssemblyProbabilityIndex; + + private readonly IEnumerable calculations; + private readonly MacroStabilityInwardsFailureMechanism failureMechanism; + private readonly IAssessmentSection assessmentSection; + private FailureMechanismSectionAssemblyCategoryGroup simpleAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup detailedAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup combinedAssemblyCategoryGroup; + + /// + /// Creates a new instance of . + /// + /// The that is + /// the source of this row. + /// All calculations in the failure mechanism. + /// The failure mechanism the section result belongs to. + /// The assessment section the section result belongs to. + /// The property values required to create an instance of + /// . + /// Throw when any parameter is null. + /// Thrown when + /// is a valid value, but unsupported. + internal MacroStabilityInwardsFailureMechanismSectionResultRowOld(MacroStabilityInwardsFailureMechanismSectionResultOld sectionResult, + IEnumerable calculations, + MacroStabilityInwardsFailureMechanism failureMechanism, + IAssessmentSection assessmentSection, + ConstructionProperties constructionProperties) + : base(sectionResult) + { + if (calculations == null) + { + throw new ArgumentNullException(nameof(calculations)); + } + + if (failureMechanism == null) + { + throw new ArgumentNullException(nameof(failureMechanism)); + } + + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + if (constructionProperties == null) + { + throw new ArgumentNullException(nameof(constructionProperties)); + } + + this.calculations = calculations; + this.failureMechanism = failureMechanism; + this.assessmentSection = assessmentSection; + + simpleAssessmentResultIndex = constructionProperties.SimpleAssessmentResultIndex; + detailedAssessmentResultIndex = constructionProperties.DetailedAssessmentResultIndex; + detailedAssessmentProbabilityIndex = constructionProperties.DetailedAssessmentProbabilityIndex; + tailorMadeAssessmentResultIndex = constructionProperties.TailorMadeAssessmentResultIndex; + tailorMadeAssessmentProbabilityIndex = constructionProperties.TailorMadeAssessmentProbabilityIndex; + simpleAssemblyCategoryGroupIndex = constructionProperties.SimpleAssemblyCategoryGroupIndex; + detailedAssemblyCategoryGroupIndex = constructionProperties.DetailedAssemblyCategoryGroupIndex; + tailorMadeAssemblyCategoryGroupIndex = constructionProperties.TailorMadeAssemblyCategoryGroupIndex; + combinedAssemblyCategoryGroupIndex = constructionProperties.CombinedAssemblyCategoryGroupIndex; + combinedAssemblyProbabilityIndex = constructionProperties.CombinedAssemblyProbabilityIndex; + manualAssemblyProbabilityIndex = constructionProperties.ManualAssemblyProbabilityIndex; + + CreateColumnStateDefinitions(); + + Update(); + } + + /// + /// Gets or sets the value representing the simple assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public SimpleAssessmentResultType SimpleAssessmentResult + { + get => SectionResult.SimpleAssessmentResult; + set + { + SectionResult.SimpleAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value representing the detailed assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentProbabilityOnlyResultType DetailedAssessmentResult + { + get => SectionResult.DetailedAssessmentResult; + set + { + SectionResult.DetailedAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets the detailed assessment probability a of the . + /// + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double DetailedAssessmentProbability => SectionResult.GetDetailedAssessmentProbability(calculations, failureMechanism.GeneralInput.ModelFactor); + + /// + /// Gets or sets the value representing the tailor made assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public TailorMadeAssessmentProbabilityCalculationResultType TailorMadeAssessmentResult + { + get => SectionResult.TailorMadeAssessmentResult; + set + { + SectionResult.TailorMadeAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value of the tailored assessment of safety. + /// + /// Thrown when is + /// not in the range [0,1]. + /// Thrown when + /// is a valid value, but unsupported. + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double TailorMadeAssessmentProbability + { + get => SectionResult.TailorMadeAssessmentProbability; + set + { + SectionResult.TailorMadeAssessmentProbability = value; + UpdateInternalData(); + } + } + + /// + /// Gets the simple assembly category group. + /// + public string SimpleAssemblyCategoryGroup => FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(simpleAssemblyCategoryGroup); + + /// + /// Gets the detailed assembly category group. + /// + public string DetailedAssemblyCategoryGroup => FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(detailedAssemblyCategoryGroup); + + /// + /// Gets the tailor made assembly category group. + /// + public string TailorMadeAssemblyCategoryGroup => FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(tailorMadeAssemblyCategoryGroup); + + /// + /// Gets the combined assembly category group. + /// + public string CombinedAssemblyCategoryGroup => FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(combinedAssemblyCategoryGroup); + + /// + /// Gets the combined assembly probability. + /// + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double CombinedAssemblyProbability { get; private set; } + + /// + /// Gets or sets the indicator whether the combined assembly probability + /// should be overwritten by . + /// + /// Thrown when + /// is a valid value, but unsupported. + public bool UseManualAssembly + { + get => SectionResult.UseManualAssembly; + set + { + SectionResult.UseManualAssembly = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the manually entered assembly probability. + /// + /// Thrown when is + /// not in the range [0,1]. + /// Thrown when + /// is a valid value, but unsupported. + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double ManualAssemblyProbability + { + get => SectionResult.ManualAssemblyProbability; + set + { + SectionResult.ManualAssemblyProbability = value; + UpdateInternalData(); + } + } + + public override void Update() + { + UpdateDerivedData(); + UpdateColumnStateDefinitions(); + UpdateDetailedAssessmentProbabilityError(); + } + + private void UpdateDetailedAssessmentProbabilityError() + { + if (FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(SimpleAssessmentResult) + || !FailureMechanismSectionResultRowHelper.DetailedAssessmentResultIsProbability(DetailedAssessmentResult) + || UseManualAssembly) + { + ColumnStateDefinitions[detailedAssessmentProbabilityIndex].ErrorText = string.Empty; + } + else + { + ColumnStateDefinitions[detailedAssessmentProbabilityIndex].ErrorText = FailureMechanismSectionResultRowHelper.GetDetailedAssessmentProbabilityError( + SectionResult.GetCalculationScenarios(calculations).ToArray(), + scenarios => SectionResult.GetTotalContribution(scenarios), + scenarios => SectionResult.GetDetailedAssessmentProbability(scenarios, failureMechanism.GeneralInput.ModelFactor)); + } + } + + private void CreateColumnStateDefinitions() + { + ColumnStateDefinitions.Add(simpleAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentProbabilityIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssessmentProbabilityIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(simpleAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(combinedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(combinedAssemblyProbabilityIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(manualAssemblyProbabilityIndex, new DataGridViewColumnStateDefinition()); + } + + private void UpdateDerivedData() + { + ResetErrorTexts(); + TryGetSimpleAssemblyCategoryGroup(); + TryGetDetailedAssemblyCategoryGroup(); + TryGetTailorMadeAssemblyCategoryGroup(); + TryGetCombinedAssemblyCategoryGroup(); + } + + private void ResetErrorTexts() + { + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[combinedAssemblyProbabilityIndex].ErrorText = string.Empty; + } + + private void TryGetSimpleAssemblyCategoryGroup() + { + try + { + simpleAssemblyCategoryGroup = MacroStabilityInwardsFailureMechanismAssemblyFactory.AssembleSimpleAssessment(SectionResult).Group; + } + catch (AssemblyException e) + { + simpleAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetDetailedAssemblyCategoryGroup() + { + try + { + detailedAssemblyCategoryGroup = MacroStabilityInwardsFailureMechanismAssemblyFactory.AssembleDetailedAssessment( + SectionResult, + calculations, + failureMechanism, + assessmentSection).Group; + } + catch (AssemblyException e) + { + detailedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetTailorMadeAssemblyCategoryGroup() + { + try + { + tailorMadeAssemblyCategoryGroup = MacroStabilityInwardsFailureMechanismAssemblyFactory.AssembleTailorMadeAssessment( + SectionResult, + failureMechanism, + assessmentSection).Group; + } + catch (AssemblyException e) + { + tailorMadeAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetCombinedAssemblyCategoryGroup() + { + try + { + FailureMechanismSectionAssembly combinedAssembly = + MacroStabilityInwardsFailureMechanismAssemblyFactory.AssembleCombinedAssessment( + SectionResult, + calculations, + failureMechanism, + assessmentSection); + + combinedAssemblyCategoryGroup = combinedAssembly.Group; + CombinedAssemblyProbability = combinedAssembly.Probability; + } + catch (AssemblyException e) + { + combinedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + CombinedAssemblyProbability = double.NaN; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = e.Message; + ColumnStateDefinitions[combinedAssemblyProbabilityIndex].ErrorText = e.Message; + } + } + + /// + /// Updates the column state definitions. + /// + /// Thrown when + /// is a valid value, but unsupported. + private void UpdateColumnStateDefinitions() + { + bool simpleAssessmentSufficient = FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(SimpleAssessmentResult); + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[simpleAssessmentResultIndex], UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultIndex], simpleAssessmentSufficient + || UseManualAssembly); + if (simpleAssessmentSufficient + || !FailureMechanismSectionResultRowHelper.DetailedAssessmentResultIsProbability(DetailedAssessmentResult) + || UseManualAssembly) + { + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[detailedAssessmentProbabilityIndex]); + } + else + { + ColumnStateHelper.EnableColumn(ColumnStateDefinitions[detailedAssessmentProbabilityIndex], true); + } + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentResultIndex], + simpleAssessmentSufficient + || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentProbabilityIndex], + simpleAssessmentSufficient + || !FailureMechanismSectionResultRowHelper.TailorMadeAssessmentResultIsProbability(TailorMadeAssessmentResult) + || UseManualAssembly); + + if (UseManualAssembly) + { + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[combinedAssemblyProbabilityIndex]); + } + else + { + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex], + simpleAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex], + detailedAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex], + tailorMadeAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex], + combinedAssemblyCategoryGroup); + ColumnStateHelper.EnableColumn(ColumnStateDefinitions[combinedAssemblyProbabilityIndex], true); + } + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[manualAssemblyProbabilityIndex], !UseManualAssembly); + } + + /// + /// Class holding the various construction parameters for . + /// + public class ConstructionProperties + { + /// + /// Sets the simple assessment result index. + /// + public int SimpleAssessmentResultIndex { internal get; set; } + + /// + /// Sets the detailed assessment result index. + /// + public int DetailedAssessmentResultIndex { internal get; set; } + + /// + /// Sets the detailed assessment probability index. + /// + public int DetailedAssessmentProbabilityIndex { internal get; set; } + + /// + /// Sets the tailor made assessment result index. + /// + public int TailorMadeAssessmentResultIndex { internal get; set; } + + /// + /// Sets the tailor made assessment probability index. + /// + public int TailorMadeAssessmentProbabilityIndex { internal get; set; } + + /// + /// Sets the simple assembly category group index. + /// + public int SimpleAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the detailed assembly category group index. + /// + public int DetailedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the tailor made assembly category group index. + /// + public int TailorMadeAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly category group index. + /// + public int CombinedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly probability index. + /// + public int CombinedAssemblyProbabilityIndex { internal get; set; } + + /// + /// Sets the manual assembly category group index. + /// + public int ManualAssemblyProbabilityIndex { internal get; set; } + } + } +} \ No newline at end of file Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsFailureMechanismResultViewTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsFailureMechanismResultViewTest.cs (.../MacroStabilityInwardsFailureMechanismResultViewTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsFailureMechanismResultViewTest.cs (.../MacroStabilityInwardsFailureMechanismResultViewTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -89,7 +89,7 @@ { // Assert Assert.IsInstanceOf>(view); Assert.IsNull(view.Data); @@ -247,7 +247,7 @@ using (ShowFailureMechanismResultsView(failureMechanism)) { DataGridView dataGridView = GetDataGridView(); - var row = (MacroStabilityInwardsFailureMechanismSectionResultRow) dataGridView.Rows[0].DataBoundItem; + var row = (MacroStabilityInwardsFailureMechanismSectionResultRowOld) dataGridView.Rows[0].DataBoundItem; var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; @@ -275,7 +275,7 @@ MacroStabilityInwardsFailureMechanismResultViewOld, MacroStabilityInwardsFailureMechanism, MacroStabilityInwardsFailureMechanismSectionResultOld, - MacroStabilityInwardsFailureMechanismSectionResultRow, + MacroStabilityInwardsFailureMechanismSectionResultRowOld, MacroStabilityInwardsCalculationScenario> { protected override MacroStabilityInwardsFailureMechanismResultViewOld CreateResultView(MacroStabilityInwardsFailureMechanism failureMechanism) Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsFailureMechanismSectionResultRowTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsFailureMechanismSectionResultRowTest.cs (.../MacroStabilityInwardsFailureMechanismSectionResultRowTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsFailureMechanismSectionResultRowTest.cs (.../MacroStabilityInwardsFailureMechanismSectionResultRowTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -50,8 +50,8 @@ [TestFixture] public class MacroStabilityInwardsFailureMechanismSectionResultRowTest { - private static MacroStabilityInwardsFailureMechanismSectionResultRow.ConstructionProperties ConstructionProperties => - new MacroStabilityInwardsFailureMechanismSectionResultRow.ConstructionProperties + private static MacroStabilityInwardsFailureMechanismSectionResultRowOld.ConstructionProperties ConstructionProperties => + new MacroStabilityInwardsFailureMechanismSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = 1, DetailedAssessmentResultIndex = 2, @@ -78,7 +78,7 @@ var result = new MacroStabilityInwardsFailureMechanismSectionResultOld(section); // Call - void Call() => new MacroStabilityInwardsFailureMechanismSectionResultRow(result, Enumerable.Empty(), + void Call() => new MacroStabilityInwardsFailureMechanismSectionResultRowOld(result, Enumerable.Empty(), null, assessmentSection, ConstructionProperties); // Assert @@ -95,7 +95,7 @@ var result = new MacroStabilityInwardsFailureMechanismSectionResultOld(section); // Call - void Call() => new MacroStabilityInwardsFailureMechanismSectionResultRow(result, Enumerable.Empty(), + void Call() => new MacroStabilityInwardsFailureMechanismSectionResultRowOld(result, Enumerable.Empty(), new MacroStabilityInwardsFailureMechanism(), null, ConstructionProperties); // Assert @@ -115,7 +115,7 @@ var result = new MacroStabilityInwardsFailureMechanismSectionResultOld(section); // Call - void Call() => new MacroStabilityInwardsFailureMechanismSectionResultRow(result, Enumerable.Empty(), + void Call() => new MacroStabilityInwardsFailureMechanismSectionResultRowOld(result, Enumerable.Empty(), new MacroStabilityInwardsFailureMechanism(), assessmentSection, null); // Assert @@ -136,7 +136,7 @@ var result = new MacroStabilityInwardsFailureMechanismSectionResultOld(section); // Call - void Call() => new MacroStabilityInwardsFailureMechanismSectionResultRow(result, null, new MacroStabilityInwardsFailureMechanism(), + void Call() => new MacroStabilityInwardsFailureMechanismSectionResultRowOld(result, null, new MacroStabilityInwardsFailureMechanism(), assessmentSection, ConstructionProperties); // Assert @@ -165,14 +165,14 @@ // Call using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityInwardsFailureMechanismSectionResultRow(result, + var row = new MacroStabilityInwardsFailureMechanismSectionResultRowOld(result, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert - Assert.IsInstanceOf>(row); + Assert.IsInstanceOf>(row); Assert.AreEqual(result.SimpleAssessmentResult, row.SimpleAssessmentResult); Assert.AreEqual(result.DetailedAssessmentResult, row.DetailedAssessmentResult); Assert.AreEqual(result.GetDetailedAssessmentProbability(calculationScenarios, failureMechanism.GeneralInput.ModelFactor), @@ -182,14 +182,14 @@ Assert.AreEqual(result.UseManualAssembly, row.UseManualAssembly); Assert.AreEqual(result.ManualAssemblyProbability, row.ManualAssemblyProbability); - TestHelper.AssertTypeConverter( - nameof(MacroStabilityInwardsFailureMechanismSectionResultRow.DetailedAssessmentProbability)); - TestHelper.AssertTypeConverter( - nameof(MacroStabilityInwardsFailureMechanismSectionResultRow.TailorMadeAssessmentProbability)); - TestHelper.AssertTypeConverter( - nameof(MacroStabilityInwardsFailureMechanismSectionResultRow.CombinedAssemblyProbability)); - TestHelper.AssertTypeConverter( - nameof(MacroStabilityInwardsFailureMechanismSectionResultRow.ManualAssemblyProbability)); + TestHelper.AssertTypeConverter( + nameof(MacroStabilityInwardsFailureMechanismSectionResultRowOld.DetailedAssessmentProbability)); + TestHelper.AssertTypeConverter( + nameof(MacroStabilityInwardsFailureMechanismSectionResultRowOld.TailorMadeAssessmentProbability)); + TestHelper.AssertTypeConverter( + nameof(MacroStabilityInwardsFailureMechanismSectionResultRowOld.CombinedAssemblyProbability)); + TestHelper.AssertTypeConverter( + nameof(MacroStabilityInwardsFailureMechanismSectionResultRowOld.ManualAssemblyProbability)); IDictionary columnStateDefinitions = row.ColumnStateDefinitions; Assert.AreEqual(11, columnStateDefinitions.Count); @@ -241,7 +241,7 @@ random.NextEnumValue()); // Call - var row = new MacroStabilityInwardsFailureMechanismSectionResultRow(result, + var row = new MacroStabilityInwardsFailureMechanismSectionResultRowOld(result, Enumerable.Empty(), failureMechanism, assessmentSection, @@ -279,7 +279,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityInwardsFailureMechanismSectionResultRow( + var row = new MacroStabilityInwardsFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); bool originalValue = result.UseManualAssembly; bool newValue = !originalValue; @@ -316,7 +316,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityInwardsFailureMechanismSectionResultRow( + var row = new MacroStabilityInwardsFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); // Call @@ -348,7 +348,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityInwardsFailureMechanismSectionResultRow( + var row = new MacroStabilityInwardsFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); // Call @@ -391,7 +391,7 @@ calculator.CombinedAssemblyOutput = new FailureMechanismSectionAssembly( random.NextDouble(), random.NextEnumValue()); - var row = new MacroStabilityInwardsFailureMechanismSectionResultRow(result, + var row = new MacroStabilityInwardsFailureMechanismSectionResultRowOld(result, Enumerable.Empty(), failureMechanism, assessmentSection, @@ -443,7 +443,7 @@ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; calculator.ThrowExceptionOnCalculate = true; - var row = new MacroStabilityInwardsFailureMechanismSectionResultRow(result, + var row = new MacroStabilityInwardsFailureMechanismSectionResultRowOld(result, Enumerable.Empty(), failureMechanism, assessmentSection, @@ -505,7 +505,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new MacroStabilityInwardsFailureMechanismSectionResultRow( + var row = new MacroStabilityInwardsFailureMechanismSectionResultRowOld( result, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -552,7 +552,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new MacroStabilityInwardsFailureMechanismSectionResultRow( + var row = new MacroStabilityInwardsFailureMechanismSectionResultRowOld( result, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -589,7 +589,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new MacroStabilityInwardsFailureMechanismSectionResultRow( + var row = new MacroStabilityInwardsFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -626,7 +626,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new MacroStabilityInwardsFailureMechanismSectionResultRow( + var row = new MacroStabilityInwardsFailureMechanismSectionResultRowOld( result, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -693,7 +693,7 @@ calculator.CombinedAssemblyCategoryOutput = assemblyCategoryGroup; // Call - var row = new MacroStabilityInwardsFailureMechanismSectionResultRow(result, + var row = new MacroStabilityInwardsFailureMechanismSectionResultRowOld(result, Enumerable.Empty(), failureMechanism, assessmentSection, @@ -741,7 +741,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new MacroStabilityInwardsFailureMechanismSectionResultRow( + var resultRow = new MacroStabilityInwardsFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -781,7 +781,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new MacroStabilityInwardsFailureMechanismSectionResultRow( + var resultRow = new MacroStabilityInwardsFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -825,7 +825,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new MacroStabilityInwardsFailureMechanismSectionResultRow( + var resultRow = new MacroStabilityInwardsFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -865,7 +865,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new MacroStabilityInwardsFailureMechanismSectionResultRow( + var resultRow = new MacroStabilityInwardsFailureMechanismSectionResultRowOld( sectionResult, Enumerable.Empty(), failureMechanism, @@ -902,7 +902,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new MacroStabilityInwardsFailureMechanismSectionResultRow( + var resultRow = new MacroStabilityInwardsFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -945,7 +945,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityInwardsFailureMechanismSectionResultRow(result, + var row = new MacroStabilityInwardsFailureMechanismSectionResultRowOld(result, Enumerable.Empty(), failureMechanism, assessmentSection, @@ -981,7 +981,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityInwardsFailureMechanismSectionResultRow( + var row = new MacroStabilityInwardsFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); // Call @@ -1008,7 +1008,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new MacroStabilityInwardsFailureMechanismSectionResultRow(sectionResult, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); + var resultRow = new MacroStabilityInwardsFailureMechanismSectionResultRowOld(sectionResult, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); // Call double detailedAssessmentProbability = resultRow.DetailedAssessmentProbability; @@ -1037,7 +1037,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new MacroStabilityInwardsFailureMechanismSectionResultRow( + var resultRow = new MacroStabilityInwardsFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -1076,7 +1076,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new MacroStabilityInwardsFailureMechanismSectionResultRow( + var resultRow = new MacroStabilityInwardsFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -1114,7 +1114,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new MacroStabilityInwardsFailureMechanismSectionResultRow( + var resultRow = new MacroStabilityInwardsFailureMechanismSectionResultRowOld( sectionResult, calculationScenarios, failureMechanism, @@ -1152,7 +1152,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityInwardsFailureMechanismSectionResultRow( + var row = new MacroStabilityInwardsFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); // Call @@ -1187,7 +1187,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityInwardsFailureMechanismSectionResultRow( + var row = new MacroStabilityInwardsFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); // Call @@ -1219,7 +1219,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new MacroStabilityInwardsFailureMechanismSectionResultRow( + var row = new MacroStabilityInwardsFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); // Call Index: Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingFailureMechanismResultViewOld.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingFailureMechanismResultViewOld.cs (.../PipingFailureMechanismResultViewOld.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingFailureMechanismResultViewOld.cs (.../PipingFailureMechanismResultViewOld.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -36,7 +36,7 @@ /// The view for the . /// public class PipingFailureMechanismResultViewOld : FailureMechanismResultViewOld { @@ -99,14 +99,14 @@ base.Dispose(disposing); } - protected override PipingFailureMechanismSectionResultRow CreateFailureMechanismSectionResultRow(PipingFailureMechanismSectionResultOld sectionResult) + protected override PipingFailureMechanismSectionResultRowOld CreateFailureMechanismSectionResultRow(PipingFailureMechanismSectionResultOld sectionResult) { - return new PipingFailureMechanismSectionResultRow( + return new PipingFailureMechanismSectionResultRowOld( sectionResult, FailureMechanism.Calculations.OfType(), FailureMechanism, assessmentSection, - new PipingFailureMechanismSectionResultRow.ConstructionProperties + new PipingFailureMechanismSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = simpleAssessmentResultIndex, DetailedAssessmentResultIndex = detailedAssessmentResultIndex, @@ -126,55 +126,55 @@ { FailureMechanismSectionResultViewColumnBuilder.AddSectionNameColumn( DataGridViewControl, - nameof(PipingFailureMechanismSectionResultRow.Name)); + nameof(PipingFailureMechanismSectionResultRowOld.Name)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssessmentResultColumn( DataGridViewControl, - nameof(PipingFailureMechanismSectionResultRow.SimpleAssessmentResult)); + nameof(PipingFailureMechanismSectionResultRowOld.SimpleAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentProbabilityOnlyResultColumn( DataGridViewControl, - nameof(PipingFailureMechanismSectionResultRow.DetailedAssessmentResult)); + nameof(PipingFailureMechanismSectionResultRowOld.DetailedAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentProbabilityColumn( DataGridViewControl, - nameof(PipingFailureMechanismSectionResultRow.DetailedAssessmentProbability)); + nameof(PipingFailureMechanismSectionResultRowOld.DetailedAssessmentProbability)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentProbabilityCalculationResultColumn( DataGridViewControl, - nameof(PipingFailureMechanismSectionResultRow.TailorMadeAssessmentResult)); + nameof(PipingFailureMechanismSectionResultRowOld.TailorMadeAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentProbabilityColumn( DataGridViewControl, - nameof(PipingFailureMechanismSectionResultRow.TailorMadeAssessmentProbability)); + nameof(PipingFailureMechanismSectionResultRowOld.TailorMadeAssessmentProbability)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(PipingFailureMechanismSectionResultRow.SimpleAssemblyCategoryGroup)); + nameof(PipingFailureMechanismSectionResultRowOld.SimpleAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(PipingFailureMechanismSectionResultRow.DetailedAssemblyCategoryGroup)); + nameof(PipingFailureMechanismSectionResultRowOld.DetailedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(PipingFailureMechanismSectionResultRow.TailorMadeAssemblyCategoryGroup)); + nameof(PipingFailureMechanismSectionResultRowOld.TailorMadeAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddCombinedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(PipingFailureMechanismSectionResultRow.CombinedAssemblyCategoryGroup)); + nameof(PipingFailureMechanismSectionResultRowOld.CombinedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddCombinedAssemblyProbabilityColumn( DataGridViewControl, - nameof(PipingFailureMechanismSectionResultRow.CombinedAssemblyProbability)); + nameof(PipingFailureMechanismSectionResultRowOld.CombinedAssemblyProbability)); FailureMechanismSectionResultViewColumnBuilder.AddUseManualAssemblyColumn( DataGridViewControl, - nameof(PipingFailureMechanismSectionResultRow.UseManualAssembly)); + nameof(PipingFailureMechanismSectionResultRowOld.UseManualAssembly)); FailureMechanismSectionResultViewColumnBuilder.AddManualAssemblyProbabilityColumn( DataGridViewControl, - nameof(PipingFailureMechanismSectionResultRow.ManualAssemblyProbability)); + nameof(PipingFailureMechanismSectionResultRowOld.ManualAssemblyProbability)); } protected override void RefreshDataGrid() Fisheye: Tag ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b refers to a dead (removed) revision in file `Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingFailureMechanismSectionResultRow.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingFailureMechanismSectionResultRowOld.cs =================================================================== diff -u --- Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingFailureMechanismSectionResultRowOld.cs (revision 0) +++ Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingFailureMechanismSectionResultRowOld.cs (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -0,0 +1,496 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using Core.Common.Controls.DataGrid; +using Riskeer.AssemblyTool.Data; +using Riskeer.Common.Data.AssessmentSection; +using Riskeer.Common.Data.Exceptions; +using Riskeer.Common.Forms.Helpers; +using Riskeer.Common.Forms.TypeConverters; +using Riskeer.Common.Forms.Views; +using Riskeer.Common.Primitives; +using Riskeer.Piping.Data; +using Riskeer.Piping.Data.SemiProbabilistic; + +namespace Riskeer.Piping.Forms.Views +{ + /// + /// This class represents a row of . + /// + public class PipingFailureMechanismSectionResultRowOld : FailureMechanismSectionResultRowOld + { + private readonly int simpleAssessmentResultIndex; + private readonly int detailedAssessmentResultIndex; + private readonly int detailedAssessmentProbabilityIndex; + private readonly int tailorMadeAssessmentResultIndex; + private readonly int tailorMadeAssessmentProbabilityIndex; + private readonly int simpleAssemblyCategoryGroupIndex; + private readonly int detailedAssemblyCategoryGroupIndex; + private readonly int tailorMadeAssemblyCategoryGroupIndex; + private readonly int combinedAssemblyCategoryGroupIndex; + private readonly int combinedAssemblyProbabilityIndex; + private readonly int manualAssemblyProbabilityIndex; + + private readonly IEnumerable calculations; + private readonly PipingFailureMechanism failureMechanism; + private readonly IAssessmentSection assessmentSection; + private FailureMechanismSectionAssemblyCategoryGroup simpleAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup detailedAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup combinedAssemblyCategoryGroup; + + /// + /// Creates a new instance of . + /// + /// The that is + /// the source of this row. + /// All calculations in the failure mechanism. + /// The failure mechanism the section result belongs to. + /// The assessment section the section result belongs to. + /// The property values required to create an instance of + /// . + /// Throw when any parameter is null. + /// Thrown when + /// is a valid value, but unsupported. + internal PipingFailureMechanismSectionResultRowOld(PipingFailureMechanismSectionResultOld sectionResult, + IEnumerable calculations, + PipingFailureMechanism failureMechanism, + IAssessmentSection assessmentSection, + ConstructionProperties constructionProperties) + : base(sectionResult) + { + if (calculations == null) + { + throw new ArgumentNullException(nameof(calculations)); + } + + if (failureMechanism == null) + { + throw new ArgumentNullException(nameof(failureMechanism)); + } + + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + if (constructionProperties == null) + { + throw new ArgumentNullException(nameof(constructionProperties)); + } + + this.calculations = calculations; + this.failureMechanism = failureMechanism; + this.assessmentSection = assessmentSection; + + simpleAssessmentResultIndex = constructionProperties.SimpleAssessmentResultIndex; + detailedAssessmentResultIndex = constructionProperties.DetailedAssessmentResultIndex; + detailedAssessmentProbabilityIndex = constructionProperties.DetailedAssessmentProbabilityIndex; + tailorMadeAssessmentResultIndex = constructionProperties.TailorMadeAssessmentResultIndex; + tailorMadeAssessmentProbabilityIndex = constructionProperties.TailorMadeAssessmentProbabilityIndex; + simpleAssemblyCategoryGroupIndex = constructionProperties.SimpleAssemblyCategoryGroupIndex; + detailedAssemblyCategoryGroupIndex = constructionProperties.DetailedAssemblyCategoryGroupIndex; + tailorMadeAssemblyCategoryGroupIndex = constructionProperties.TailorMadeAssemblyCategoryGroupIndex; + combinedAssemblyCategoryGroupIndex = constructionProperties.CombinedAssemblyCategoryGroupIndex; + combinedAssemblyProbabilityIndex = constructionProperties.CombinedAssemblyProbabilityIndex; + manualAssemblyProbabilityIndex = constructionProperties.ManualAssemblyProbabilityIndex; + + CreateColumnStateDefinitions(); + + Update(); + } + + /// + /// Gets or sets the value representing the simple assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public SimpleAssessmentResultType SimpleAssessmentResult + { + get => SectionResult.SimpleAssessmentResult; + set + { + SectionResult.SimpleAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value representing the detailed assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentProbabilityOnlyResultType DetailedAssessmentResult + { + get => SectionResult.DetailedAssessmentResult; + set + { + SectionResult.DetailedAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets the detailed assessment probability a of the . + /// + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double DetailedAssessmentProbability => SectionResult.GetDetailedAssessmentProbability(calculations, assessmentSection.FailureMechanismContribution.Norm); + + /// + /// Gets or sets the value representing the tailor made assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public TailorMadeAssessmentProbabilityCalculationResultType TailorMadeAssessmentResult + { + get => SectionResult.TailorMadeAssessmentResult; + set + { + SectionResult.TailorMadeAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value of the tailored assessment of safety. + /// + /// Thrown when is + /// not in the range [0,1]. + /// Thrown when + /// is a valid value, but unsupported. + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double TailorMadeAssessmentProbability + { + get => SectionResult.TailorMadeAssessmentProbability; + set + { + SectionResult.TailorMadeAssessmentProbability = value; + UpdateInternalData(); + } + } + + /// + /// Gets the simple assembly category group. + /// + public string SimpleAssemblyCategoryGroup => FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(simpleAssemblyCategoryGroup); + + /// + /// Gets the detailed assembly category group. + /// + public string DetailedAssemblyCategoryGroup => FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(detailedAssemblyCategoryGroup); + + /// + /// Gets the tailor made assembly category group. + /// + public string TailorMadeAssemblyCategoryGroup => FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(tailorMadeAssemblyCategoryGroup); + + /// + /// Gets the combined assembly category group. + /// + public string CombinedAssemblyCategoryGroup => FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(combinedAssemblyCategoryGroup); + + /// + /// Gets the combined assembly probability. + /// + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double CombinedAssemblyProbability { get; private set; } + + /// + /// Gets or sets the indicator whether the combined assembly probability + /// should be overwritten by . + /// + /// Thrown when + /// is a valid value, but unsupported. + public bool UseManualAssembly + { + get => SectionResult.UseManualAssembly; + set + { + SectionResult.UseManualAssembly = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the manually entered assembly probability. + /// + /// Thrown when is + /// not in the range [0,1]. + /// Thrown when + /// is a valid value, but unsupported. + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double ManualAssemblyProbability + { + get => SectionResult.ManualAssemblyProbability; + set + { + SectionResult.ManualAssemblyProbability = value; + UpdateInternalData(); + } + } + + public override void Update() + { + UpdateDerivedData(); + UpdateColumnStateDefinitions(); + UpdateDetailedAssessmentProbabilityError(); + } + + private void UpdateDetailedAssessmentProbabilityError() + { + if (FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(SimpleAssessmentResult) + || !FailureMechanismSectionResultRowHelper.DetailedAssessmentResultIsProbability(DetailedAssessmentResult) + || UseManualAssembly) + { + ColumnStateDefinitions[detailedAssessmentProbabilityIndex].ErrorText = string.Empty; + } + else + { + ColumnStateDefinitions[detailedAssessmentProbabilityIndex].ErrorText = FailureMechanismSectionResultRowHelper.GetDetailedAssessmentProbabilityError( + SectionResult.GetCalculationScenarios(calculations).ToArray(), + scenarios => SectionResult.GetTotalContribution(scenarios), + scenarios => SectionResult.GetDetailedAssessmentProbability(scenarios, assessmentSection.FailureMechanismContribution.Norm)); + } + } + + private void CreateColumnStateDefinitions() + { + ColumnStateDefinitions.Add(simpleAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentProbabilityIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssessmentProbabilityIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(simpleAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(combinedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(combinedAssemblyProbabilityIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(manualAssemblyProbabilityIndex, new DataGridViewColumnStateDefinition()); + } + + private void UpdateDerivedData() + { + ResetErrorTexts(); + TryGetSimpleAssemblyCategoryGroup(); + TryGetDetailedAssemblyCategoryGroup(); + TryGetTailorMadeAssemblyCategoryGroup(); + TryGetCombinedAssemblyCategoryGroup(); + } + + private void ResetErrorTexts() + { + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[combinedAssemblyProbabilityIndex].ErrorText = string.Empty; + } + + private void TryGetSimpleAssemblyCategoryGroup() + { + try + { + simpleAssemblyCategoryGroup = PipingFailureMechanismAssemblyFactory.AssembleSimpleAssessment(SectionResult).Group; + } + catch (AssemblyException e) + { + simpleAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetDetailedAssemblyCategoryGroup() + { + try + { + detailedAssemblyCategoryGroup = PipingFailureMechanismAssemblyFactory.AssembleDetailedAssessment( + SectionResult, + calculations, + failureMechanism, + assessmentSection).Group; + } + catch (AssemblyException e) + { + detailedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetTailorMadeAssemblyCategoryGroup() + { + try + { + tailorMadeAssemblyCategoryGroup = PipingFailureMechanismAssemblyFactory.AssembleTailorMadeAssessment( + SectionResult, + failureMechanism, + assessmentSection).Group; + } + catch (AssemblyException e) + { + tailorMadeAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetCombinedAssemblyCategoryGroup() + { + try + { + FailureMechanismSectionAssembly combinedAssembly = + PipingFailureMechanismAssemblyFactory.AssembleCombinedAssessment( + SectionResult, + calculations, + failureMechanism, + assessmentSection); + + combinedAssemblyCategoryGroup = combinedAssembly.Group; + CombinedAssemblyProbability = combinedAssembly.Probability; + } + catch (AssemblyException e) + { + combinedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + CombinedAssemblyProbability = double.NaN; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = e.Message; + ColumnStateDefinitions[combinedAssemblyProbabilityIndex].ErrorText = e.Message; + } + } + + /// + /// Updates the column state definitions. + /// + /// Thrown when + /// is a valid value, but unsupported. + private void UpdateColumnStateDefinitions() + { + bool simpleAssessmentSufficient = FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(SimpleAssessmentResult); + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[simpleAssessmentResultIndex], UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultIndex], simpleAssessmentSufficient + || UseManualAssembly); + if (simpleAssessmentSufficient + || !FailureMechanismSectionResultRowHelper.DetailedAssessmentResultIsProbability(DetailedAssessmentResult) + || UseManualAssembly) + { + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[detailedAssessmentProbabilityIndex]); + } + else + { + ColumnStateHelper.EnableColumn(ColumnStateDefinitions[detailedAssessmentProbabilityIndex], true); + } + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentResultIndex], + simpleAssessmentSufficient + || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentProbabilityIndex], + simpleAssessmentSufficient + || !FailureMechanismSectionResultRowHelper.TailorMadeAssessmentResultIsProbability(TailorMadeAssessmentResult) + || UseManualAssembly); + + if (UseManualAssembly) + { + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[combinedAssemblyProbabilityIndex]); + } + else + { + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex], + simpleAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex], + detailedAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex], + tailorMadeAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex], + combinedAssemblyCategoryGroup); + ColumnStateHelper.EnableColumn(ColumnStateDefinitions[combinedAssemblyProbabilityIndex], true); + } + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[manualAssemblyProbabilityIndex], !UseManualAssembly); + } + + /// + /// Class holding the various construction parameters for . + /// + public class ConstructionProperties + { + /// + /// Sets the simple assessment result index. + /// + public int SimpleAssessmentResultIndex { internal get; set; } + + /// + /// Sets the detailed assessment result index. + /// + public int DetailedAssessmentResultIndex { internal get; set; } + + /// + /// Sets the detailed assessment probability index. + /// + public int DetailedAssessmentProbabilityIndex { internal get; set; } + + /// + /// Sets the tailor made assessment result index. + /// + public int TailorMadeAssessmentResultIndex { internal get; set; } + + /// + /// Sets the tailor made assessment probability index. + /// + public int TailorMadeAssessmentProbabilityIndex { internal get; set; } + + /// + /// Sets the simple assembly category group index. + /// + public int SimpleAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the detailed assembly category group index. + /// + public int DetailedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the tailor made assembly category group index. + /// + public int TailorMadeAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly category group index. + /// + public int CombinedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly probability index. + /// + public int CombinedAssemblyProbabilityIndex { internal get; set; } + + /// + /// Sets the manual assembly category group index. + /// + public int ManualAssemblyProbabilityIndex { internal get; set; } + } + } +} \ No newline at end of file Index: Riskeer/Piping/test/Riskeer.Piping.Forms.Test/Views/PipingFailureMechanismResultViewTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Piping/test/Riskeer.Piping.Forms.Test/Views/PipingFailureMechanismResultViewTest.cs (.../PipingFailureMechanismResultViewTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Piping/test/Riskeer.Piping.Forms.Test/Views/PipingFailureMechanismResultViewTest.cs (.../PipingFailureMechanismResultViewTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -90,7 +90,7 @@ { // Assert Assert.IsInstanceOf>(view); Assert.IsNull(view.Data); @@ -248,7 +248,7 @@ using (ShowFailureMechanismResultsView(failureMechanism)) { DataGridView dataGridView = GetDataGridView(); - var row = (PipingFailureMechanismSectionResultRow) dataGridView.Rows[0].DataBoundItem; + var row = (PipingFailureMechanismSectionResultRowOld) dataGridView.Rows[0].DataBoundItem; var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; @@ -276,7 +276,7 @@ PipingFailureMechanismResultViewOld, PipingFailureMechanism, PipingFailureMechanismSectionResultOld, - PipingFailureMechanismSectionResultRow, + PipingFailureMechanismSectionResultRowOld, SemiProbabilisticPipingCalculationScenario> { protected override PipingFailureMechanismResultViewOld CreateResultView(PipingFailureMechanism failureMechanism) Index: Riskeer/Piping/test/Riskeer.Piping.Forms.Test/Views/PipingFailureMechanismSectionResultRowTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/Piping/test/Riskeer.Piping.Forms.Test/Views/PipingFailureMechanismSectionResultRowTest.cs (.../PipingFailureMechanismSectionResultRowTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/Piping/test/Riskeer.Piping.Forms.Test/Views/PipingFailureMechanismSectionResultRowTest.cs (.../PipingFailureMechanismSectionResultRowTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -52,8 +52,8 @@ [TestFixture] public class PipingFailureMechanismSectionResultRowTest { - private static PipingFailureMechanismSectionResultRow.ConstructionProperties ConstructionProperties => - new PipingFailureMechanismSectionResultRow.ConstructionProperties + private static PipingFailureMechanismSectionResultRowOld.ConstructionProperties ConstructionProperties => + new PipingFailureMechanismSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = 1, DetailedAssessmentResultIndex = 2, @@ -80,7 +80,7 @@ var result = new PipingFailureMechanismSectionResultOld(section); // Call - void Call() => new PipingFailureMechanismSectionResultRow(result, Enumerable.Empty(), null, + void Call() => new PipingFailureMechanismSectionResultRowOld(result, Enumerable.Empty(), null, assessmentSection, ConstructionProperties); // Assert @@ -97,7 +97,7 @@ var result = new PipingFailureMechanismSectionResultOld(section); // Call - void Call() => new PipingFailureMechanismSectionResultRow(result, Enumerable.Empty(), + void Call() => new PipingFailureMechanismSectionResultRowOld(result, Enumerable.Empty(), new PipingFailureMechanism(), null, ConstructionProperties); // Assert @@ -117,7 +117,7 @@ var result = new PipingFailureMechanismSectionResultOld(section); // Call - void Call() => new PipingFailureMechanismSectionResultRow(result, Enumerable.Empty(), + void Call() => new PipingFailureMechanismSectionResultRowOld(result, Enumerable.Empty(), new PipingFailureMechanism(), assessmentSection, null); // Assert @@ -138,7 +138,7 @@ var result = new PipingFailureMechanismSectionResultOld(section); // Call - void Call() => new PipingFailureMechanismSectionResultRow(result, null, new PipingFailureMechanism(), + void Call() => new PipingFailureMechanismSectionResultRowOld(result, null, new PipingFailureMechanism(), assessmentSection, ConstructionProperties); // Assert @@ -167,14 +167,14 @@ // Call using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new PipingFailureMechanismSectionResultRow(result, + var row = new PipingFailureMechanismSectionResultRowOld(result, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert - Assert.IsInstanceOf>(row); + Assert.IsInstanceOf>(row); Assert.AreEqual(result.SimpleAssessmentResult, row.SimpleAssessmentResult); Assert.AreEqual(result.DetailedAssessmentResult, row.DetailedAssessmentResult); Assert.AreEqual(result.GetDetailedAssessmentProbability(calculationScenarios, assessmentSection.FailureMechanismContribution.Norm), @@ -184,14 +184,14 @@ Assert.AreEqual(result.UseManualAssembly, row.UseManualAssembly); Assert.AreEqual(result.ManualAssemblyProbability, row.ManualAssemblyProbability); - TestHelper.AssertTypeConverter( - nameof(PipingFailureMechanismSectionResultRow.DetailedAssessmentProbability)); - TestHelper.AssertTypeConverter( - nameof(PipingFailureMechanismSectionResultRow.TailorMadeAssessmentProbability)); - TestHelper.AssertTypeConverter( - nameof(PipingFailureMechanismSectionResultRow.CombinedAssemblyProbability)); - TestHelper.AssertTypeConverter( - nameof(PipingFailureMechanismSectionResultRow.ManualAssemblyProbability)); + TestHelper.AssertTypeConverter( + nameof(PipingFailureMechanismSectionResultRowOld.DetailedAssessmentProbability)); + TestHelper.AssertTypeConverter( + nameof(PipingFailureMechanismSectionResultRowOld.TailorMadeAssessmentProbability)); + TestHelper.AssertTypeConverter( + nameof(PipingFailureMechanismSectionResultRowOld.CombinedAssemblyProbability)); + TestHelper.AssertTypeConverter( + nameof(PipingFailureMechanismSectionResultRowOld.ManualAssemblyProbability)); IDictionary columnStateDefinitions = row.ColumnStateDefinitions; Assert.AreEqual(11, columnStateDefinitions.Count); @@ -243,7 +243,7 @@ random.NextEnumValue()); // Call - var row = new PipingFailureMechanismSectionResultRow(result, + var row = new PipingFailureMechanismSectionResultRowOld(result, Enumerable.Empty(), failureMechanism, assessmentSection, @@ -281,7 +281,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new PipingFailureMechanismSectionResultRow( + var row = new PipingFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); bool originalValue = result.UseManualAssembly; bool newValue = !originalValue; @@ -318,7 +318,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new PipingFailureMechanismSectionResultRow( + var row = new PipingFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); // Call @@ -350,7 +350,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new PipingFailureMechanismSectionResultRow( + var row = new PipingFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); // Call @@ -393,7 +393,7 @@ calculator.CombinedAssemblyOutput = new FailureMechanismSectionAssembly( random.NextDouble(), random.NextEnumValue()); - var row = new PipingFailureMechanismSectionResultRow(result, + var row = new PipingFailureMechanismSectionResultRowOld(result, Enumerable.Empty(), failureMechanism, assessmentSection, @@ -445,7 +445,7 @@ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; calculator.ThrowExceptionOnCalculate = true; - var row = new PipingFailureMechanismSectionResultRow(result, + var row = new PipingFailureMechanismSectionResultRowOld(result, Enumerable.Empty(), failureMechanism, assessmentSection, @@ -507,7 +507,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new PipingFailureMechanismSectionResultRow( + var row = new PipingFailureMechanismSectionResultRowOld( result, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -554,7 +554,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new PipingFailureMechanismSectionResultRow( + var row = new PipingFailureMechanismSectionResultRowOld( result, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -591,7 +591,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new PipingFailureMechanismSectionResultRow( + var row = new PipingFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -628,7 +628,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new PipingFailureMechanismSectionResultRow( + var row = new PipingFailureMechanismSectionResultRowOld( result, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -695,7 +695,7 @@ calculator.CombinedAssemblyCategoryOutput = assemblyCategoryGroup; // Call - var row = new PipingFailureMechanismSectionResultRow(result, + var row = new PipingFailureMechanismSectionResultRowOld(result, Enumerable.Empty(), failureMechanism, assessmentSection, @@ -743,7 +743,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new PipingFailureMechanismSectionResultRow( + var resultRow = new PipingFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -783,7 +783,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new PipingFailureMechanismSectionResultRow( + var resultRow = new PipingFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -827,7 +827,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new PipingFailureMechanismSectionResultRow( + var resultRow = new PipingFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -867,7 +867,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new PipingFailureMechanismSectionResultRow( + var resultRow = new PipingFailureMechanismSectionResultRowOld( sectionResult, Enumerable.Empty(), failureMechanism, @@ -909,7 +909,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new PipingFailureMechanismSectionResultRow( + var resultRow = new PipingFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -952,7 +952,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new PipingFailureMechanismSectionResultRow(result, + var row = new PipingFailureMechanismSectionResultRowOld(result, Enumerable.Empty(), failureMechanism, assessmentSection, @@ -988,7 +988,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new PipingFailureMechanismSectionResultRow( + var row = new PipingFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); // Call @@ -1015,7 +1015,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new PipingFailureMechanismSectionResultRow(sectionResult, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); + var resultRow = new PipingFailureMechanismSectionResultRowOld(sectionResult, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); // Call double detailedAssessmentProbability = resultRow.DetailedAssessmentProbability; @@ -1044,7 +1044,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new PipingFailureMechanismSectionResultRow( + var resultRow = new PipingFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -1083,7 +1083,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new PipingFailureMechanismSectionResultRow( + var resultRow = new PipingFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -1121,7 +1121,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new PipingFailureMechanismSectionResultRow( + var resultRow = new PipingFailureMechanismSectionResultRowOld( sectionResult, calculationScenarios, failureMechanism, @@ -1159,7 +1159,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new PipingFailureMechanismSectionResultRow( + var row = new PipingFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); // Call @@ -1194,7 +1194,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new PipingFailureMechanismSectionResultRow( + var row = new PipingFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); // Call @@ -1226,7 +1226,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new PipingFailureMechanismSectionResultRow( + var row = new PipingFailureMechanismSectionResultRowOld( result, Enumerable.Empty(), failureMechanism, assessmentSection, ConstructionProperties); // Call Index: Riskeer/StabilityPointStructures/src/Riskeer.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismResultViewOld.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/StabilityPointStructures/src/Riskeer.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismResultViewOld.cs (.../StabilityPointStructuresFailureMechanismResultViewOld.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/StabilityPointStructures/src/Riskeer.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismResultViewOld.cs (.../StabilityPointStructuresFailureMechanismResultViewOld.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -37,7 +37,7 @@ /// for stability point structures. /// public class StabilityPointStructuresFailureMechanismResultViewOld : FailureMechanismResultViewOld { @@ -94,14 +94,14 @@ calculationGroupObserver.Observable = observableGroup; } - protected override StabilityPointStructuresFailureMechanismSectionResultRow CreateFailureMechanismSectionResultRow(StabilityPointStructuresFailureMechanismSectionResultOld sectionResult) + protected override StabilityPointStructuresFailureMechanismSectionResultRowOld CreateFailureMechanismSectionResultRow(StabilityPointStructuresFailureMechanismSectionResultOld sectionResult) { - return new StabilityPointStructuresFailureMechanismSectionResultRow( + return new StabilityPointStructuresFailureMechanismSectionResultRowOld( sectionResult, FailureMechanism.Calculations.Cast>(), FailureMechanism, assessmentSection, - new StabilityPointStructuresFailureMechanismSectionResultRow.ConstructionProperties + new StabilityPointStructuresFailureMechanismSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = simpleAssessmentResultIndex, DetailedAssessmentResultIndex = detailedAssessmentResultIndex, @@ -129,55 +129,55 @@ { FailureMechanismSectionResultViewColumnBuilder.AddSectionNameColumn( DataGridViewControl, - nameof(StabilityPointStructuresFailureMechanismSectionResultRow.Name)); + nameof(StabilityPointStructuresFailureMechanismSectionResultRowOld.Name)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssessmentValidityOnlyResultColumn( DataGridViewControl, - nameof(StabilityPointStructuresFailureMechanismSectionResultRow.SimpleAssessmentResult)); + nameof(StabilityPointStructuresFailureMechanismSectionResultRowOld.SimpleAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentProbabilityOnlyResultColumn( DataGridViewControl, - nameof(StabilityPointStructuresFailureMechanismSectionResultRow.DetailedAssessmentResult)); + nameof(StabilityPointStructuresFailureMechanismSectionResultRowOld.DetailedAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentProbabilityColumn( DataGridViewControl, - nameof(StabilityPointStructuresFailureMechanismSectionResultRow.DetailedAssessmentProbability)); + nameof(StabilityPointStructuresFailureMechanismSectionResultRowOld.DetailedAssessmentProbability)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentProbabilityCalculationResultColumn( DataGridViewControl, - nameof(StabilityPointStructuresFailureMechanismSectionResultRow.TailorMadeAssessmentResult)); + nameof(StabilityPointStructuresFailureMechanismSectionResultRowOld.TailorMadeAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentProbabilityColumn( DataGridViewControl, - nameof(StabilityPointStructuresFailureMechanismSectionResultRow.TailorMadeAssessmentProbability)); + nameof(StabilityPointStructuresFailureMechanismSectionResultRowOld.TailorMadeAssessmentProbability)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(StabilityPointStructuresFailureMechanismSectionResultRow.SimpleAssemblyCategoryGroup)); + nameof(StabilityPointStructuresFailureMechanismSectionResultRowOld.SimpleAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(StabilityPointStructuresFailureMechanismSectionResultRow.DetailedAssemblyCategoryGroup)); + nameof(StabilityPointStructuresFailureMechanismSectionResultRowOld.DetailedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(StabilityPointStructuresFailureMechanismSectionResultRow.TailorMadeAssemblyCategoryGroup)); + nameof(StabilityPointStructuresFailureMechanismSectionResultRowOld.TailorMadeAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddCombinedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(StabilityPointStructuresFailureMechanismSectionResultRow.CombinedAssemblyCategoryGroup)); + nameof(StabilityPointStructuresFailureMechanismSectionResultRowOld.CombinedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddCombinedAssemblyProbabilityColumn( DataGridViewControl, - nameof(StabilityPointStructuresFailureMechanismSectionResultRow.CombinedAssemblyProbability)); + nameof(StabilityPointStructuresFailureMechanismSectionResultRowOld.CombinedAssemblyProbability)); FailureMechanismSectionResultViewColumnBuilder.AddUseManualAssemblyColumn( DataGridViewControl, - nameof(StabilityPointStructuresFailureMechanismSectionResultRow.UseManualAssembly)); + nameof(StabilityPointStructuresFailureMechanismSectionResultRowOld.UseManualAssembly)); FailureMechanismSectionResultViewColumnBuilder.AddManualAssemblyProbabilityColumn( DataGridViewControl, - nameof(StabilityPointStructuresFailureMechanismSectionResultRow.ManualAssemblyProbability)); + nameof(StabilityPointStructuresFailureMechanismSectionResultRowOld.ManualAssemblyProbability)); } protected override void RefreshDataGrid() Fisheye: Tag ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b refers to a dead (removed) revision in file `Riskeer/StabilityPointStructures/src/Riskeer.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismSectionResultRow.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/StabilityPointStructures/src/Riskeer.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismSectionResultRowOld.cs =================================================================== diff -u --- Riskeer/StabilityPointStructures/src/Riskeer.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismSectionResultRowOld.cs (revision 0) +++ Riskeer/StabilityPointStructures/src/Riskeer.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismSectionResultRowOld.cs (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -0,0 +1,499 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using Core.Common.Controls.DataGrid; +using Riskeer.AssemblyTool.Data; +using Riskeer.Common.Data.AssessmentSection; +using Riskeer.Common.Data.Exceptions; +using Riskeer.Common.Data.Structures; +using Riskeer.Common.Forms.Helpers; +using Riskeer.Common.Forms.TypeConverters; +using Riskeer.Common.Forms.Views; +using Riskeer.Common.Primitives; +using Riskeer.StabilityPointStructures.Data; + +namespace Riskeer.StabilityPointStructures.Forms.Views +{ + /// + /// This class represents a row of for stability point structures + /// + public class StabilityPointStructuresFailureMechanismSectionResultRowOld + : FailureMechanismSectionResultRowOld + { + private readonly int simpleAssessmentResultIndex; + private readonly int detailedAssessmentResultIndex; + private readonly int detailedAssessmentProbabilityIndex; + private readonly int tailorMadeAssessmentResultIndex; + private readonly int tailorMadeAssessmentProbabilityIndex; + private readonly int simpleAssemblyCategoryGroupIndex; + private readonly int detailedAssemblyCategoryGroupIndex; + private readonly int tailorMadeAssemblyCategoryGroupIndex; + private readonly int combinedAssemblyCategoryGroupIndex; + private readonly int combinedAssemblyProbabilityIndex; + private readonly int manualAssemblyProbabilityIndex; + + private readonly IEnumerable> calculationScenarios; + private readonly StabilityPointStructuresFailureMechanism failureMechanism; + private readonly IAssessmentSection assessmentSection; + + private FailureMechanismSectionAssemblyCategoryGroup simpleAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup detailedAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup combinedAssemblyCategoryGroup; + + /// + /// Creates a new instance of . + /// + /// The to wrap + /// so that it can be displayed as a row. + /// All calculation scenarios in the failure mechanism. + /// The failure mechanism the result belongs to. + /// The assessment section the result belongs to. + /// /// The property values required to create an instance of + /// . + /// Thrown when any parameter is null. + /// Thrown when + /// is a valid value, but unsupported. + internal StabilityPointStructuresFailureMechanismSectionResultRowOld(StabilityPointStructuresFailureMechanismSectionResultOld sectionResult, + IEnumerable> calculationScenarios, + StabilityPointStructuresFailureMechanism failureMechanism, + IAssessmentSection assessmentSection, + ConstructionProperties constructionProperties) + : base(sectionResult) + { + if (calculationScenarios == null) + { + throw new ArgumentNullException(nameof(calculationScenarios)); + } + + if (failureMechanism == null) + { + throw new ArgumentNullException(nameof(failureMechanism)); + } + + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + if (constructionProperties == null) + { + throw new ArgumentNullException(nameof(constructionProperties)); + } + + this.calculationScenarios = calculationScenarios; + this.failureMechanism = failureMechanism; + this.assessmentSection = assessmentSection; + + simpleAssessmentResultIndex = constructionProperties.SimpleAssessmentResultIndex; + detailedAssessmentResultIndex = constructionProperties.DetailedAssessmentResultIndex; + detailedAssessmentProbabilityIndex = constructionProperties.DetailedAssessmentProbabilityIndex; + tailorMadeAssessmentResultIndex = constructionProperties.TailorMadeAssessmentResultIndex; + tailorMadeAssessmentProbabilityIndex = constructionProperties.TailorMadeAssessmentProbabilityIndex; + simpleAssemblyCategoryGroupIndex = constructionProperties.SimpleAssemblyCategoryGroupIndex; + detailedAssemblyCategoryGroupIndex = constructionProperties.DetailedAssemblyCategoryGroupIndex; + tailorMadeAssemblyCategoryGroupIndex = constructionProperties.TailorMadeAssemblyCategoryGroupIndex; + combinedAssemblyCategoryGroupIndex = constructionProperties.CombinedAssemblyCategoryGroupIndex; + combinedAssemblyProbabilityIndex = constructionProperties.CombinedAssemblyProbabilityIndex; + manualAssemblyProbabilityIndex = constructionProperties.ManualAssemblyProbabilityIndex; + + CreateColumnStateDefinitions(); + + Update(); + } + + /// + /// Gets or sets the value representing the simple assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public SimpleAssessmentValidityOnlyResultType SimpleAssessmentResult + { + get => SectionResult.SimpleAssessmentResult; + set + { + SectionResult.SimpleAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value representing the detailed assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentProbabilityOnlyResultType DetailedAssessmentResult + { + get => SectionResult.DetailedAssessmentResult; + set + { + SectionResult.DetailedAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets the value representing the detailed assessment probability. + /// + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double DetailedAssessmentProbability => SectionResult.GetDetailedAssessmentProbability(calculationScenarios); + + /// + /// Gets or sets the value representing the tailor made assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public TailorMadeAssessmentProbabilityCalculationResultType TailorMadeAssessmentResult + { + get => SectionResult.TailorMadeAssessmentResult; + set + { + SectionResult.TailorMadeAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value of the tailored assessment of safety. + /// + /// Thrown when + /// is outside of the valid ranges. + /// Thrown when + /// is a valid value, but unsupported. + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double TailorMadeAssessmentProbability + { + get => SectionResult.TailorMadeAssessmentProbability; + set + { + SectionResult.TailorMadeAssessmentProbability = value; + UpdateInternalData(); + } + } + + /// + /// Gets the simple assembly category group. + /// + public string SimpleAssemblyCategoryGroup => FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(simpleAssemblyCategoryGroup); + + /// + /// Gets the detailed assembly category group. + /// + public string DetailedAssemblyCategoryGroup => FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(detailedAssemblyCategoryGroup); + + /// + /// Gets the tailor made assembly category group. + /// + public string TailorMadeAssemblyCategoryGroup => FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(tailorMadeAssemblyCategoryGroup); + + /// + /// Gets the combined assembly category group. + /// + public string CombinedAssemblyCategoryGroup => FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(combinedAssemblyCategoryGroup); + + /// + /// Gets the combined assembly probability. + /// + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double CombinedAssemblyProbability { get; private set; } + + /// + /// Gets or sets the indicator whether the combined assembly probability + /// should be overwritten by . + /// + /// Thrown when + /// is a valid value, but unsupported. + public bool UseManualAssembly + { + get => SectionResult.UseManualAssembly; + set + { + SectionResult.UseManualAssembly = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the manually entered assembly probability. + /// + /// Thrown when is + /// not in the range [0,1]. + /// Thrown when + /// is a valid value, but unsupported. + [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] + public double ManualAssemblyProbability + { + get => SectionResult.ManualAssemblyProbability; + set + { + SectionResult.ManualAssemblyProbability = value; + UpdateInternalData(); + } + } + + public override void Update() + { + UpdateDerivedData(); + UpdateColumnStateDefinitions(); + UpdateDetailedAssessmentProbabilityError(); + } + + private void UpdateDetailedAssessmentProbabilityError() + { + if (FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(SimpleAssessmentResult) + || !FailureMechanismSectionResultRowHelper.DetailedAssessmentResultIsProbability(DetailedAssessmentResult) + || UseManualAssembly) + { + ColumnStateDefinitions[detailedAssessmentProbabilityIndex].ErrorText = string.Empty; + } + else + { + ColumnStateDefinitions[detailedAssessmentProbabilityIndex].ErrorText = FailureMechanismSectionResultRowHelper.GetDetailedAssessmentProbabilityError( + SectionResult.GetCalculationScenarios(calculationScenarios).ToArray(), + scenarios => SectionResult.GetTotalContribution(scenarios), + scenarios => SectionResult.GetDetailedAssessmentProbability(scenarios)); + } + } + + private void CreateColumnStateDefinitions() + { + ColumnStateDefinitions.Add(simpleAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentProbabilityIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssessmentProbabilityIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(simpleAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(combinedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(combinedAssemblyProbabilityIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(manualAssemblyProbabilityIndex, new DataGridViewColumnStateDefinition()); + } + + private void UpdateDerivedData() + { + ResetErrorTexts(); + TryGetSimpleAssemblyCategoryGroup(); + TryGetDetailedAssemblyCategoryGroup(); + TryGetTailorMadeAssemblyCategoryGroup(); + TryGetCombinedAssemblyCategoryGroup(); + } + + private void ResetErrorTexts() + { + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[combinedAssemblyProbabilityIndex].ErrorText = string.Empty; + } + + private void TryGetSimpleAssemblyCategoryGroup() + { + try + { + simpleAssemblyCategoryGroup = StabilityPointStructuresFailureMechanismAssemblyFactory.AssembleSimpleAssessment(SectionResult).Group; + } + catch (AssemblyException e) + { + simpleAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetDetailedAssemblyCategoryGroup() + { + try + { + detailedAssemblyCategoryGroup = StabilityPointStructuresFailureMechanismAssemblyFactory.AssembleDetailedAssessment( + SectionResult, + calculationScenarios, + failureMechanism, + assessmentSection).Group; + } + catch (AssemblyException e) + { + detailedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetTailorMadeAssemblyCategoryGroup() + { + try + { + tailorMadeAssemblyCategoryGroup = StabilityPointStructuresFailureMechanismAssemblyFactory.AssembleTailorMadeAssessment( + SectionResult, + failureMechanism, + assessmentSection).Group; + } + catch (AssemblyException e) + { + tailorMadeAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = e.Message; + } + } + + private void TryGetCombinedAssemblyCategoryGroup() + { + try + { + FailureMechanismSectionAssembly combinedAssembly = + StabilityPointStructuresFailureMechanismAssemblyFactory.AssembleCombinedAssessment( + SectionResult, + calculationScenarios, + failureMechanism, + assessmentSection); + + combinedAssemblyCategoryGroup = combinedAssembly.Group; + CombinedAssemblyProbability = combinedAssembly.Probability; + } + catch (AssemblyException e) + { + combinedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + CombinedAssemblyProbability = double.NaN; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = e.Message; + ColumnStateDefinitions[combinedAssemblyProbabilityIndex].ErrorText = e.Message; + } + } + + /// + /// Updates the column state definitions. + /// + /// Thrown when + /// is a valid value, but unsupported. + private void UpdateColumnStateDefinitions() + { + bool simpleAssessmentSufficient = FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(SimpleAssessmentResult); + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[simpleAssessmentResultIndex], UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultIndex], simpleAssessmentSufficient + || UseManualAssembly); + + if (simpleAssessmentSufficient + || !FailureMechanismSectionResultRowHelper.DetailedAssessmentResultIsProbability(DetailedAssessmentResult) + || UseManualAssembly) + { + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[detailedAssessmentProbabilityIndex]); + } + else + { + ColumnStateHelper.EnableColumn(ColumnStateDefinitions[detailedAssessmentProbabilityIndex], true); + } + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentResultIndex], + simpleAssessmentSufficient + || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentProbabilityIndex], + simpleAssessmentSufficient + || !FailureMechanismSectionResultRowHelper.TailorMadeAssessmentResultIsProbability(TailorMadeAssessmentResult) + || UseManualAssembly); + + if (UseManualAssembly) + { + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[combinedAssemblyProbabilityIndex]); + } + else + { + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex], + simpleAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex], + detailedAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex], + tailorMadeAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex], + combinedAssemblyCategoryGroup); + ColumnStateHelper.EnableColumn(ColumnStateDefinitions[combinedAssemblyProbabilityIndex], true); + } + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[manualAssemblyProbabilityIndex], !UseManualAssembly); + } + + /// + /// Class holding the various construction parameters for . + /// + public class ConstructionProperties + { + /// + /// Sets the simple assessment result index. + /// + public int SimpleAssessmentResultIndex { internal get; set; } + + /// + /// Sets the detailed assessment result index. + /// + public int DetailedAssessmentResultIndex { internal get; set; } + + /// + /// Sets the detailed assessment probability index. + /// + public int DetailedAssessmentProbabilityIndex { internal get; set; } + + /// + /// Sets the tailor made assessment result index. + /// + public int TailorMadeAssessmentResultIndex { internal get; set; } + + /// + /// Sets the tailor made assessment probability index. + /// + public int TailorMadeAssessmentProbabilityIndex { internal get; set; } + + /// + /// Sets the simple assembly category group index. + /// + public int SimpleAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the detailed assembly category group index. + /// + public int DetailedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the tailor made assembly category group index. + /// + public int TailorMadeAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly category group index. + /// + public int CombinedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly probability index. + /// + public int CombinedAssemblyProbabilityIndex { internal get; set; } + + /// + /// Sets the manual assembly category group index. + /// + public int ManualAssemblyProbabilityIndex { internal get; set; } + } + } +} \ No newline at end of file Index: Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismResultViewTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismResultViewTest.cs (.../StabilityPointStructuresFailureMechanismResultViewTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismResultViewTest.cs (.../StabilityPointStructuresFailureMechanismResultViewTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -89,7 +89,7 @@ { // Assert Assert.IsInstanceOf>(view); Assert.IsNull(view.Data); @@ -248,7 +248,7 @@ using (ShowFailureMechanismResultsView(failureMechanism)) { DataGridView dataGridView = GetDataGridView(); - var row = (StabilityPointStructuresFailureMechanismSectionResultRow) dataGridView.Rows[0].DataBoundItem; + var row = (StabilityPointStructuresFailureMechanismSectionResultRowOld) dataGridView.Rows[0].DataBoundItem; var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; @@ -276,7 +276,7 @@ StabilityPointStructuresFailureMechanismResultViewOld, StabilityPointStructuresFailureMechanism, StabilityPointStructuresFailureMechanismSectionResultOld, - StabilityPointStructuresFailureMechanismSectionResultRow, + StabilityPointStructuresFailureMechanismSectionResultRowOld, StructuresCalculation> { protected override StabilityPointStructuresFailureMechanismResultViewOld CreateResultView(StabilityPointStructuresFailureMechanism failureMechanism) Index: Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismSectionResultRowTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismSectionResultRowTest.cs (.../StabilityPointStructuresFailureMechanismSectionResultRowTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismSectionResultRowTest.cs (.../StabilityPointStructuresFailureMechanismSectionResultRowTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -51,8 +51,8 @@ [TestFixture] public class StabilityPointStructuresFailureMechanismSectionResultRowTest { - private static StabilityPointStructuresFailureMechanismSectionResultRow.ConstructionProperties ConstructionProperties => - new StabilityPointStructuresFailureMechanismSectionResultRow.ConstructionProperties + private static StabilityPointStructuresFailureMechanismSectionResultRowOld.ConstructionProperties ConstructionProperties => + new StabilityPointStructuresFailureMechanismSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = 1, DetailedAssessmentResultIndex = 2, @@ -79,7 +79,7 @@ var result = new StabilityPointStructuresFailureMechanismSectionResultOld(section); // Call - void Call() => new StabilityPointStructuresFailureMechanismSectionResultRow( + void Call() => new StabilityPointStructuresFailureMechanismSectionResultRowOld( result, null, new StabilityPointStructuresFailureMechanism(), assessmentSection, ConstructionProperties); @@ -101,7 +101,7 @@ var result = new StabilityPointStructuresFailureMechanismSectionResultOld(section); // Call - void Call() => new StabilityPointStructuresFailureMechanismSectionResultRow( + void Call() => new StabilityPointStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), null, assessmentSection, ConstructionProperties); @@ -119,7 +119,7 @@ var result = new StabilityPointStructuresFailureMechanismSectionResultOld(section); // Call - void Call() => new StabilityPointStructuresFailureMechanismSectionResultRow( + void Call() => new StabilityPointStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), new StabilityPointStructuresFailureMechanism(), null, ConstructionProperties); @@ -140,7 +140,7 @@ var result = new StabilityPointStructuresFailureMechanismSectionResultOld(section); // Call - void Call() => new StabilityPointStructuresFailureMechanismSectionResultRow( + void Call() => new StabilityPointStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), new StabilityPointStructuresFailureMechanism(), assessmentSection, null); @@ -171,11 +171,11 @@ // Call using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new StabilityPointStructuresFailureMechanismSectionResultRow( + var row = new StabilityPointStructuresFailureMechanismSectionResultRowOld( result, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert - Assert.IsInstanceOf>(row); + Assert.IsInstanceOf>(row); IDictionary columnStateDefinitions = row.ColumnStateDefinitions; Assert.AreEqual(11, columnStateDefinitions.Count); @@ -200,12 +200,12 @@ Assert.AreEqual(result.UseManualAssembly, row.UseManualAssembly); Assert.AreEqual(result.ManualAssemblyProbability, row.ManualAssemblyProbability); - TestHelper.AssertTypeConverter( - nameof(StabilityPointStructuresFailureMechanismSectionResultRow.DetailedAssessmentProbability)); - TestHelper.AssertTypeConverter( - nameof(StabilityPointStructuresFailureMechanismSectionResultRow.TailorMadeAssessmentProbability)); - TestHelper.AssertTypeConverter( - nameof(StabilityPointStructuresFailureMechanismSectionResultRow.CombinedAssemblyProbability)); + TestHelper.AssertTypeConverter( + nameof(StabilityPointStructuresFailureMechanismSectionResultRowOld.DetailedAssessmentProbability)); + TestHelper.AssertTypeConverter( + nameof(StabilityPointStructuresFailureMechanismSectionResultRowOld.TailorMadeAssessmentProbability)); + TestHelper.AssertTypeConverter( + nameof(StabilityPointStructuresFailureMechanismSectionResultRowOld.CombinedAssemblyProbability)); mocks.VerifyAll(); } } @@ -242,7 +242,7 @@ random.NextEnumValue()); // Call - var row = new StabilityPointStructuresFailureMechanismSectionResultRow( + var row = new StabilityPointStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -290,7 +290,7 @@ calculator.CombinedAssemblyOutput = new FailureMechanismSectionAssembly( random.NextDouble(), random.NextEnumValue()); - var row = new StabilityPointStructuresFailureMechanismSectionResultRow( + var row = new StabilityPointStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -340,7 +340,7 @@ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; calculator.ThrowExceptionOnCalculate = true; - var row = new StabilityPointStructuresFailureMechanismSectionResultRow( + var row = new StabilityPointStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -387,7 +387,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new StabilityPointStructuresFailureMechanismSectionResultRow( + var row = new StabilityPointStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); bool originalValue = result.UseManualAssembly; @@ -425,7 +425,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new StabilityPointStructuresFailureMechanismSectionResultRow( + var row = new StabilityPointStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -458,7 +458,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new StabilityPointStructuresFailureMechanismSectionResultRow( + var row = new StabilityPointStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -503,7 +503,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new StabilityPointStructuresFailureMechanismSectionResultRow( + var row = new StabilityPointStructuresFailureMechanismSectionResultRowOld( result, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -551,7 +551,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new StabilityPointStructuresFailureMechanismSectionResultRow( + var row = new StabilityPointStructuresFailureMechanismSectionResultRowOld( result, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -588,7 +588,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new StabilityPointStructuresFailureMechanismSectionResultRow( + var row = new StabilityPointStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -627,7 +627,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new StabilityPointStructuresFailureMechanismSectionResultRow( + var row = new StabilityPointStructuresFailureMechanismSectionResultRowOld( result, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -694,7 +694,7 @@ calculator.CombinedAssemblyCategoryOutput = assemblyCategoryGroup; // Call - var row = new StabilityPointStructuresFailureMechanismSectionResultRow( + var row = new StabilityPointStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -739,7 +739,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow( + var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -779,7 +779,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow( + var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -823,7 +823,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow( + var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -863,7 +863,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow( + var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRowOld( sectionResult, Enumerable.Empty>(), failureMechanism, @@ -904,7 +904,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow( + var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -943,7 +943,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow( + var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRowOld( sectionResult, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -977,7 +977,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow( + var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRowOld( sectionResult, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -1011,7 +1011,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow( + var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRowOld( sectionResult, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -1045,7 +1045,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow( + var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRowOld( sectionResult, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Assert @@ -1114,7 +1114,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new StabilityPointStructuresFailureMechanismSectionResultRow( + var row = new StabilityPointStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -1148,7 +1148,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new StabilityPointStructuresFailureMechanismSectionResultRow( + var row = new StabilityPointStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -1176,7 +1176,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow( + var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRowOld( sectionResult, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -1209,7 +1209,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow( + var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRowOld( sectionResult, calculationScenarios, failureMechanism, assessmentSection, ConstructionProperties); // Call @@ -1239,7 +1239,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow( + var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -1278,7 +1278,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow( + var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRowOld( sectionResult, new[] { @@ -1318,7 +1318,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new StabilityPointStructuresFailureMechanismSectionResultRow( + var row = new StabilityPointStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), failureMechanism, assessmentSection, ConstructionProperties); @@ -1354,7 +1354,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new StabilityPointStructuresFailureMechanismSectionResultRow( + var row = new StabilityPointStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), new StabilityPointStructuresFailureMechanism(), assessmentSection, ConstructionProperties); @@ -1387,7 +1387,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new StabilityPointStructuresFailureMechanismSectionResultRow( + var row = new StabilityPointStructuresFailureMechanismSectionResultRowOld( result, Enumerable.Empty>(), new StabilityPointStructuresFailureMechanism(), assessmentSection, ConstructionProperties); Index: Riskeer/StabilityStoneCover/src/Riskeer.StabilityStoneCover.Forms/Views/StabilityStoneCoverResultViewOld.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/StabilityStoneCover/src/Riskeer.StabilityStoneCover.Forms/Views/StabilityStoneCoverResultViewOld.cs (.../StabilityStoneCoverResultViewOld.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/StabilityStoneCover/src/Riskeer.StabilityStoneCover.Forms/Views/StabilityStoneCoverResultViewOld.cs (.../StabilityStoneCoverResultViewOld.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -31,7 +31,7 @@ /// The view for a collection of . /// public class StabilityStoneCoverResultViewOld : FailureMechanismResultViewOld { @@ -56,11 +56,11 @@ StabilityStoneCoverFailureMechanism failureMechanism) : base(failureMechanismSectionResults, failureMechanism) {} - protected override StabilityStoneCoverSectionResultRow CreateFailureMechanismSectionResultRow(StabilityStoneCoverFailureMechanismSectionResultOld sectionResult) + protected override StabilityStoneCoverSectionResultRowOld CreateFailureMechanismSectionResultRow(StabilityStoneCoverFailureMechanismSectionResultOld sectionResult) { - return new StabilityStoneCoverSectionResultRow( + return new StabilityStoneCoverSectionResultRowOld( sectionResult, - new StabilityStoneCoverSectionResultRow.ConstructionProperties + new StabilityStoneCoverSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = simpleAssessmentResultIndex, DetailedAssessmentResultForFactorizedSignalingNormIndex = detailedAssessmentResultForFactorizedSignalingNormIndex, @@ -81,59 +81,59 @@ { FailureMechanismSectionResultViewColumnBuilder.AddSectionNameColumn( DataGridViewControl, - nameof(StabilityStoneCoverSectionResultRow.Name)); + nameof(StabilityStoneCoverSectionResultRowOld.Name)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssessmentValidityOnlyResultColumn( DataGridViewControl, - nameof(StabilityStoneCoverSectionResultRow.SimpleAssessmentResult)); + nameof(StabilityStoneCoverSectionResultRowOld.SimpleAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultForFactorizedSignalingNormColumn( DataGridViewControl, - nameof(StabilityStoneCoverSectionResultRow.DetailedAssessmentResultForFactorizedSignalingNorm)); + nameof(StabilityStoneCoverSectionResultRowOld.DetailedAssessmentResultForFactorizedSignalingNorm)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultForSignalingNormColumn( DataGridViewControl, - nameof(StabilityStoneCoverSectionResultRow.DetailedAssessmentResultForSignalingNorm)); + nameof(StabilityStoneCoverSectionResultRowOld.DetailedAssessmentResultForSignalingNorm)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultForMechanismSpecificLowerLimitNormColumn( DataGridViewControl, - nameof(StabilityStoneCoverSectionResultRow.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm)); + nameof(StabilityStoneCoverSectionResultRowOld.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultForLowerLimitNormColumn( DataGridViewControl, - nameof(StabilityStoneCoverSectionResultRow.DetailedAssessmentResultForLowerLimitNorm)); + nameof(StabilityStoneCoverSectionResultRowOld.DetailedAssessmentResultForLowerLimitNorm)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultForFactorizedLowerLimitNormColumn( DataGridViewControl, - nameof(StabilityStoneCoverSectionResultRow.DetailedAssessmentResultForFactorizedLowerLimitNorm)); + nameof(StabilityStoneCoverSectionResultRowOld.DetailedAssessmentResultForFactorizedLowerLimitNorm)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentCategoryGroupColumn( DataGridViewControl, - nameof(StabilityStoneCoverSectionResultRow.TailorMadeAssessmentResult)); + nameof(StabilityStoneCoverSectionResultRowOld.TailorMadeAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(StabilityStoneCoverSectionResultRow.SimpleAssemblyCategoryGroup)); + nameof(StabilityStoneCoverSectionResultRowOld.SimpleAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(StabilityStoneCoverSectionResultRow.DetailedAssemblyCategoryGroup)); + nameof(StabilityStoneCoverSectionResultRowOld.DetailedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(StabilityStoneCoverSectionResultRow.TailorMadeAssemblyCategoryGroup)); + nameof(StabilityStoneCoverSectionResultRowOld.TailorMadeAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddCombinedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(StabilityStoneCoverSectionResultRow.CombinedAssemblyCategoryGroup)); + nameof(StabilityStoneCoverSectionResultRowOld.CombinedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddUseManualAssemblyColumn( DataGridViewControl, - nameof(StabilityStoneCoverSectionResultRow.UseManualAssembly)); + nameof(StabilityStoneCoverSectionResultRowOld.UseManualAssembly)); FailureMechanismSectionResultViewColumnBuilder.AddSelectableAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(StabilityStoneCoverSectionResultRow.ManualAssemblyCategoryGroup)); + nameof(StabilityStoneCoverSectionResultRowOld.ManualAssemblyCategoryGroup)); } protected override void UpdateAssemblyResultControl() Fisheye: Tag ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b refers to a dead (removed) revision in file `Riskeer/StabilityStoneCover/src/Riskeer.StabilityStoneCover.Forms/Views/StabilityStoneCoverSectionResultRow.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/StabilityStoneCover/src/Riskeer.StabilityStoneCover.Forms/Views/StabilityStoneCoverSectionResultRowOld.cs =================================================================== diff -u --- Riskeer/StabilityStoneCover/src/Riskeer.StabilityStoneCover.Forms/Views/StabilityStoneCoverSectionResultRowOld.cs (revision 0) +++ Riskeer/StabilityStoneCover/src/Riskeer.StabilityStoneCover.Forms/Views/StabilityStoneCoverSectionResultRowOld.cs (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -0,0 +1,509 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Controls.DataGrid; +using Riskeer.AssemblyTool.Data; +using Riskeer.AssemblyTool.Forms; +using Riskeer.Common.Data.Exceptions; +using Riskeer.Common.Forms.Helpers; +using Riskeer.Common.Forms.Views; +using Riskeer.Common.Primitives; +using Riskeer.StabilityStoneCover.Data; + +namespace Riskeer.StabilityStoneCover.Forms.Views +{ + /// + /// Class for displaying + /// as a row in a grid view. + /// + public class StabilityStoneCoverSectionResultRowOld : FailureMechanismSectionResultRowOld + { + private readonly int simpleAssessmentResultIndex; + private readonly int detailedAssessmentResultForFactorizedSignalingNormIndex; + private readonly int detailedAssessmentResultForSignalingNormIndex; + private readonly int detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex; + private readonly int detailedAssessmentResultForLowerLimitNormIndex; + private readonly int detailedAssessmentResultForFactorizedLowerLimitNormIndex; + private readonly int tailorMadeAssessmentResultIndex; + private readonly int simpleAssemblyCategoryGroupIndex; + private readonly int detailedAssemblyCategoryGroupIndex; + private readonly int tailorMadeAssemblyCategoryGroupIndex; + private readonly int combinedAssemblyCategoryGroupIndex; + private readonly int manualAssemblyCategoryGroupIndex; + + private FailureMechanismSectionAssemblyCategoryGroup simpleAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup detailedAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup combinedAssemblyCategoryGroup; + + /// + /// Creates a new instance of . + /// + /// The + /// to wrap so that it can be displayed as a row. + /// The property values required to create an instance of + /// . + /// Thrown when any parameter is null. + /// Thrown when + /// is a valid value, but unsupported. + internal StabilityStoneCoverSectionResultRowOld(StabilityStoneCoverFailureMechanismSectionResultOld sectionResult, + ConstructionProperties constructionProperties) + : base(sectionResult) + { + if (constructionProperties == null) + { + throw new ArgumentNullException(nameof(constructionProperties)); + } + + simpleAssessmentResultIndex = constructionProperties.SimpleAssessmentResultIndex; + detailedAssessmentResultForFactorizedSignalingNormIndex = constructionProperties.DetailedAssessmentResultForFactorizedSignalingNormIndex; + detailedAssessmentResultForSignalingNormIndex = constructionProperties.DetailedAssessmentResultForSignalingNormIndex; + detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex = constructionProperties.DetailedAssessmentResultForMechanismSpecificLowerLimitNormIndex; + detailedAssessmentResultForLowerLimitNormIndex = constructionProperties.DetailedAssessmentResultForLowerLimitNormIndex; + detailedAssessmentResultForFactorizedLowerLimitNormIndex = constructionProperties.DetailedAssessmentResultForFactorizedLowerLimitNormIndex; + tailorMadeAssessmentResultIndex = constructionProperties.TailorMadeAssessmentResultIndex; + simpleAssemblyCategoryGroupIndex = constructionProperties.SimpleAssemblyCategoryGroupIndex; + detailedAssemblyCategoryGroupIndex = constructionProperties.DetailedAssemblyCategoryGroupIndex; + tailorMadeAssemblyCategoryGroupIndex = constructionProperties.TailorMadeAssemblyCategoryGroupIndex; + combinedAssemblyCategoryGroupIndex = constructionProperties.CombinedAssemblyCategoryGroupIndex; + manualAssemblyCategoryGroupIndex = constructionProperties.ManualAssemblyCategoryGroupIndex; + + CreateColumnStateDefinitions(); + + Update(); + } + + /// + /// Gets or sets the value representing the simple assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public SimpleAssessmentValidityOnlyResultType SimpleAssessmentResult + { + get + { + return SectionResult.SimpleAssessmentResult; + } + set + { + SectionResult.SimpleAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value of the detailed assessment of safety per failure mechanism section + /// for the factorized signaling norm (Category boundary Iv). + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentResultType DetailedAssessmentResultForFactorizedSignalingNorm + { + get + { + return SectionResult.DetailedAssessmentResultForFactorizedSignalingNorm; + } + set + { + SectionResult.DetailedAssessmentResultForFactorizedSignalingNorm = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value of the detailed assessment of safety per failure mechanism section + /// for the signaling norm (Category boundary IIv). + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentResultType DetailedAssessmentResultForSignalingNorm + { + get + { + return SectionResult.DetailedAssessmentResultForSignalingNorm; + } + set + { + SectionResult.DetailedAssessmentResultForSignalingNorm = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value of the detailed assessment of safety per failure mechanism section + /// for the failure mechanism specific lower limit norm (Category boundary IIIv). + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentResultType DetailedAssessmentResultForMechanismSpecificLowerLimitNorm + { + get + { + return SectionResult.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm; + } + set + { + SectionResult.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value of the detailed assessment of safety per failure mechanism section + /// for the lower limit norm (Category boundary IVv). + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentResultType DetailedAssessmentResultForLowerLimitNorm + { + get + { + return SectionResult.DetailedAssessmentResultForLowerLimitNorm; + } + set + { + SectionResult.DetailedAssessmentResultForLowerLimitNorm = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value of the detailed assessment of safety per failure mechanism section + /// for the factorized lower limit norm (Category boundary Vv). + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentResultType DetailedAssessmentResultForFactorizedLowerLimitNorm + { + get + { + return SectionResult.DetailedAssessmentResultForFactorizedLowerLimitNorm; + } + set + { + SectionResult.DetailedAssessmentResultForFactorizedLowerLimitNorm = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the tailor made assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public TailorMadeAssessmentCategoryGroupResultType TailorMadeAssessmentResult + { + get + { + return SectionResult.TailorMadeAssessmentResult; + } + set + { + SectionResult.TailorMadeAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets the simple assembly category group. + /// + public string SimpleAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(simpleAssemblyCategoryGroup); + } + } + + /// + /// Gets the detailed assembly category group. + /// + public string DetailedAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(detailedAssemblyCategoryGroup); + } + } + + /// + /// Gets the tailor made assembly category group. + /// + public string TailorMadeAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(tailorMadeAssemblyCategoryGroup); + } + } + + /// + /// Gets the combined assembly category group. + /// + public string CombinedAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(combinedAssemblyCategoryGroup); + } + } + + /// + /// Gets or sets the indicator whether the combined assembly should be overwritten by . + /// + /// Thrown when + /// is a valid value, but unsupported. + public bool UseManualAssembly + { + get + { + return SectionResult.UseManualAssembly; + } + set + { + SectionResult.UseManualAssembly = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the manually selected assembly category group. + /// + /// Thrown when + /// is a valid value, but unsupported. + public SelectableFailureMechanismSectionAssemblyCategoryGroup ManualAssemblyCategoryGroup + { + get + { + return SelectableFailureMechanismSectionAssemblyCategoryGroupConverter.ConvertTo(SectionResult.ManualAssemblyCategoryGroup); + } + set + { + SectionResult.ManualAssemblyCategoryGroup = SelectableFailureMechanismSectionAssemblyCategoryGroupConverter.ConvertFrom(value); + UpdateInternalData(); + } + } + + public override void Update() + { + UpdateDerivedData(); + UpdateColumnStateDefinitionStates(); + } + + private void CreateColumnStateDefinitions() + { + ColumnStateDefinitions.Add(simpleAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultForFactorizedSignalingNormIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultForSignalingNormIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultForLowerLimitNormIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultForFactorizedLowerLimitNormIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(simpleAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(combinedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(manualAssemblyCategoryGroupIndex, new DataGridViewColumnStateDefinition()); + } + + private void UpdateDerivedData() + { + ResetErrorTexts(); + TryGetSimpleAssemblyCategoryGroup(); + TryGetDetailedAssemblyCategoryGroup(); + TryGetTailorMadeAssemblyCategoryGroup(); + TryGetCombinedAssemblyCategoryGroup(); + } + + private void ResetErrorTexts() + { + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + } + + private void TryGetSimpleAssemblyCategoryGroup() + { + try + { + simpleAssemblyCategoryGroup = StabilityStoneCoverFailureMechanismAssemblyFactory.AssembleSimpleAssessment(SectionResult); + } + catch (AssemblyException e) + { + simpleAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = e.InnerException.Message; + } + } + + private void TryGetDetailedAssemblyCategoryGroup() + { + try + { + detailedAssemblyCategoryGroup = StabilityStoneCoverFailureMechanismAssemblyFactory.AssembleDetailedAssessment(SectionResult); + } + catch (AssemblyException e) + { + detailedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = e.InnerException.Message; + } + } + + private void TryGetTailorMadeAssemblyCategoryGroup() + { + try + { + tailorMadeAssemblyCategoryGroup = StabilityStoneCoverFailureMechanismAssemblyFactory.AssembleTailorMadeAssessment(SectionResult); + } + catch (AssemblyException e) + { + tailorMadeAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = e.InnerException.Message; + } + } + + private void TryGetCombinedAssemblyCategoryGroup() + { + try + { + combinedAssemblyCategoryGroup = StabilityStoneCoverFailureMechanismAssemblyFactory.AssembleCombinedAssessment( + SectionResult); + } + catch (AssemblyException e) + { + combinedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = e.InnerException.Message; + } + } + + /// + /// Updates the column state definitions. + /// + /// Thrown when + /// is a valid value, but unsupported. + private void UpdateColumnStateDefinitionStates() + { + bool simpleAssessmentSufficient = FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(SimpleAssessmentResult); + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[simpleAssessmentResultIndex], UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultForFactorizedSignalingNormIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultForSignalingNormIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultForLowerLimitNormIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultForFactorizedLowerLimitNormIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentResultIndex], + simpleAssessmentSufficient || UseManualAssembly); + + if (UseManualAssembly) + { + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex]); + } + else + { + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex], + simpleAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex], + detailedAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex], + tailorMadeAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex], + combinedAssemblyCategoryGroup); + } + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[manualAssemblyCategoryGroupIndex], !UseManualAssembly); + } + + /// + /// Class holding the various construction parameters for . + /// + public class ConstructionProperties + { + /// + /// Sets the simple assessment result index. + /// + public int SimpleAssessmentResultIndex { internal get; set; } + + /// + /// Sets the detailed assessment result for factorized signaling norm index. + /// + public int DetailedAssessmentResultForFactorizedSignalingNormIndex { internal get; set; } + + /// + /// Sets the detailed assessment result for signaling norm index. + /// + public int DetailedAssessmentResultForSignalingNormIndex { internal get; set; } + + /// + /// Sets the detailed assessment result for mechanism specific lower limit norm index. + /// + public int DetailedAssessmentResultForMechanismSpecificLowerLimitNormIndex { internal get; set; } + + /// + /// Sets the detailed assessment result for lower limit norm index. + /// + public int DetailedAssessmentResultForLowerLimitNormIndex { internal get; set; } + + /// + /// Sets the detailed assessment result for factorized lower limit norm index. + /// + public int DetailedAssessmentResultForFactorizedLowerLimitNormIndex { internal get; set; } + + /// + /// Sets the tailor made assessment result index. + /// + public int TailorMadeAssessmentResultIndex { internal get; set; } + + /// + /// Sets the simple assembly category group index. + /// + public int SimpleAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the detailed assembly category group index. + /// + public int DetailedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the tailor made assembly category group index. + /// + public int TailorMadeAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly category group index. + /// + public int CombinedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the manual assembly category group index. + /// + public int ManualAssemblyCategoryGroupIndex { internal get; set; } + } + } +} \ No newline at end of file Index: Riskeer/StabilityStoneCover/test/Riskeer.StabilityStoneCover.Forms.Test/Views/StabilityStoneCoverResultViewTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/StabilityStoneCover/test/Riskeer.StabilityStoneCover.Forms.Test/Views/StabilityStoneCoverResultViewTest.cs (.../StabilityStoneCoverResultViewTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/StabilityStoneCover/test/Riskeer.StabilityStoneCover.Forms.Test/Views/StabilityStoneCoverResultViewTest.cs (.../StabilityStoneCoverResultViewTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -83,7 +83,7 @@ { // Assert Assert.IsInstanceOf>(view); Assert.IsNull(view.Data); @@ -207,7 +207,7 @@ StabilityStoneCoverResultViewOld, StabilityStoneCoverFailureMechanism, StabilityStoneCoverFailureMechanismSectionResultOld, - StabilityStoneCoverSectionResultRow> + StabilityStoneCoverSectionResultRowOld> { protected override StabilityStoneCoverResultViewOld CreateResultView(StabilityStoneCoverFailureMechanism failureMechanism) { Index: Riskeer/StabilityStoneCover/test/Riskeer.StabilityStoneCover.Forms.Test/Views/StabilityStoneCoverSectionResultRowTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/StabilityStoneCover/test/Riskeer.StabilityStoneCover.Forms.Test/Views/StabilityStoneCoverSectionResultRowTest.cs (.../StabilityStoneCoverSectionResultRowTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/StabilityStoneCover/test/Riskeer.StabilityStoneCover.Forms.Test/Views/StabilityStoneCoverSectionResultRowTest.cs (.../StabilityStoneCoverSectionResultRowTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -46,11 +46,11 @@ [TestFixture] public class StabilityStoneCoverSectionResultRowTest { - private static StabilityStoneCoverSectionResultRow.ConstructionProperties ConstructionProperties + private static StabilityStoneCoverSectionResultRowOld.ConstructionProperties ConstructionProperties { get { - return new StabilityStoneCoverSectionResultRow.ConstructionProperties + return new StabilityStoneCoverSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = 1, DetailedAssessmentResultForFactorizedSignalingNormIndex = 2, @@ -76,7 +76,7 @@ var result = new StabilityStoneCoverFailureMechanismSectionResultOld(section); // Call - TestDelegate call = () => new StabilityStoneCoverSectionResultRow(result, null); + TestDelegate call = () => new StabilityStoneCoverSectionResultRowOld(result, null); // Assert var exception = Assert.Throws(call); @@ -93,10 +93,10 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new StabilityStoneCoverSectionResultRow(result, ConstructionProperties); + var row = new StabilityStoneCoverSectionResultRowOld(result, ConstructionProperties); // Assert - Assert.IsInstanceOf>(row); + Assert.IsInstanceOf>(row); Assert.AreEqual(result.SimpleAssessmentResult, row.SimpleAssessmentResult); Assert.AreEqual(result.DetailedAssessmentResultForFactorizedSignalingNorm, row.DetailedAssessmentResultForFactorizedSignalingNorm); Assert.AreEqual(result.DetailedAssessmentResultForSignalingNorm, row.DetailedAssessmentResultForSignalingNorm); @@ -147,7 +147,7 @@ calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue(); // Call - var row = new StabilityStoneCoverSectionResultRow(result, ConstructionProperties); + var row = new StabilityStoneCoverSectionResultRowOld(result, ConstructionProperties); // Assert Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(calculator.SimpleAssessmentAssemblyOutput.Group), row.SimpleAssemblyCategoryGroup); @@ -174,7 +174,7 @@ calculator.ThrowExceptionOnCalculate = true; // Call - var row = new StabilityStoneCoverSectionResultRow(result, ConstructionProperties); + var row = new StabilityStoneCoverSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -204,7 +204,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new StabilityStoneCoverSectionResultRow(result, ConstructionProperties); + var row = new StabilityStoneCoverSectionResultRowOld(result, ConstructionProperties); // Precondition Assert.IsFalse(result.UseManualAssembly); @@ -236,7 +236,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new StabilityStoneCoverSectionResultRow(result, ConstructionProperties); + var row = new StabilityStoneCoverSectionResultRowOld(result, ConstructionProperties); // Call row.ManualAssemblyCategoryGroup = newValue; @@ -267,7 +267,7 @@ calculator.TailorMadeAssemblyCategoryOutput = random.NextEnumValue(); calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue(); - var row = new StabilityStoneCoverSectionResultRow(result, ConstructionProperties); + var row = new StabilityStoneCoverSectionResultRowOld(result, ConstructionProperties); // Precondition Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(calculator.SimpleAssessmentAssemblyOutput.Group), @@ -305,7 +305,7 @@ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; calculator.ThrowExceptionOnCalculate = true; - var row = new StabilityStoneCoverSectionResultRow(result, ConstructionProperties); + var row = new StabilityStoneCoverSectionResultRowOld(result, ConstructionProperties); // Precondition IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -347,7 +347,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new StabilityStoneCoverSectionResultRow(result, ConstructionProperties); + var row = new StabilityStoneCoverSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -382,7 +382,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new StabilityStoneCoverSectionResultRow(result, ConstructionProperties); + var row = new StabilityStoneCoverSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -438,7 +438,7 @@ calculator.CombinedAssemblyCategoryOutput = assemblyCategoryGroup; // Call - var row = new StabilityStoneCoverSectionResultRow(result, ConstructionProperties); + var row = new StabilityStoneCoverSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -476,7 +476,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new StabilityStoneCoverSectionResultRow(result, ConstructionProperties); + var row = new StabilityStoneCoverSectionResultRowOld(result, ConstructionProperties); // Call row.SimpleAssessmentResult = newValue; @@ -505,7 +505,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new StabilityStoneCoverSectionResultRow(result, ConstructionProperties); + var row = new StabilityStoneCoverSectionResultRowOld(result, ConstructionProperties); // Call row.DetailedAssessmentResultForFactorizedSignalingNorm = newValue; @@ -534,7 +534,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new StabilityStoneCoverSectionResultRow(result, ConstructionProperties); + var row = new StabilityStoneCoverSectionResultRowOld(result, ConstructionProperties); // Call row.DetailedAssessmentResultForSignalingNorm = newValue; @@ -563,7 +563,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new StabilityStoneCoverSectionResultRow(result, ConstructionProperties); + var row = new StabilityStoneCoverSectionResultRowOld(result, ConstructionProperties); // Call row.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm = newValue; @@ -592,7 +592,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new StabilityStoneCoverSectionResultRow(result, ConstructionProperties); + var row = new StabilityStoneCoverSectionResultRowOld(result, ConstructionProperties); // Call row.DetailedAssessmentResultForLowerLimitNorm = newValue; @@ -621,7 +621,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new StabilityStoneCoverSectionResultRow(result, ConstructionProperties); + var row = new StabilityStoneCoverSectionResultRowOld(result, ConstructionProperties); // Call row.DetailedAssessmentResultForFactorizedLowerLimitNorm = newValue; @@ -650,7 +650,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new StabilityStoneCoverSectionResultRow(result, ConstructionProperties); + var row = new StabilityStoneCoverSectionResultRowOld(result, ConstructionProperties); // Call row.TailorMadeAssessmentResult = newValue; Index: Riskeer/WaveImpactAsphaltCover/src/Riskeer.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismResultViewOld.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/WaveImpactAsphaltCover/src/Riskeer.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismResultViewOld.cs (.../WaveImpactAsphaltCoverFailureMechanismResultViewOld.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/WaveImpactAsphaltCover/src/Riskeer.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismResultViewOld.cs (.../WaveImpactAsphaltCoverFailureMechanismResultViewOld.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -31,7 +31,7 @@ /// The view for a collection of . /// public class WaveImpactAsphaltCoverFailureMechanismResultViewOld : FailureMechanismResultViewOld { @@ -56,12 +56,12 @@ WaveImpactAsphaltCoverFailureMechanism failureMechanism) : base(failureMechanismSectionResults, failureMechanism) {} - protected override WaveImpactAsphaltCoverFailureMechanismSectionResultRow CreateFailureMechanismSectionResultRow( + protected override WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld CreateFailureMechanismSectionResultRow( WaveImpactAsphaltCoverFailureMechanismSectionResultOld sectionResult) { - return new WaveImpactAsphaltCoverFailureMechanismSectionResultRow( + return new WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld( sectionResult, - new WaveImpactAsphaltCoverFailureMechanismSectionResultRow.ConstructionProperties + new WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = simpleAssessmentResultIndex, DetailedAssessmentResultForFactorizedSignalingNormIndex = detailedAssessmentResultForFactorizedSignalingNormIndex, @@ -82,59 +82,59 @@ { FailureMechanismSectionResultViewColumnBuilder.AddSectionNameColumn( DataGridViewControl, - nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.Name)); + nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld.Name)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssessmentResultColumn( DataGridViewControl, - nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.SimpleAssessmentResult)); + nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld.SimpleAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultForFactorizedSignalingNormColumn( DataGridViewControl, - nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.DetailedAssessmentResultForFactorizedSignalingNorm)); + nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld.DetailedAssessmentResultForFactorizedSignalingNorm)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultForSignalingNormColumn( DataGridViewControl, - nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.DetailedAssessmentResultForSignalingNorm)); + nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld.DetailedAssessmentResultForSignalingNorm)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultForMechanismSpecificLowerLimitNormColumn( DataGridViewControl, - nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm)); + nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultForLowerLimitNormColumn( DataGridViewControl, - nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.DetailedAssessmentResultForLowerLimitNorm)); + nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld.DetailedAssessmentResultForLowerLimitNorm)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultForFactorizedLowerLimitNormColumn( DataGridViewControl, - nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.DetailedAssessmentResultForFactorizedLowerLimitNorm)); + nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld.DetailedAssessmentResultForFactorizedLowerLimitNorm)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentCategoryGroupColumn( DataGridViewControl, - nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.TailorMadeAssessmentResult)); + nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld.TailorMadeAssessmentResult)); FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.SimpleAssemblyCategoryGroup)); + nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld.SimpleAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.DetailedAssemblyCategoryGroup)); + nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld.DetailedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.TailorMadeAssemblyCategoryGroup)); + nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld.TailorMadeAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddCombinedAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.CombinedAssemblyCategoryGroup)); + nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld.CombinedAssemblyCategoryGroup)); FailureMechanismSectionResultViewColumnBuilder.AddUseManualAssemblyColumn( DataGridViewControl, - nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.UseManualAssembly)); + nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld.UseManualAssembly)); FailureMechanismSectionResultViewColumnBuilder.AddSelectableAssemblyCategoryGroupColumn( DataGridViewControl, - nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.ManualAssemblyCategoryGroup)); + nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld.ManualAssemblyCategoryGroup)); } protected override void UpdateAssemblyResultControl() Fisheye: Tag ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b refers to a dead (removed) revision in file `Riskeer/WaveImpactAsphaltCover/src/Riskeer.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismSectionResultRow.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/WaveImpactAsphaltCover/src/Riskeer.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld.cs =================================================================== diff -u --- Riskeer/WaveImpactAsphaltCover/src/Riskeer.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld.cs (revision 0) +++ Riskeer/WaveImpactAsphaltCover/src/Riskeer.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld.cs (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -0,0 +1,508 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Controls.DataGrid; +using Riskeer.AssemblyTool.Data; +using Riskeer.AssemblyTool.Forms; +using Riskeer.Common.Data.Exceptions; +using Riskeer.Common.Forms.Helpers; +using Riskeer.Common.Forms.Views; +using Riskeer.Common.Primitives; +using Riskeer.WaveImpactAsphaltCover.Data; + +namespace Riskeer.WaveImpactAsphaltCover.Forms.Views +{ + /// + /// Class for displaying as a row in a grid view. + /// + public class WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld : FailureMechanismSectionResultRowOld + { + private readonly int simpleAssessmentResultIndex; + private readonly int detailedAssessmentResultForFactorizedSignalingNormIndex; + private readonly int detailedAssessmentResultForSignalingNormIndex; + private readonly int detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex; + private readonly int detailedAssessmentResultForLowerLimitNormIndex; + private readonly int detailedAssessmentResultForFactorizedLowerLimitNormIndex; + private readonly int tailorMadeAssessmentResultIndex; + private readonly int simpleAssemblyCategoryGroupIndex; + private readonly int detailedAssemblyCategoryGroupIndex; + private readonly int tailorMadeAssemblyCategoryGroupIndex; + private readonly int combinedAssemblyCategoryGroupIndex; + private readonly int manualAssemblyCategoryGroupIndex; + + private FailureMechanismSectionAssemblyCategoryGroup simpleAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup detailedAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssemblyCategoryGroup; + private FailureMechanismSectionAssemblyCategoryGroup combinedAssemblyCategoryGroup; + + /// + /// Creates a new instance of . + /// + /// The + /// to wrap so that it can be displayed as a row. + /// The property values required to create an instance of + /// . + /// Thrown when any parameter is null. + /// Thrown when + /// is a valid value, but unsupported. + internal WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld(WaveImpactAsphaltCoverFailureMechanismSectionResultOld sectionResult, + ConstructionProperties constructionProperties) + : base(sectionResult) + { + if (constructionProperties == null) + { + throw new ArgumentNullException(nameof(constructionProperties)); + } + + simpleAssessmentResultIndex = constructionProperties.SimpleAssessmentResultIndex; + detailedAssessmentResultForFactorizedSignalingNormIndex = constructionProperties.DetailedAssessmentResultForFactorizedSignalingNormIndex; + detailedAssessmentResultForSignalingNormIndex = constructionProperties.DetailedAssessmentResultForSignalingNormIndex; + detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex = constructionProperties.DetailedAssessmentResultForMechanismSpecificLowerLimitNormIndex; + detailedAssessmentResultForLowerLimitNormIndex = constructionProperties.DetailedAssessmentResultForLowerLimitNormIndex; + detailedAssessmentResultForFactorizedLowerLimitNormIndex = constructionProperties.DetailedAssessmentResultForFactorizedLowerLimitNormIndex; + tailorMadeAssessmentResultIndex = constructionProperties.TailorMadeAssessmentResultIndex; + simpleAssemblyCategoryGroupIndex = constructionProperties.SimpleAssemblyCategoryGroupIndex; + detailedAssemblyCategoryGroupIndex = constructionProperties.DetailedAssemblyCategoryGroupIndex; + tailorMadeAssemblyCategoryGroupIndex = constructionProperties.TailorMadeAssemblyCategoryGroupIndex; + combinedAssemblyCategoryGroupIndex = constructionProperties.CombinedAssemblyCategoryGroupIndex; + manualAssemblyCategoryGroupIndex = constructionProperties.ManualAssemblyCategoryGroupIndex; + + CreateColumnStateDefinitions(); + + Update(); + } + + /// + /// Gets or sets the value representing the simple assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public SimpleAssessmentResultType SimpleAssessmentResult + { + get + { + return SectionResult.SimpleAssessmentResult; + } + set + { + SectionResult.SimpleAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value of the detailed assessment of safety per failure mechanism section + /// for the factorized signaling norm (Category boundary Iv). + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentResultType DetailedAssessmentResultForFactorizedSignalingNorm + { + get + { + return SectionResult.DetailedAssessmentResultForFactorizedSignalingNorm; + } + set + { + SectionResult.DetailedAssessmentResultForFactorizedSignalingNorm = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value of the detailed assessment of safety per failure mechanism section + /// for the signaling norm (Category boundary IIv). + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentResultType DetailedAssessmentResultForSignalingNorm + { + get + { + return SectionResult.DetailedAssessmentResultForSignalingNorm; + } + set + { + SectionResult.DetailedAssessmentResultForSignalingNorm = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value of the detailed assessment of safety per failure mechanism section + /// for the failure mechanism specific signaling norm (Category boundary IIIv). + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentResultType DetailedAssessmentResultForMechanismSpecificLowerLimitNorm + { + get + { + return SectionResult.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm; + } + set + { + SectionResult.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value of the detailed assessment of safety per failure mechanism section + /// for the lower limit norm (Category boundary IVv). + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentResultType DetailedAssessmentResultForLowerLimitNorm + { + get + { + return SectionResult.DetailedAssessmentResultForLowerLimitNorm; + } + set + { + SectionResult.DetailedAssessmentResultForLowerLimitNorm = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the value of the detailed assessment of safety per failure mechanism section + /// for the factorized lower limit norm (Category boundary Vv). + /// + /// Thrown when + /// is a valid value, but unsupported. + public DetailedAssessmentResultType DetailedAssessmentResultForFactorizedLowerLimitNorm + { + get + { + return SectionResult.DetailedAssessmentResultForFactorizedLowerLimitNorm; + } + set + { + SectionResult.DetailedAssessmentResultForFactorizedLowerLimitNorm = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the tailor made assessment result. + /// + /// Thrown when + /// is a valid value, but unsupported. + public TailorMadeAssessmentCategoryGroupResultType TailorMadeAssessmentResult + { + get + { + return SectionResult.TailorMadeAssessmentResult; + } + set + { + SectionResult.TailorMadeAssessmentResult = value; + UpdateInternalData(); + } + } + + /// + /// Gets the simple assembly category group. + /// + public string SimpleAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(simpleAssemblyCategoryGroup); + } + } + + /// + /// Gets the detailed assembly category group. + /// + public string DetailedAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(detailedAssemblyCategoryGroup); + } + } + + /// + /// Gets the tailor made assembly category group. + /// + public string TailorMadeAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(tailorMadeAssemblyCategoryGroup); + } + } + + /// + /// Gets the combined assembly category group. + /// + public string CombinedAssemblyCategoryGroup + { + get + { + return FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(combinedAssemblyCategoryGroup); + } + } + + /// + /// Gets or sets the indicator whether the combined assembly should be overwritten by . + /// + /// Thrown when + /// is a valid value, but unsupported. + public bool UseManualAssembly + { + get + { + return SectionResult.UseManualAssembly; + } + set + { + SectionResult.UseManualAssembly = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the manually selected assembly category group. + /// + /// Thrown when + /// is a valid value, but unsupported. + public SelectableFailureMechanismSectionAssemblyCategoryGroup ManualAssemblyCategoryGroup + { + get + { + return SelectableFailureMechanismSectionAssemblyCategoryGroupConverter.ConvertTo(SectionResult.ManualAssemblyCategoryGroup); + } + set + { + SectionResult.ManualAssemblyCategoryGroup = SelectableFailureMechanismSectionAssemblyCategoryGroupConverter.ConvertFrom(value); + UpdateInternalData(); + } + } + + public override void Update() + { + UpdateDerivedData(); + UpdateColumnStateDefinitionStates(); + } + + private void CreateColumnStateDefinitions() + { + ColumnStateDefinitions.Add(simpleAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultForFactorizedSignalingNormIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultForSignalingNormIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultForLowerLimitNormIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssessmentResultForFactorizedLowerLimitNormIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssessmentResultIndex, new DataGridViewColumnStateDefinition()); + ColumnStateDefinitions.Add(simpleAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(detailedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(tailorMadeAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(combinedAssemblyCategoryGroupIndex, DataGridViewColumnStateDefinitionFactory.CreateReadOnlyColumnStateDefinition()); + ColumnStateDefinitions.Add(manualAssemblyCategoryGroupIndex, new DataGridViewColumnStateDefinition()); + } + + private void UpdateDerivedData() + { + ResetErrorTexts(); + TryGetSimpleAssemblyCategoryGroup(); + TryGetDetailedAssemblyCategoryGroup(); + TryGetTailorMadeAssemblyCategoryGroup(); + TryGetCombinedAssemblyCategoryGroup(); + } + + private void ResetErrorTexts() + { + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = string.Empty; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = string.Empty; + } + + private void TryGetSimpleAssemblyCategoryGroup() + { + try + { + simpleAssemblyCategoryGroup = WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.AssembleSimpleAssessment(SectionResult); + } + catch (AssemblyException e) + { + simpleAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = e.InnerException.Message; + } + } + + private void TryGetDetailedAssemblyCategoryGroup() + { + try + { + detailedAssemblyCategoryGroup = WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.AssembleDetailedAssessment(SectionResult); + } + catch (AssemblyException e) + { + detailedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = e.InnerException.Message; + } + } + + private void TryGetTailorMadeAssemblyCategoryGroup() + { + try + { + tailorMadeAssemblyCategoryGroup = WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.AssembleTailorMadeAssessment(SectionResult); + } + catch (AssemblyException e) + { + tailorMadeAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = e.InnerException.Message; + } + } + + private void TryGetCombinedAssemblyCategoryGroup() + { + try + { + combinedAssemblyCategoryGroup = WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.AssembleCombinedAssessment( + SectionResult); + } + catch (AssemblyException e) + { + combinedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None; + ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = e.InnerException.Message; + } + } + + /// + /// Updates the column state definitions. + /// + /// Thrown when + /// is a valid value, but unsupported. + private void UpdateColumnStateDefinitionStates() + { + bool simpleAssessmentSufficient = FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(SimpleAssessmentResult); + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[simpleAssessmentResultIndex], UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultForFactorizedSignalingNormIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultForSignalingNormIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultForLowerLimitNormIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultForFactorizedLowerLimitNormIndex], + simpleAssessmentSufficient || UseManualAssembly); + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentResultIndex], + simpleAssessmentSufficient || UseManualAssembly); + + if (UseManualAssembly) + { + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex]); + ColumnStateHelper.DisableColumn(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex]); + } + else + { + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex], + simpleAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex], + detailedAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex], + tailorMadeAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex], + combinedAssemblyCategoryGroup); + } + + ColumnStateHelper.SetColumnState(ColumnStateDefinitions[manualAssemblyCategoryGroupIndex], !UseManualAssembly); + } + + /// + /// Class holding the various construction parameters for . + /// + public class ConstructionProperties + { + /// + /// Sets the simple assessment result index. + /// + public int SimpleAssessmentResultIndex { internal get; set; } + + /// + /// Sets the detailed assessment result for factorized signaling norm index. + /// + public int DetailedAssessmentResultForFactorizedSignalingNormIndex { internal get; set; } + + /// + /// Sets the detailed assessment result for signaling norm index. + /// + public int DetailedAssessmentResultForSignalingNormIndex { internal get; set; } + + /// + /// Sets the detailed assessment result for mechanism specific lower limit norm index. + /// + public int DetailedAssessmentResultForMechanismSpecificLowerLimitNormIndex { internal get; set; } + + /// + /// Sets the detailed assessment result for lower limit norm index. + /// + public int DetailedAssessmentResultForLowerLimitNormIndex { internal get; set; } + + /// + /// Sets the detailed assessment result for factorized lower limit norm index. + /// + public int DetailedAssessmentResultForFactorizedLowerLimitNormIndex { internal get; set; } + + /// + /// Sets the tailor made assessment result index. + /// + public int TailorMadeAssessmentResultIndex { internal get; set; } + + /// + /// Sets the simple assembly category group index. + /// + public int SimpleAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the detailed assembly category group index. + /// + public int DetailedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the tailor made assembly category group index. + /// + public int TailorMadeAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the combined assembly category group index. + /// + public int CombinedAssemblyCategoryGroupIndex { internal get; set; } + + /// + /// Sets the manual assembly category group index. + /// + public int ManualAssemblyCategoryGroupIndex { internal get; set; } + } + } +} \ No newline at end of file Index: Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.Forms.Test/Views/WaveImpactAsphaltCoverFailureMechanismResultViewTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.Forms.Test/Views/WaveImpactAsphaltCoverFailureMechanismResultViewTest.cs (.../WaveImpactAsphaltCoverFailureMechanismResultViewTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.Forms.Test/Views/WaveImpactAsphaltCoverFailureMechanismResultViewTest.cs (.../WaveImpactAsphaltCoverFailureMechanismResultViewTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -83,7 +83,7 @@ { // Assert Assert.IsInstanceOf>(view); Assert.IsNull(view.Data); @@ -207,7 +207,7 @@ WaveImpactAsphaltCoverFailureMechanismResultViewOld, WaveImpactAsphaltCoverFailureMechanism, WaveImpactAsphaltCoverFailureMechanismSectionResultOld, - WaveImpactAsphaltCoverFailureMechanismSectionResultRow> + WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld> { protected override WaveImpactAsphaltCoverFailureMechanismResultViewOld CreateResultView(WaveImpactAsphaltCoverFailureMechanism failureMechanism) { Index: Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.Forms.Test/Views/WaveImpactAsphaltCoverFailureMechanismSectionResultRowTest.cs =================================================================== diff -u -rd07611d7e455e358e7255b2807447412ac56f9c6 -rca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b --- Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.Forms.Test/Views/WaveImpactAsphaltCoverFailureMechanismSectionResultRowTest.cs (.../WaveImpactAsphaltCoverFailureMechanismSectionResultRowTest.cs) (revision d07611d7e455e358e7255b2807447412ac56f9c6) +++ Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.Forms.Test/Views/WaveImpactAsphaltCoverFailureMechanismSectionResultRowTest.cs (.../WaveImpactAsphaltCoverFailureMechanismSectionResultRowTest.cs) (revision ca05b1d7e9fa4460c5bb6bcdb1e360f2bebfa08b) @@ -46,11 +46,11 @@ [TestFixture] public class WaveImpactAsphaltCoverFailureMechanismSectionResultRowTest { - private static WaveImpactAsphaltCoverFailureMechanismSectionResultRow.ConstructionProperties ConstructionProperties + private static WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld.ConstructionProperties ConstructionProperties { get { - return new WaveImpactAsphaltCoverFailureMechanismSectionResultRow.ConstructionProperties + return new WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld.ConstructionProperties { SimpleAssessmentResultIndex = 1, DetailedAssessmentResultForFactorizedSignalingNormIndex = 2, @@ -76,7 +76,7 @@ var result = new WaveImpactAsphaltCoverFailureMechanismSectionResultOld(section); // Call - TestDelegate call = () => new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, null); + TestDelegate call = () => new WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld(result, null); // Assert var exception = Assert.Throws(call); @@ -93,10 +93,10 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Assert - Assert.IsInstanceOf>(row); + Assert.IsInstanceOf>(row); Assert.AreEqual(result.SimpleAssessmentResult, row.SimpleAssessmentResult); Assert.AreEqual(result.DetailedAssessmentResultForFactorizedSignalingNorm, row.DetailedAssessmentResultForFactorizedSignalingNorm); Assert.AreEqual(result.DetailedAssessmentResultForSignalingNorm, row.DetailedAssessmentResultForSignalingNorm); @@ -147,7 +147,7 @@ calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue(); // Call - var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Assert Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(calculator.SimpleAssessmentAssemblyOutput.Group), row.SimpleAssemblyCategoryGroup); @@ -174,7 +174,7 @@ calculator.ThrowExceptionOnCalculate = true; // Call - var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -204,7 +204,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Precondition Assert.IsFalse(result.UseManualAssembly); @@ -236,7 +236,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Call row.ManualAssemblyCategoryGroup = newValue; @@ -267,7 +267,7 @@ calculator.TailorMadeAssemblyCategoryOutput = random.NextEnumValue(); calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue(); - var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Precondition Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroupHelper.GetCategoryGroupDisplayName(calculator.SimpleAssessmentAssemblyOutput.Group), @@ -305,7 +305,7 @@ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; calculator.ThrowExceptionOnCalculate = true; - var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Precondition IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -348,7 +348,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -383,7 +383,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { // Call - var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -439,7 +439,7 @@ calculator.CombinedAssemblyCategoryOutput = assemblyCategoryGroup; // Call - var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Assert IDictionary columnStateDefinitions = row.ColumnStateDefinitions; @@ -477,7 +477,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Call row.SimpleAssessmentResult = newValue; @@ -506,7 +506,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Call row.DetailedAssessmentResultForFactorizedSignalingNorm = newValue; @@ -535,7 +535,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Call row.DetailedAssessmentResultForSignalingNorm = newValue; @@ -564,7 +564,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Call row.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm = newValue; @@ -593,7 +593,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Call row.DetailedAssessmentResultForLowerLimitNorm = newValue; @@ -622,7 +622,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Call row.DetailedAssessmentResultForFactorizedLowerLimitNorm = newValue; @@ -651,7 +651,7 @@ using (new AssemblyToolCalculatorFactoryConfig()) { - var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties); + var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRowOld(result, ConstructionProperties); // Call row.TailorMadeAssessmentResult = newValue;