Beispiel #1
0
        private static void DoWork(object sender, DoWorkEventArgs e)
        {
            // Try to connect to CRM server

            var connectionString = e.Argument as string;

            if (connectionString == null)
            {
                throw new Exception("Connection String must not be null.");
            }

            if (!ConnectionDialog.TestOrganizationConnection(connectionString))
            {
                throw new Exception();
            }
        }
        private static void DoWork(object sender, DoWorkEventArgs e)
        {
            // connect to CRM server

            var connectionData = e.Argument as ConnectionData;

            if (connectionData == null)
            {
                throw new Exception("Connection String must not be null.");
            }

            // copy the password over to a new property
            // this is necessary because the form will automatically blank out the password field

            connectionData.Password = connectionData.FormPassword;

            connectionData.Organizations = ConnectionDialog.GetOrganizations(connectionData);
        }
Beispiel #3
0
        private void ProcessInput()
        {
            if (!IsInputValid())
            {
                return;
            }

            _connectionData.Organization = (OrganizationDetail)cmbOrganizationName.SelectedItem;

            var connectionString = ConnectionDialog.GenerateCrmConnectionString(_connectionData);

            _connectionData.ConnectionString = connectionString;

            if (string.IsNullOrEmpty(connectionString))
            {
                throw new NullReferenceException("ErrorPage generating connection string.");
            }

            Connect(connectionString);
        }