public DeleteCareTeamMemberDataResponse DeleteCareTeamMember(DeleteCareTeamMemberRequest request) { var response = new DeleteCareTeamMemberDataResponse(); try { IRestClient client = new JsonServiceClient(); //[Route("/{Version}/{ContractNumber}/Contacts/{ContactId}/CareTeams/{CareTeamId}/CareTeamMembers/{Id}", "DELETE")] string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Contacts/{4}/CareTeams/{5}/CareTeamMembers/{6}", DDContactServiceUrl, "NG", request.Version, request.ContractNumber, request.ContactId, request.CareTeamId, request.Id), request.UserId); var dataDomainResponse = client.Delete <DeleteCareTeamMemberDataResponse>(url); if (dataDomainResponse != null) { response.Version = dataDomainResponse.Version; response.Status = dataDomainResponse.Status; } } catch (WebServiceException wse) { throw new WebServiceException("AD:DeleteCareTeamMember()::" + wse.Message, wse.InnerException); } return(response); }
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); }
public DeleteCareTeamMemberResponse Delete(DeleteCareTeamMemberRequest request) { if (request == null) { throw new ArgumentNullException("request"); } var response = new DeleteCareTeamMemberResponse(); ValidateTokenResponse result = null; try { 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 = ContactManager.DeleteCareTeamMember(request); } else { throw new UnauthorizedAccessException(); } } catch (Exception ex) { CommonFormatter.FormatExceptionResponse(response, base.Response, ex); if ((ex is WebServiceException) == false) { ContactManager.LogException(ex); } } finally { if (result != null) { AuditHelper.LogAuditData(request, result.SQLUserId, null, System.Web.HttpContext.Current.Request, request.GetType().Name); } } return(response); }