示例#1
0
        public SalesTotalsByAmountCollectionResponse Fetch(SalesTotalsByAmountQueryCollectionRequest request)
        {
            base.FixupLimitAndPagingOnRequest(request);

            var totalItemCount     = 0;
            var sortExpression     = RepositoryHelper.ConvertStringToSortExpression(TypedViewType, request.Sort);
            var includedFieldNames = RepositoryHelper.ConvertStringToExcludedIncludedFields(request.Select);
            var predicateBucket    = RepositoryHelper.ConvertStringToRelationPredicateBucket(TypedViewType, request.Filter);

            var typedView = new SalesTotalsByAmountTypedView();

            using (var adapter = DataAccessAdapterFactory.NewDataAccessAdapter())
            {
                OnBeforeFetchSalesTotalsByAmountQueryCollectionRequest(adapter, request, sortExpression, includedFieldNames, predicateBucket,
                                                                       request.PageNumber, request.PageSize, request.Limit);
                totalItemCount = (int)adapter.GetDbCount(typedView.GetFieldsInfo(), predicateBucket, null, false);
                adapter.FetchTypedView(typedView.GetFieldsInfo(), typedView, predicateBucket, request.Limit, sortExpression, true, null, request.PageNumber, request.PageSize);
                OnAfterFetchSalesTotalsByAmountQueryCollectionRequest(adapter, request, typedView, sortExpression, includedFieldNames, predicateBucket,
                                                                      request.PageNumber, request.PageSize, request.Limit, totalItemCount);
            }

            var dtos       = new SalesTotalsByAmountCollection();
            var enumerator = typedView.GetEnumerator();

            while (enumerator.MoveNext())
            {
                dtos.Add(Map(enumerator.Current, includedFieldNames));
            }

            var response = new SalesTotalsByAmountCollectionResponse(dtos, request.PageNumber,
                                                                     request.PageSize, totalItemCount);

            return(response);
        }
        /// <summary>Queries 'SalesTotalsByAmount' typed view records using sorting, filtering, paging and more.</summary>
        public SalesTotalsByAmountCollectionResponse Get(SalesTotalsByAmountQueryCollectionRequest request)
        {
            OnBeforeGetSalesTotalsByAmountQueryCollectionRequest(request);
            var output = Repository.Fetch(request);

            OnAfterGetSalesTotalsByAmountQueryCollectionRequest(request, output);
            return(output);
        }
 partial void OnAfterGetSalesTotalsByAmountQueryCollectionRequest(SalesTotalsByAmountQueryCollectionRequest request, SalesTotalsByAmountCollectionResponse response);
 partial void OnBeforeGetSalesTotalsByAmountQueryCollectionRequest(SalesTotalsByAmountQueryCollectionRequest request);
示例#5
0
 partial void OnAfterFetchSalesTotalsByAmountQueryCollectionRequest(IDataAccessAdapter adapter, SalesTotalsByAmountQueryCollectionRequest request, SalesTotalsByAmountTypedView typedView, SortExpression sortExpression, string[] includedFieldNames, IRelationPredicateBucket predicateBucket, int pageNumber, int pageSize, int limit, int totalItemCount);