Ejemplo n.º 1
0
        public DeleteCareTeamMemberResponse DeleteCareTeamMember(DeleteCareTeamMemberRequest request)
        {
            var response = new DeleteCareTeamMemberResponse();

            if (request == null)
            {
                throw new ArgumentNullException("request");
            }
            try
            {
                var dataResponse = EndpointUtil.DeleteCareTeamMember(request);

                if (dataResponse != null)
                {
                    //TODO: Refactor.
                    var contact = GetContactByContactId(new GetContactByContactIdRequest
                    {
                        ContractNumber = request.ContractNumber,
                        ContactId      = request.ContactId,
                        UserId         = request.UserId,
                        Version        = request.Version
                    });

                    if (contact == null)
                    {
                        throw new ApplicationException(string.Format("Contact with id: {0} does not exist", request.ContactId));
                    }

                    var cohortRuleCheckData = new CohortRuleCheckData()
                    {
                        ContactId      = request.ContactId,
                        ContractNumber = request.ContractNumber,
                        UserId         = request.UserId,
                        PatientId      = contact.PatientId
                    };
                    CohortRules.EnqueueCohorRuleCheck(cohortRuleCheckData);
                }
            }
            catch (WebServiceException wse)
            {
                throw new WebServiceException("AD:DeleteCareTeamMemberResponse()::" + wse.Message, wse.InnerException);
            }

            return(response);
        }