Exemple #1
0
        public List <Application> GetApplicationList(MedicalInstitutions institution)
        {
            List <Application> applicationList = new List <Application>();

            Assembly    a   = Assembly.GetExecutingAssembly();
            Stream      s   = a.GetManifestResourceStream("K4Y.AMCAS.DataExchange.DataAccess.Samples.Applications.xml");
            XmlDocument doc = new XmlDocument();

            doc.Load(s);

            string xmlns = doc.DocumentElement.Attributes["xmlns"].Value;
            XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);

            nsmgr.AddNamespace("amcas", xmlns);

            XmlNodeList nodes     = doc.DocumentElement.SelectNodes("/amcas:Export/amcas:Applications/amcas:Application", nsmgr);
            string      firstName = "";
            string      lastName  = "";
            string      phone     = "";

            foreach (XmlNode node in nodes)
            {
                firstName = node.SelectSingleNode("amcas:IdentifyingInformation/amcas:FirstName", nsmgr).InnerText;
                lastName  = node.SelectSingleNode("amcas:IdentifyingInformation/amcas:LastName", nsmgr).InnerText;
                phone     = node.SelectSingleNode("amcas:ContactInformation/amcas:Phone", nsmgr).InnerText;
                applicationList.Add(new Application()
                {
                    FirstName = firstName,
                    LastName  = lastName,
                    Phone     = phone
                });
            }
            return(applicationList);
        }
Exemple #2
0
        public override List <Application> GetAllApplications(MedicalInstitutions institution)
        {
            string      responseContent = GetApiResponseContent(institution);
            XmlDocument doc             = new XmlDocument();

            doc.LoadXml(responseContent);
            return(parseApplicationsXml(doc));
        }
        public override List <Application> GetSingleApplication(MedicalInstitutions institution, string year, string AAMCID)
        {
            List <Application> applicationList = new List <Application>();

            Assembly    a   = Assembly.GetExecutingAssembly();
            Stream      s   = a.GetManifestResourceStream("K4Y.AMCAS.DataExchange.RestApi.Samples.SingleApplication.xml");
            XmlDocument doc = new XmlDocument();

            doc.Load(s);

            return(parseApplicationsXml(doc));
        }
        public override string GetApiResponseContent(MedicalInstitutions institution)
        {
            string   content = "";
            Assembly a       = Assembly.GetExecutingAssembly();
            Stream   s       = a.GetManifestResourceStream("K4Y.AMCAS.DataExchange.RestApi.Samples.Applications.xml");

            using (StreamReader reader = new StreamReader(s))
            {
                content = reader.ReadToEnd();
            }
            return(content);
        }
Exemple #5
0
        private async Task <List <Application> > getApplicationListAsync(MedicalInstitutions institution)
        {
            List <Application> applications = new List <Application>();

            String query = String.Format("applications");
            HttpResponseMessage response = await client.GetAsync(query);

            if (response.IsSuccessStatusCode)
            {
                applications = await response.Content.ReadAsAsync <List <Application> >();
            }

            return(applications);
        }
Exemple #6
0
        private async Task <string> getApiResponseContentAsync(MedicalInstitutions institution)
        {
            string content = "";

            String query = String.Format("applications");
            HttpResponseMessage response = await client.GetAsync(query);

            if (response.IsSuccessStatusCode)
            {
                content = await response.Content.ReadAsStringAsync();
            }

            return(content);
        }
Exemple #7
0
        public override string GetApiResponseContent(MedicalInstitutions institution)
        {
            var psi = new ProcessStartInfo(AppDomain.CurrentDomain.BaseDirectory + @"curl\curl.exe")
            {
                Arguments              = @" --insecure --cacert curl-ca-bundle.crt -H ""Med-Inst-Id:870"" --cert client.pem:password https://ws-amcas.staging.aamc.org/amcas-data-service/applications",
                UseShellExecute        = false,
                CreateNoWindow         = true,
                WorkingDirectory       = AppDomain.CurrentDomain.BaseDirectory + "curl",
                RedirectStandardOutput = true
            };
            var    process  = Process.Start(psi);
            string response = process.StandardOutput.ReadToEnd();

            process.WaitForExit();

            return(response);
        }
Exemple #8
0
        public override List <Application> GetSingleApplication(MedicalInstitutions institution, string year, string AAMCID)
        {
            var psi = new ProcessStartInfo(AppDomain.CurrentDomain.BaseDirectory + @"curl\curl.exe")
            {
                Arguments              = @" --insecure --cacert curl-ca-bundle.crt -H ""Med-Inst-Id:870"" --cert client.pem:password https://ws-amcas.staging.aamc.org/amcas-data-service/applications/list/" + year + "/" + AAMCID,
                UseShellExecute        = false,
                CreateNoWindow         = true,
                WorkingDirectory       = AppDomain.CurrentDomain.BaseDirectory + "curl",
                RedirectStandardOutput = true
            };
            var    process  = Process.Start(psi);
            string response = process.StandardOutput.ReadToEnd();

            process.WaitForExit();
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(response);
            return(parseApplicationsXml(doc));
        }
Exemple #9
0
 public override List <Application> GetSingleApplication(MedicalInstitutions institution, string year, string AAMCID)
 {
     throw new NotImplementedException();
 }
Exemple #10
0
 public override List <ApplicationData> GetApplicationList(MedicalInstitutions institution, string year)
 {
     throw new NotImplementedException();
 }
Exemple #11
0
 public override List <Application> GetAllApplications(MedicalInstitutions institution)
 {
     return(getApplicationListAsync(institution).Result);
 }
Exemple #12
0
 public override string GetApiResponseContent(MedicalInstitutions institution)
 {
     return(getApiResponseContentAsync(institution).Result);
 }