internal override void PerformAction() { foreach (TreeListNode node in _senderNodes) { PolicyTreeListTag polTag = node.Tag as PolicyTreeListTag; FunctionTreeListTag funTag = node.Tag as FunctionTreeListTag; ParameterTreeListTag parTag = node.Tag as ParameterTreeListTag; if (polTag != null) { foreach (CountryConfig.PolicyRow policyRow in polTag.GetPolicyRows()) { policyRow.Private = policyRow.Private == DefPar.Value.YES ? DefPar.Value.NO : DefPar.Value.YES; } node.StateImageIndex = polTag.GetDefaultPolicyRow().Private == DefPar.Value.YES ? DefGeneral.IMAGE_IND_PRIV_POL : DefGeneral.IMAGE_IND_POL; } else if (funTag != null) { foreach (CountryConfig.FunctionRow funRow in funTag.GetFunctionRows()) { funRow.Private = funRow.Private == DefPar.Value.YES ? DefPar.Value.NO : DefPar.Value.YES; } node.StateImageIndex = funTag.GetDefaultFunctionRow().Private == DefPar.Value.YES ? DefGeneral.IMAGE_IND_PRIV_FUN : DefGeneral.IMAGE_IND_FUN; } else if (parTag != null) { foreach (CountryConfig.ParameterRow parRow in parTag.GetParameterRows()) { parRow.Private = parRow.Private == DefPar.Value.YES ? DefPar.Value.NO : DefPar.Value.YES; } node.StateImageIndex = parTag.GetDefaultParameterRow().Private == DefPar.Value.YES ? DefGeneral.IMAGE_IND_PRIV_PAR : -1; } } }
public override void Execute(TreeListNode senderNode) { if (senderNode.Tag == null || (senderNode.Tag as BaseTreeListTag).GetParameterName() == null) { return; //policy- or function-node } ParameterTreeListTag nodeTag = senderNode.Tag as ParameterTreeListTag; UsedComponent usedComponent = new UsedComponent(); foreach (CountryConfig.ParameterRow parameterRow in nodeTag.GetParameterRows()) { if (!_systemIDs.Contains(parameterRow.FunctionRow.PolicyRow.SystemID)) { continue; } if (_ignoreIfSwitchedOff && (parameterRow.FunctionRow.Switch.ToLower() == DefPar.Value.OFF || parameterRow.FunctionRow.PolicyRow.Switch.ToLower() == DefPar.Value.OFF)) { continue; } //formulas and conditions need a special comparison operation ... if (parameterRow.ValueType.ToLower() == DefinitionAdmin.ParTypeToString(DefPar.PAR_TYPE.CONDITION).ToLower() || parameterRow.ValueType.ToLower() == DefinitionAdmin.ParTypeToString(DefPar.PAR_TYPE.FORMULA).ToLower()) { if (!_doPatternSearch) { if (!EM_Helpers.DoesFormulaContainComponent(parameterRow.Value, _componentName)) { continue; } } else { if (!EM_Helpers.DoesValueMatchPattern(_componentName, parameterRow.Value, false, true)) { continue; } } } //... for other parameter types it's enough to compare the value else { if (!_doPatternSearch) { if (parameterRow.Value.ToLower() != _componentName.ToLower()) { continue; } } else { if (!EM_Helpers.DoesValueMatchPattern(_componentName, parameterRow.Value, false, true)) { continue; } } } usedComponent._systemNames.Add(parameterRow.FunctionRow.PolicyRow.SystemRow.Name); } //take account of the fact that the policy column also may contain components (i.e. variables in DefIL, SetDefault, Uprate, etc.) if (nodeTag.IsPolicyColumnEditable()) { string contentPolicyColumn = senderNode.GetDisplayText(senderNode.TreeList.Columns.ColumnByName(TreeListBuilder._policyColumnName)); if (EM_Helpers.DoesValueMatchPattern(_componentName, contentPolicyColumn, false, false)) { usedComponent._row = TreeListManager.GetNodeRowNumber(senderNode, senderNode.ParentNode); } } if (usedComponent._systemNames.Count == 0 && usedComponent._row == string.Empty) { return; } usedComponent._policyName = nodeTag.GetPolicyName(); usedComponent._functionName = nodeTag.GetFunctionName(); if (usedComponent._row == string.Empty) { usedComponent._parameterName = nodeTag.GetParameterName(); } usedComponent._row = TreeListManager.GetNodeRowNumber(senderNode, senderNode.ParentNode); usedComponent._node = senderNode; _usedComponents.Add(usedComponent); }