Example #1
0
        public DeleteTaskDataResponse DeleteTask(DeleteTaskDataRequest request)
        {
            try
            {
                DeleteTaskDataResponse result = new DeleteTaskDataResponse();

                IGoalRepository repo = Factory.GetRepository(request, RepositoryType.PatientTask);

                List <PatientTaskData> ptd        = (List <PatientTaskData>)repo.Find(request.PatientGoalId);
                List <string>          deletedIds = null;
                if (ptd != null && ptd.Count > 0)
                {
                    deletedIds = new List <string>();
                    ptd.ForEach(t =>
                    {
                        request.TaskId = t.Id;
                        repo.Delete(request);
                        deletedIds.Add(request.TaskId);
                    });
                }
                result.DeletedIds = deletedIds;
                result.Success    = true;
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
        public bool DeleteTaskRequest(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}/Task/{6}/Delete/",
                                                                  DDPatientGoalsServiceUrl,
                                                                  "NG",
                                                                  request.Version,
                                                                  request.ContractNumber,
                                                                  request.PatientId,
                                                                  request.PatientGoalId,
                                                                  id), request.UserId);

                DeleteTaskDataResponse response = client.Delete <DeleteTaskDataResponse>(
                    url);

                if (response != null)
                {
                    result = true;
                }

                return(result);
            }
            catch (WebServiceException ex)
            {
                throw new WebServiceException("AD:DeleteTaskRequest()::" + ex.Message, ex.InnerException);
            }
        }
        public void Delete_Intervention_Test()
        {
            string      url            = "http://localhost:8888/PatientGoal";
            string      patientId      = "52a0da34fe7a5915485bdfd6";
            string      contractNumber = "InHealth001";
            string      context        = "NG";
            string      version        = "v1";
            string      id             = "52fd3fcefe7a5912b0149acd";
            string      patientGoaldId = "52fd2d6cd433231c845e7d25";
            IRestClient client         = new JsonServiceClient();

            DeleteTaskDataResponse response = client.Delete <DeleteTaskDataResponse>(
                string.Format("{0}/{1}/{2}/{3}/Patient/{4}/Goal/{5}/Intervention/{6}/Delete/?UserId={7}",
                              url,
                              context,
                              version,
                              contractNumber,
                              patientId,
                              patientGoaldId,
                              id,
                              patientId));
        }
Example #4
0
        public DeleteTaskDataResponse Delete(DeleteTaskDataRequest request)
        {
            DeleteTaskDataResponse response = new DeleteTaskDataResponse();

            try
            {
                if (string.IsNullOrEmpty(request.UserId))
                {
                    throw new UnauthorizedAccessException("PatientGoalDD:Get()::Unauthorized Access");
                }

                response         = Manager.DeleteTask(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);
        }
Example #5
0
        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; }
        }