Exemplo n.º 1
0
        public RemoveProgramInPatientNotesDataResponse RemoveProgramInPatientNotes(RemoveProgramInPatientNotesDataRequest request)
        {
            RemoveProgramInPatientNotesDataResponse response = null;

            try
            {
                response = new RemoveProgramInPatientNotesDataResponse();

                IMongoPatientNoteRepository repo = Factory.GetRepository(RepositoryType.PatientNote);
                if (request.ProgramId != null)
                {
                    List <PatientNoteData> notes = repo.FindNotesWithAProgramId(request.ProgramId) as List <PatientNoteData>;
                    if (notes != null && notes.Count > 0)
                    {
                        notes.ForEach(u =>
                        {
                            request.NoteId = u.Id;
                            if (u.ProgramIds != null && u.ProgramIds.Remove(request.ProgramId))
                            {
                                repo.RemoveProgram(request, u.ProgramIds);
                            }
                        });
                    }
                }
                return(response);
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 2
0
        public void RemoveProgramInPatientNotes_Test()
        {
            double      version        = 1.0;
            string      contractNumber = "InHealth001";
            string      context        = "NG";
            string      userId         = "000000000000000000000000";
            string      ddUrl          = "http://localhost:8888/PatientNote";
            string      programId      = "53cedd21d6a4850d58889ee7";
            IRestClient client         = new JsonServiceClient();

            //[Route("/{Context}/{Version}/{ContractNumber}/Note/RemoveProgram/{ProgramId}/Update", "PUT")]
            string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Note/RemoveProgram/{4}/Update",
                                                              ddUrl,
                                                              context,
                                                              version,
                                                              contractNumber, programId), userId);
            RemoveProgramInPatientNotesDataResponse response = client.Put <RemoveProgramInPatientNotesDataResponse>(url, new RemoveProgramInPatientNotesDataRequest
            {
                ProgramId      = programId,
                Context        = context,
                ContractNumber = contractNumber,
                UserId         = userId,
                Version        = version
            });

            Assert.IsNotNull(response);
        }
Exemplo n.º 3
0
        public RemoveProgramInPatientNotesDataResponse Put(RemoveProgramInPatientNotesDataRequest request)
        {
            RemoveProgramInPatientNotesDataResponse response = new RemoveProgramInPatientNotesDataResponse();

            try
            {
                RequireUserId(request);
                response         = Manager.RemoveProgramInPatientNotes(request);
                response.Version = request.Version;
            }
            catch (Exception ex)
            {
                RaiseException(response, ex);
            }
            return(response);
        }