Exemple #1
0
        private void CreateAddedItemsTreeNodes(
            ICollection <EntityStoreSchemaFilterEntry> tableEntries,
            ICollection <EntityStoreSchemaFilterEntry> viewEntries,
            ICollection <EntityStoreSchemaFilterEntry> storedProcEntries,
            SortedDictionary <DatabaseObject, int> existingTables,
            SortedDictionary <DatabaseObject, int> existingViews,
            SortedDictionary <DatabaseObject, int> existingStoredProcs,
            string storageEntityContainerName)
        {
            var newTables = NotPreviouslyExistingNodes(tableEntries, storageEntityContainerName, existingTables);
            var newViews  = NotPreviouslyExistingNodes(viewEntries, storageEntityContainerName, existingViews);
            var newSprocs = NotPreviouslyExistingNodes(storedProcEntries, storageEntityContainerName, existingStoredProcs);

            var addedTablesNode = DatabaseObjectTreeView.CreateRootNodeAndDescendents(
                newTables, Resources.SelectTablesPage_TablesNode, DatabaseObjectTreeView.TreeViewImage.DbTablesImage,
                DatabaseObjectTreeView.TreeViewImage.TableImage);
            var addedViewsNode = DatabaseObjectTreeView.CreateRootNodeAndDescendents(
                newViews, Resources.SelectTablesPage_ViewsNode, DatabaseObjectTreeView.TreeViewImage.DbViewsImage,
                DatabaseObjectTreeView.TreeViewImage.ViewImage);
            var addedSprocsNode = DatabaseObjectTreeView.CreateRootNodeAndDescendents(
                newSprocs, Resources.SelectTablesPage_StoredProceduresNode, DatabaseObjectTreeView.TreeViewImage.DbStoreProcsImage,
                DatabaseObjectTreeView.TreeViewImage.StoreProcImage);

            AddTreeView.TreeViewControl.Nodes.Add(addedTablesNode);
            AddTreeView.TreeViewControl.Nodes.Add(addedViewsNode);
            AddTreeView.TreeViewControl.Nodes.Add(addedSprocsNode);

            // if there are _new_ Sproc entries then enable the Create Function Imports box and by default set to checked
            if (newSprocs.Count > 0)
            {
                chkCreateFunctionImports.Enabled = true;
                chkCreateFunctionImports.Checked = true;
            }
        }
 private void CreateTreeForNewModel(
     ICollection <EntityStoreSchemaFilterEntry> tableEntries,
     ICollection <EntityStoreSchemaFilterEntry> viewEntries, ICollection <EntityStoreSchemaFilterEntry> sprocEntries)
 {
     databaseObjectTreeView.TreeViewControl.Nodes.Add(
         DatabaseObjectTreeView.CreateRootNodeAndDescendents(
             tableEntries, ModelWizard.Properties.Resources.SelectTablesPage_TablesNode,
             DatabaseObjectTreeView.TreeViewImage.DbTablesImage, DatabaseObjectTreeView.TreeViewImage.TableImage));
     databaseObjectTreeView.TreeViewControl.Nodes.Add(
         DatabaseObjectTreeView.CreateRootNodeAndDescendents(
             viewEntries, ModelWizard.Properties.Resources.SelectTablesPage_ViewsNode,
             DatabaseObjectTreeView.TreeViewImage.DbViewsImage, DatabaseObjectTreeView.TreeViewImage.ViewImage));
     databaseObjectTreeView.TreeViewControl.Nodes.Add(
         DatabaseObjectTreeView.CreateRootNodeAndDescendents(
             sprocEntries, ModelWizard.Properties.Resources.SelectTablesPage_StoredProceduresNode,
             DatabaseObjectTreeView.TreeViewImage.DbStoreProcsImage, DatabaseObjectTreeView.TreeViewImage.StoreProcImage));
 }
