public void DeletePatientGoalByPatientId_Test() { double version = 1.0; string contractNumber = "InHealth001"; string context = "NG"; string patientId = "5325db70d6a4850adcbba946"; string userId = "000000000000000000000000"; string ddUrl = "http://localhost:8888/PatientGoal"; IRestClient client = new JsonServiceClient(); // [Route("/{Context}/{Version}/{ContractNumber}/PatientGoal/Patient/{PatientId}/Delete", "DELETE")] string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/PatientGoal/Patient/{4}/Delete", ddUrl, context, version, contractNumber, patientId), userId); DeletePatientGoalByPatientIdDataResponse response = client.Delete <DeletePatientGoalByPatientIdDataResponse>(url); Assert.IsNotNull(response); }
public void Execute() { try { //[Route("/{Context}/{Version}/{ContractNumber}/PatientGoal/Patient/{PatientId}/Delete", "DELETE")] string pgUrl = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/PatientGoal/Patient/{4}/Delete", DDPatientGoalsServiceUrl, "NG", request.Version, request.ContractNumber, request.Id), request.UserId); DeletePatientGoalByPatientIdDataResponse pgDDResponse = client.Delete <DeletePatientGoalByPatientIdDataResponse>(pgUrl); if (pgDDResponse != null && pgDDResponse.Success) { deletedPatientGoals = pgDDResponse.DeletedPatientGoals; } } catch (Exception ex) { throw new Exception("AD: PatientGoalCommand Execute::" + ex.Message, ex.InnerException); } }
public DeletePatientGoalByPatientIdDataResponse Delete(DeletePatientGoalByPatientIdDataRequest request) { DeletePatientGoalByPatientIdDataResponse response = new DeletePatientGoalByPatientIdDataResponse(); try { if (string.IsNullOrEmpty(request.UserId)) { throw new UnauthorizedAccessException("PatientGoalDD:PatientGoalDelete()::Unauthorized Access"); } response = Manager.DeletePatientGoalByPatientId(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; } }