public DeleteBarrierDataResponse DeleteBarrier(DeleteBarrierDataRequest request) { try { DeleteBarrierDataResponse result = new DeleteBarrierDataResponse(); IGoalRepository repo = Factory.GetRepository(request, RepositoryType.PatientBarrier); List <PatientBarrierData> pbd = (List <PatientBarrierData>)repo.Find(request.PatientGoalId); List <string> deletedIds = null; if (pbd != null && pbd.Count > 0) { deletedIds = new List <string>(); pbd.ForEach(b => { request.BarrierId = b.Id; repo.Delete(request); deletedIds.Add(request.BarrierId); }); } result.DeletedIds = deletedIds; result.Success = true; return(result); } catch (Exception ex) { throw ex; } }
public bool DeleteBarrierRequest(PostDeletePatientGoalRequest request, string id) { try { bool result = false; IRestClient client = new JsonServiceClient(); string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Patient/{4}/Goal/{5}/Barrier/{6}/Delete/", DDPatientGoalsServiceUrl, "NG", request.Version, request.ContractNumber, request.PatientId, request.PatientGoalId, id), request.UserId); DeleteBarrierDataResponse response = client.Delete <DeleteBarrierDataResponse>( url); if (response != null) { result = true; } return(result); } catch (WebServiceException ex) { throw new WebServiceException("AD:DeleteBarrierRequest()::" + ex.Message, ex.InnerException); } }
public void Delete_Barrier_Test() { string url = "http://localhost:8888/PatientGoal"; string patientId = "52a0da34fe7a5915485bdfd6"; string contractNumber = "InHealth001"; string context = "NG"; string version = "v1"; string id = "52fe51a1d6a4850944a9d19d"; string patientGoaldId = "52fd2d6cd433231c845e7d25"; IRestClient client = new JsonServiceClient(); DeleteBarrierDataResponse response = client.Delete <DeleteBarrierDataResponse>( string.Format("{0}/{1}/{2}/{3}/Patient/{4}/Goal/{5}/Barrier/{6}/Delete/?UserId={7}", url, context, version, contractNumber, patientId, patientGoaldId, id, patientId)); }
public DeleteBarrierDataResponse Delete(DeleteBarrierDataRequest request) { DeleteBarrierDataResponse response = new DeleteBarrierDataResponse(); try { if (string.IsNullOrEmpty(request.UserId)) { throw new UnauthorizedAccessException("PatientGoalDD:Get()::Unauthorized Access"); } response = Manager.DeleteBarrier(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); }
public DeletePatientGoalByPatientIdDataResponse DeletePatientGoalByPatientId(DeletePatientGoalByPatientIdDataRequest request) { DeletePatientGoalByPatientIdDataResponse response = null; bool success = false; try { response = new DeletePatientGoalByPatientIdDataResponse(); IGoalRepository goalRepo = Factory.GetRepository(request, RepositoryType.PatientGoal); List <PatientGoalViewData> goalViewDataList = goalRepo.Find(request.PatientId) as List <PatientGoalViewData>; List <DeletedPatientGoal> deletedPatientGoals = null; if (goalViewDataList != null && goalViewDataList.Count > 0) { deletedPatientGoals = new List <DeletedPatientGoal>(); goalViewDataList.ForEach(u => { DeletePatientGoalDataRequest deletePatientGoalDataRequest = new DeletePatientGoalDataRequest { Context = request.Context, ContractNumber = request.ContractNumber, PatientGoalId = u.Id, PatientId = request.PatientId, UserId = request.UserId, Version = request.Version }; goalRepo.Delete(deletePatientGoalDataRequest); success = true; DeletedPatientGoal deletedPatientGoal = new DeletedPatientGoal { Id = deletePatientGoalDataRequest.PatientGoalId }; #region Delete Barriers DeleteBarrierDataResponse deleteBarrierDataResponse = DeleteBarrier(new DeleteBarrierDataRequest { Context = request.Context, ContractNumber = request.ContractNumber, PatientGoalId = deletePatientGoalDataRequest.PatientGoalId, PatientId = request.PatientId, UserId = request.UserId, Version = request.Version }); if (deleteBarrierDataResponse.Success) { deletedPatientGoal.PatientBarrierIds = deleteBarrierDataResponse.DeletedIds; success = true; } #endregion #region Delete Tasks DeleteTaskDataResponse deleteTaskDataResponse = DeleteTask(new DeleteTaskDataRequest { Context = request.Context, ContractNumber = request.ContractNumber, PatientGoalId = deletePatientGoalDataRequest.PatientGoalId, PatientId = request.PatientId, UserId = request.UserId, Version = request.Version }); if (deleteTaskDataResponse.Success) { deletedPatientGoal.PatientTaskIds = deleteTaskDataResponse.DeletedIds; success = true; } #endregion #region Delete Interventions DeleteInterventionDataResponse deleteInterventionDataResponse = DeleteIntervention(new DeleteInterventionDataRequest { Context = request.Context, ContractNumber = request.ContractNumber, PatientGoalId = deletePatientGoalDataRequest.PatientGoalId, PatientId = request.PatientId, UserId = request.UserId, Version = request.Version }); if (deleteInterventionDataResponse.Success) { deletedPatientGoal.PatientInterventionIds = deleteInterventionDataResponse.DeletedIds; success = true; } #endregion deletedPatientGoals.Add(deletedPatientGoal); }); response.DeletedPatientGoals = deletedPatientGoals; } else { success = true; } response.Success = success; return(response); } catch (Exception ex) { throw ex; } }