Exemple #3
0
        private void CreateRefreshedAndDeletedItemsTreeNodes(
            SortedDictionary <DatabaseObject, int> existingTables,
            SortedDictionary <DatabaseObject, int> existingViews,
            SortedDictionary <DatabaseObject, int> existingStoredProcs,
            Dictionary <DatabaseObject, EntityStoreSchemaFilterEntry> tablesFromDB,
            Dictionary <DatabaseObject, EntityStoreSchemaFilterEntry> viewsFromDB,
            Dictionary <DatabaseObject, EntityStoreSchemaFilterEntry> storedProcsFromDB)
        {
            // setup top-level Tables, Views and Sprocs nodes for RefreshTree
            var refreshedTablesNode =
                DatabaseObjectTreeView.CreateTreeNode(
                    Resources.SelectTablesPage_TablesNode, false, null, Resources.SelectTablesPage_TablesNode,
                    DatabaseObjectTreeView.TreeViewImage.DbTablesImage, Resources.SelectTablesPage_TablesNode);
            var refreshedViewsNode =
                DatabaseObjectTreeView.CreateTreeNode(
                    Resources.SelectTablesPage_ViewsNode, false, null, Resources.SelectTablesPage_ViewsNode,
                    DatabaseObjectTreeView.TreeViewImage.DbViewsImage, Resources.SelectTablesPage_ViewsNode);
            var refreshedSprocsNode =
                DatabaseObjectTreeView.CreateTreeNode(
                    Resources.SelectTablesPage_StoredProceduresNode, false, null, Resources.SelectTablesPage_StoredProceduresNode,
                    DatabaseObjectTreeView.TreeViewImage.DbStoreProcsImage, Resources.SelectTablesPage_StoredProceduresNode);

            RefreshTreeView.TreeViewControl.Nodes.Add(refreshedTablesNode);
            RefreshTreeView.TreeViewControl.Nodes.Add(refreshedViewsNode);
            RefreshTreeView.TreeViewControl.Nodes.Add(refreshedSprocsNode);

            // setup top-level Tables, Views and Sprocs nodes for DeleteTree
            var deletedTablesNode =
                DatabaseObjectTreeView.CreateTreeNode(
                    Resources.SelectTablesPage_TablesNode, false, null, Resources.SelectTablesPage_TablesNode,
                    DatabaseObjectTreeView.TreeViewImage.DbTablesImage, Resources.SelectTablesPage_TablesNode);
            var deletedViewsNode =
                DatabaseObjectTreeView.CreateTreeNode(
                    Resources.SelectTablesPage_ViewsNode, false, null, Resources.SelectTablesPage_ViewsNode,
                    DatabaseObjectTreeView.TreeViewImage.DbViewsImage, Resources.SelectTablesPage_ViewsNode);
            var deletedSprocsNode =
                DatabaseObjectTreeView.CreateTreeNode(
                    Resources.SelectTablesPage_StoredProceduresNode, false, null, Resources.SelectTablesPage_StoredProceduresNode,
                    DatabaseObjectTreeView.TreeViewImage.DbStoreProcsImage, Resources.SelectTablesPage_StoredProceduresNode);

            DeleteTreeView.TreeViewControl.Nodes.Add(deletedTablesNode);
            DeleteTreeView.TreeViewControl.Nodes.Add(deletedViewsNode);
            DeleteTreeView.TreeViewControl.Nodes.Add(deletedSprocsNode);

            // any entry in existingTables which also exists in tablesFromDB is about to be refreshed
            // otherwise its about to be deleted
            foreach (var table in existingTables.Keys)
            {
                if (tablesFromDB.ContainsKey(table))
                {
                    DatabaseObjectTreeView.EnsureSchemaAndLeafNode(
                        refreshedTablesNode, table, DatabaseObjectTreeView.TreeViewImage.TableImage, tablesFromDB[table]);
                }
                else
                {
                    DatabaseObjectTreeView.EnsureSchemaAndLeafNode(
                        deletedTablesNode, table, DatabaseObjectTreeView.TreeViewImage.TableImage, null);
                }
            }

            // any entry in existingViews which also exists in viewsFromDB is about to be refreshed
            // otherwise its about to be deleted
            foreach (var view in existingViews.Keys)
            {
                if (viewsFromDB.ContainsKey(view))
                {
                    DatabaseObjectTreeView.EnsureSchemaAndLeafNode(
                        refreshedViewsNode, view, DatabaseObjectTreeView.TreeViewImage.ViewImage, viewsFromDB[view]);
                }
                else
                {
                    DatabaseObjectTreeView.EnsureSchemaAndLeafNode(
                        deletedViewsNode, view, DatabaseObjectTreeView.TreeViewImage.ViewImage, null);
                }
            }

            // similarly any entry in existingStoredProcNames which also exists in storedProcsFromDB is about to be refreshed
            foreach (var storedProc in existingStoredProcs.Keys)
            {
                if (storedProcsFromDB.ContainsKey(storedProc))
                {
                    DatabaseObjectTreeView.EnsureSchemaAndLeafNode(
                        refreshedSprocsNode, storedProc, DatabaseObjectTreeView.TreeViewImage.StoreProcImage, storedProcsFromDB[storedProc]);
                }
                else
                {
                    DatabaseObjectTreeView.EnsureSchemaAndLeafNode(
                        deletedSprocsNode, storedProc, DatabaseObjectTreeView.TreeViewImage.StoreProcImage, null);
                }
            }
        }