예제 #1
0
        public RemoveProgramInPatientGoalsDataResponse RemoveProgramInPatientGoals(RemoveProgramInPatientGoalsDataRequest request)
        {
            RemoveProgramInPatientGoalsDataResponse response = null;

            try
            {
                response = new RemoveProgramInPatientGoalsDataResponse();

                IGoalRepository repo = Factory.GetRepository(request, RepositoryType.PatientGoal);
                if (request.ProgramId != null)
                {
                    List <PatientGoalData> goals = repo.FindGoalsWithAProgramId(request.ProgramId) as List <PatientGoalData>;
                    if (goals != null && goals.Count > 0)
                    {
                        goals.ForEach(u =>
                        {
                            request.PatientGoalId = 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
        public void RemoveProgramInPatientGoals_Test()
        {
            double      version        = 1.0;
            string      contractNumber = "InHealth001";
            string      context        = "NG";
            string      userId         = "000000000000000000000000";
            string      programId      = "53cedd21d6a4850d58889ee7";
            string      ddUrl          = "http://localhost:8888/PatientGoal";
            IRestClient client         = new JsonServiceClient();

            // [Route("/{Context}/{Version}/{ContractNumber}/Goal/RemoveProgram/{ProgramId}/Update", "PUT")]
            string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Goal/RemoveProgram/{4}/Update",
                                                              ddUrl,
                                                              context,
                                                              version,
                                                              contractNumber, programId), userId);

            RemoveProgramInPatientGoalsDataResponse response = client.Put <RemoveProgramInPatientGoalsDataResponse>(url, new RemoveProgramInPatientGoalsDataRequest
            {
                ProgramId      = programId,
                Context        = context,
                ContractNumber = contractNumber,
                UserId         = userId,
                Version        = version
            });

            Assert.IsNotNull(response);
        }
예제 #3
0
        public RemoveProgramInPatientGoalsDataResponse Put(RemoveProgramInPatientGoalsDataRequest request)
        {
            RemoveProgramInPatientGoalsDataResponse response = new RemoveProgramInPatientGoalsDataResponse();

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

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