Пример #1
0
        public async Task DeleteAsync(long Id)
        {
            var goal = await _goalRepository.FindByIdAsync(Id);

            _goalRepository.Delete(goal);
            await _unitOfWork.CompleteAsync();
        }
Пример #2
0
        public void DeleteGoal(int id)
        {
            var goal = _goalRepository.GetById(id);

            _goalRepository.Delete(goal);
            SaveGoal();
        }
        public bool Delete(long id)
        {
            bool deleted = Repo.Delete(id);

            Unit.SaveChanges();
            return(deleted);
        }
Пример #4
0
        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;
            }
        }
Пример #5
0
        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;
            }
        }
Пример #6
0
        public async Task DeleteGoal(long id)
        {
            await _goalRepository.Delete(id);

            var feedEvents = _feedEventService.GetFeedEvents().Where(e => (e.Type == EventType.GoalSet || e.Type == EventType.GoalAchieved) && e.EventId == id);

            foreach (FeedEvent f in feedEvents)
            {
                await _feedEventService.DeleteFeedEvent(f.Id);
            }
            await _unit.Commit();
        }
        public ActionResult Delete(Guid?id)
        {
            if (!id.HasValue)
            {
                return(NotFound());
            }

            var goal = _goalRepository.Get(id.Value);

            if (goal == null)
            {
                return(NotFound(id.Value));
            }

            _goalRepository.Delete(goal);

            return(NoContent());
        }
Пример #8
0
        public DeletePatientGoalDataResponse DeletePatientGoal(DeletePatientGoalDataRequest request)
        {
            try
            {
                DeletePatientGoalDataResponse result = new DeletePatientGoalDataResponse();

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

                repo.Delete(request);

                result.Deleted = true;
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #9
0
        /// <summary>
        /// Deletes the goal on the system with the given
        /// ID and User Id Owner. This will delete milestones associated with
        /// the goal also.
        /// </summary>
        /// <param name="userId">The ID of the user owning the goal</param>
        /// <param name="id">The ID of the Goal to delete</param>
        /// <returns>Whether we have deleted the goal</returns>
        public bool DeleteGoal(int userId, int id)
        {
            Goal existing = goalRepository.GetGoalForUser(id, userId);

            if (existing == null)
            {
                throw new NullReferenceException("Goal does not exist on the system for this User ID and Goal ID");
            }

            //Attempt to remove
            Goal removed = goalRepository.Delete(id);

            if (removed == null)
            {
                throw new NullReferenceException("The goal does not exist on the system");
            }

            return(true);
        }
Пример #10
0
        public PutUpdateBarrierResponse UpdatePatientBarrier(PutUpdateBarrierRequest request)
        {
            try
            {
                PutUpdateBarrierResponse result = new PutUpdateBarrierResponse();

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

                if (request.BarrierIdsList != null && request.BarrierIdsList.Count > 0)
                {
                    List <PatientBarrierData> pid             = (List <PatientBarrierData>)repo.Find(request.PatientGoalId);
                    List <string>             dbBarrierIdList = GetBarrierIds(pid);

                    // update existing barrier entries with a delete
                    List <string> excludes = dbBarrierIdList.Except(request.BarrierIdsList).ToList <string>();
                    excludes.ForEach(ex =>
                    {
                        // create delete barrier request to insert
                        DeleteBarrierDataRequest dbr = new DeleteBarrierDataRequest {
                            BarrierId = ex, UserId = request.UserId
                        };
                        repo.Delete(dbr);
                    });
                }
                if (request.Barrier != null && request.Barrier.Id != "0")
                {
                    bool status = (bool)repo.Update(request);
                    if (status)
                    {
                        PatientBarrierData data = repo.FindByID(request.Barrier.Id) as PatientBarrierData;
                        result.BarrierData = data;
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #11
0
 public Goal Delete(Goal goal)
 {
     _goalRepository.Delete(goal);
     return(goal);
 }
Пример #12
0
        public void Delete(int id)
        {
            var model = goalRepository.GetById(id);

            goalRepository.Delete(model);
        }
Пример #13
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; }
        }