public DeleteCareMemberByPatientIdDataResponse DeleteCareMemberByPatientId(DeleteCareMemberByPatientIdDataRequest request) { DeleteCareMemberByPatientIdDataResponse response = null; try { response = new DeleteCareMemberByPatientIdDataResponse(); ICareMemberRepository repo = Factory.GetRepository(request, RepositoryType.CareMember); List <CareMemberData> careMembers = repo.FindByPatientId(request.PatientId) as List <CareMemberData>; List <string> deletedIds = null; if (careMembers != null) { deletedIds = new List <string>(); careMembers.ForEach(u => { request.Id = u.Id; repo.Delete(request); deletedIds.Add(request.Id); }); response.DeletedIds = deletedIds; } response.Success = true; return(response); } catch (Exception ex) { throw ex; } }
public void DeleteCareMemberByPatientId_Test() { double version = 1.0; string contractNumber = "InHealth001"; string context = "NG"; string patientId = "5325db70d6a4850adcbba946"; string userId = "000000000000000000000000"; string ddUrl = "http://localhost:8888/CareMember"; IRestClient client = new JsonServiceClient(); // [Route("/{Context}/{Version}/{ContractNumber}/CareMember/Patient/{PatientId}/Delete", "DELETE")] string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/CareMember/Patient/{4}/Delete", ddUrl, context, version, contractNumber, patientId), userId); DeleteCareMemberByPatientIdDataResponse response = client.Delete <DeleteCareMemberByPatientIdDataResponse>(url); Assert.IsNotNull(response); }
public void Execute() { try { //[Route("/{Context}/{Version}/{ContractNumber}/CareMember/Patient/{PatientId}/Delete", "DELETE")] string cmUrl = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/CareMember/Patient/{4}/Delete", DDCareMemberUrl, "NG", request.Version, request.ContractNumber, request.Id), request.UserId); DeleteCareMemberByPatientIdDataResponse cmDDResponse = client.Delete <DeleteCareMemberByPatientIdDataResponse>(cmUrl); if (cmDDResponse != null && cmDDResponse.Success) { deletedIds = cmDDResponse.DeletedIds; } } catch (Exception ex) { throw new Exception("AD: CareMemberCommand Execute::" + ex.Message, ex.InnerException); } }
public DeleteCareMemberByPatientIdDataResponse Delete(DeleteCareMemberByPatientIdDataRequest request) { DeleteCareMemberByPatientIdDataResponse response = new DeleteCareMemberByPatientIdDataResponse(); try { if (string.IsNullOrEmpty(request.UserId)) { throw new UnauthorizedAccessException("CareMemberDD:CareMemberDelete()::Unauthorized Access"); } response = Manager.DeleteCareMemberByPatientId(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); }