コード例 #1
0
        public TextQueryResponse <ProcedureTypeSummary> TextQuery(TextQueryRequest request)
        {
            var broker    = PersistenceContext.GetBroker <IProcedureTypeBroker>();
            var assembler = new ProcedureTypeAssembler();

            var helper = new TextQueryHelper <ProcedureType, ProcedureTypeSearchCriteria, ProcedureTypeSummary>(
                delegate
            {
                var rawQuery = request.TextQuery;

                IList <string> terms = TextQueryHelper.ParseTerms(rawQuery);
                var criteria         = new List <ProcedureTypeSearchCriteria>();

                // allow matching on name (assume entire query is a name which may contain spaces)
                var nameCriteria = new ProcedureTypeSearchCriteria();
                nameCriteria.Name.StartsWith(rawQuery);
                criteria.Add(nameCriteria);

                // allow matching of any term against ID
                criteria.AddRange(CollectionUtils.Map(terms,
                                                      delegate(string term)
                {
                    var c = new ProcedureTypeSearchCriteria();
                    c.Id.StartsWith(term);
                    return(c);
                }));

                return(criteria.ToArray());
            },
                assembler.CreateSummary,
                (criteria, threshold) => broker.Count(criteria) <= threshold,
                broker.Find);

            return(helper.Query(request));
        }
コード例 #2
0
		public TextQueryResponse<ProcedureTypeSummary> TextQuery(TextQueryRequest request)
		{
			var broker = PersistenceContext.GetBroker<IProcedureTypeBroker>();
			var assembler = new ProcedureTypeAssembler();

			var helper = new TextQueryHelper<ProcedureType, ProcedureTypeSearchCriteria, ProcedureTypeSummary>(
					delegate
					{
						var rawQuery = request.TextQuery;

						IList<string> terms = TextQueryHelper.ParseTerms(rawQuery);
						var criteria = new List<ProcedureTypeSearchCriteria>();

						// allow matching on name (assume entire query is a name which may contain spaces)
						var nameCriteria = new ProcedureTypeSearchCriteria();
						nameCriteria.Name.StartsWith(rawQuery);
						criteria.Add(nameCriteria);

						// allow matching of any term against ID
						criteria.AddRange(CollectionUtils.Map(terms,
									 delegate(string term)
									 {
										 var c = new ProcedureTypeSearchCriteria();
										 c.Id.StartsWith(term);
										 return c;
									 }));

						return criteria.ToArray();
					},
					assembler.CreateSummary,
					(criteria, threshold) => broker.Count(criteria) <= threshold,
					broker.Find);

			return helper.Query(request);
		}
コード例 #3
0
        public TextQueryResponse <StaffGroupSummary> TextQuery(StaffGroupTextQueryRequest request)
        {
            var broker    = PersistenceContext.GetBroker <IStaffGroupBroker>();
            var assembler = new StaffGroupAssembler();

            var helper = new TextQueryHelper <StaffGroup, StaffGroupSearchCriteria, StaffGroupSummary>(
                delegate
            {
                var rawQuery = request.TextQuery;

                // allow matching on name (assume entire query is a name which may contain spaces)
                var nameCriteria = new StaffGroupSearchCriteria();
                nameCriteria.Name.StartsWith(rawQuery);
                if (request.ElectiveGroupsOnly)
                {
                    nameCriteria.Elective.EqualTo(true);
                }

                return(new [] { nameCriteria });
            },
                assembler.CreateSummary,
                (criteria, threshold) => broker.Count(criteria) <= threshold,
                broker.Find);

            return(helper.Query(request));
        }
コード例 #4
0
ファイル: StaffAdminService.cs プロジェクト: hksonngan/Xian
        public TextQueryResponse <StaffSummary> TextQuery(StaffTextQueryRequest request)
        {
            var broker    = PersistenceContext.GetBroker <IStaffBroker>();
            var assembler = new StaffAssembler();

            var helper = new TextQueryHelper <Staff, StaffSearchCriteria, StaffSummary>(
                delegate
            {
                var rawQuery = request.TextQuery;

                // this will hold all criteria
                var criteria = new List <StaffSearchCriteria>();

                // build criteria against names
                var names = TextQueryHelper.ParsePersonNames(rawQuery);
                criteria.AddRange(CollectionUtils.Map(names,
                                                      (PersonName n) =>
                {
                    var sc = new StaffSearchCriteria();
                    sc.Name.FamilyName.StartsWith(n.FamilyName);
                    if (n.GivenName != null)
                    {
                        sc.Name.GivenName.StartsWith(n.GivenName);
                    }
                    return(sc);
                }));

                // build criteria against identifiers
                var ids = TextQueryHelper.ParseIdentifiers(rawQuery);
                criteria.AddRange(CollectionUtils.Map(ids,
                                                      (string word) =>
                {
                    var c = new StaffSearchCriteria();
                    c.Id.StartsWith(word);
                    return(c);
                }));


                ApplyStaffTypesFilter(request.StaffTypesFilter, criteria);

                return(criteria.ToArray());
            },
                staff => assembler.CreateStaffSummary(staff, PersistenceContext),
                (criteria, threshold) => broker.Count(criteria) <= threshold,
                broker.Find);

            return(helper.Query(request));
        }
