public List <PatientMedSuppData> GetPatientMedSupps(GetPatientMedSuppsRequest request) { try { List <PatientMedSuppData> result = null; IRestClient client = new JsonServiceClient(); //[Route("/{Context}/{Version}/{ContractNumber}/PatientMedSupp/{PatientId}", "POST")] var url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/PatientMedSupp/{4}", DDMedicationUrl, "NG", request.Version, request.ContractNumber, request.PatientId), request.UserId); GetPatientMedSuppsDataResponse dataDomainResponse = client.Post <GetPatientMedSuppsDataResponse>(url, new GetPatientMedSuppsDataRequest { Context = "NG", ContractNumber = request.ContractNumber, StatusIds = request.StatusIds, CategoryIds = request.CategoryIds, PatientId = request.PatientId, UserId = request.UserId, Version = request.Version } as object); if (dataDomainResponse != null) { result = dataDomainResponse.PatientMedSuppsData; } return(result); } catch (Exception ex) { throw ex; } }
public List <PatientMedSupp> GetPatientMedSupps(GetPatientMedSuppsRequest request) { List <PatientMedSupp> patientMedSupps = null; try { List <PatientMedSuppData> data = EndpointUtil.GetPatientMedSupps(request); if (data != null && data.Count > 0) { patientMedSupps = new List <PatientMedSupp>(); data.ForEach(a => patientMedSupps.Add(Mapper.Map <PatientMedSupp>(a))); } return(patientMedSupps); } catch (Exception ex) { throw ex; } }
public GetPatientMedSuppsResponse Post(GetPatientMedSuppsRequest request) { GetPatientMedSuppsResponse response = new GetPatientMedSuppsResponse(); 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.PatientMedSupps = MedicationManager.GetPatientMedSupps(request); } else { throw new UnauthorizedAccessException(); } } catch (Exception ex) { CommonFormatter.FormatExceptionResponse(response, base.Response, ex); if ((ex is WebServiceException) == false) { MedicationManager.LogException(ex); } } finally { List <string> patientIds = new List <string>(); patientIds.Add(request.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 void GetPatientMedSupps_Test() { GetPatientMedSuppsRequest request = new GetPatientMedSuppsRequest { ContractNumber = contractNumber, PatientId = "534685c160e4b90f8c8966a8", StatusIds = new List <int> { 1 }, CategoryIds = new List <int> { 1 }, UserId = userId, Version = version }; JsonServiceClient.HttpWebRequestFilter = x => x.Headers.Add(string.Format("{0}: {1}", "Token", token)); //[Route("/{Version}/{ContractNumber}/PatientMedSupp/{PatientId}", "POST")] GetPatientMedSuppsResponse response = client.Post <GetPatientMedSuppsResponse>(string.Format("{0}/{1}/{2}/PatientMedSupp/{3}", url, version, contractNumber, request.PatientId), request); Assert.IsNotNull(response); }