示例#1
0
        /// <summary>
        /// Event delegate method fired when the <see cref="AddRelatedTablesToolStripMenuItem"/> context menu item is clicked.
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="e">Event arguments.</param>
        private void AddRelatedTablesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var selectedTableOrView = MiscUtilities.GetSelectedDbTableOrView(sender) as DbTable;

            if (selectedTableOrView == null)
            {
                return;
            }

            AddRelatedTablesToRelatedTablesListView(selectedTableOrView, false, true);
            RelatedTablesListView.Sort();
        }
示例#2
0
        /// <summary>
        /// Refreshes the list with tables and views.
        /// </summary>
        /// <param name="checkAllRelatedTables">Flag indicating whether all found related tables not in the original selection are checked by default.</param>
        private void ProcessSelectedTablesOrViews(bool checkAllRelatedTables)
        {
            foreach (var tableOrView in _importTablesOrViews)
            {
                // Fill the selected tables and views list.
                var dbTable = tableOrView as DbTable;
                var lvi     = TablesViewsListView.Items.Add(tableOrView.Name, tableOrView.Name, dbTable == null ? 1 : 0);
                lvi.SubItems.Add(string.Empty);
                lvi.Tag = tableOrView;
                if (dbTable == null)
                {
                    continue;
                }

                // Get the related tables that are not in the original selection so we can fill the Related Tables list view.
                lvi.SubItems[1].Text = dbTable.RelatedObjectNames;
                AddRelatedTablesToRelatedTablesListView(dbTable, checkAllRelatedTables, false);
            }

            RelatedTablesListView.Sort();
        }