public DeleteInterventionDataResponse DeleteIntervention(DeleteInterventionDataRequest request) { try { DeleteInterventionDataResponse result = new DeleteInterventionDataResponse(); IGoalRepository repo = Factory.GetRepository(request, RepositoryType.PatientIntervention); List <PatientInterventionData> pid = (List <PatientInterventionData>)repo.Find(request.PatientGoalId); List <string> deletedIds = null; if (pid != null && pid.Count > 0) { deletedIds = new List <string>(); pid.ForEach(i => { request.InterventionId = i.Id; repo.Delete(request); deletedIds.Add(request.InterventionId); }); } result.DeletedIds = deletedIds; result.Success = true; return(result); } catch (Exception ex) { throw ex; } }
public bool DeleteInterventionRequest(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}/Intervention/{6}/Delete/", DDPatientGoalsServiceUrl, "NG", request.Version, request.ContractNumber, request.PatientId, request.PatientGoalId, id), request.UserId); DeleteInterventionDataResponse response = client.Delete <DeleteInterventionDataResponse>( url); if (response != null) { result = true; } return(result); } catch (WebServiceException ex) { throw new WebServiceException("AD:DeleteInterventionRequest()::" + ex.Message, ex.InnerException); } }
public DeleteInterventionDataResponse Delete(DeleteInterventionDataRequest request) { DeleteInterventionDataResponse response = new DeleteInterventionDataResponse(); try { if (string.IsNullOrEmpty(request.UserId)) { throw new UnauthorizedAccessException("PatientGoalDD:Get()::Unauthorized Access"); } response = Manager.DeleteIntervention(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; } }