Ejemplo n.º 1
0
        private void btnTestConnect_Click(object sender, EventArgs e)
        {
            string server   = txtServer.Text;
            string database = txtDatabase.Text;
            string port     = txtPort.Text;
            string username = txtUsername.Text;
            string password = txtPassword.Text;
            bool   result   = DatabaseConfig.CheckConnectDatabase(server, database, port, username, password);

            if (result)
            {
                MessageBox.Show(MessageBoxText.DatabaseConnectTrue, MessageBoxText.CaptionInformation, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show(MessageBoxText.DatabaseConnectFalse, MessageBoxText.CaptionError, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        private void btnSaveConnect_Click(object sender, EventArgs e)
        {
            string server   = txtServer.Text;
            string database = txtDatabase.Text;
            string port     = txtPort.Text;
            string username = txtUsername.Text;
            string password = txtPassword.Text;
            bool   result   = DatabaseConfig.CheckConnectDatabase(server, database, port, username, password);

            if (result)
            {
                DatabaseConfig.SaveLocalStorageConfig(server, database, port, username, password);
                DialogResult resultBox = MessageBox.Show(MessageBoxText.SaveFileSuccess, MessageBoxText.CaptionSuccess, MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (resultBox == DialogResult.OK)
                {
                    Application.Exit();
                }
            }
            else
            {
                MessageBox.Show(MessageBoxText.DatabaseConnectFalse, MessageBoxText.CaptionError, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }