internal static List <State> GetAllowedObservationStates(GetAllowedStatesRequest request) { try { List <State> result = null; IRestClient client = new JsonServiceClient(); // [Route("/{Context}/{Version}/{ContractNumber}/Observation/States", "GET")] string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Observation/States", DDPatientObservationsServiceUrl, "NG", request.Version, request.ContractNumber), request.UserId); GetAllowedStatesDataResponse dataDomainResponse = client.Get <GetAllowedStatesDataResponse>(url); if (dataDomainResponse != null && dataDomainResponse.StatesData.Count > 0) { result = new List <State>(); dataDomainResponse.StatesData.ForEach(a => { result.Add(new State { Id = a.Id, Name = a.Name, TypeIds = a.TypeIds }); }); } return(result); } catch (WebServiceException ex) { throw new WebServiceException("AD:GetAllowedObservationStates()::" + ex.Message, ex.InnerException); } }
public void GetAllowedObservationStates_CorrectType_Test() { GetAllowedStatesDataRequest request = new GetAllowedStatesDataRequest { Context = context, ContractNumber = contractNumber, UserId = userId, Version = 1 }; PatientObservationDataManager cm = new PatientObservationDataManager { Factory = new PatientObservationRepositoryFactory() }; GetAllowedStatesDataResponse response = cm.GetAllowedStates(request); Assert.IsTrue(response.StatesData.Count > 0); }
public GetAllowedStatesDataResponse GetAllowedStates(GetAllowedStatesDataRequest request) { try { GetAllowedStatesDataResponse response = new GetAllowedStatesDataResponse(); IPatientObservationRepository repo = Factory.GetRepository(request, RepositoryType.Observation); response.StatesData = repo.GetAllowedObservationStates(); return(response); } catch (Exception ex) { throw new Exception("DD.DataPatientObservationManager:GetAllowedStates()::" + ex.Message, ex.InnerException); } }
public void GetAllowedObservationStates_IncorrectType_Test() { string url = "http://localhost:8888/PatientObservation"; //string url = "http://azurePhytel.cloudapp.net:59901/PatientObservation"; string type = "Labs"; string contractNumber = "InHealth001"; string context = "NG"; double version = 1.0; string userId = "000000000000000000"; IRestClient client = new JsonServiceClient(); GetAllowedStatesDataResponse response = client.Get <GetAllowedStatesDataResponse>( string.Format("{0}/{1}/{2}/{3}/Observation/States/{4}?UserId={5}", url, context, version, contractNumber, type, userId)); Assert.IsNull(response.StatesData); }
public GetAllowedStatesDataResponse Get(GetAllowedStatesDataRequest request) { GetAllowedStatesDataResponse response = new GetAllowedStatesDataResponse(); try { if (string.IsNullOrEmpty(request.UserId)) { throw new UnauthorizedAccessException("PatientObservationDD:Get()::Unauthorized Access"); } response = Omgr.GetAllowedStates(request); response.Version = request.Version; } catch (Exception ex) { CommonFormatter.FormatExceptionResponse(response, base.Response, ex); string aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0"; Common.Helper.LogException(int.Parse(aseProcessID), ex); } return(response); }