示例#1
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);
        }
示例#2
0
        /// <summary>
        /// This function sets whether or not security is enabled
        /// </summary>
        /// <param name="enable"></param>
        public void SecurityStatus(bool enable)
        {
            if (isDebugEnabled)
            {
                logger.Debug(System.Reflection.MethodBase.GetCurrentMethod().Name + " in");
            }

            if (compactDatabaseType)
            {
                try
                {
                    using (SqlCeConnection conn = DatabaseConnection.CreateOpenCEConnection())
                    {
                        SettingsDAO settingsDAO = new SettingsDAO();
                        settingsDAO.SetSetting("SecurityEnabled", enable);
                    }
                }
                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();
                lAuditWizardDataAccess.SecurityStatus(enable);
            }

            if (isDebugEnabled)
            {
                logger.Debug(System.Reflection.MethodBase.GetCurrentMethod().Name + " out");
            }
        }
示例#3
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);
            }
        }