private async Task <GetListOperationsOutput> GetOperations(GetListOperationsInput OperationsInput)
        {
            _proxy.InnerChannel.OperationTimeout = TimeSpan.FromMinutes(10);
            var operations = await _proxy.getListOperationsAsync(OperationsInput);

            if (operations.returnCodes.Any())
            {
                string error = "";

                foreach (var returnCode in operations.returnCodes)
                {
                    error += $"{returnCode.code} : {returnCode.message} {Environment.NewLine}";
                }

                throw new InvalidOperationException($"An error occurred while getting operations from Signal. {error}");
            }

            return(operations);
        }
        public async Task <string> GetOperations(string programCode, DateTime startDate, DateTime endDate, string operationsInternes)
        {
            GetListOperationsOutput operationOutput = null;
            string error      = "";
            var    retryCount = 0;
            var    canRetry   = retryCount < 3;
            Dictionary <int, string> errorMessage = new Dictionary <int, string>();
            var outMessages = string.Empty;

            try
            {
                GetListOperationsInput ReservationsInput = new GetListOperationsInput()
                {
                    principal          = System.Configuration.ConfigurationManager.AppSettings["SignalUser"],
                    subject            = System.Configuration.ConfigurationManager.AppSettings["SignalPassword"],
                    codeProgramme      = programCode,
                    codeNavire         = null,
                    operationsInternes = operationsInternes,
                    dateDebut          = startDate,
                    dateFin            = endDate,
                };

                _logger.Debug($"Calling Signal WS: {_proxy.Endpoint.ListenUri.AbsoluteUri}.");
                //_logger.Debug($"Start importing Signal operations. Criteria: {JsonConvert.SerializeObject(ReservationsInput)}.");
                HubFunctions.SendMessage($"start Calling Signal WS: {_proxy.Endpoint.ListenUri.AbsoluteUri}.");
                _logger.Debug($"Start importing Signal operations. Criteria: {JsonConvert.SerializeObject(ReservationsInput)}.");
                while (canRetry)
                {
                    try
                    {
                        operationOutput = await GetOperations(ReservationsInput);

                        HubFunctions.SendMessage($"end Calling Signal WS");
                        canRetry = false;
                    }
                    catch (Exception ex)
                    {
                        retryCount++;
                        canRetry = retryCount < 3;
                        if (!canRetry)
                        {
                            error = $"An error occurred while calling Signal ExtractionOperationsWS service: {ex.Message}\n";
                            HubFunctions.SendMessage(error);
                            _logger.Error(error);
                            throw;
                        }
                        else
                        {
                            //_logger.Debug($"An error occurred while calling Signal ExtractionOperationsWS service. Waiting for retry..");
                            HubFunctions.SendMessage($"An error occurred while calling Signal ExtractionOperationsWS service. Waiting for retry..");
                            _logger.Error($"An error occurred while calling Signal ExtractionOperationsWS service. Waiting for retry..");
                            await Task.Delay(5000 *retryCount);
                        }
                    }
                }

                if (operationOutput != null && operationOutput.listOperations != null && operationOutput.listOperations.Any())
                {
                    if (operationOutput.returnCodes != null && operationOutput.returnCodes.Length > 0)
                    {
                        // errorMessage.Add(operationOutput.returnCodes[0].code, operationOutput.returnCodes[0].message);
                        outMessages = "ErrorCode: " + operationOutput.returnCodes[0].code + "\n Error message: " + operationOutput.returnCodes[0].message;
                        return(outMessages);
                    }
                    //var listOpe = operations.listOperations.Where(e => e.idPositionCtrm > 0).ToList();
                    outMessages = SaveOperations(operationOutput, programCode, startDate, endDate, ref errorMessage);
                    //calcul de l'exposure sur chaque opeartion par procedure stoqué
                    //_dataContext..ExecuteStoreCommand("[compute]", new object[] { });
                }
            }
            finally
            {
                //CheckProcessCanContinue(_currentProcess, error);
            }

            return(outMessages);
        }