private async Task PublishingAllAsync(IOrganizationServiceExtented service)
        {
            using (service.Lock())
            {
                try
                {
                    _iWriteToOutput.WriteToOutput(service.ConnectionData
                                                  , Properties.OutputStrings.PublishingAllFormat2
                                                  , service.ConnectionData.Name
                                                  , DateTime.Now.ToString("G", System.Globalization.CultureInfo.CurrentCulture)
                                                  );

                    var repository = new PublishActionsRepository(service);

                    await repository.PublishAllXmlAsync();

                    _iWriteToOutput.WriteToOutput(service.ConnectionData
                                                  , Properties.OutputStrings.PublishingAllCompletedFormat2
                                                  , service.ConnectionData.Name
                                                  , DateTime.Now.ToString("G", System.Globalization.CultureInfo.CurrentCulture)
                                                  );
                }
                catch (Exception ex)
                {
                    _iWriteToOutput.WriteErrorToOutput(service.ConnectionData, ex);

                    _iWriteToOutput.WriteToOutput(service.ConnectionData
                                                  , Properties.OutputStrings.PublishingAllFailedFormat2
                                                  , service.ConnectionData.Name
                                                  , DateTime.Now.ToString("G", System.Globalization.CultureInfo.CurrentCulture)
                                                  );
                }
            }
        }
Example #2
0
        private async Task PublishingAllAsync(IOrganizationServiceExtented service)
        {
            try
            {
                var repository = new PublishActionsRepository(service);

                await repository.PublishAllXmlAsync();

                _iWriteToOutput.WriteToOutput(service.ConnectionData, Properties.OutputStrings.PublishingAllCompletedFormat1, service.ConnectionData.Name);
            }
            catch (Exception ex)
            {
                _iWriteToOutput.WriteErrorToOutput(service.ConnectionData, ex);

                _iWriteToOutput.WriteToOutput(service.ConnectionData, Properties.OutputStrings.PublishingAllFailedFormat1, service.ConnectionData.Name);
            }
        }
        private async Task PublishingAllAsync(ConnectionData connectionData)
        {
            if (connectionData == null)
            {
                this._iWriteToOutput.WriteToOutput(connectionData, Properties.OutputStrings.NoCurrentCRMConnection);
                return;
            }

            this._iWriteToOutput.WriteToOutput(connectionData, Properties.OutputStrings.ConnectingToCRM);

            this._iWriteToOutput.WriteToOutput(connectionData, connectionData.GetConnectionDescription());

            var service = await QuickConnection.ConnectAsync(connectionData);

            if (service == null)
            {
                _iWriteToOutput.WriteToOutput(connectionData, Properties.OutputStrings.ConnectionFailedFormat1, connectionData.Name);
                return;
            }

            this._iWriteToOutput.WriteToOutput(connectionData, Properties.OutputStrings.CurrentServiceEndpointFormat1, service.CurrentServiceEndpoint);

            try
            {
                var repository = new PublishActionsRepository(service);

                await repository.PublishAllXmlAsync();

                _iWriteToOutput.WriteToOutput(connectionData, Properties.OutputStrings.PublishingAllCompletedFormat1, connectionData.Name);
            }
            catch (Exception ex)
            {
                _iWriteToOutput.WriteErrorToOutput(connectionData, ex);

                _iWriteToOutput.WriteToOutput(connectionData, Properties.OutputStrings.PublishingAllFailedFormat1, connectionData.Name);
            }
        }