public HttpResponseMessage GetPatientNotesBySearchCriteria([FromUri] PatientNotesSearchCriteria searchCriteria) { try { AccessControl.VerifyUserAccessToPatient(searchCriteria.PatientId); var noteTypes = GetNoteTypes(); IList <PatientNotesSearchResults> results = this.it2Business.GetSearchResults(searchCriteria); var resources = this.GetResources(results); return(this.Request.CreateResponse(HttpStatusCode.OK, new PatientNotes { NoteTypes = noteTypes, Results = results, Resources = resources })); } catch (HttpResponseException) { throw; } catch (NHibernate.ObjectNotFoundException ex) { Logger.Error("GetPatientNotesBySearchCriteria: " + ex); return(this.Request.CreateResponse(HttpStatusCode.NotFound, "Note Not Found.")); } catch (Exception ex) { var msg = "GetPatientNotesBySearchCriteria: " + ex; return(HandleExceptions.LogExceptions(msg, Logger, ex)); } }
public HttpResponseMessage GetPatientNotesBySearchCriteriaForOverview([FromUri] PatientNotesSearchCriteria searchCriteria) { try { if (searchCriteria != null) { AccessControl.VerifyUserAccessToPatient(searchCriteria.PatientId); var noteTypes = GetNoteTypes(); IList <PatientNotesSearchResults> results = this.it2Business.GetSearchResults(searchCriteria); results = results.Where(a => a.Note != null).ToList(); foreach (var notes in results) { if (!string.IsNullOrEmpty(notes.Note) && notes.Note.Length > 150) { notes.Note = notes.Note.Substring(0, 150); } } var resources = this.GetResources(results); return(this.Request.CreateResponse( HttpStatusCode.OK, new PatientNotes { NoteTypes = noteTypes, Results = results, Resources = resources })); } return(this.Request.CreateResponse(HttpStatusCode.NotFound, "Note Not Found.")); } catch (HttpResponseException) { throw; } catch (NHibernate.ObjectNotFoundException ex) { Logger.Error("GetPatientNotesBySearchCriteriaForOverview: " + ex); return(this.Request.CreateResponse(HttpStatusCode.NotFound, "Note Not Found.")); } catch (Exception ex) { var msg = "GetPatientNotesBySearchCriteriaForOverview: " + ex; return(HandleExceptions.LogExceptions(msg, Logger, ex)); } }