Exemple #1
0
        internal void SchemaChanged(JoinSourceType type)
        {
            if (type == JoinSourceType.Target)
            {
                return;
            }

            _view.ClearJoins();
            FdoConnection conn = GetConnection(type);

            if (conn != null)
            {
                using (FdoFeatureService service = conn.CreateFeatureService())
                {
                    switch (type)
                    {
                    case JoinSourceType.Left:
                        _view.LeftClasses = service.GetClassNames(_view.SelectedLeftSchema);
                        ClassChanged(type);
                        break;

                    case JoinSourceType.Right:
                        _view.RightClasses = service.GetClassNames(_view.SelectedRightSchema);
                        ClassChanged(type);
                        break;
                    }
                }
            }
        }
Exemple #2
0
 private void UpdateSourceClasses()
 {
     using (FdoFeatureService svc = CreateSourceService())
     {
         string schema  = cmbSrcSchema.SelectedItem.ToString();
         var    classes = svc.GetClassNames(schema);
         cmbSrcClass.DataSource = classes;
         if (classes.Count > 0)
         {
             cmbSrcClass.SelectedIndex = 0;
         }
         CheckEmptyName();
     }
 }
Exemple #3
0
 private void UpdateTargetClasses()
 {
     using (FdoFeatureService svc = CreateTargetService())
     {
         string schema   = cmbDstSchema.SelectedItem.ToString();
         string srcClass = this.SourceClass;
         var    classes  = svc.GetClassNames(schema);
         if (!string.IsNullOrEmpty(srcClass))
         {
             //Activate this option only if the source class name doesn't exist in the target's selected schema
             chkCreate.Enabled = !classes.Contains(srcClass);
         }
         cmbDstClass.DataSource = classes;
         if (classes.Count > 0)
         {
             cmbDstClass.SelectedIndex = 0;
         }
         CheckEmptyName();
     }
 }
        void OnAfterNodeExpansion(object sender, TreeViewEventArgs e)
        {
            if (e.Action == TreeViewAction.Expand)
            {
                TreeNode node = e.Node;
                TreeNode root = _explorer.GetRootNode(RootNodeName);
                //Is a FDO data source node
                if (IsChild(root.Nodes, node, NODE_LEVEL_CLASS))
                {
                    //Find the connection node
                    TreeNode connNode = node;
                    while (connNode.Level > 1)
                    {
                        connNode = connNode.Parent;
                    }
                    string connName = connNode.Name;

                    using (new TempCursor(Cursors.WaitCursor))
                    {
                        switch (node.Level)
                        {
                        case NODE_LEVEL_CONNECTION:     //Connection node
                        {
                            if (!(bool)node.Tag)        //Not loaded, load it now
                            {
                                //Clear out dummy node
                                node.Nodes.Clear();
                                CreateSchemaNodes(node);
                                node.Tag = true;         //Schema is loaded
                            }
                        }
                        break;

                        case NODE_LEVEL_SCHEMA:     //Schema Node
                        {
                            bool isPartial = Convert.ToBoolean(node.Tag);
                            if (isPartial)
                            {
                                Debug.Assert(node.Nodes.Count == 1);         //Has a dummy node
                                string        schemaName = node.Name;
                                FdoConnection conn       = _connMgr.GetConnection(connName);

                                using (FdoFeatureService svc = conn.CreateFeatureService())
                                {
                                    Debug.Assert(svc.SupportsPartialSchemaDiscovery());
                                    List <string> classNames = svc.GetClassNames(schemaName);
                                    GetClassNodesPartial(classNames, node);
                                    node.Tag = false;         //This node is no longer partial
                                    node.Expand();
                                }
                            }
                        }
                        break;

                        case NODE_LEVEL_CLASS:     //Class Node
                        {
                            bool isPartial = Convert.ToBoolean(node.Tag);
                            if (isPartial)
                            {
                                Debug.Assert(node.Nodes.Count == 1);         //Has a dummy node
                                string        schemaName = node.Parent.Name;
                                FdoConnection conn       = _connMgr.GetConnection(connName);
                                using (FdoFeatureService svc = conn.CreateFeatureService())
                                {
                                    Debug.Assert(svc.SupportsPartialSchemaDiscovery());
                                    ClassDefinition cd = svc.GetClassByName(schemaName, node.Name);
                                    if (cd != null)
                                    {
                                        UpdateClassNode(node, cd);
                                    }
                                }
                            }
                        }
                        break;
                        }
                    }
                }
            }
        }