コード例 #1
0
        public PagedResultList <FeedbackContract> GetFeedbackList(int start,
                                                                  int count,
                                                                  FeedbackSortEnumContract sort,
                                                                  SortDirectionEnumContract sortDirection,
                                                                  IList <FeedbackCategoryEnumContract> filterCategories,
                                                                  PortalTypeContract portalType)
        {
            try
            {
                var url = UrlQueryBuilder.Create("feedback")
                          .AddParameter("start", start)
                          .AddParameter("count", count)
                          .AddParameter("sort", sort)
                          .AddParameter("sortDirection", sortDirection)
                          .AddParameterList("filterCategories", filterCategories)
                          .AddParameter("portalType", portalType)
                          .ToResult();
                var result = m_client.GetPagedList <FeedbackContract>(url);
                return(result);
            }
            catch (HttpRequestException e)
            {
                if (m_logger.IsErrorEnabled())
                {
                    m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e);
                }

                throw;
            }
        }
コード例 #2
0
ファイル: FeedbackManager.cs プロジェクト: RIDICS/ITJakub
        public PagedResultList <FeedbackContract> GetFeedbackList(int?start, int?count, FeedbackSortEnumContract sort,
                                                                  SortDirectionEnumContract sortDirection, IList <FeedbackCategoryEnumContract> filterCategories, PortalTypeContract portalTypeContract)
        {
            var startValue           = PagingHelper.GetStart(start);
            var countValue           = PagingHelper.GetCount(count);
            var sortValue            = m_mapper.Map <FeedbackSortEnum>(sort);
            var filterCategoryValues = m_mapper.Map <List <FeedbackCategoryEnum> >(filterCategories);
            var portalType           = m_mapper.Map <PortalTypeEnum>(portalTypeContract);

            var result = m_portalRepository.InvokeUnitOfWork(repository =>
            {
                var dbFeedbacks = repository.GetFeedbackList(startValue, countValue, sortValue, sortDirection, filterCategoryValues, portalType);

                var headwordFeedbackIds = dbFeedbacks.List.Where(x => x.FeedbackType == FeedbackType.Headword)
                                          .Select(x => x.Id);
                repository.FetchHeadwordFeedbacks(headwordFeedbackIds);

                return(dbFeedbacks);
            });

            return(new PagedResultList <FeedbackContract>
            {
                List = m_userDetailManager.AddUserDetails(m_mapper.Map <List <FeedbackContract> >(result.List)),
                TotalCount = result.Count,
            });
        }