private void saveButton_Click(object sender, RoutedEventArgs e)
        {
            Data.ApplicationDataSetTableAdapters.InstancesTableAdapter ta = new Data.ApplicationDataSetTableAdapters.InstancesTableAdapter();

            ta.Connection.ConnectionString = ConfigData.SQLMonitorDBConnection;

            ta.Update(Common.ApplicationDataSet.Instances);
        }
示例#2
0
        private void UserControl_Loaded_1(object sender, RoutedEventArgs e)
        {
            // Do not load your data at design time.
            if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
            {
                // Pretend we are in the EAC
                using (StreamReader reader = new StreamReader(@"Test Data\TestWindowConsoleParameter.xml"))
                {
                    ConfigData.RawXML = reader.ReadToEnd();
                }

                //Load your data here and assign the result to the CollectionViewSource.
                System.Windows.Data.CollectionViewSource myCollectionViewSource = (System.Windows.Data.CollectionViewSource) this.Resources["serversViewSource"];
                //myCollectionViewSource.Source = Common.ApplicationDataSet.Servers;

                Data.ApplicationDataSetTableAdapters.ServersTableAdapter   serversTableAdapter;
                Data.ApplicationDataSetTableAdapters.InstancesTableAdapter instancesTableAdapter;
                Data.ApplicationDataSetTableAdapters.DatabasesTableAdapter databasesTableAdapter;

                Data.ApplicationDataSetTableAdapters.TableAdapterManager tableAdapterManager;

                serversTableAdapter   = new Data.ApplicationDataSetTableAdapters.ServersTableAdapter();
                instancesTableAdapter = new Data.ApplicationDataSetTableAdapters.InstancesTableAdapter();
                databasesTableAdapter = new Data.ApplicationDataSetTableAdapters.DatabasesTableAdapter();

                tableAdapterManager = new Data.ApplicationDataSetTableAdapters.TableAdapterManager();

                // Must have to do more work before can do this.  Connection is null
                //tableAdapterManager.Connection.ConnectionString = ConfigData.SQLMonitorDBConnection;\

                // DO this instead for now.
                serversTableAdapter.Connection.ConnectionString   = ConfigData.SQLMonitorDBConnection;
                instancesTableAdapter.Connection.ConnectionString = ConfigData.SQLMonitorDBConnection;
                databasesTableAdapter.Connection.ConnectionString = ConfigData.SQLMonitorDBConnection;

                try
                {
                    //serversTableAdapter.Fill(Common.ApplicationDataSet.Servers);
                    //instancesTableAdapter.Fill(Common.ApplicationDataSet.Instances);
                    //databasesTableAdapter.Fill(Common.ApplicationDataSet.Databases);
                    //serversListView.ItemsSource = Common.ApplicationDataSet.Servers;
                    //serversBindingSource.DataSource = Common.ApplicationDS.Servers;
                }
                catch (Exception ex)
                {
                    System.Windows.Forms.MessageBox.Show(text: "Initial Load Error: " + ex.ToString(), caption: "Error", buttons: System.Windows.Forms.MessageBoxButtons.OK);
                }

                //serversDataGrid.DataContext = Common.ApplicationDataSet.Servers.DefaultView;
                // This is needed to make it work.
                //ServerList.DataContext = Common.ApplicationDataSet.Servers.DefaultView;
            }

            masterListManager.Load();
        }
示例#3
0
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            // Pretend we are in the EAC
            using (StreamReader reader = new StreamReader(@"Test Data\TestWindowConsoleParameter.xml"))
            {
                ConfigData.RawXML = reader.ReadToEnd();
            }

            //Load your data here and assign the result to the CollectionViewSource.
            System.Windows.Data.CollectionViewSource myCollectionViewSource = (System.Windows.Data.CollectionViewSource) this.Resources["serversViewSource"];
            //myCollectionViewSource.Source = Common.ApplicationDataSet.Servers;

            Data.ApplicationDataSetTableAdapters.ServersTableAdapter   serversTableAdapter;
            Data.ApplicationDataSetTableAdapters.InstancesTableAdapter instancesTableAdapter;
            Data.ApplicationDataSetTableAdapters.DatabasesTableAdapter databasesTableAdapter;

            Data.ApplicationDataSetTableAdapters.TableAdapterManager tableAdapterManager;

            serversTableAdapter   = new Data.ApplicationDataSetTableAdapters.ServersTableAdapter();
            instancesTableAdapter = new Data.ApplicationDataSetTableAdapters.InstancesTableAdapter();
            databasesTableAdapter = new Data.ApplicationDataSetTableAdapters.DatabasesTableAdapter();

            tableAdapterManager = new Data.ApplicationDataSetTableAdapters.TableAdapterManager();

            // Must have to do more work before can do this.  Connection is null
            //tableAdapterManager.Connection.ConnectionString = ConfigData.SQLMonitorDBConnection;\

            // DO this instead for now.
            serversTableAdapter.Connection.ConnectionString   = ConfigData.SQLMonitorDBConnection;
            instancesTableAdapter.Connection.ConnectionString = ConfigData.SQLMonitorDBConnection;
            databasesTableAdapter.Connection.ConnectionString = ConfigData.SQLMonitorDBConnection;

            try
            {
                serversTableAdapter.Fill(Common.ApplicationDataSet.Servers);
                instancesTableAdapter.Fill(Common.ApplicationDataSet.Instances);
                //databasesTableAdapter.Fill(Common.ApplicationDataSet.Databases);
                //serversListView.ItemsSource = Common.ApplicationDataSet.Servers;
                //serversBindingSource.DataSource = Common.ApplicationDS.Servers;
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(text: "Initial Load Error: " + ex.ToString(), caption: "Error", buttons: System.Windows.Forms.MessageBoxButtons.OK);
            }
        }