コード例 #5
0
        public TextQueryResponse <DiagnosticServiceSummary> TextQuery(TextQueryRequest request)
        {
            IDiagnosticServiceBroker   broker    = PersistenceContext.GetBroker <IDiagnosticServiceBroker>();
            DiagnosticServiceAssembler assembler = new DiagnosticServiceAssembler();

            TextQueryHelper <DiagnosticService, DiagnosticServiceSearchCriteria, DiagnosticServiceSummary> helper
                = new TextQueryHelper <DiagnosticService, DiagnosticServiceSearchCriteria, DiagnosticServiceSummary>(
                      delegate
            {
                string rawQuery = request.TextQuery;

                IList <string> terms = TextQueryHelper.ParseTerms(rawQuery);
                List <DiagnosticServiceSearchCriteria> criteria = new List <DiagnosticServiceSearchCriteria>();

                // allow matching on name (assume entire query is a name which may contain spaces)
                DiagnosticServiceSearchCriteria nameCriteria = new DiagnosticServiceSearchCriteria();
                nameCriteria.Name.StartsWith(rawQuery);
                criteria.Add(nameCriteria);

                // allow matching of any term against ID
                criteria.AddRange(CollectionUtils.Map <string, DiagnosticServiceSearchCriteria>(terms,
                                                                                                delegate(string term)
                {
                    DiagnosticServiceSearchCriteria c = new DiagnosticServiceSearchCriteria();
                    c.Id.StartsWith(term);
                    return(c);
                }));

                return(criteria.ToArray());
            },
                      delegate(DiagnosticService ds)
            {
                return(assembler.CreateSummary(ds));
            },
                      delegate(DiagnosticServiceSearchCriteria[] criteria, int threshold)
            {
                return(broker.Count(criteria) <= threshold);
            },
                      delegate(DiagnosticServiceSearchCriteria[] criteria, SearchResultPage page)
            {
                return(broker.Find(criteria, page));
            });

            return(helper.Query(request));
        }
コード例 #6
0
        public TextQueryResponse <ExternalPractitionerSummary> TextQuery(TextQueryRequest request)
        {
            var broker    = PersistenceContext.GetBroker <IExternalPractitionerBroker>();
            var assembler = new ExternalPractitionerAssembler();

            var helper = new TextQueryHelper <ExternalPractitioner, ExternalPractitionerSearchCriteria, ExternalPractitionerSummary>(
                delegate
            {
                var rawQuery = request.TextQuery;

                var criteria = new List <ExternalPractitionerSearchCriteria>();

                // build criteria against names
                var names = TextQueryHelper.ParsePersonNames(rawQuery);
                criteria.AddRange(CollectionUtils.Map(names,
                                                      delegate(PersonName n)
                {
                    var sc = new ExternalPractitionerSearchCriteria();
                    sc.Name.FamilyName.StartsWith(n.FamilyName);
                    if (n.GivenName != null)
                    {
                        sc.Name.GivenName.StartsWith(n.GivenName);
                    }
                    return(sc);
                }));

                // build criteria against identifiers
                var ids = TextQueryHelper.ParseIdentifiers(rawQuery);
                criteria.AddRange(CollectionUtils.Map(ids,
                                                      delegate(string word)
                {
                    var c = new ExternalPractitionerSearchCriteria();
                    c.LicenseNumber.StartsWith(word);
                    return(c);
                }));

                return(criteria.ToArray());
            },
                prac => assembler.CreateExternalPractitionerSummary(prac, PersistenceContext),
                (criteria, threshold) => broker.Count(criteria) <= threshold,
                broker.Find);

            return(helper.Query(request));
        }
