Beispiel #1
0
        private static SqlDatabaseSettings _GetDatabaseInfos(string pDatabaseName, SqlConnection pSqlConnection)
        {
            SqlDatabaseSettings sqlDatabase = new SqlDatabaseSettings { Name = pDatabaseName };
            string version = DatabaseManager.GetDatabaseVersion(pDatabaseName, pSqlConnection);

            if (string.IsNullOrEmpty(version)) return null;

            sqlDatabase.Version = version;
            sqlDatabase.Size = DatabaseManager.GetDatabaseSize(pDatabaseName, pSqlConnection);

            return sqlDatabase;
        }
        private void _InitializeTabPageSqlDatabaseSettings(SqlDatabaseSettings pSqlDatabaseSettings)
        {
            lbSQLServerSettings.Text = string.Format(" {0}: {1}     {2}:  {3}     {4}:  ****",
                "Server.Text", TechnicalSettings.DatabaseServerName,
                "Login.Text", TechnicalSettings.DatabaseLoginName,
                "Password.Text");

            lbSQLDatabaseSettingsName.Text = string.Format("{0}:  {1}            {2}:  {3}            {4}:  {5}",
                "Database.Text", pSqlDatabaseSettings.Name,
                 "BranchCode.Text", pSqlDatabaseSettings.BranchCode,
                 "Size.Text", pSqlDatabaseSettings.Size);
            lbSQLDatabaseSettingsVersion.Text = string.Format("{0}:  {1}",  "Version.Text", pSqlDatabaseSettings.Version);

            buttonSave.Visible = true;
            btnDatabaseConnection.Visible = false;
            if (pSqlDatabaseSettings.Version != TechnicalSettings.SoftwareVersion)
            {
                tBDatabaseSettingsSchemaResult.Text = "";
                lbSQLDatabaseSettingsUpgradeNeedfull.Visible = true;
                lbSQLDatabaseSettingsUpgradeNeedfull.Text = "UpgradeYourDatabase.Text";
                buttonSQLDatabaseSettingsUpgrade.Text = string.Format("{0} {1}","обновить до ", TechnicalSettings.SoftwareVersion);
                buttonSQLDatabaseSettingsUpgrade.Enabled = true;
                buttonSQLDatabaseSettingsUpgrade.Tag = pSqlDatabaseSettings;
            }
            else
            {
                lbSQLDatabaseSettingsUpgradeNeedfull.Visible = false;
                buttonSQLDatabaseSettingsUpgrade.Text = "Upgrade.Text";
                buttonSQLDatabaseSettingsUpgrade.Enabled = false;
                _CheckDatabaseStructure(pSqlDatabaseSettings.Name);
            }

            labelResult.Text = string.Empty;
            tableLayoutPanelDatabaseSettings.Controls.Add(groupBoxSQLSettings, 0, 0);
            tableLayoutPanelDatabaseSettings.Controls.Add(groupBoxSaveSettings, 0, 3);
        }