Esempio n. 1
0
        protected override IList <ProtocolGroup> GetItemsForExport(IReadContext context, int firstRow, int maxRows)
        {
            ProtocolGroupSearchCriteria where = new ProtocolGroupSearchCriteria();
            where.Name.SortAsc(0);

            return(context.GetBroker <IProtocolGroupBroker>().Find(where, new SearchResultPage(firstRow, maxRows)));
        }
        public ListProtocolGroupsResponse ListProtocolGroups(ListProtocolGroupsRequest request)
        {
            var where = new ProtocolGroupSearchCriteria();
            where.Name.SortAsc(0);

            var protocolGroups = CollectionUtils.Map <ProtocolGroup, ProtocolGroupSummary>(
                this.PersistenceContext.GetBroker <IProtocolGroupBroker>().Find(where, request.Page),
                pg => new ProtocolGroupSummary(pg.GetRef(), pg.Name, pg.Description));

            return(new ListProtocolGroupsResponse(protocolGroups));
        }
Esempio n. 3
0
        private ProtocolGroup LoadOrCreateProtocolGroup(string name, IPersistenceContext context)
        {
            ProtocolGroup group;

            try
            {
                // see if already exists in db
                ProtocolGroupSearchCriteria where = new ProtocolGroupSearchCriteria();
                where.Name.EqualTo(name);
                group = context.GetBroker <IProtocolGroupBroker>().FindOne(where);
            }
            catch (EntityNotFoundException)
            {
                // create it
                group      = new ProtocolGroup();
                group.Name = name;
                context.Lock(group, DirtyState.New);
            }

            return(group);
        }
		public ListProtocolGroupsResponse ListProtocolGroups(ListProtocolGroupsRequest request)
		{
			var where = new ProtocolGroupSearchCriteria();
			where.Name.SortAsc(0);

			var protocolGroups = CollectionUtils.Map<ProtocolGroup, ProtocolGroupSummary>(
				this.PersistenceContext.GetBroker<IProtocolGroupBroker>().Find(where, request.Page),
				pg => new ProtocolGroupSummary(pg.GetRef(), pg.Name, pg.Description));

			return new ListProtocolGroupsResponse(protocolGroups);
		}