public void connectToRepository(RepositoryOptions ro, string user, string password) { if (string.IsNullOrEmpty(ro.InitialCatalog) || string.IsNullOrEmpty(ro.IPAddress) || string.IsNullOrEmpty(ro.IPPort) || string.IsNullOrEmpty(user) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(ro.TaxonNamesInitialCatalog)) return; //RepositoryOptions aktualisieren? if (ro.SqlAuthentification) { if (ro.LastUsername != user) { ro.LastUsername = user; OptionsAccess.RepositoryOptions = ro; } } else { if (ro.LastUsername != Environment.UserName) { ro.LastUsername = Environment.UserName; OptionsAccess.RepositoryOptions = ro; } } StringBuilder praef=new StringBuilder(); praef.Append("[").Append(ro.InitialCatalog).Append("].[dbo]."); String praefix = praef.ToString(); StringBuilder taxPraef = new StringBuilder(); taxPraef.Append("[").Append(ro.TaxonNamesInitialCatalog).Append("].[dbo]."); String taxonPraefix = taxPraef.ToString(); StringBuilder syncPraef = new StringBuilder(); syncPraef.Append("[").Append("Synchronisation_Test").Append("]."); String syncPraefix = syncPraef.ToString(); if(ro.SqlAuthentification) { RepositoryDB = new MS_SqlServerIPSerializer(ro.LastUsername, password ,ro.IPAddress, ro.IPPort, ro.InitialCatalog, praefix); RepositoryDefinitions = new MS_SqlServerIPSerializer(ro.LastUsername, password, ro.IPAddress, ro.IPPort, ro.TaxonNamesInitialCatalog,taxonPraefix); Synchronization = new MS_SqlServerIPSerializer(ro.LastUsername, password, ro.IPAddress, ro.IPPort, syncDBCatalog,syncPraefix); } else { RepositoryDB = new MS_SqlServerWASerializier(ro.IPAddress+","+ro.IPPort, ro.InitialCatalog,praefix); RepositoryDefinitions = new MS_SqlServerWASerializier(ro.IPAddress + "," + ro.IPPort, ro.TaxonNamesInitialCatalog,taxonPraefix); Synchronization = new MS_SqlServerWASerializier(ro.IPAddress + "," + ro.IPPort, syncDBCatalog,syncPraefix); } //Verbindung zum Repository herstellen connectRepositoryDB(); connectSynchronization(ro); connectRepositoryDefinitions(); }
public void connectRepositoryWinAuth(ConnectionProfile repo) { if (repo != null) { _userName = Environment.UserName; Repository = new MS_SqlServerWASerializier(repo.IPAddress + "," + repo.Port, repo.InitialCatalog, string.Format(REPOSITORY_PREFIX, repo.InitialCatalog)); Definitions = new MS_SqlServerWASerializier(repo.IPAddress + "," + repo.Port, repo.TaxonNamesInitialCatalog, string.Format(REPOSITORY_PREFIX, repo.TaxonNamesInitialCatalog)); Synchronization = new MS_SqlServerWASerializier(repo.IPAddress + "," + repo.Port, SYNCDB_CATALOG, string.Format(SYNCDB_PREFIX, SYNCDB_CATALOG)); connectRepository(repo); } else _Log.Info("No Connection Configured"); }