Example #1
0
        public string Search(ProgramButtonSearchRequestDto searchModel)
        {
            var gridParam = GetGridParams();
            var list      = _programButtonService.Search(searchModel, ref gridParam);

            return(JSONHelper.ToJson(list, gridParam == null ? list.Count : gridParam.TotalCount));
        }
Example #2
0
        public List <ProgramButtonSearchResultDto> Search(ProgramButtonSearchRequestDto searchRequest, ref GridParams gridParams)
        {
            var query = from programButton in _programButtonRepository.Table
                        join program in _programRepository.Table
                        on programButton.ProgramID equals program.ProgramID
                        join button in _buttonRepository.Table
                        on programButton.ButtonID equals button.ButtonID
                        select new ProgramButtonSearchResultDto {
                ProgramButtonID = programButton.ProgramButtonID,
                ProgramID       = program.ProgramID,
                ButtonID        = button.ButtonID,
                ProgramName     = program.ProgramName,
                ButtonName      = button.ButtonName,
                Url             = programButton.Url,
                ButtonText      = button.ButtonText
            };

            query = query.Where(b => !(
                                    (searchRequest.ButtonID != 0 && b.ButtonID != searchRequest.ButtonID) ||
                                    (searchRequest.ProgramID != 0 && b.ProgramID != searchRequest.ProgramID) ||
                                    (searchRequest.ProgramButtonID != 0 && b.ProgramButtonID != searchRequest.ProgramButtonID)
                                    ));

            gridParams.TotalCount = query.Count();
            return(QueryExtensions.SortAndPage(query, gridParams).ToList());
        }