public SqlEEViewModel(SIEESettings settings, ISqlClient sqlClient) { SqlEESettings = settings as SqlEESettings; SqlClient = sqlClient; CT = new SqlEEViewModel_CT(this); TT = new SqlEEViewModel_TT(this); DT = new SqlEEViewModel_DT(this); SelectedTab = 0; IsRunning = false; DataLoaded = false; if (SqlEESettings.LoginPossible) { LoginButtonHandler(); } CT.PropertyChanged += (s, e) => { if (CT.IsConnectionRelevant(e.PropertyName)) { SqlEESettings.LoginPossible = false; DataLoaded = false; TabNamesReset(); } }; }
private bool TestFunction_Login(ref string errorMsg) { SqlEEViewModel_CT vmConnection = (SqlEEViewModel_CT)CallingViewModel; try { vmConnection.Login(); } catch (Exception e) { errorMsg = "Could not log in. \n" + e.Message; if (e.InnerException != null) { errorMsg += "\n" + e.InnerException.Message; } return(false); } return(true); }
private bool TestFunction_Read(ref string errorMsg) { SqlEEViewModel_CT vmConnection = (SqlEEViewModel_CT)CallingViewModel; ISqlClient sqlClient = vmConnection.GetSqlClient(); try { List <string> tables = sqlClient.GetTablenames(); errorMsg = tables.Count.ToString() + " Tables found"; return(true); } catch (Exception e) { errorMsg = "Could not read solutions\n" + e.Message; if (e.InnerException != null) { errorMsg += "\n" + e.InnerException.Message; } return(false); } }