/// <summary> /// Met à jour les libellés des causes d'écarts sur les actions. /// </summary> private void UpdateDifferenceReasons() { if (this.SelectedOriginalScenario != null && this.SelectedTargetScenario != null) { foreach (var action in this.SelectedOriginalScenario.Actions.Concat( this.SelectedTargetScenario.Actions)) { action.DifferenceReasonManaged = action.DifferenceReason; } foreach (var action in this.SelectedOriginalScenario.Actions) { var derived = ScenarioActionHierarchyHelper.GetDerivedAction(action, this.SelectedTargetScenario); if (derived != null && action.DifferenceReason != null) { derived.DifferenceReasonManaged = action.DifferenceReason; } } foreach (var action in this.SelectedTargetScenario.Actions) { var ancestor = ScenarioActionHierarchyHelper.GetAncestorAction(action, this.SelectedOriginalScenario); if (ancestor != null && action.DifferenceReason != null) { ancestor.DifferenceReasonManaged = action.DifferenceReason; } } } }
/// <summary> /// Obtient la source de la cause des écarts. /// </summary> /// <param name="action">L'action où la cause des écarts a changé.</param> /// <param name="isFromValidationScenario"><c>true</c> si l'action provient du scénario de validation. <c>false</c> si elle provient du scénario cible.</param> /// <param name="targetAction">L'action du scénario cible.</param> /// <param name="validationAction">L'action du scénario de validation.</param> /// <returns></returns> private DifferenceReasonSource GetDifferenceReasonSource(KAction action, out bool isFromValidationScenario, out KAction targetAction, out KAction validationAction) { isFromValidationScenario = this.SelectedTargetScenario != null && this.SelectedTargetScenario.Actions.Contains(action); if (isFromValidationScenario) { validationAction = action; targetAction = ScenarioActionHierarchyHelper.GetAncestorAction(action, this.SelectedOriginalScenario); if (targetAction == null) { return(DifferenceReasonSource.FromSourceScenarioNew); } else { return(DifferenceReasonSource.FromBoth); } } else { targetAction = action; validationAction = ScenarioActionHierarchyHelper.GetDerivedAction(action, this.SelectedTargetScenario); if (validationAction == null) { return(DifferenceReasonSource.FromTargetScenarioDeleted); } else { return(DifferenceReasonSource.FromBoth); } } }