Exemple #1
0
        public RemoveProgramInToDosDataResponse RemoveProgramInToDos(RemoveProgramInToDosDataRequest request)
        {
            RemoveProgramInToDosDataResponse response = new RemoveProgramInToDosDataResponse();

            try
            {
                ISchedulingRepository repo = Factory.GetRepository(request, RepositoryType.ToDo);
                if (request.ProgramId != null)
                {
                    List <ToDoData> todos = repo.FindToDosWithAProgramId(request.ProgramId) as List <ToDoData>;
                    if (todos != null && todos.Count > 0)
                    {
                        todos.ForEach(u =>
                        {
                            request.ToDoId = u.Id;
                            if (u.ProgramIds != null && u.ProgramIds.Remove(request.ProgramId))
                            {
                                repo.RemoveProgram(request, u.ProgramIds);
                            }
                        });
                    }
                }
                return(response);
            }
            catch (Exception ex) { throw ex; }
        }