public Root1 getCacheReserva(string llave) { try { _logger.LogInformation($"SOLICITUD OBTENCIO CACHE CON LA SIGUIENTE {llave}"); var client = new RestClient("http://host.docker.internal:32793/get/" + llave); Root1 responseVuelos = null; client.Timeout = -1; var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); if (response.IsSuccessful) { string test = response.Content; string test2 = test.Substring(1, test.Length - 1) .Replace("\\n", "").Replace("\\", ""); string test3 = test2.Remove(test2.Length - 1); string test4 = test3.Remove(test3.Length - 1); string test5 = test4.Remove(0, 1); _logger.LogInformation($"VALOR OBTENIDO {test5}"); responseVuelos = JsonConvert.DeserializeObject <Root1>(test5); } _logger.LogInformation($"NO SE OBTUVO NADA"); return(responseVuelos); } catch (Exception ex) { _logger.LogError("SE REVENTO LA JODA MI PAPA EN GET RESERVA:" + ex.Message); throw; } }
public List <string> IsConflict(List <string> NDC) { WebClient webC = new WebClient(); //finding the RXCUI code by the NDC code List <string> RXCUI = new List <string>(); string linkXML, XML, jsonText, RXCUICode; XmlDocument document; for (int i = 0; i < NDC.Count(); i++) { //the URL link to the XML file includeing the RXCUI code linkXML = @"https://rxnav.nlm.nih.gov/REST/rxcui?idtype=NDC&id=" + NDC[i]; //downloading the files from the server XML = webC.DownloadString(linkXML); document = new XmlDocument(); document.LoadXml(XML); //convert the xml to json file jsonText = JsonConvert.SerializeXmlNode(document); Root1 jsonClass = JsonConvert.DeserializeObject <Root1>(jsonText); try { RXCUICode = jsonClass.rxnormdata.idGroup.rxnormId; } catch (Exception) { RXCUICode = "false"; } RXCUI.Add(RXCUICode); } //if there is no Rx code if (RXCUI.All(IsFalse) == true) { return(new List <string>() { "", "false" }); } //the URL link to the XML file includeing interaction result string linkIteraction = "https://rxnav.nlm.nih.gov/REST/interaction/list?rxcuis=" + RXCUI[0]; for (int i = 1; i < RXCUI.Count(); i++) { linkIteraction = linkIteraction + "+" + RXCUI[i]; } List <string> strings = Isinterected(linkIteraction); return(strings); }