private void AddConnection(bool isSource, string type) { if (string.IsNullOrEmpty(type)) { MessageBox.Show("Please select database type."); return; } DatabaseType dbType = this.DatabaseType; frmDbConnect frmDbConnect = new frmDbConnect(dbType); if (this.SetConnectionInfo(frmDbConnect)) { this.LoadProfileNames(frmDbConnect.ProflieName); } }
private bool SetConnectionInfo(frmDbConnect frmDbConnect) { DialogResult dialogResult = frmDbConnect.ShowDialog(); if (dialogResult == DialogResult.OK) { ConnectionInfo connectionInfo = frmDbConnect.ConnectionInfo; this.connectionInfo = connectionInfo; if (this.OnSelectedChanged != null) { this.OnSelectedChanged(this, connectionInfo); } return(true); } return(false); }
private bool CheckConnection() { if (this.displayInfo.ConnectionInfo == null) { frmDbConnect dbConnect = new frmDbConnect(this.displayInfo.DatabaseType) { NotUseProfile = true }; if (dbConnect.ShowDialog() == DialogResult.OK) { this.displayInfo.ConnectionInfo = dbConnect.ConnectionInfo; } } if (this.displayInfo.ConnectionInfo != null && !string.IsNullOrEmpty(this.displayInfo.ConnectionInfo.Database)) { return(true); } else { return(false); } }
public void ConfigConnection(bool requriePassword = false) { string type = this.cboDbType.Text; object selectedItem = this.cboDbProfile.SelectedItem; ConnectionProfileInfo profile = selectedItem as ConnectionProfileInfo; string profileName = selectedItem == null ? string.Empty : profile?.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.DatabaseType; frmDbConnect from = new frmDbConnect(dbType, profileName, requriePassword); from.ConnectionInfo = profile?.ConnectionInfo; this.SetConnectionInfo(from); if (profileName != from.ProflieName) { this.LoadProfileNames(from.ProflieName); } if (this.cboDbProfile.SelectedItem != null) { (this.cboDbProfile.SelectedItem as ConnectionProfileInfo).ConnectionInfo = from.ConnectionInfo; } }