Exemple #1
0
        private void ConfigConnection(bool isSource, string type, object selectedItem, bool requriePassword = false)
        {
            string profileName = selectedItem == null ? string.Empty : (selectedItem as ConnectionInfoProfile)?.Name;

            if (string.IsNullOrEmpty(type))
            {
                MessageBox.Show("Please select database type.");
                return;
            }

            if (string.IsNullOrEmpty(profileName))
            {
                MessageBox.Show("Please select a profile.");
                return;
            }

            DatabaseType dbType       = this.GetDatabaseType(type);
            frmDbConnect frmDbConnect = new frmDbConnect(dbType, profileName, requriePassword);

            this.SetConnectionInfo(isSource, frmDbConnect);

            if (profileName != frmDbConnect.ProflieName)
            {
                this.LoadProfileNames(isSource, frmDbConnect.ProflieName);
            }
        }
Exemple #2
0
        private void AddConnection(bool isSource, string type)
        {
            if (string.IsNullOrEmpty(type))
            {
                MessageBox.Show("Please select database type.");
                return;
            }

            DatabaseType dbType       = this.GetDatabaseType(type);
            frmDbConnect frmDbConnect = new frmDbConnect(dbType);

            if (this.SetConnectionInfo(isSource, frmDbConnect))
            {
                this.LoadProfileNames(isSource, frmDbConnect.ProflieName);
            }
        }
Exemple #3
0
        private bool SetConnectionInfo(bool isSource, frmDbConnect frmDbConnect)
        {
            DialogResult dialogResult = frmDbConnect.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                ConnectionInfo connectionInfo = frmDbConnect.ConnectionInfo;
                if (isSource)
                {
                    this.sourceDbConnectionInfo = connectionInfo;
                }
                else
                {
                    this.targetDbConnectionInfo = connectionInfo;
                }
                return(true);
            }
            return(false);
        }