Пример #1
0
        public List <AllergyData> GetAllergies(GetAllergiesRequest request)
        {
            try
            {
                List <AllergyData> result = null;
                IRestClient        client = new JsonServiceClient();
                //[Route("/{Context}/{Version}/{ContractNumber}/Allergy", "GET")]
                var url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Allergy",
                                                               DDAllergyUrl,
                                                               "NG",
                                                               request.Version,
                                                               request.ContractNumber), request.UserId);

                GetAllAllergysResponse dataDomainResponse = client.Get <GetAllAllergysResponse>(url);

                if (dataDomainResponse != null)
                {
                    result = dataDomainResponse.Allergys;
                }

                return(result);
            }
            catch (WebServiceException ex)
            {
                throw new WebServiceException("AD:GetAllergies()::" + ex.Message, ex.InnerException);
            }
        }
Пример #2
0
 public List <DTO.Allergy> GetAllergies(GetAllergiesRequest request)
 {
     try
     {
         List <DTO.Allergy> result = new List <DTO.Allergy>();
         var algy = EndpointUtil.GetAllergies(request);
         algy.ForEach(a => result.Add(Mapper.Map <DTO.Allergy>(a)));
         IndexResultSet(result);
         return(result);
     }
     catch (WebServiceException ex)
     {
         throw new WebServiceException("AD:GetAllergies()::" + ex.Message, ex.InnerException);
     }
 }
Пример #3
0
        public GetAllergiesResponse Get(GetAllergiesRequest request)
        {
            GetAllergiesResponse  response = new GetAllergiesResponse();
            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.Allergies = AllergyManager.GetAllergies(request);
                }
                else
                {
                    throw new UnauthorizedAccessException();
                }
            }
            catch (Exception ex)
            {
                CommonFormatterUtil.FormatExceptionResponse(response, base.Response, ex);
                if ((ex is WebServiceException) == false)
                {
                    AllergyManager.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);
        }