コード例 #1
0
        public void Can_Get_SQL_Servers()
        {
            var sqlManager = new SqlManager();
            var servers = sqlManager.GetServers();

            Assert.IsTrue(servers.Contains(Environment.MachineName));
        }
コード例 #2
0
        public void Can_Get_SQL_Databases()
        {
            var sqlManager = new SqlManager();
            var databases = sqlManager.GetDatabases(Environment.MachineName, "sysdba", "masterkey");

            Assert.IsTrue(databases.Contains("saleslogix_eval"));
        }
コード例 #3
0
        private void DatabaseCombo_DropDown(object sender, EventArgs e)
        {
            ErrorLabel.Text = string.Empty;

            if (ServerCombo.Text.Trim() == string.Empty
                || UserTextBox.Text.Trim() == string.Empty
                ) return;

            if (PasswordTextBox.Text.Trim() == string.Empty)
            {
                ErrorLabel.Text = _NOPASSWORD;
                DatabaseCombo.DroppedDown = false;
                return;
            }

            this.Cursor = Cursors.WaitCursor;
            DatabaseCombo.Items.Clear();

            try
            {
                var sqlManager = new SqlManager();
                var databases = sqlManager.GetDatabases(ServerCombo.Text, UserTextBox.Text, PasswordTextBox.Text);
                foreach (var database in databases)
                {
                    DatabaseCombo.Items.Add(database);
                }
            }
            catch (Exception exception)
            {
                ErrorLabel.Text = string.Format(_GENERALERROR, exception.Message);
            }

            this.Cursor = Cursors.Default;
        }
コード例 #4
0
        private void DatabaseCombo_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (DatabaseCombo.SelectedIndex == -1) return;

            var sqlManager = new SqlManager();
            if (sqlManager.IsSalesLogixDatabase(DatabaseCombo.Text, ServerCombo.Text, UserTextBox.Text, PasswordTextBox.Text))
            {
                StartButton.Enabled = true;
                ErrorLabel.Text = string.Empty;
            }
            else
            {
                StartButton.Enabled = false;
                ErrorLabel.Text = _DATABASENOTSALESLOGIX;
            }
        }
コード例 #5
0
 public void Can_Test_If_Database_Is_SalesLogix_Database()
 {
     var sqlManager = new SqlManager();
     Assert.IsTrue(sqlManager.IsSalesLogixDatabase("saleslogix_eval", Environment.MachineName, "sysdba", "masterkey"));
 }
コード例 #6
0
        private void StartButton_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;

                var sqlManager = new SqlManager();
                var logins = sqlManager.GetLogins(ServerCombo.Text, DatabaseCombo.Text, UserTextBox.Text, PasswordTextBox.Text);
                DataListView.Tag = logins;
                PopulateListView();
            }
            catch (Exception exception)
            {
                ErrorLabel.Text = string.Format(_GENERALERROR, exception.Message);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
コード例 #7
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     this.Cursor = Cursors.AppStarting;
     new Thread(() =>
     {
         var sqlManager = new SqlManager();
         foreach (var server in sqlManager.GetServers())
         {
             ServerCombo.SafeThreadAction(x => x.Items.Add(server));
         }
         this.SafeThreadAction(x => x.Cursor = Cursors.Default);
     }).Start();
 }