コード例 #7
0
ファイル: StaffGroupAdminService.cs プロジェクト: nhannd/Xian
        public TextQueryResponse<StaffGroupSummary> TextQuery(StaffGroupTextQueryRequest request)
        {
            var broker = PersistenceContext.GetBroker<IStaffGroupBroker>();
            var assembler = new StaffGroupAssembler();

            var helper = new TextQueryHelper<StaffGroup, StaffGroupSearchCriteria, StaffGroupSummary>(
                    delegate
                    {
                        var rawQuery = request.TextQuery;

                        // allow matching on name (assume entire query is a name which may contain spaces)
                        var nameCriteria = new StaffGroupSearchCriteria();
                        nameCriteria.Name.StartsWith(rawQuery);
						if(request.ElectiveGroupsOnly)
							nameCriteria.Elective.EqualTo(true);

                        return new []{ nameCriteria };
                    },
                    assembler.CreateSummary,
                    (criteria, threshold) => broker.Count(criteria) <= threshold,
                    broker.Find);

            return helper.Query(request);
        }
コード例 #8
0
ファイル: StaffAdminService.cs プロジェクト: nhannd/Xian
		public TextQueryResponse<StaffSummary> TextQuery(StaffTextQueryRequest request)
		{
			var broker = PersistenceContext.GetBroker<IStaffBroker>();
			var assembler = new StaffAssembler();

			var helper = new TextQueryHelper<Staff, StaffSearchCriteria, StaffSummary>(
                    delegate
					{
                        var rawQuery = request.TextQuery;

						// this will hold all criteria
						var criteria = new List<StaffSearchCriteria>();

						// build criteria against names
						var names = TextQueryHelper.ParsePersonNames(rawQuery);
						criteria.AddRange(CollectionUtils.Map(names,
							(PersonName n) =>
							{
								var sc = new StaffSearchCriteria();
								sc.Name.FamilyName.StartsWith(n.FamilyName);
								if (n.GivenName != null)
									sc.Name.GivenName.StartsWith(n.GivenName);
								return sc;
							}));

						// build criteria against identifiers
						var ids = TextQueryHelper.ParseIdentifiers(rawQuery);
						criteria.AddRange(CollectionUtils.Map(ids,
									 (string word) =>
									 {
										 var c = new StaffSearchCriteria();
										 c.Id.StartsWith(word);
										 return c;
									 }));


						ApplyStaffTypesFilter(request.StaffTypesFilter, criteria);

						return criteria.ToArray();
					},
                    staff => assembler.CreateStaffSummary(staff, PersistenceContext),
                    (criteria, threshold) => broker.Count(criteria) <= threshold,
					broker.Find);

			return helper.Query(request);
		}
コード例 #9
0
		public TextQueryResponse<DiagnosticServiceSummary> TextQuery(TextQueryRequest request)
		{
			IDiagnosticServiceBroker broker = PersistenceContext.GetBroker<IDiagnosticServiceBroker>();
			DiagnosticServiceAssembler assembler = new DiagnosticServiceAssembler();

			TextQueryHelper<DiagnosticService, DiagnosticServiceSearchCriteria, DiagnosticServiceSummary> helper
				= new TextQueryHelper<DiagnosticService, DiagnosticServiceSearchCriteria, DiagnosticServiceSummary>(
                    delegate
					{
                        string rawQuery = request.TextQuery;

						IList<string> terms = TextQueryHelper.ParseTerms(rawQuery);
						List<DiagnosticServiceSearchCriteria> criteria = new List<DiagnosticServiceSearchCriteria>();

						// allow matching on name (assume entire query is a name which may contain spaces)
						DiagnosticServiceSearchCriteria nameCriteria = new DiagnosticServiceSearchCriteria();
						nameCriteria.Name.StartsWith(rawQuery);
						criteria.Add(nameCriteria);

						// allow matching of any term against ID
						criteria.AddRange(CollectionUtils.Map<string, DiagnosticServiceSearchCriteria>(terms,
									 delegate(string term)
									 {
										 DiagnosticServiceSearchCriteria c = new DiagnosticServiceSearchCriteria();
										 c.Id.StartsWith(term);
										 return c;
									 }));

						return criteria.ToArray();
					},
					delegate(DiagnosticService ds)
					{
						return assembler.CreateSummary(ds);
					},
					delegate(DiagnosticServiceSearchCriteria[] criteria, int threshold)
					{
						return broker.Count(criteria) <= threshold;
					},
					delegate(DiagnosticServiceSearchCriteria[] criteria, SearchResultPage page)
					{
						return broker.Find(criteria, page);
					});
			return helper.Query(request);
		}