示例#1
0
        // Methods
        public AuditStatistics(DataRow dataRow)
        {
            try
            {
                this._publishers            = Convert.ToInt32(dataRow["publishers"]);
                this._uniqueApplications    = Convert.ToInt32(dataRow["uniqueapplications"]);
                this._totalApplications     = Convert.ToInt32(dataRow["totalapplications"]);
                this._deployedAgents        = Convert.ToInt32(dataRow["deployedagents"]);
                this._mostCommonApplication = "";

                // Get the filtered publisher string from the database
                SettingsDAO lwDataAccess    = new SettingsDAO();
                string      publisherFilter = lwDataAccess.GetPublisherFilter();
                if (publisherFilter != "")
                {
                    String[] publishers = publisherFilter.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    _filterPublishersCount = publishers.Length;
                }
                else
                {
                    _filterPublishersCount = 0;
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                Utility.DisplayErrorMessage("Exception occurred creating an AUDITSTATISTICS Object, please check database schema.  The message was " + ex.Message);
            }
        }
示例#2
0
        public void LoadSettings()
        {
            SettingsDAO lwDataAccess = new SettingsDAO();

            AutoPurge         = lwDataAccess.GetSettingAsBoolean(Setting_AutoPurge, false);
            HistoryPurge      = Convert.ToInt32(lwDataAccess.GetSetting(Setting_HistoryPurge, false));
            HistoryPurgeUnits = (PURGEUNITS)Convert.ToInt32(lwDataAccess.GetSetting(Setting_HistoryPurgeUnits, false));
            //
            InternetPurge      = Convert.ToInt32(lwDataAccess.GetSetting(Setting_InternetPurge, false));
            InternetPurgeUnits = (PURGEUNITS)Convert.ToInt32(lwDataAccess.GetSetting(Setting_InternetPurgeUnits, false));
            //
            AssetPurge      = Convert.ToInt32(lwDataAccess.GetSetting(Setting_AssetPurge, false));
            AssetPurgeUnits = (PURGEUNITS)Convert.ToInt32(lwDataAccess.GetSetting(Setting_AssetPurgeUnits, false));
            //
            DatabaseBackupFolder = lwDataAccess.GetSetting(Setting_DatabaseFolder, false);
        }
示例#3
0
        public void SaveSettings()
        {
            SettingsDAO lwDataAccess = new SettingsDAO();

            lwDataAccess.SetSetting(Setting_AutoPurge, AutoPurge.ToString(), false);
            //
            lwDataAccess.SetSetting(Setting_HistoryPurge, HistoryPurge.ToString(), false);
            lwDataAccess.SetSetting(Setting_HistoryPurgeUnits, ((int)HistoryPurgeUnits).ToString(), false);
            //
            lwDataAccess.SetSetting(Setting_InternetPurge, InternetPurge.ToString(), false);
            lwDataAccess.SetSetting(Setting_InternetPurgeUnits, ((int)InternetPurgeUnits).ToString(), false);
            //
            lwDataAccess.SetSetting(Setting_AssetPurge, AssetPurge.ToString(), false);
            lwDataAccess.SetSetting(Setting_AssetPurgeUnits, ((int)AssetPurgeUnits).ToString(), false);
            //
            lwDataAccess.SetSetting(Setting_DatabaseFolder, DatabaseBackupFolder, false);
        }
示例#4
0
        /// <summary>
        /// Return the current security status
        /// </summary>
        /// <returns></returns>
        public bool SecurityStatus()
        {
            if (isDebugEnabled)
            {
                logger.Debug(System.Reflection.MethodBase.GetCurrentMethod().Name + " in");
            }

            bool bEnabled = false;

            if (compactDatabaseType)
            {
                using (SqlCeConnection conn = DatabaseConnection.CreateOpenCEConnection())
                {
                    try
                    {
                        SettingsDAO settingsDAO = new SettingsDAO();
                        bEnabled = (settingsDAO.GetSetting("SecurityEnabled", false) == "True");
                    }
                    catch (SqlCeException ex)
                    {
                        Utility.DisplayErrorMessage("A database error has occurred in AuditWizard." + Environment.NewLine + Environment.NewLine +
                                                    "Please see the log file for further details.");
                        logger.Error("Exception in " + System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
                    }
                    catch (Exception ex)
                    {
                        Utility.DisplayErrorMessage("A database error has occurred in AuditWizard." + Environment.NewLine + Environment.NewLine +
                                                    "Please see the log file for further details.");

                        logger.Error("Exception in " + System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
                    }
                }
            }
            else
            {
                AuditWizardDataAccess lAuditWizardDataAccess = new AuditWizardDataAccess();
                bEnabled = lAuditWizardDataAccess.SecurityStatus();
            }

            if (isDebugEnabled)
            {
                logger.Debug(System.Reflection.MethodBase.GetCurrentMethod().Name + " out");
            }
            return(bEnabled);
        }
示例#5
0
        public void CheckHBStoredProcs()
        {
            try
            {
                if (compactDatabaseType)
                {
                    return;
                }
                else
                {
                    SettingsDAO lSettingsDao = new SettingsDAO();

                    using (SqlConnection conn = DatabaseConnection.CreateOpenStandardConnection())
                    {
                        string latestHBSPVersion = "1.1";

                        if (lSettingsDao.GetSetting("HBSPAdded", false) != latestHBSPVersion)
                        {
                            ExecuteDatabaseCreateScript(Application.StartupPath + @".\db\CreateHBStoredProcedures.sql", conn);
                            lSettingsDao.SetSetting("HBSPAdded", latestHBSPVersion, false);
                        }
                    }
                }
            }
            catch (SqlException ex)
            {
                Utility.DisplayErrorMessage("A database error has occurred in AuditWizard." + Environment.NewLine + Environment.NewLine +
                                            "Please see the log file for further details.");
                logger.Error("Exception in " + System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
            }
            catch (Exception ex)
            {
                Utility.DisplayErrorMessage("There was an error adding the HelpBox stored procedures." + Environment.NewLine + Environment.NewLine +
                                            "Please see the log file for further details.");

                logger.Error("Exception in " + System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
            }
        }