Exemplo n.º 1
0
        void FillPolicyNodeWithFunctions(CountryConfig.SystemRow systemRow, CountryConfig.PolicyRow policyRow, TreeListNode policyNode, bool isFirstSystem)
        {
            //generate the functions of the policy
            int functionIndex = 0;
            var functionQuery = (from function in policyRow.GetFunctionRows() select function).OrderBy(function => long.Parse(function.Order));

            foreach (CountryConfig.FunctionRow functionRow in functionQuery.ToList <CountryConfig.FunctionRow>())
            {
                TreeListNode functionNode = isFirstSystem ? BuildFunctionNode(policyNode, functionRow) : policyNode.Nodes[functionIndex++];
                (functionNode.Tag as FunctionTreeListTag).AddFunctionRowOfSystem(systemRow.ID, functionRow);
                functionNode.SetValue(systemRow.Name, ExtensionAndGroupManager.GetExtensionAdaptedSwitch(functionRow));

                //generate the parameters of the function
                FillFunctionNodeWithParameters(systemRow, functionRow, functionNode, isFirstSystem);
            }
        }
Exemplo n.º 2
0
        internal void InsertFunctionNode(List <CountryConfig.FunctionRow> functionRowsOfAllSystems, TreeListNode policyNode, int nodeIndex = -1)
        {
            TreeListNode functionNode  = null;
            bool         isFirstSystem = true;

            foreach (CountryConfig.FunctionRow functionRow in functionRowsOfAllSystems)
            {
                CountryConfig.SystemRow systemRow = functionRow.PolicyRow.SystemRow;
                functionNode = isFirstSystem ? BuildFunctionNode(policyNode, functionRow) : policyNode.Nodes.LastNode;
                (functionNode.Tag as FunctionTreeListTag).AddFunctionRowOfSystem(systemRow.ID, functionRow);
                functionNode.SetValue(systemRow.Name, ExtensionAndGroupManager.GetExtensionAdaptedSwitch(functionRow));

                FillFunctionNodeWithParameters(systemRow, functionRow, functionNode, isFirstSystem);
                isFirstSystem = false;
            }
            if (nodeIndex != -1)
            {
                _mainForm.treeList.SetNodeIndex(functionNode, nodeIndex);
            }
        }
Exemplo n.º 3
0
        internal void InsertPolicyNode(CountryConfig.PolicyRow distinctPolicyRow, int nodeIndex = -1)
        {
            TreeListNode policyNode = _mainForm.treeList.AppendNode(null, null);

            if (nodeIndex != -1)
            {
                _mainForm.treeList.SetNodeIndex(policyNode, nodeIndex);
            }

            //a reference policy is a policy that does not really exist, but marks (in the spine)
            //the re-calculation of a policy that was already calculated further up in the spine
            CountryConfig.PolicyRow referencePolicy = null;

            if (distinctPolicyRow.ReferencePolID != null && distinctPolicyRow.ReferencePolID != string.Empty)
            {
                referencePolicy = _countryConfigFacade.GetPolicyRowByID(distinctPolicyRow.ReferencePolID); //get the "real" policy to assess the necessary information (in essence the name)
            }
            //equip the node with the non system specific information about the policy
            policyNode.SetValue(_policyColumnName, referencePolicy == null ? distinctPolicyRow.Name : referencePolicy.Name);
            policyNode.SetValue(_commentColumnName, distinctPolicyRow.Comment);
            policyNode.Tag             = new PolicyTreeListTag(_mainForm); //here create the tag - (system specific) information will be filled in below
            policyNode.StateImageIndex = policyNode.SelectImageIndex = PolicyTreeListTag.GetStateImageIndex(distinctPolicyRow);
            policyNode.ImageIndex      = -1;                               //not used

            bool isFirstSystem = true;

            foreach (CountryConfig.SystemRow systemRow in _countryConfigFacade.GetSystemRowsOrdered())
            {
                //equip the policy node with the system specific information about the policy
                CountryConfig.PolicyRow policyRow = _countryConfigFacade.GetPolicyRowByNameOrderAndSystemID(distinctPolicyRow.Name,
                                                                                                            distinctPolicyRow.Order, systemRow.ID);
                (policyNode.Tag as PolicyTreeListTag).AddPolicyRowOfSystem(systemRow.ID, policyRow);
                policyNode.SetValue(systemRow.Name, ExtensionAndGroupManager.GetExtensionAdaptedSwitch(policyRow));

                FillPolicyNodeWithFunctions(systemRow, policyRow, policyNode, isFirstSystem);
                isFirstSystem = false;
            }
        }