private void buttonTestAuthentication_Click(object sender, EventArgs e) { string username = textBoxUserName.Text; string pwd = PasswordManager.GetPassword(textBoxUserName.Text); if (pwd.Length == 0) { labelStatus.Text = "Password in keystore is blank."; return; } Authentication auth = new Authentication(username, pwd); Uri endpoint = new Uri(StringUtilities.RemoveTrailingBackSlash(System.Configuration.ConfigurationManager.AppSettings["AddNewPatientUri"].ToString())); Patient newPatient = FHIRUtilities.CreateTestFHIRPatientProfile(); WebSend ws = new WebSend(endpoint, auth, newPatient); try { ws.PostHttpWebRequest(); PasswordManager.SavePassword("Successful", username + "_Status"); labelStatus.Text = "Status: Authentication Successful"; } catch (Exception ex) { PasswordManager.SavePassword("Failed", username + "_Status"); labelStatus.Text = "Status: Authentication Failed " + ex.Message; } }
public bool SendDemographicFHIRSearch(Uri endpoint, Authentication auth, Patient patient = null) { try { _responseText = ""; WebSend clientWebSend = new WebSend(endpoint, auth, patient); _responseText = clientWebSend.PostHttpWebRequest(); } catch (Exception ex) { _exception = new Exception("DataTransport::SendDemographicFHIRSearch() failed to send to FHIR server: " + ex.Message); return(false); } return(true); }
public bool SendFHIRMediaProfile(Uri endpoint, Authentication auth, Media media = null) { try { _responseText = ""; WebSend clientWebSend = new WebSend(endpoint, auth, media); _responseText = clientWebSend.PostHttpWebRequest(); } catch (Exception ex) { _responseText = "Error in DataTransport::SendFHIRMediaProfile() failed to send to FHIR server: " + ex.Message; _exception = new Exception(_responseText); return(false); } return(true); }
public static void Main(string[] args) { if (args.Length > 0) { Utilities.Auth = new Authentication(_serviceName, args[0].ToString()); Uri endpoint = new Uri(StringUtilities.RemoveTrailingBackSlash(System.Configuration.ConfigurationManager.AppSettings["AddNewPatientUri"].ToString())); Patient newPatient = FHIRUtilities.CreateTestFHIRPatientProfile(); WebSend ws = new WebSend(endpoint, Utilities.Auth, newPatient); try { ws.PostHttpWebRequest(); } catch (Exception ex) { MessageBox.Show("Status: Authentication Failed " + ex.Message + " Closing NoID."); return; } } if (Utilities.Auth != null || PasswordManager.GetPassword(_serviceName + "_Status") == "Successful") { //For Windows 7 and above, best to include relevant app.manifest entries as well Cef.EnableHighDPISupport(); //Perform dependency check to make sure all relevant resources are in our output directory. Cef.Initialize(new CefSettings(), performDependencyCheck: true, browserProcessHandler: null); var browser = new BrowserForm(); Application.Run(browser); } else { var login = new LoginForm(); Application.Run(login); } }