Esempio n. 1
0
        public static void UpdateProviderObjects(MainForm frm)
        {
            PFConnectionManager connMgr = new PFConnectionManager();

            try
            {
                _msg.Length = 0;
                _msg.Append("UpdateProviderObjects started ...\r\n");
                Program._messageLog.WriteLine(_msg.ToString());

                //this will get the installation status
                connMgr.UpdateAllProvidersInstallationStatus();
            }
            catch (System.Exception ex)
            {
                _msg.Length = 0;
                _msg.Append(AppGlobals.AppMessages.FormatErrorMessage(ex));
                Program._messageLog.WriteLine(_msg.ToString());
                AppMessages.DisplayErrorMessage(_msg.ToString(), _saveErrorMessagesToAppLog);
            }
            finally
            {
                _msg.Length = 0;
                _msg.Append("\r\n... UpdateProviderObjects finished.");
                Program._messageLog.WriteLine(_msg.ToString());
            }
        }
        private void InitFormValues()
        {
            bool showInstalledDatabaseProvidersOnly = this.ShowInstalledDatabaseProvidersOnly;
            PFConnectionManager connMgr             = new PFConnectionManager();
            PFKeyValueList <string, PFProviderDefinition> provDefs = connMgr.GetListOfProviderDefinitions();

            if (provDefs.Count == 0)
            {
                connMgr.CreateProviderDefinitions();
            }
            else
            {
                connMgr.UpdateAllProvidersInstallationStatus();
            }
            provDefs = connMgr.GetListOfProviderDefinitions();

            this.cboDatabaseTypeForOutputTable.Items.Clear();
            foreach (stKeyValuePair <string, PFProviderDefinition> provDef in provDefs)
            {
                if (showInstalledDatabaseProvidersOnly)
                {
                    if (provDef.Value.InstallationStatus == enProviderInstallationStatus.IsInstalled)
                    {
                        //this.cboDatabaseTypeForOutputTable.Items.Add(provDef.Key);
                        if (provDef.Value.AvailableForSelection)
                        {
                            this.cboDatabaseTypeForOutputTable.Items.Add(provDef.Key);
                        }
                        else
                        {
                            ;
                        }
                    }
                    else
                    {
                        ;
                    }
                }
                else
                {
                    this.cboDatabaseTypeForOutputTable.Items.Add(provDef.Key);
                }
            }

            SetOutputDatabaseProvider();
            SetOutputConnectionString();
            if (this.cboDatabaseTypeForOutputTable.Text.Trim().Length > 0)
            {
                SetOutputTableName();
                SetOutputBatchSizeForDbPlatform();
            }
            else
            {
                this.txtOutputTableName.Text = string.Empty;
                this.txtOutputBatchSize.Text = AppConfig.GetStringValueFromConfigFile("DefaultOutputDatabaseBatchSize", "120");;
            }
            this.chkReplaceExistingTable.Checked = AppConfig.GetBooleanValueFromConfigFile("ReplaceOutputTableIfExists", "False");
        }
        private void RefreshProviderOption(DatabasePlatform dbPlat, RadioButton opt)
        {
            PFConnectionManager connMgr = new PFConnectionManager();

            //test
            //if (this.chkShowInstalledProvidersOnly.Checked)
            //{
            //    if (dbPlat == DatabasePlatform.Informix
            //        || dbPlat == DatabasePlatform.SQLAnywhereUltraLite
            //        || dbPlat == DatabasePlatform.SQLServerCE40)
            //    {
            //        opt.Visible = false;
            //        return;
            //    }
            //}
            //end test

            if (connMgr.ProviderDefinitions.Count == 0)
            {
                connMgr.CreateProviderDefinitions();
            }
            else
            {
                connMgr.UpdateAllProvidersInstallationStatus();
            }

            if (this.chkShowInstalledProvidersOnly.Checked)
            {
                for (int i = 0; i < connMgr.ProviderDefinitions.Count; i++)
                {
                    PFProviderDefinition provDef = connMgr.ProviderDefinitions[i].Value;
                    if (provDef.DbPlatform == dbPlat)
                    {
                        if (provDef.InstallationStatus == enProviderInstallationStatus.IsInstalled)
                        {
                            opt.Visible = true;
                        }
                        else
                        {
                            opt.Visible = false;
                        }
                        break;
                    }
                }//end for loop
            }
            else
            {
                opt.Visible = true;
            }
        }
        private void VerifyProviderLists()
        {
            PFKeyValueList <string, PFProviderDefinition> provDefs = _connMgr.GetListOfProviderDefinitions();

            if (provDefs.Count == 0)
            {
                _connMgr.CreateProviderDefinitions();
            }
            else
            {
                _connMgr.UpdateAllProvidersInstallationStatus();
            }
            //provDefs = _connMgr.GetListOfProviderDefinitions();
        }