Esempio n. 1
0
        public GetCareTeamDataResponse Get(GetCareTeamDataRequest request)
        {
            var response = new GetCareTeamDataResponse()
            {
                Version = request.Version
            };

            try
            {
                if (string.IsNullOrEmpty(request.UserId))
                {
                    throw new UnauthorizedAccessException("ContactDD:CareTeamService:Get()::Unauthorized Access");
                }

                response = Manager.GetCareTeam(request);
            }
            catch (Exception ex)
            {
                CommonFormat.FormatExceptionResponse(response, base.Response, ex);

                var aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0";
                Helpers.LogException(int.Parse(aseProcessID), ex);
            }
            return(response);
        }
Esempio n. 2
0
        public CareTeamData GetCareTeam(DTO.GetCareTeamRequest request)
        {
            try
            {
                CareTeamData result = null;
                IRestClient  client = new JsonServiceClient();
                //[Route("/{Context}/{Version}/{ContractNumber}/Contacts/{ContactId}/CareTeams", "GET")]
                var url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Contacts/{4}/CareTeams",
                                                               DDContactServiceUrl,
                                                               "NG",
                                                               request.Version,
                                                               request.ContractNumber,
                                                               request.ContactId), request.UserId);

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

                if (dataDomainResponse != null)
                {
                    result = dataDomainResponse.CareTeamData;
                }
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
        public GetCareTeamDataResponse GetCareTeam(GetCareTeamDataRequest request)
        {
            var response = new GetCareTeamDataResponse();

            if (request == null)
            {
                throw new ArgumentNullException("request");
            }
            if (string.IsNullOrEmpty(request.ContactId))
            {
                throw new ArgumentNullException("ContactId");
            }

            var repo = _factory.GetCareTeamRepository(request, RepositoryType.CareTeam);

            if (repo == null)
            {
                throw new Exception("Repository is null");
            }

            response.CareTeamData = (CareTeamData)repo.GetCareTeamByContactId(request.ContactId);
            return(response);
        }