示例#1
0
        public bool Authenticate(string username, string password)
        {
            string tgt = UmlsHelper.Authenticate(username, password);

            this.ticketGrantingTicket = tgt;
            return(!string.IsNullOrEmpty(this.ticketGrantingTicket));
        }
示例#2
0
        public bool Authenticate(string apiKey)
        {
            string tgt = UmlsHelper.GetTicketGrantingTicket(apiKey);

            this.ticketGrantingTicket = tgt;
            return(!string.IsNullOrEmpty(this.ticketGrantingTicket));
        }
示例#3
0
        /// <summary>
        /// Retrieves the specified value set from the VSAC and imports the value set into Trifolia.
        /// If the value set already exists, it is updated with the latest name and codes from VSAC.
        /// </summary>
        /// <remarks>Requires Authenticate() to be called first.</remarks>
        /// <param name="oid">The oid of the value set to retrieve. Should not include any prefix (i.e. "urn:oid:")</param>
        public bool ImportValueSet(string oid)
        {
            string serviceTicket = UmlsHelper.GetServiceTicket(this.ticketGrantingTicket);

            if (string.IsNullOrEmpty(serviceTicket))
            {
                return(false);
            }

            string          url        = string.Format(SVS_RETRIEVE_VALUE_SET_URL_FORMAT, oid, serviceTicket);
            HttpWebRequest  webRequest = (HttpWebRequest)HttpWebRequest.Create(url);
            HttpWebResponse response   = (HttpWebResponse)webRequest.GetResponse();

            if (response.StatusCode == HttpStatusCode.OK)
            {
                using (StreamReader sr = new StreamReader(response.GetResponseStream()))
                {
                    string responseBody = sr.ReadToEnd();
                    return(this.ImportRetrieveValueSet(responseBody));
                }
            }

            return(false);
        }