예제 #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; }
        }
예제 #2
0
파일: ToDoTest.cs 프로젝트: rotovibe/engage
        public void RemoveProgramInToDos_Test()
        {
            RemoveProgramInToDosDataRequest request = new RemoveProgramInToDosDataRequest
            {
                Context        = context,
                ContractNumber = contractNumber,
                ProgramId      = "5400b12bd6a4850940b9f245",
                UserId         = userId,
                Version        = version
            };

            ISchedulingDataManager cm = new SchedulingDataManager {
                Factory = new SchedulingRepositoryFactory()
            };
            RemoveProgramInToDosDataResponse response = cm.RemoveProgramInToDos(request);

            Assert.IsNotNull(response);
        }
예제 #3
0
        public void RemoveProgramInToDos_Test()
        {
            RemoveProgramInToDosDataRequest request = new RemoveProgramInToDosDataRequest
            {
                Context        = context,
                ContractNumber = contractNumber,
                ProgramId      = "535ad70ad2d8e912e857525c",
                UserId         = userId,
                Version        = version
            };

            ISchedulingDataManager cm = new StubToDoDataManager {
                Factory = new StubSchedulingRepositoryFactory()
            };
            RemoveProgramInToDosDataResponse response = cm.RemoveProgramInToDos(request);

            Assert.IsNotNull(response);
        }
예제 #4
0
        public RemoveProgramInToDosDataResponse Put(RemoveProgramInToDosDataRequest request)
        {
            RemoveProgramInToDosDataResponse response = new RemoveProgramInToDosDataResponse();

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

                response         = Manager.RemoveProgramInToDos(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);
        }