public GetMedNamesResponse Get(GetMedNamesRequest request) { GetMedNamesResponse response = new GetMedNamesResponse(); ValidateTokenResponse result = null; try { if (base.Request != null) { request.Token = base.Request.Headers["Token"] as string; } result = Security.IsUserValidated(request.Version, request.Token, request.ContractNumber); if (result.UserId.Trim() != string.Empty) { request.UserId = result.UserId; var res = SearchManager.GetSearchMedNameResults(request); var count = res.Count; if (request.Take > 0 && res.Count > request.Take) { res = res.Take(request.Take).ToList(); response.Message = request.Take + " out of " + count + ". Please refine your search."; } response.ProprietaryNames = res; } else { throw new UnauthorizedAccessException(); } } catch (Exception ex) { CommonFormatterUtil.FormatExceptionResponse(response, base.Response, ex); if ((ex is WebServiceException) == false) { SearchManager.LogException(ex); } } finally { if (result != null) { string browser = (base.Request != null) ? base.Request.UserAgent : unknownBrowserType; string hostAddress = (base.Request != null) ? base.Request.UserHostAddress : unknownUserHostAddress; AuditUtil.LogAuditData(request, result.SQLUserId, null, browser, hostAddress, request.GetType().Name); } } return(response); }
public PostPatientAllergiesResponse Post(PostPatientAllergiesRequest request) { PostPatientAllergiesResponse response = new PostPatientAllergiesResponse(); ValidateTokenResponse result = null; try { if (base.Request != null) { request.Token = base.Request.Headers["Token"] as string; } result = Security.IsUserValidated(request.Version, request.Token, request.ContractNumber); if (result.UserId.Trim() != string.Empty) { request.UserId = result.UserId; response.PatientAllergies = AllergyManager.UpdatePatientAllergies(request); } else { throw new UnauthorizedAccessException(); } } catch (Exception ex) { CommonFormatter.FormatExceptionResponse(response, base.Response, ex); if ((ex is WebServiceException) == false) { AllergyManager.LogException(ex); } } finally { List <string> patientIds = null; if (request.PatientAllergies != null && request.PatientAllergies.Count > 0) { patientIds = new List <string>(); request.PatientAllergies.ForEach(p => { patientIds.Add(p.PatientId); }); } if (result != null) { string browser = (base.Request != null) ? base.Request.UserAgent : unknownBrowserType; string hostAddress = (base.Request != null) ? base.Request.UserHostAddress : unknownUserHostAddress; AuditUtil.LogAuditData(request, result.SQLUserId, patientIds, browser, hostAddress, request.GetType().Name); } } return(response); }
public GetPatientSystemsResponse Get(GetPatientSystemsRequest request) { GetPatientSystemsResponse response = new GetPatientSystemsResponse(); ValidateTokenResponse result = null; try { if (base.Request != null) { request.Token = base.Request.Headers["Token"] as string; } result = Security.IsUserValidated(request.Version, request.Token, request.ContractNumber); if (result.UserId.Trim() != string.Empty) { ServiceContext.UserId = result.UserId; response.PatientSystems = PatientSystemManager.GetPatientSystems(ServiceContext, request.PatientId); } else { throw new UnauthorizedAccessException(); } } catch (Exception ex) { CommonFormatterUtil.FormatExceptionResponse(response, base.Response, ex); if ((ex is WebServiceException) == false) { PatientSystemManager.LogException(ex); } } finally { if (result != null) { List <string> patientIds = null; if (response.PatientSystems != null) { patientIds = response.PatientSystems.Select(x => x.PatientId).ToList(); } string browser = (base.Request != null) ? base.Request.UserAgent : unknownBrowserType; string hostAddress = (base.Request != null) ? base.Request.UserHostAddress : unknownUserHostAddress; AuditUtil.LogAuditData(request, result.SQLUserId, patientIds, browser, hostAddress, request.GetType().Name); } } return(response); }
public GetMedFieldsResponse Get(GetMedFieldsRequest request) { GetMedFieldsResponse response = new GetMedFieldsResponse(); ValidateTokenResponse result = null; try { if (base.Request != null) { request.Token = base.Request.Headers["Token"] as string; } result = Security.IsUserValidated(request.Version, request.Token, request.ContractNumber); if (result.UserId.Trim() != string.Empty) { request.UserId = result.UserId; var results = SearchManager.GetSearchMedFieldsResults(request); response.DosageForms = results.FormList; response.Routes = results.RouteList; response.Strengths = results.StrengthList; response.Units = results.UnitsList; } else { throw new UnauthorizedAccessException(); } } catch (Exception ex) { CommonFormatterUtil.FormatExceptionResponse(response, base.Response, ex); if ((ex is WebServiceException) == false) { SearchManager.LogException(ex); } } finally { if (result != null) { string browser = (base.Request != null) ? base.Request.UserAgent : unknownBrowserType; string hostAddress = (base.Request != null) ? base.Request.UserHostAddress : unknownUserHostAddress; AuditUtil.LogAuditData(request, result.SQLUserId, null, browser, hostAddress, request.GetType().Name); } } return(response); }
public PostInitializeMedicationMapResponse Post(PostInitializeMedicationMapRequest request) { PostInitializeMedicationMapResponse response = new PostInitializeMedicationMapResponse(); ValidateTokenResponse result = null; try { if (base.Request != null) { request.Token = base.Request.Headers["Token"] as string; } result = Security.IsUserValidated(request.Version, request.Token, request.ContractNumber); if (result.UserId.Trim() != string.Empty) { request.UserId = result.UserId; response.MedicationMap = MedicationManager.InitializeMedicationMap(request); } else { throw new UnauthorizedAccessException(); } } catch (Exception ex) { CommonFormatter.FormatExceptionResponse(response, base.Response, ex); if ((ex is WebServiceException) == false) { MedicationManager.LogException(ex); } } finally { if (result != null) { string browser = (base.Request != null) ? base.Request.UserAgent : unknownBrowserType; string hostAddress = (base.Request != null) ? base.Request.UserHostAddress : unknownUserHostAddress; AuditUtil.LogAuditData(request, result.SQLUserId, null, browser, hostAddress, request.GetType().Name); } } return(response); }