コード例 #1
0
        public IActionResponse <List <Transaction> > Get(TransactionSearchFilter filterModel)
        {
            var response = new ActionResponse <List <Transaction> >();
            var q        = _transaction.AsNoTracking().AsQueryable();

            if (filterModel.OrderId != null)
            {
                q = q.Where(x => x.OrderId == filterModel.OrderId);
            }
            if (!string.IsNullOrWhiteSpace(filterModel.MobileNumber))
            {
                long mobNum = 0;
                if (long.TryParse(filterModel.MobileNumber, out mobNum))
                {
                    q = q.Where(x => x.Order.User.MobileNumber == mobNum);
                }
            }
            if (filterModel.PaymentGatewayId != null)
            {
                q = q.Where(x => x.PaymentGatewayId == filterModel.PaymentGatewayId);
            }
            if (filterModel.Status != null)
            {
                q = q.Where(x => x.Status == filterModel.Status);
            }
            if (!string.IsNullOrWhiteSpace(filterModel.TrackingId))
            {
                q = q.Where(x => x.TrackingId.Contains(filterModel.TrackingId));
            }
            if (!string.IsNullOrWhiteSpace(filterModel.FromDateSh))
            {
                q = q.Where(x => x.InsertDateSh.CompareTo(filterModel.FromDateSh) >= 0);
            }
            if (!string.IsNullOrWhiteSpace(filterModel.FromDateSh))
            {
                q = q.Where(x => x.InsertDateSh.CompareTo(filterModel.ToDateSh) <= 0);
            }
            response.Result = q.OrderByDescending(x => x.TransactionId)
                              .Take(filterModel.ItemsCount)
                              .ToList();
            return(response);
        }
コード例 #2
0
 public SearchTransaction(TransactionSearchFilter filter, PaginationFilter pageFilter, Guid userId)
 {
     this.Filter     = filter;
     this.UserId     = userId;
     this.PageFilter = pageFilter;
 }
コード例 #3
0
        public async Task <AggregateEnvelope> Report(TransactionSearchFilter filter, Guid userId)
        {
            var results = Compute(await queryBuilder.Query(userId, filter), filter.DateFilter);

            return(new AggregateEnvelope(filter.DateFilter, results));
        }