public void TestService() { searchRequest = new SearchRequest(); searchRequest.Pan = 5112345678901234; searchRequest.AuditInfo.UserId = "testUser"; searchRequest.AuditInfo.UserName = "******"; searchRequest.AuditInfo.Organization = "Test Org"; response = service.GetSearchResponse(searchRequest); Assert.IsNotNull(response.PANDetails); Assert.IsNotNull(response.Response); }
public void TestService() { searchRequest = new SearchRequest(); searchRequest.Pan = 5112345678901234; searchRequest.AuditInfo.UserId = "testUser"; searchRequest.AuditInfo.UserName = "******"; searchRequest.AuditInfo.Organization = "Test Org"; response = mappingSearchService.GetSearchResponse(searchRequest); string tokenUniqueId = response.Devices.ElementAt(0).TokenUniqueId; deliveryChannels = deliveryChannelsService.GetDeliveryChannels(tokenUniqueId); Assert.IsNotNull(deliveryChannels.DeliveryChannel); }
public void TestService() { searchRequest = new SearchRequest(); searchRequest.Pan = 5112345678901234; searchRequest.AuditInfo.UserId = "testUser"; searchRequest.AuditInfo.UserName = "******"; searchRequest.AuditInfo.Organization = "Test Org"; response = mappingSearchService.GetSearchResponse(searchRequest); String tokenUniqueId = response.Devices.ElementAt(0).TokenUniqueId; deliveryChannels = deliveryChannelsService.GetDeliveryChannels(tokenUniqueId); long deliveryChannelId = deliveryChannels.DeliveryChannel.ElementAt(0).Id; resendRequest = new ResendRequest(); resendRequest.DeliveryChannelId = deliveryChannelId; resendRequest.AuditInfo.UserId = "testUser"; resendRequest.AuditInfo.UserName = "******"; resendRequest.AuditInfo.Organization = "Test Org"; resendCodeResults = resendActivationCodeService.GetResendCodeResults(resendRequest, tokenUniqueId); Assert.IsNotNull(resendCodeResults.ResponseCode); }
// NEW WITH Win 8 - Calls to TriageTrak/PL Search functions: /// <summary> /// Gets all reports for the specified event, from the current hospital. Caller must filter more, to narrow. To get reports from all orgs, set myOrgOnly=false. /// </summary> public async Task<string> GetReportsForOutboxImpl(string eventShortName, bool myOrgOnly) // was, but now uses global token: (string userPL, string passwordPL) { App.MyAssert(App.pd.plToken != null && App.pd.plToken.Length == 128); // token is 128 char long SHA-512 //searchWithAuthRequest sarin = new searchWithAuthRequest(); // Before V31: named searchCompleteWithAuth //searchWithAuthResponse sarout = new searchWithAuthResponse(); searchRequest srin = new searchRequest(); searchResponse srout = new searchResponse(); srin.token = App.pd.plToken; //sarin.username = userPL; //sarin.password = passwordPL; // "sarin" replaced by "srin", "sarout" replaced by "srout" many places below srin.eventShortname = eventShortName; // moved to caller Feb 2015: App.CurrentDisaster.EventShortName; // was v33: srin.filterAgeAdult = srin.filterAgeChild = srin.filterAgeUnknown = true; // was v33: srin.filterGenderMale = srin.filterGenderFemale = srin.filterGenderComplex = srin.filterGenderUnknown = true; string Uuid = ""; if(myOrgOnly) Uuid = "all"; else { string Name = App.CurrentOrgContactInfo.OrgName; Uuid = App.OrgDataList.GetOrgUuidFromOrgName(Name); if (Uuid == "") // couldn't find match { App.MyAssert(false); //Uuid = App.OrgDataList.First().OrgUuid; //Name = App.OrgDataList.First().OrgName; } } // was v33: srin.filterHospital = Uuid; // instead of "" or "all" = don't filter on orgs. srin.filters = PackageFiltersIntoSearchParameter(Uuid); // WAS before v32: sarin.filterHospitalSH = sarin.filterHospitalWRNMMC = sarin.filterHospitalOther = true; // was v33: srin.filterStatusAlive = srin.filterStatusInjured = srin.filterStatusDeceased = srin.filterStatusMissing = srin.filterStatusUnknown = srin.filterStatusFound = true; // was v33: srin.filterHasImage = false; // true would return ONLY reports with images srin.pageStart = 0; // was v33: "0"; srin.perPage = 250; // was v33: "250"; // "1000"; If you change this, change it too in TP_PatientReportsSource.cs. 1000 seemed to be running out of memory srin.sortBy = ""; // = updated desc, score desc srin.query = ""; // was v33: srin.searchTerm = ""; srin.photo = ""; // if empty, means "use query instead". try { SetPLEndpointAddress(App.pl); //read the configured endpoint address if(App.BlockWebServices) throw new Exception(PHONY_COMMUNICATIONS_EXCEPTION); // Win 7: responseData = App.pl.getEventListUser(userPL, passwordPL, out errorCode, out errorMessage); //sarout = await App.pl.searchWithAuthAsync(sarin); srout = await App.pl.searchAsync(srin); } // Also available with v34, but not used here: srout.recordsFound; srout.timeElapsed catch (Exception e) { srout.resultSet = "ERROR: " + e.Message; // Win 7: responseData = "ERROR: " + e.Message; } return ChangeToErrorIfNull(srout.resultSet); }
// NEW July, 2015: /// <summary> /// Does a quick checks if candidate Patient ID is already in use for current event, independent of submitter or submitting organization. /// This is to supplement check of local data (which is limited to this submitter in the case of Outbox, or may be stale in the case of All Stations. /// </summary> /// <param name="patientID"></param> /// <returns>-1 = don't know; 0 = no; 1 = yes</returns> public async Task<int> IsPatientIdAlreadyInUseForCurrentEvent(string patientID) { // This is a variant of GetReportsFromAllStationsCurrentEvent() App.MyAssert(App.pd.plToken != null && App.pd.plToken.Length == 128); // token is 128 char long SHA-512 searchRequest srin = new searchRequest(); searchResponse srout = new searchResponse(); srin.token = App.pd.plToken; srin.eventShortname = App.CurrentDisaster.EventShortName; // NOT WORKING AS CLAIMED, ACTS AS IF hasImage=true // srin.filters = ""; // Spec says this means all filters are true, except hasImage is false and hospital defaults to "all". // Equivalently in effect, if not in verbosity: srin.filters = PackageFiltersIntoSearchParameter("all"); srin.pageStart = 0; srin.perPage = 250; srin.sortBy = ""; // = updated desc, score desc srin.query = patientID; srin.photo = ""; // if empty, means "use query instead". try { SetPLEndpointAddress(App.pl); //read the configured endpoint address if (App.BlockWebServices) throw new Exception(PHONY_COMMUNICATIONS_EXCEPTION); srout = await App.pl.searchAsync(srin); } // Also available with v34, but not used here: srout.recordsFound; srout.timeElapsed catch (Exception) { return -1; // Error. Don't know } if (srout.resultSet == null || srout.errorCode != 0) return -1; // Error. Don't know if ((srout.resultSet == "") || (srout.recordsFound == 0)) return 0; return 1; // 1 or more records found. In theory multiple means some problem, but let's ignore that for now }
// NEW WITH Win 8 - Calls to PL Search functions: /// <summary> /// Gets all reports for the current event, independent of submitter or submitting organization. /// This is in support of client-side filtering. /// </summary> public async Task<string> GetReportsFromAllStationsCurrentEvent()// was, but not needed now: (string userPL, string passwordPL) { App.MyAssert(App.pd.plToken != null && App.pd.plToken.Length == 128); // token is 128 char long SHA-512 //searchWithAuthRequest sarin = new searchWithAuthRequest(); // Before V31: named searchCompleteWithAuth //searchWithAuthResponse sarout = new searchWithAuthResponse(); searchRequest srin = new searchRequest(); searchResponse srout = new searchResponse(); //sarin.username = userPL; //sarin.password = passwordPL; srin.token = App.pd.plToken; //sarin.eventShortname = App.CurrentDisaster.EventShortName; // v33, replace "sarin" with "srin" many times below srin.eventShortname = App.CurrentDisaster.EventShortName; // NOT WORKING AS CLAIMED, ACTS AS IF hasImage=true // srin.filters = ""; // Spec says this means all filters are true, except hasImage is false and hospital defaults to "all". // Equivalently in effect, if not in verbosity: srin.filters = PackageFiltersIntoSearchParameter("all"); // was v33: srin.filterAgeAdult = srin.filterAgeChild = srin.filterAgeUnknown = true; // was v33: srin.filterGenderMale = srin.filterGenderFemale = srin.filterGenderComplex = srin.filterGenderUnknown = true; /* NO. Always get all records here. Filter later if(App.OutboxCheckBoxMyOrgOnly) { string Name = App.CurrentOrgContactInfo.OrgName; string Uuid = App.OrgDataList.GetOrgUuidFromOrgName(Name); if (Uuid == "") // couldn't find match { App.MyAssert(false); //Uuid = App.OrgDataList.First().OrgUuid; //Name = App.OrgDataList.First().OrgName; } sarin.filterHospital = Uuid; } else { // spec says: sarin.filterHospital = ""; // empty = don't filter on orgs; otherwise, [but not implemeneted] comma-separated org shortnames // What Greg chose to implement instead is single hospital uuid */ // was v 33: srin.filterHospital = "all"; // temporary workaround //} // WAS before V32: sarin.filterHospitalSH = sarin.filterHospitalWRNMMC = sarin.filterHospitalOther = true; // was v33: srin.filterStatusAlive = srin.filterStatusInjured = srin.filterStatusDeceased = srin.filterStatusMissing = srin.filterStatusUnknown = srin.filterStatusFound = true; // was v33: srin.filterHasImage = false; // true would return ONLY reports with images srin.pageStart = 0; // was v33: "0"; srin.perPage = 250; // was v33: "250"; // 1000 gave out of memory problems srin.sortBy = ""; // = updated desc, score desc srin.query = ""; // was v 33: srin.searchTerm = ""; srin.photo = ""; // if empty, means "use query instead". try { SetPLEndpointAddress(App.pl); //read the configured endpoint address if(App.BlockWebServices) throw new Exception(PHONY_COMMUNICATIONS_EXCEPTION); // Win 7: responseData = App.pl.getEventListUser(userPL, passwordPL, out errorCode, out errorMessage); //sarout = await App.pl.searchWithAuthAsync(sarin); srout = await App.pl.searchAsync(srin); } // Also available with v34, but not used here: srout.recordsFound; srout.timeElapsed catch (Exception e) { // WAS: sarout srout.resultSet = "ERROR: " + e.Message; // Win 7: responseData = "ERROR: " + e.Message; } return ChangeToErrorIfNull(srout.resultSet); // WAS before v33: sarout }
// searches flights using the city codes from city code operation. Use date to narrow search public List <string> searchFlights(string origin, string dest, string date) { // trim leading and trailing whitespace origin = origin.Trim(); dest = dest.Trim(); date.Trim(); // url for api call using origin, destination, and date of desired departure string url = string.Format("https://api.skypicker.com/flights?flyFrom={0}&to={1}&dateFrom={2}&dateTo={3}&typeFlight=oneway&adults=1&curr=USD&locale=en&limit=3&directFlights=1", origin, dest, date, date); // results returned here List <string> result = new List <string>(); // use webclient to access web data using (WebClient client = new WebClient()) { // try to download. If exception, the date is entered incorrectly try { // download information from url string json = client.DownloadString(url); // deserialize json components searchResponse search = (new JavaScriptSerializer()).Deserialize <searchResponse>(json); // checks if there is data if (search.data.Length == 0) { // return empty no direct flights found, check the origin and destination result.Add("Error: Either your destination/origin city is not recognized or there are no direct flights between those cities. Please try again"); return(result); } // itterate the length of json data returned, add flight info for (int i = 0; i < search.data.Length; i++) { // adds city origin data result.Add(search.data[i].cityFrom); result.Add(search.data[i].mapIdfrom); result.Add(search.data[i].route[0].flyFrom); // adds city destination data result.Add(search.data[i].cityTo); result.Add(search.data[i].mapIdto); result.Add(search.data[i].route[0].flyTo); // adds duration of flight result.Add(search.data[i].fly_duration); // adds depature and arrival times, converts from unix result.Add(convertUnixTime(search.data[i].dTime)); result.Add(convertUnixTime(search.data[i].aTime)); // adds price of flight result.Add(Convert.ToString(search.data[i].price)); //adds flight no result.Add(Convert.ToString(search.data[i].route[0].flight_no)); // updates url, the api refers to airlines by 2 characters that must be looked up in their // api url = string.Format("https://api.skypicker.com/airlines"); // download as a string json = client.DownloadString(url); // itterate as a strong, issues downloading into json objects for (int j = 3; j < json.Length; j++) { // if identifying tag = id if (Convert.ToString(json[j]) + Convert.ToString(json[j + 1]) == "id") { // if the id of the current airline matches the airline id from user query if (Convert.ToString(json[j + 6]) + Convert.ToString(json[j + 7]) == search.data[i].route[0].airline) { //itterate across the name tag and save each char into a string that is then added to results string temp = ""; for (int k = j + 32; json[k] != '"'; k++) { temp += json[k]; } result.Add(temp); // airline id has been matched and the full name of the airline has been saved, we can now break break; } } } } } catch { // if exception, the date was invalid, return result.Add("Error: Invalid Date"); return(result); } } return(result); }