Пример #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; }
        }
Пример #2
0
        public void RemoveProgram(object entity, List <string> updatedProgramIds)
        {
            RemoveProgramInPatientNotesDataRequest request = (RemoveProgramInPatientNotesDataRequest)entity;

            try
            {
                List <ObjectId> ids = updatedProgramIds.ConvertAll(r => ObjectId.Parse(r));
                using (PatientNoteMongoContext ctx = new PatientNoteMongoContext(ContractDBName))
                {
                    var q = MB.Query <MEPatientNote> .EQ(b => b.Id, ObjectId.Parse(request.NoteId));

                    var uv = new List <MB.UpdateBuilder>();
                    uv.Add(MB.Update.SetWrapped <List <ObjectId> >(MEPatientNote.ProgramProperty, ids));
                    uv.Add(MB.Update.Set(MEPatientNote.LastUpdatedOnProperty, DateTime.UtcNow));
                    uv.Add(MB.Update.Set(MEPatientNote.UpdatedByProperty, ObjectId.Parse(this.UserId)));

                    IMongoUpdate update = MB.Update.Combine(uv);
                    ctx.PatientNotes.Collection.Update(q, update);

                    AuditHelper.LogDataAudit(this.UserId,
                                             MongoCollectionName.PatientUtilization.ToString(),
                                             request.NoteId.ToString(),
                                             DataAuditType.Update,
                                             request.ContractNumber);
                }
            }
            catch (Exception) { throw; }
        }
Пример #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);
        }
Пример #4
0
 public RemoveProgramInPatientNotesDataResponse RemoveProgramInPatientNotes(RemoveProgramInPatientNotesDataRequest request)
 {
     throw new NotImplementedException();
 }