示例#4
0
        public void LoadApplicationDataSetFromDB()
        {
//#if TRACE
//            long startTime = Common.WriteToDebugWindow(string.Format("Enter {0}:{1}()", TYPE_NAME, System.Reflection.MethodInfo.GetCurrentMethod().Name));
////#endif
            // Pretend we are in the EAC
            using (StreamReader reader = new StreamReader(@"Test Data\TestWindowConsoleParameter.xml"))
            {
                ConfigData.RawXML = reader.ReadToEnd();
            }

            //Load your data here and assign the result to the CollectionViewSource.
            //System.Windows.Data.CollectionViewSource myCollectionViewSource = (System.Windows.Data.CollectionViewSource)this.Resources["serversViewSource"];
            //myCollectionViewSource.Source = Common.ApplicationDataSet.Servers;

            Data.ApplicationDataSetTableAdapters.ServersTableAdapter            serversTA;
            Data.ApplicationDataSetTableAdapters.InstancesTableAdapter          instancesTA;
            Data.ApplicationDataSetTableAdapters.DatabasesTableAdapter          databasesTA;
            Data.ApplicationDataSetTableAdapters.DBTablesTableAdapter           dbTablesTA;
            Data.ApplicationDataSetTableAdapters.DBViewsTableAdapter            dbViewsTA;
            Data.ApplicationDataSetTableAdapters.DBStoredProceduresTableAdapter dbStoredProceduresTA;


            Data.ApplicationDataSetTableAdapters.TableAdapterManager tableAdapterManager;

            serversTA            = new Data.ApplicationDataSetTableAdapters.ServersTableAdapter();
            instancesTA          = new Data.ApplicationDataSetTableAdapters.InstancesTableAdapter();
            databasesTA          = new Data.ApplicationDataSetTableAdapters.DatabasesTableAdapter();
            dbTablesTA           = new Data.ApplicationDataSetTableAdapters.DBTablesTableAdapter();
            dbViewsTA            = new Data.ApplicationDataSetTableAdapters.DBViewsTableAdapter();
            dbStoredProceduresTA = new Data.ApplicationDataSetTableAdapters.DBStoredProceduresTableAdapter();

            tableAdapterManager = new Data.ApplicationDataSetTableAdapters.TableAdapterManager();

            // Must have to do more work before can do this.  Connection is null
            //tableAdapterManager.Connection.ConnectionString = ConfigData.SQLMonitorDBConnection;\

            // DO this instead for now.
            serversTA.Connection.ConnectionString            = ConfigData.SQLMonitorDBConnection;
            instancesTA.Connection.ConnectionString          = ConfigData.SQLMonitorDBConnection;
            databasesTA.Connection.ConnectionString          = ConfigData.SQLMonitorDBConnection;
            dbTablesTA.Connection.ConnectionString           = ConfigData.SQLMonitorDBConnection;
            dbViewsTA.Connection.ConnectionString            = ConfigData.SQLMonitorDBConnection;
            dbStoredProceduresTA.Connection.ConnectionString = ConfigData.SQLMonitorDBConnection;

            try
            {
                serversTA.Fill(Common.ApplicationDataSet.Servers);
                instancesTA.Fill(Common.ApplicationDataSet.Instances);
                databasesTA.Fill(Common.ApplicationDataSet.Databases);
                dbTablesTA.Fill(Common.ApplicationDataSet.DBTables);
                dbViewsTA.Fill(Common.ApplicationDataSet.DBViews);
                dbStoredProceduresTA.Fill(Common.ApplicationDataSet.DBStoredProcedures);

                //serversListView.ItemsSource = Common.ApplicationDataSet.Servers;
                //serversBindingSource.DataSource = Common.ApplicationDS.Servers;
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(text: "Initial Load Error: " + ex.ToString(), caption: "Error", buttons: System.Windows.Forms.MessageBoxButtons.OK);
            }

            //Common.WriteToDebugWindow(string.Format(" Exit {0}:{1}()", TYPE_NAME, System.Reflection.MethodInfo.GetCurrentMethod().Name), startTime);
        }