コード例 #1
0
    private static DatabaseMessageObject GetDatabaseMessage(string connectionString, string sql)
    {
        string message = "";
        bool   success = false;

        DatabaseOperation databaseOperation = new DatabaseOperation();

        SqlConnectionStringBuilder tempConnString = new SqlConnectionStringBuilder(connectionString);

        tempConnString.Password = ConnectionStringSecurity.Decode(tempConnString.Password);

        databaseOperation.InitializeDal(tempConnString.ToString());

        ErrorFormParams errorFormParams = databaseOperation.GetErrorFormParams();

        if (errorFormParams != null)
        {
            message = errorFormParams.Message;
        }
        else
        {
            try
            {
                DataTable dataTable = databaseOperation.ExecuteDataTable(sql);

                if (dataTable != null)
                {
                    message = dataTable.Rows[0]["Message"].ToString();
                    success = true;
                }
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }
        }

        return(new DatabaseMessageObject(success, message));
    }
コード例 #2
0
    public static void LoadConfig()
    {
        ConnectionString = ConnectionStringSecurity.Decode(RegistryHandler.ReadFromRegistry("ConnectionString"), "ConnectionString");

        if (ConnectionString == "")
        {
            ConnectionString = @"Data Source=SQLServerName\SQLServerInstance;Initial Catalog=master;Integrated Security=True";
        }

        ConnectionStringToSave = ConnectionStringSecurity.Decode(RegistryHandler.ReadFromRegistry("ConnectionString"), "ConnectionString");

        if (ConnectionStringToSave == "")
        {
            ConnectionStringToSave = @"Data Source=SQLServerName\SQLServerInstance;Initial Catalog=master;Integrated Security=True";
        }

        SaveConnectionString = RegistryHandler.ReadFromRegistry("SaveConnectionString");

        if (SaveConnectionString == "")
        {
            SaveConnectionString = "True";
        }

        WordWrap = RegistryHandler.ReadFromRegistry("WordWrap");

        if (WordWrap == "")
        {
            WordWrap = "False";
        }

        if (TraceFileDirectory == null)
        {
            TraceFileDirectory = "";
        }

        EditWindowSize = RegistryHandler.ReadFromRegistry("EditWindowSize");

        if (EditWindowSize == "")
        {
            EditWindowSize = GenericHelper.DefaultWindowSize;
        }

        EditorWindowSize = RegistryHandler.ReadFromRegistry("EditorWindowSize");

        if (EditorWindowSize == "")
        {
            EditorWindowSize = GenericHelper.DefaultWindowSize;
        }

        CommandLineParametersWindowSize = RegistryHandler.ReadFromRegistry("CommandLineParametersWindowSize");

        if (CommandLineParametersWindowSize == "")
        {
            CommandLineParametersWindowSize = GenericHelper.DefaultWindowSize;
        }

        MainWindowSize = RegistryHandler.ReadFromRegistry("MainWindowSize");

        if (MainWindowSize == "")
        {
            MainWindowSize = GenericHelper.DefaultWindowSize;
        }

        ResultsWindowSize = RegistryHandler.ReadFromRegistry("ResultsWindowSize");

        if (ResultsWindowSize == "")
        {
            ResultsWindowSize = GenericHelper.DefaultWindowSize;
        }

        ValueSubstitutorWindowSize = RegistryHandler.ReadFromRegistry("ValueSubstitutorWindowSize");

        if (ValueSubstitutorWindowSize == "")
        {
            ValueSubstitutorWindowSize = GenericHelper.DefaultWindowSize;
        }

        EditorFontFamily = RegistryHandler.ReadFromRegistry("EditorFontFamily");

        if (EditorFontFamily == "")
        {
            EditorFontFamily = "Courier New";
        }

        EditorFontSize = RegistryHandler.ReadFromRegistry("EditorFontSize");

        if (EditorFontSize == "")
        {
            EditorFontSize = "10";
        }

        DefaultStylesheet = RegistryHandler.ReadFromRegistry("DefaultStylesheet");

        if (DefaultStylesheet == "")
        {
            DefaultStylesheet = "Graphs";
        }

        UseExtendedEvents = RegistryHandler.ReadFromRegistry("UseExtendedEvents");

        if (UseExtendedEvents == "")
        {
            UseExtendedEvents = "";
        }

        IgnoreErrors = RegistryHandler.ReadFromRegistry("IgnoreErrors");

        OfflineMode = RegistryHandler.ReadFromRegistry("OfflineMode");

        if (OfflineMode == "")
        {
            OfflineMode = "False";
        }

        OfflineModeToSave = RegistryHandler.ReadFromRegistry("OfflineModeToSave");

        if (OfflineModeToSave == "")
        {
            OfflineModeToSave = "False";
        }

        CheckForUpdatesOnStart = RegistryHandler.ReadFromRegistry("CheckForUpdatesOnStart");

        if (CheckForUpdatesOnStart == "")
        {
            CheckForUpdatesOnStart = "True";
        }

        string installed = RegistryHandler.ReadFromRegistry("Installed", Registry.CurrentUser);

        if (installed == "1")
        {
            SaveConfig();             // To set default values in registry

            if (TaskHelper.TaskCollection.Tasks.Count == 0)
            {
                TaskHelper.TaskCollection.Description = "No Task Collection loaded.\r\nTo load or create a Task Collection choose \"Options\", \"Task Collection Editor...\".";
                TaskHelper.TaskCollection.Connections = 1;
                TaskHelper.TaskCollection.PerformanceCountersSamplingInterval = 0;
                TaskHelper.TaskCollection.TimeBetweenConnections = 0;
            }

            if (StylesheetHelper.StylesheetCollection.Stylesheets.Count == 0)
            {
                StylesheetHelper.StylesheetCollection = StylesheetHelper.XmlToStylesheetCollection(PerformanceTestTool.Properties.Resources.DefaultStylesheets);
            }

            SessionHelper.SaveSession();
            RegistryHandler.SaveToRegistry("Installed", "2", Registry.CurrentUser);
        }

        UpdateServiceUrl = RegistryHandler.ReadFromRegistry("UpdateServiceUrl");

        if (UpdateServiceUrl == "")
        {
            UpdateServiceUrl = "http://virtcore.com/VirtcoreService.asmx";
            RegistryHandler.SaveToRegistry("UpdateServiceUrl", UpdateServiceUrl);
        }
    }
