protected override IList <PatientNoteCategory> GetItemsForExport(IReadContext context, int firstRow, int maxRows) { PatientNoteCategorySearchCriteria where = new PatientNoteCategorySearchCriteria(); where.Name.SortAsc(0); return(context.GetBroker <IPatientNoteCategoryBroker>().Find(where, new SearchResultPage(firstRow, maxRows))); }
public ListAllNoteCategoriesResponse ListAllNoteCategories(ListAllNoteCategoriesRequest request) { PatientNoteCategorySearchCriteria criteria = new PatientNoteCategorySearchCriteria(); criteria.Name.SortAsc(0); if (!request.IncludeDeactivated) criteria.Deactivated.EqualTo(false); PatientNoteCategoryAssembler assembler = new PatientNoteCategoryAssembler(); return new ListAllNoteCategoriesResponse( CollectionUtils.Map<PatientNoteCategory, PatientNoteCategorySummary, List<PatientNoteCategorySummary>>( PersistenceContext.GetBroker<IPatientNoteCategoryBroker>().Find(criteria, request.Page), delegate(PatientNoteCategory category) { return assembler.CreateNoteCategorySummary(category, this.PersistenceContext); })); }
public ListAllNoteCategoriesResponse ListAllNoteCategories(ListAllNoteCategoriesRequest request) { PatientNoteCategorySearchCriteria criteria = new PatientNoteCategorySearchCriteria(); criteria.Name.SortAsc(0); if (!request.IncludeDeactivated) { criteria.Deactivated.EqualTo(false); } PatientNoteCategoryAssembler assembler = new PatientNoteCategoryAssembler(); return(new ListAllNoteCategoriesResponse( CollectionUtils.Map <PatientNoteCategory, PatientNoteCategorySummary, List <PatientNoteCategorySummary> >( PersistenceContext.GetBroker <IPatientNoteCategoryBroker>().Find(criteria, request.Page), delegate(PatientNoteCategory category) { return assembler.CreateNoteCategorySummary(category, this.PersistenceContext); }))); }
private PatientNoteCategory LoadOrCreatePatientNoteCategory(string name, NoteSeverity severity, IPersistenceContext context) { PatientNoteCategory nc; try { // see if already exists in db PatientNoteCategorySearchCriteria where = new PatientNoteCategorySearchCriteria(); where.Name.EqualTo(name); nc = context.GetBroker <IPatientNoteCategoryBroker>().FindOne(where); } catch (EntityNotFoundException) { // create it nc = new PatientNoteCategory(name, null, severity); context.Lock(nc, DirtyState.New); } return(nc); }