internal UnhideRowsForm(List <KeyValuePair <TreeListNode, TreeListNode> > rangesOfHiddenNodes, TreeListManager treeListManager)
 {
     InitializeComponent();
     foreach (KeyValuePair <TreeListNode, TreeListNode> fromNodeToNode in rangesOfHiddenNodes)
     {
         ListViewItem item = lstHiddenRows.Items.Add(TreeListManager.GetNodeRowNumber(fromNodeToNode.Key, fromNodeToNode.Key.ParentNode) + " - " +
                                                     TreeListManager.GetNodeRowNumber(fromNodeToNode.Value, fromNodeToNode.Value.ParentNode));
         item.Tag = fromNodeToNode;
     }
 }
Beispiel #2
0
        internal ContextMenuStrip GetContextMenu(TreeListNode senderNode)
        {
            _senderNode = senderNode;
            List <TreeListNode> nodeList = EM_AppContext.Instance.GetActiveCountryMainForm().GetMultiCellSelector().GetSelectedNodes();

            mniHideSelectedRows.Enabled = (nodeList.Count > 0);
            //fill drop-down menu for 'Hide Rows unto ...' with the rownumber of the node itself (e.g. 1.2) and all its successors on the same level (e.g. 1.3, 1.4, ...)
            cboHideRowsUnto.Items.Clear();
            cboHideRowsUnto.Items.Add(TreeListManager.GetNodeRowNumber(_senderNode, _senderNode.ParentNode));
            foreach (TreeListNode siblingNodeAfter in TreeListManager.GetSiblingNodesAfter(_senderNode))
            {
                cboHideRowsUnto.Items.Add(TreeListManager.GetNodeRowNumber(siblingNodeAfter, siblingNodeAfter.ParentNode));
            }
            cboHideRowsUnto.SelectedIndex = 0; //put starting node into textfield of drop-down

            return(mnuRow);
        }
        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);
        }