Exemplo n.º 1
0
        public void LoadApplicationDataSetFromDB(Data.ApplicationDataSet applicationDS)
        {
#if TRACE
            long startTicksTotal = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif

            try
            {
                long startTicks = 0;


                if (Config.ADSLoad_Servers)
                {
#if TRACE
                    startTicks = PLLog.Trace2("Fill Servers", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                    // Intialize the TAManager and all the other TableAdapters by using the embedded ServersTableAdapter
                    // See the Get method on TaManager.
                    TaManager.ServersTableAdapter.Fill(applicationDS.Servers);
#if TRACE
                    PLLog.Trace2("End Fill Servers", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif
                }

                if (Config.ADSLoad_ServerInfo)
                {
#if TRACE
                    startTicks = PLLog.Trace2("Fill ServerInfo", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                    ServerInfoTA.Fill(applicationDS.ServerInfo);
#if TRACE
                    PLLog.Trace2("End Fill ServerInfo", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif
                }

                if (Config.ADSLoad_Instances)
                {
#if TRACE
                    startTicks = PLLog.Trace2("Fill Instances", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                    InstancesTA.Fill(applicationDS.Instances);
#if TRACE
                    PLLog.Trace2("End Fill Instances", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif
                }

                if (Config.ADSLoad_InstanceInfo)
                {
#if TRACE
                    startTicks = PLLog.Trace2("Fill InstanceInfo", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                    InstanceInfoTA.Fill(applicationDS.InstanceInfo);
#if TRACE
                    PLLog.Trace2("End Fill InstanceInfo", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif
                }

                if (Config.ADSLoad_Jobs)
                {
#if TRACE
                    startTicks = PLLog.Trace2("Fill Jobs", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                    JobsTA.Fill(applicationDS.Jobs);
#if TRACE
                    PLLog.Trace2("End Fill Jobs", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif
                }

                if (Config.ADSLoad_Logins)
                {
#if TRACE
                    startTicks = PLLog.Trace2("Fill Logins", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                    LoginsTA.Fill(applicationDS.Logins);
#if TRACE
                    PLLog.Trace2("End Fill Logins", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif
                }

                if (Config.ADSLoad_ServerRoles)
                {
#if TRACE
                    startTicks = PLLog.Trace2("Fill ServerRoles", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                    ServerRolesTA.Fill(applicationDS.ServerRoles);
#if TRACE
                    PLLog.Trace2("End Fill ServerRoles", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif
                }

                if (Config.ADSLoad_Databases)
                {
#if TRACE
                    startTicks = PLLog.Trace2("Fill Databases", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                    DatabasesTA.Fill(applicationDS.Databases);
#if TRACE
                    PLLog.Trace2("End Fill Databases", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif
                }

                if (Config.ADSLoad_DatabaseInfo)
                {
#if TRACE
                    startTicks = PLLog.Trace2("Fill DatabaseInfo", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                    DatabaseInfoTA.Fill(applicationDS.DatabaseInfo);
#if TRACE
                    PLLog.Trace2("End Fill DatabaseInfo", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif
                }

                if (Config.ADSLoad_DBDataFiles)
                {
#if TRACE
                    startTicks = PLLog.Trace2("Fill DBDataFiles", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                    DBDataFilesTA.Fill(applicationDS.DBDataFiles);;
#if TRACE
                    PLLog.Trace2("End Fill DBDataFiles", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif
                }
                if (Config.ADSLoad_DBDataFileInfo)
                {
#if TRACE
                    startTicks = PLLog.Trace2("Fill DBDataFileInfo", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                    DBDataFileInfoTA.Fill(applicationDS.DBDataFileInfo);
#if TRACE
                    PLLog.Trace2("End Fill DBDataFileInfo", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif
                }

                if (Config.ADSLoad_DBDdlTriggers)
                {
#if TRACE
                    startTicks = PLLog.Trace2("Fill DBDdlTriggers", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                    DBDdlTriggersTA.Fill(applicationDS.DBDdlTriggers);
#if TRACE
                    PLLog.Trace2("End Fill DBDdlTriggers", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif
                }

                if (Config.ADSLoad_DBFileGroups)
                {
#if TRACE
                    startTicks = PLLog.Trace2("Fill DBFileGroups", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                    DBFileGroupsTA.Fill(applicationDS.DBFileGroups);
#if TRACE
                    PLLog.Trace2("End Fill DBFileGroups", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif
                }

                if (Config.ADSLoad_DBLogFiles)
                {
#if TRACE
                    startTicks = PLLog.Trace2("Fill DBLogFiles", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                    DBLogFilesTA.Fill(applicationDS.DBLogFiles);
#if TRACE
                    PLLog.Trace2("End Fill DBLogFiles", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif
                }

                if (Config.ADSLoad_DBLogFileInfo)
                {
#if TRACE
                    startTicks = PLLog.Trace2("Fill DBLogFileInfo", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                    DBLogFileInfoTA.Fill(applicationDS.DBLogFileInfo);
#if TRACE
                    PLLog.Trace2("End Fill DBLogFileInfo", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif
                }

                if (Config.ADSLoad_DBRoles)
                {
#if TRACE
                    startTicks = PLLog.Trace2("Fill DBRoles", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                    DBRolesTA.Fill(applicationDS.DBRoles);
                }
#if TRACE
                PLLog.Trace2("End Fill DBRoles", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif

                if (Config.ADSLoad_DBStoredProcedures)
                {
#if TRACE
                    startTicks = PLLog.Trace2("Fill DBStoredProcedures", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                    DBStoredProceduresTA.Fill(applicationDS.DBStoredProcedures);

#if TRACE
                    PLLog.Trace2("End Fill DBStoredProcedures", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif
                }

                if (Config.ADSLoad_DBTables)
                {
#if TRACE
                    startTicks = PLLog.Trace2("Fill DBTables", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                    DBTablesTA.Fill(applicationDS.DBTables);
#if TRACE
                    PLLog.Trace2("End Fill DBTables", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif
                }

                if (Config.ADSLoad_DBUserDefinedFunctions)
                {
#if TRACE
                    startTicks = PLLog.Trace2("Fill DBUserDefinedFunctions", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                    DBUserDefinedFunctionsTA.Fill(applicationDS.DBUserDefinedFunctions);
#if TRACE
                    PLLog.Trace2("End Fill DBUserDefinedFunctions", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif
                }

                if (Config.ADSLoad_DBUsers)
                {
#if TRACE
                    startTicks = PLLog.Trace2("Fill DBUsers", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                    DBUsersTA.Fill(applicationDS.DBUsers);;
#if TRACE
                    PLLog.Trace2("End Fill DBUsers", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif
                }

                if (Config.ADSLoad_DBViews)
                {
#if TRACE
                    startTicks = PLLog.Trace2("Fill DBViews", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                    DBViewsTA.Fill(applicationDS.DBViews);
#if TRACE
                    PLLog.Trace2("End Fill DBViews", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif
                }

                if (Config.ADSLoad_TBTriggers)
                {
#if TRACE
                    startTicks = PLLog.Trace2("Fill TBTriggers", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                    TBTriggersTA.Fill(applicationDS.TBTriggers);;
#if TRACE
                    PLLog.Trace2("End Fill TBTriggers", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif
                }

                if (Config.ADSLoad_VWTriggers)
                {
#if TRACE
                    startTicks = PLLog.Trace2("Fill VWTriggers", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                    VWTriggersTA.Fill(applicationDS.VWTriggers);
#if TRACE
                    PLLog.Trace2("End Fill VWTriggers", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif
                }

#if TRACE
                startTicks = PLLog.Trace2("Fill LKUP_ADDomains", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                LU_ADDomainsTA.Fill(applicationDS.LKUP_ADDomains);
#if TRACE
                PLLog.Trace2("End Fill LKUP_ADDomains", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif

#if TRACE
                startTicks = PLLog.Trace2("Fill LKUP_Environments", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                LU_EnvironmentsTA.Fill(applicationDS.LKUP_Environments);
#if TRACE
                PLLog.Trace2("End Fill LKUP_Environments", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif

#if TRACE
                startTicks = PLLog.Trace2("Fill LKUP_SQLServerVersions", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0);
#endif
                LU_SQLServerVersionsTA.Fill(applicationDS.LKUP_SQLServerVersions);
#if TRACE
                PLLog.Trace2("End Fill LKUP_SQLServerVersions", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks);
#endif
            }
            catch (Exception ex)
            {
                PLLog.Error(string.Format("ConnectionString:>{0}<", Config.SQLMonitorDBConnection), PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1);
                PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1);
            }

#if TRACE
            PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicksTotal);
#endif
        }
Exemplo n.º 2
0
        /// <summary>
        /// Load the tables that contain database storage information.
        /// </summary>
        /// <param name="applicationDS"></param>
        private void LoadSnapShotTables(ApplicationDataSet applicationDS)
        {
#if TRACE
            long startTicksTotal = VNC.AppLog.Trace("Start", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 3);
#endif
            long startTicks = 0;

            if (Config.ADSLoad_ServerInfo)
            {
#if TRACE
                startTicks = VNC.AppLog.Trace2("Fill ServerInfo", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 6);
#endif
                lock (_concurrencyLock)
                {
                    ServerInfoTA.Fill(applicationDS.ServerInfo);
                }
#if TRACE
                VNC.AppLog.Trace2("End Fill ServerInfo", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 7, startTicks);
#endif
            }

            if (Config.ADSLoad_InstanceInfo)
            {
#if TRACE
                startTicks = VNC.AppLog.Trace2("Fill InstanceInfo", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 10);
#endif
                lock (_concurrencyLock)
                {
                    InstanceInfoTA.Fill(applicationDS.InstanceInfo);
                }
#if TRACE
                VNC.AppLog.Trace2("End Fill InstanceInfo", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 11, startTicks);
#endif
            }

            if (Config.ADSLoad_DatabaseInfo)
            {
#if TRACE
                startTicks = VNC.AppLog.Trace2("Fill DatabaseInfo", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 20);
#endif
                lock (_concurrencyLock)
                {
                    DatabaseInfoTA.Fill(applicationDS.DatabaseInfo);
                }
#if TRACE
                VNC.AppLog.Trace2("End Fill DatabaseInfo", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 21, startTicks);
#endif
            }

            if (Config.ADSLoad_DBDataFiles)
            {
#if TRACE
                startTicks = VNC.AppLog.Trace2("Fill DBDataFiles", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 22);
#endif
                lock (_concurrencyLock)
                {
                    DBDataFilesTA.Fill(applicationDS.DBDataFiles);
                }
#if TRACE
                VNC.AppLog.Trace2("End Fill DBDataFiles", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 23, startTicks);
#endif
            }
            if (Config.ADSLoad_DBDataFileInfo)
            {
#if TRACE
                startTicks = VNC.AppLog.Trace2("Fill DBDataFileInfo", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 24);
#endif
                lock (_concurrencyLock)
                {
                    DBDataFileInfoTA.Fill(applicationDS.DBDataFileInfo);
                }
#if TRACE
                VNC.AppLog.Trace2("End Fill DBDataFileInfo", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 25, startTicks);
#endif
            }

            if (Config.ADSLoad_DBFileGroups)
            {
#if TRACE
                startTicks = VNC.AppLog.Trace2("Fill DBFileGroups", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 28);
#endif
                lock (_concurrencyLock)
                {
                    DBFileGroupsTA.Fill(applicationDS.DBFileGroups);
                }
#if TRACE
                VNC.AppLog.Trace2("End Fill DBFileGroups", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 29, startTicks);
#endif
            }

            if (Config.ADSLoad_DBFileGroupInfo)
            {
#if TRACE
                startTicks = VNC.AppLog.Trace2("Fill DBFileGroupInfo", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 28);
#endif
                lock (_concurrencyLock)
                {
                    DBFileGroupInfoTA.Fill(applicationDS.DBFileGroupInfo);
                }
#if TRACE
                VNC.AppLog.Trace2("End Fill DBFileGroupInfo", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 29, startTicks);
#endif
            }

            if (Config.ADSLoad_DBLogFiles)
            {
#if TRACE
                startTicks = VNC.AppLog.Trace2("Fill DBLogFiles", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 30);
#endif
                lock (_concurrencyLock)
                {
                    DBLogFilesTA.Fill(applicationDS.DBLogFiles);
                }
#if TRACE
                VNC.AppLog.Trace2("End Fill DBLogFiles", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 31, startTicks);
#endif
            }

            if (Config.ADSLoad_DBLogFileInfo)
            {
#if TRACE
                startTicks = VNC.AppLog.Trace2("Fill DBLogFileInfo", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 32);
#endif
                lock (_concurrencyLock)
                {
                    DBLogFileInfoTA.Fill(applicationDS.DBLogFileInfo);
                }
#if TRACE
                VNC.AppLog.Trace2("End Fill DBLogFileInfo", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 33, startTicks);
#endif
            }

#if TRACE
            VNC.AppLog.Trace("End", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 62, startTicksTotal);
#endif
        }