/// <summary>
        /// Handles the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>A <see cref="Agatha.Common.Response"/></returns>
        public override Response Handle(GetLookupListByKeywordRequest request)
        {
            var lookupType = _lookupTypeService.GetLookupType(request.LookupName);

            IList <Expression <Func <LookupBase, object> > > propertiesToSearch = new List <Expression <Func <LookupBase, object> > >
            {
                p => p.Name,
                p => p.Description
            };

            IList <Order> orders = new List <Order>
            {
                Order.Asc(Projections.Property <LookupBase> (p => p.SortOrderNumber)),
                Order.Asc(Projections.Property <LookupBase> (p => p.Name))
            };

            var result = _keywordsSearchService.FindPagedEntityListByKeywords(
                lookupType, request.SearchCriteria, propertiesToSearch, request.PageIndex, request.PageSize, orders);

            var pagedLookupListDto = new PagedLookupListDto
            {
                TotalCount = result.TotalCount,
                PageIndex  = result.PageIndex,
                PageSize   = result.PageSize,
                PagedList  = Mapper.Map <IList <LookupBase>, IList <LookupValueDto> > (result.ItemList)
            };

            var response = CreateTypedResponse();

            response.SearchCriteria     = request.SearchCriteria;
            response.PagedLookupListDto = pagedLookupListDto;

            return(response);
        }
Beispiel #2
0
        /// <summary>
        /// Finds the paged location list by keywords.
        /// </summary>
        /// <param name="searchCriteria">The search criteria.</param>
        /// <param name="pageIndex">Index of the page.</param>
        /// <param name="pageSize">Size of the page.</param>
        /// <returns>
        /// A PagedEntityList&lt;Location&gt;
        /// </returns>
        public PagedEntityList <Location> FindPagedLocationListByKeywords(string searchCriteria, int pageIndex, int pageSize)
        {
            IList <Expression <Func <Location, object> > > propertiesToSearch = new List <Expression <Func <Location, object> > >
            {
                p => p.LocationProfile.LocationName.Name,
                p => p.LocationProfile.LocationName.DisplayName
            };

            IList <Order> orders = new List <Order>
            {
                Order.Asc(Projections.Property <Location> (p => p.LocationProfile.LocationName.Name))
            };

            var pagedLocationList = _keywordsSearchService.FindPagedEntityListByKeywords(searchCriteria, propertiesToSearch, pageIndex, pageSize, orders);

            return(pagedLocationList);
        }
Beispiel #3
0
        /// <summary>
        /// Finds the paged staff list by keywords.
        /// </summary>
        /// <param name="searchCriteria">The search criteria.</param>
        /// <param name="pageIndex">Index of the page.</param>
        /// <param name="pageSize">Size of the page.</param>
        /// <returns>
        /// A PagedEntityList&lt;Staff&gt;
        /// </returns>
        public PagedEntityList <Staff> FindPagedStaffListByKeywords(string searchCriteria, int pageIndex, int pageSize)
        {
            IList <Expression <Func <Staff, object> > > propertiesToSearch = new List <Expression <Func <Staff, object> > >
            {
                p => p.StaffProfile.StaffName.First,
                p => p.StaffProfile.StaffName.Middle,
                p => p.StaffProfile.StaffName.Last
            };

            IList <Order> orders = new List <Order>
            {
                Order.Asc(Projections.Property <Staff> (p => p.StaffProfile.StaffName.First)),
                Order.Asc(Projections.Property <Staff> (p => p.StaffProfile.StaffName.Last))
            };

            var pagedStaffList = _keywordsSearchService.FindPagedEntityListByKeywords(searchCriteria, propertiesToSearch, pageIndex, pageSize, orders);

            return(pagedStaffList);
        }
        /// <summary>
        /// Handles the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>A <see cref="Agatha.Common.Response"/></returns>
        public override Response Handle(GetPatientsByKeywordsRequest request)
        {
            IList <Expression <Func <Patient, object> > > propertiesToSearch = new List <Expression <Func <Patient, object> > >
            {
                p => p.Name.First,
                p => p.Name.Middle,
                p => p.Name.Last
            };

            IList <Order> orders = new List <Order>
            {
                Order.Asc(Projections.Property <Patient> (p => p.Name.Last)),
                Order.Asc(Projections.Property <Patient> (p => p.Name.First))
            };
            IList <Expression <Func <Patient, IEnumerable> > > eagerLoadingAssociations = new List <Expression <Func <Patient, IEnumerable> > >
            {
                p => p.PhoneNumbers,
                p => p.Addresses
            };

            var result = _keywordsSearchService.FindPagedEntityListByKeywords(
                request.SearchCriteria, propertiesToSearch, request.PageIndex, request.PageSize, orders, eagerLoadingAssociations);

            var pagedPatientSearchResultDto = new PagedPatientSearchResultDto
            {
                TotalCount = result.TotalCount,
                PageIndex  = result.PageIndex,
                PageSize   = result.PageSize,
                PagedList  = Mapper.Map <IList <Patient>, IList <PatientSearchResultDto> > (result.ItemList)
            };

            var response = CreateTypedResponse();

            response.SearchCriteria = request.SearchCriteria;
            response.PagedPatientSearchResultDto = pagedPatientSearchResultDto;

            return(response);
        }