public void connectRepositorySqlAuth(ConnectionProfile repo, string user, string password)
        {
            if (repo != null)
            {
                if (user != null && password != null)
                {
                    _userName  = user;
                    Repository = new MS_SqlServerIPSerializer(user, password, repo.IPAddress, repo.Port, repo.InitialCatalog,
                                                              string.Format(REPOSITORY_PREFIX, repo.InitialCatalog));
                    Definitions = new MS_SqlServerIPSerializer(user, password, repo.IPAddress, repo.Port, repo.TaxonNamesInitialCatalog,
                                                               string.Format(REPOSITORY_PREFIX, repo.TaxonNamesInitialCatalog));
                    Synchronization = new MS_SqlServerIPSerializer(user, password, repo.IPAddress, repo.Port, SYNCDB_CATALOG,
                                                                   string.Format(SYNCDB_PREFIX, SYNCDB_CATALOG));

                    connectRepository(repo);
                }
                else
                {
                    _Log.Info("Login Credentials incomplete");
                }
            }
            else
            {
                _Log.Info("No Connection Configured");
            }
        }
Пример #2
0
        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();
        }
Пример #3
0
 private void buttonConnectRepository_Click(object sender, EventArgs e)
 {
     try
     {
         SerRepository = new MS_SqlServerIPSerializer(@textBoxUser.Text, @textBoxPassword.Text, @textBoxIP.Text, @textBoxPort.Text, @textBoxDBName.Text);
         SerRepository.RegisterType(typeof(TaxonNames));
         SerRepository.Activate();
         ConnRepository = SerRepository.CreateConnection();
         buttonConnectRepository.Text      = "Connected";
         buttonConnectRepository.BackColor = Color.Yellow;
         repositoryConnection = true;
     }
     catch (Exception f)
     {
         MessageBox.Show("An error according to Your Values has occured", "Check Values", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     startcheck();
 }