private void PopulatePlainTablesOrViews(IEnumerable<string> names, TreeNode parent, MakeTableOrTreeNode nodeMaker)
 {
     foreach (string name in names)
     {
         NodeTableViewBase newNode = nodeMaker(name);
         parent.Nodes.Add(newNode);
     }            
 }
 private void PopulateUbwTablesOrViews(IEnumerable<string> names, TreeNode parent, MakeTableOrTreeNode nodeMaker)
 {
     const string norwegianProductsPrefix = "A47";
     string lastGroupName = string.Empty;
     TreeNode groupNode = null;
     string lastSubgroupName = string.Empty;
     TreeNode subgroupNode = null;
     int subgroupPosition = 0;
     foreach (string name in names)
     {
         string groupName = name.Substring(0, name.Substring(0, 4).ToUpper() == "ASYS" ? 4 : 3);
         if (groupName.ToUpper() != lastGroupName)
         {
             lastGroupName = groupName.ToUpper();
             groupNode = new NodeFolder(groupName);
             if (lastGroupName == norwegianProductsPrefix)
             {
                 parent.Nodes.Insert(0, groupNode);
             }
             else
             {
                 parent.Nodes.Add(groupNode);
             }
         }
         NodeTableViewBase newNode = nodeMaker(name);
         //                NodeDatabaseTable newNode = new NodeDatabaseTable(name, SqlCommon.SqlForm.contextDatabaseTable);
         if (lastGroupName == norwegianProductsPrefix)
         {
             if (char.IsLetter(name[3]) &&
                 char.IsLetter(name[4]) &&
                 char.IsDigit(name[5]) &&
                 char.IsDigit(name[6]) &&
                 char.IsLetter(name[7]))
             {
                 string subgroupName = name.Substring(3, 4).ToUpper();
                 if (subgroupName != lastSubgroupName)
                 {
                     lastSubgroupName = subgroupName;
                     subgroupNode = new NodeFolder(subgroupName);
                     Debug.Assert(groupNode != null, "groupNode != null");
                     groupNode.Nodes.Insert(subgroupPosition, subgroupNode);
                     ++subgroupPosition;
                 }
                 Debug.Assert(subgroupNode != null, "subgroupNode != null");
                 subgroupNode.Nodes.Add(newNode);
             }
             else
             {
                 Debug.Assert(groupNode != null, "groupNode != null");
                 groupNode.Nodes.Add(newNode);
             }
         }
         else
         {
             Debug.Assert(groupNode != null, "groupNode != null");
             groupNode.Nodes.Add(newNode);
         }
     }
 }