static void Main(string[] args) { string commandLine = ""; Console.WriteLine("Enter C for checkin patient, P for pending patient queue, M for Mongo tests, F for fingerprint identity and Q to quit"); while (commandLine != "q") { if (commandLine == "c") { // call PatentCheckinUri Console.WriteLine("Sending test patient FHIR message."); Patient testPt = TestPatient(); SendJSON(testPt); Console.WriteLine("Sending FHIR message from file."); Patient readPt = ReadPatient(@"C:\JSONTest\sample-new-patient.json"); SendJSON(readPt); } else if (commandLine == "p") //send profiles { // call PendingPatientsUri IList <PatientProfile> patientProfiles = GetCheckinList(); Console.WriteLine("Patient profiles received."); } else if (commandLine == "m") // MongoDB tests { MongoDBWrapper dbwrapper = new MongoDBWrapper(NoIDMongoDBAddress, SparkMongoDBAddress); SessionQueue seq = new SessionQueue(); seq._id = Guid.NewGuid().ToString(); seq.ClinicArea = "Test Clinic"; seq.LocalReference = "123456"; seq.SparkReference = "spark5"; seq.ApprovalStatus = "pending"; seq.PatientStatus = "new"; seq.RemoteHubReference = "rem440403"; seq.SessionComputerName = "Prototype Computer 1"; seq.SubmitDate = DateTime.UtcNow.AddMinutes(-15); seq.PatientBeginDate = DateTime.UtcNow.AddMinutes(-19); Console.WriteLine(seq.Serialize()); dbwrapper.AddPendingPatient(seq); List <SessionQueue> PendingPatients = dbwrapper.GetPendingPatients(); dbwrapper.UpdateSessionQueueRecord(seq._id, "approved", "TestUser", "TestComputer"); } else if (commandLine == "f") // test fingerprint identity web service { Media readMedia = ReadMedia(@"C:\JSONTest\sample-media-fhir-message.json"); SendJSON(readMedia); } string previousCommand = commandLine; commandLine = Console.ReadLine(); if (commandLine.Length > 0) { commandLine = commandLine.ToLower().Substring(0, 1); } else { commandLine = previousCommand; } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; try { foreach (String key in context.Request.QueryString.AllKeys) { switch (key) { case "sessionid": _sessionID = context.Request.QueryString[key]; break; case "action": _action = context.Request.QueryString[key]; break; case "computername": _computerName = context.Request.QueryString[key]; break; case "username": _userName = context.Request.QueryString[key]; break; } } MongoDBWrapper dbwrapper = new MongoDBWrapper(NoIDMongoDBAddress, SparkMongoDBAddress); if (dbwrapper.UpdateSessionQueueRecord(_sessionID, _action, _userName, _computerName) == false) { if (dbwrapper.Exceptions.Count > 0) { string errorMessage = dbwrapper.Exceptions[0].Message; context.Response.Write("UpdatePendingStatus::ProcessRequest Error: " + errorMessage); } else { context.Response.Write("UpdatePendingStatus::ProcessRequest Error: Could not find sessionID " + _sessionID + "."); } } else { context.Response.Write("Successfully updated the pending status."); } } catch (Exception ex) { context.Response.Write("UpdatePendingStatus::ProcessRequest Error: " + ex.Message); } context.Response.End(); }