Exemplo n.º 1
0
        /// <summary>
        /// Occurs when the form was shown
        /// </summary>
        private void ClassGenerator_Shown(object sender, EventArgs e)
        {
            var selector = new SourceSelection();

            if (selector.ShowDialog() == DialogResult.OK)
            {
                _provider  = selector.Provider;
                _mySqlRepo = selector.MySqlConnection;
                _msSqlRepo = selector.MsSqlConnection;

                ShowDatabases();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a connection to the server
        /// </summary>
        private void ConnectToServer()
        {
            if (string.IsNullOrEmpty(txtServer.Text))
            {
                return;
            }

            if (!checkWindowsAuthentication.Checked)
            {
                if (string.IsNullOrEmpty(txtUser.Text))
                {
                    return;
                }
                if (string.IsNullOrEmpty(txtPassword.Text))
                {
                    return;
                }
            }

            if (Provider == CustomEnums.Provider.MsSql)
            {
                if (checkWindowsAuthentication.Checked)
                {
                    MsSqlConnection = new MsSqlRepo(txtServer.Text, null, null, checkWindowsAuthentication.Checked);
                }
                else
                {
                    MsSqlConnection = new MsSqlRepo(txtServer.Text, txtUser.Text.ToSecureString(),
                                                    txtPassword.Text.ToSecureString(), checkWindowsAuthentication.Checked);
                }
            }
            else
            {
                MySqlConnection = new MySqlRepo(txtServer.Text, txtUser.Text.ToSecureString(),
                                                txtPassword.Text.ToSecureString());
            }

            DialogResult = DialogResult.OK;
        }