コード例 #3
0
    public static void LoadConfig()
    {
        ConnectionString = ConnectionStringSecurity.Decode(RegistryHandler.ReadFromRegistry("ConnectionString"), "ConnectionString");

        if (ConnectionString == "")
        {
            ConnectionString = @"Data Source=SQLServerName\SQLServerInstance;Initial Catalog=master;Integrated Security=True";
        }

        ConnectionStringToSave = ConnectionStringSecurity.Decode(RegistryHandler.ReadFromRegistry("ConnectionString"), "ConnectionString");

        if (ConnectionStringToSave == "")
        {
            ConnectionStringToSave = @"Data Source=SQLServerName\SQLServerInstance;Initial Catalog=master;Integrated Security=True";
        }

        SaveConnectionString = RegistryHandler.ReadFromRegistry("SaveConnectionString");

        if (SaveConnectionString == "")
        {
            SaveConnectionString = "True";
        }

        DescriptionFields    = XmlToDescriptionFields(RegistryHandler.ReadFromRegistry("DescriptionFields"));
        DescriptionTemplates = XmlToDescriptionTemplates(RegistryHandler.ReadFromRegistry("DescriptionTemplates"));

        WindowSize = RegistryHandler.ReadFromRegistry("WindowSize");

        if (WindowSize == "")
        {
            WindowSize = "822; 555";
        }

        SplitterDistanceVertical = RegistryHandler.ReadFromRegistry("SplitterDistanceVertical");

        if (SplitterDistanceVertical == "")
        {
            SplitterDistanceVertical = "216";
        }

        SplitterDistanceHorizontal = RegistryHandler.ReadFromRegistry("SplitterDistanceHorizontal");

        if (SplitterDistanceHorizontal == "")
        {
            SplitterDistanceHorizontal = "200";
        }

        TextDataFontFamily = RegistryHandler.ReadFromRegistry("TextDataFontFamily");

        if (TextDataFontFamily == "")
        {
            TextDataFontFamily = "Courier New";
        }

        TextDataFontSize = RegistryHandler.ReadFromRegistry("TextDataFontSize");

        if (TextDataFontSize == "")
        {
            TextDataFontSize = "10";
        }

        DescriptionFontFamily = RegistryHandler.ReadFromRegistry("DescriptionFontFamily");

        if (DescriptionFontFamily == "")
        {
            DescriptionFontFamily = "Courier New";
        }

        DescriptionFontSize = RegistryHandler.ReadFromRegistry("DescriptionFontSize");

        if (DescriptionFontSize == "")
        {
            DescriptionFontSize = "10";
        }

        CheckForUpdatesOnStart = RegistryHandler.ReadFromRegistry("CheckForUpdatesOnStart");

        if (CheckForUpdatesOnStart == "")
        {
            CheckForUpdatesOnStart = "True";
        }

        ShowDdlScript = RegistryHandler.ReadFromRegistry("ShowDdlScript");

        if (ShowDdlScript == "")
        {
            ShowDdlScript = "True";
        }

        SchemaName = RegistryHandler.ReadFromRegistry("SchemaName");

        if (SchemaName == "")
        {
            SchemaName = "dbo";
        }

        UpdateServiceUrl = RegistryHandler.ReadFromRegistry("UpdateServiceUrl");

        if (UpdateServiceUrl == "")
        {
            UpdateServiceUrl = "http://virtcore.com/VirtcoreService.asmx";
            RegistryHandler.SaveToRegistry("UpdateServiceUrl", UpdateServiceUrl);
        }
    }
コード例 #4
0
 private static string DecodeConnectionStringPassword(string encryptedPassword)
 {
     return(ConnectionStringSecurity.Decode(encryptedPassword));
 }