Ejemplo n.º 1
0
        /// <summary>
        /// Creates the report id from report keys
        /// </summary>
        /// <param name="reportKeys">Keys of the report.</param>
        /// <returns>Hash of the report.</returns>
        public static String GetHash(IDictionary <String, String> reportKeys)
        {
            var factAux = new FactJBRL();
            var json    = factAux.ParseJson(reportKeys);
            var hash    = factAux.GeneraHash(json);

            return(hash);
        }
Ejemplo n.º 2
0
        public static async Task <ResponseDto> ProcessFileAsync(Uri downloadUri, string cnbvId, DateTime receptionDate, SemaphoreSlim concurrencySemaphore)
        {
            try
            {
                using (WebClient webClient = new WebClient())
                {
                    //var azureFunctionURI = new Uri("http://localhost:7071/api/XBRLUploadFromJsonURI");
                    var azureFunctionURI = new Uri("https://jbrl-bot.azurewebsites.net/api/XBRLUploadFromJsonURI?code=gDAMhiFMTI1AW374tDqrE6nel3ddNX3FWOSDeFSF2ZJsRsdsbrJenQ==");
                    //var azureFunctionURI = new Uri("https://jbrl-bot.azurewebsites.net/api/XBRLUpdateTextFactsFromJonsURI?code=7i6yO9Cl4v/TcvwobhAiENAsR/jnSjTvFHk9ley8khItX1Kk7iTVTA==");
                    ServicePointManager.SecurityProtocol             = System.Net.SecurityProtocolType.Tls12;
                    webClient.Headers[HttpRequestHeader.ContentType] = "application/json";
                    var respectionDateSting = receptionDate.ToString("yyyy-MM-ddTHH:mm:ssZ");
                    var jsonBody            =
                        "{" +
                        "\"uri\":" + FactJBRL.ParseJson(downloadUri.AbsoluteUri) + ", " +
                        "\"downloadId\": \"" + cnbvId + "\", " +
                        "\"receptionDate\": \"" + respectionDateSting + "\"" +
                        "}";
                    LogUtil.Info(jsonBody);
                    var jsonResponse = await webClient.UploadStringTaskAsync(azureFunctionURI, jsonBody);

                    var response = JsonConvert.DeserializeObject <ResponseDto>(jsonResponse);
                    if (response.exception == null)
                    {
                        LogUtil.Info(jsonResponse);
                    }
                    else
                    {
                        LogUtil.Error(response);
                    }

                    return(response);
                }
            }
            catch (Exception ex)
            {
                LogUtil.Error(ex);
            }
            finally
            {
                concurrencySemaphore.Release();
            }
            return(new ResponseDto());
        }
Ejemplo n.º 3
0
        public static async Task <ResponseDto> ProcessFileAsync(string reportRecordId, SemaphoreSlim concurrencySemaphore)
        {
            try
            {
                using (WebClient webClient = new WebClient())
                {
                    var azureFunctionURI = new Uri("https://jbrl-bot.azurewebsites.net/api/XBRLRestoreReport?code=/YZp9LQ9E6wlMAVzVD5CiRHNG1DKD/hY7yCtENzuraYlXLfCfVmENQ==");
                    ServicePointManager.SecurityProtocol             = System.Net.SecurityProtocolType.Tls12;
                    webClient.Headers[HttpRequestHeader.ContentType] = "application/json";
                    var jsonBody =
                        "{" +
                        "\"reportRecordId\":" + FactJBRL.ParseJson(reportRecordId) +
                        "}";
                    LogUtil.Info(jsonBody);
                    var jsonResponse = await webClient.UploadStringTaskAsync(azureFunctionURI, jsonBody);

                    var response = JsonConvert.DeserializeObject <ResponseDto>(jsonResponse);
                    if (response.exception == null)
                    {
                        LogUtil.Info(jsonResponse);
                    }
                    else
                    {
                        LogUtil.Error(response);
                    }

                    return(response);
                }
            }
            catch (Exception ex)
            {
                LogUtil.Error(ex);
            }
            finally
            {
                concurrencySemaphore.Release();
            }
            return(new ResponseDto());
        }