Ejemplo n.º 1
0
        public async Task <PagedList <Domain.Advertisement> > GetPageByFilterSortSearch(GetPages.Request parameters, List <int> ids, CancellationToken cancellationToken)
        {
            var ads = _context.Advertisements.AsQueryable();

            var isCategorySet = parameters.CategoryId != 0;

            if (isCategorySet)
            {
                ads = ads.Where(a => ids.Contains(a.CategoryId));
            }


            ads = ads.Where(a =>
                            a.Price >= parameters.MinPrice &&
                            a.Price <= parameters.MaxPrice &&
                            a.CreatedDate.Date >= parameters.MinDate &&
                            a.CreatedDate.Date <= parameters.MaxDate &&
                            a.Status.Equals(Domain.Advertisement.Statuses.Created));


            SearchByTitleOrDescription(ref ads, parameters.SearchString);

            var sortAds = _sortHelper.ApplySort(ads, parameters.SortBy, parameters.SortDirection);

            return(await PagedList <Domain.Advertisement> .ToPagedListAsync(sortAds, parameters.Limit, parameters.Offset,
                                                                            cancellationToken));
        }
Ejemplo n.º 2
0
        public async Task <PagedList <ShapedEntity> > GetAllOwnersAsync(OwnerParameters ownerParameters)
        {
            var owners = FindByCondition(o => o.DateOfBirth.Year >= ownerParameters.MinYearOfBirth &&
                                         o.DateOfBirth.Year <= ownerParameters.MaxYearOfBirth);

            SearchByName(ref owners, ownerParameters.Name);

            _sortHelper.ApplySort(owners, ownerParameters.OrderBy);

            var shapedOwners = _dataShaper.ShapeData(owners, ownerParameters.Fields);

            return(await PagedList <ShapedEntity> .ToPagedListAsync(shapedOwners, ownerParameters.PageNumber, ownerParameters.PageSize));
        }
Ejemplo n.º 3
0
        public async Task <PagedList <Vehicle> > GetAllVehiclesWithInfoAsync(VehicleParameters vehicleParameters)
        {
            var vehicles = _context.Vehicles.AsQueryable();

            // If request URI has makeId query parameter which value is greater than 1 which mean it is valid MakeId,
            // filter the vehicles with MakeId.
            if (vehicleParameters.MakeId > 0)
            {
                vehicles = Find(v => v.Model.MakeId == vehicleParameters.MakeId).AsQueryable();
            }

            var columnsMap = new Dictionary <string, string>()
            {
                ["make"]        = "model.make.name",
                ["model"]       = "model.name",
                ["contactName"] = "contact.name",
                ["id"]          = "id"
            };
            var sortedVehicles = _sortHelper.ApplySort(vehicles, columnsMap, vehicleParameters.OrderBy);

            return(await PagedList <Vehicle> .ToPagedListAsync(sortedVehicles
                                                               .Include(v => v.Features)
                                                               .ThenInclude(vf => vf.Feature)
                                                               .Include(v => v.Model)
                                                               .ThenInclude(m => m.Make).AsQueryable()
                                                               , vehicleParameters.PageNumber, vehicleParameters.PageSize));
        }
Ejemplo n.º 4
0
        public void ApplySort_WhenCalled_ReturnsSortedList()
        {
            // Act
            var lastNameAsc  = _sortHelper.ApplySort(_contacts.AsQueryable(), "lastName asc");
            var lastNameDesc = _sortHelper.ApplySort(_contacts.AsQueryable(), "lastName desc");

            // Assert
            Assert.IsType <EnumerableQuery <Contact> >(lastNameAsc);
            Assert.IsType <EnumerableQuery <Contact> >(lastNameDesc);
            Assert.Equal(_contacts[1].LastName, lastNameAsc.ToList()[0].LastName);
            Assert.Equal(_contacts[0].LastName, lastNameAsc.ToList()[1].LastName);
            Assert.Equal(_contacts[2].LastName, lastNameAsc.ToList()[2].LastName);
            Assert.Equal(_contacts[2].LastName, lastNameDesc.ToList()[0].LastName);
            Assert.Equal(_contacts[0].LastName, lastNameDesc.ToList()[1].LastName);
            Assert.Equal(_contacts[1].LastName, lastNameDesc.ToList()[2].LastName);
        }
Ejemplo n.º 5
0
        public PagedList <Account> GetAccontsByOwner(Guid ownerId, AccountParameters parameters)
        {
            var accounts       = FindByCondition(a => a.OwnerId.Equals(ownerId));
            var sortedAccounts = _accountHelper.ApplySort(accounts, parameters.OrderBy);

            return(PagedList <Account> .ToPagedList(sortedAccounts, parameters.PageNumber, parameters.PageSize));
        }
Ejemplo n.º 6
0
        public PagedList <Contact> GetContacts(ContactParameters contactParameters)
        {
            // Build dynamically the lambda expression for filters
            var parameter = Expression.Parameter(typeof(Contact), "c");

            // Age filter
            var minAgeConstant   = Expression.Constant(contactParameters.MinAge);
            var maxAgeConstant   = Expression.Constant(contactParameters.MaxAge);
            var ageProperty      = Expression.Property(parameter, "Age");
            var minAgeExpression = Expression.GreaterThanOrEqual(ageProperty, minAgeConstant);
            var maxAgeExpression = Expression.LessThanOrEqual(ageProperty, maxAgeConstant);
            var expression       = Expression.And(minAgeExpression, maxAgeExpression);

            // Gender filter
            if (!String.IsNullOrEmpty(contactParameters.Gender))
            {
                var genderProperty   = Expression.Property(parameter, "Gender");
                var genderConstant   = Expression.Constant(contactParameters.Gender);
                var genderExpression = Expression.Equal(genderProperty, genderConstant);
                expression = Expression.And(expression, genderExpression);
            }

            // Find contacts
            var contacts = FindByCondition(Expression.Lambda <Func <Contact, bool> >(expression, parameter));

            // Sort contacts
            var sortedContacts = _sortHelper.ApplySort(contacts, contactParameters.SortBy);

            return(PagedList <Contact> .ToPagedList(
                       sortedContacts,
                       contactParameters.PageNumber,
                       contactParameters.PageSize));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Gets All the lead Assign.
        /// </summary>
        /// <param name="leadAssignParameter">The lead Assign parameters.</param>
        /// <returns></returns>
        public async Task <PagedList <Entity> > GetAllLeadAssign(LeadAssignParameter leadAssignParameter)
        {
            var leadAssign   = FindByCondition(x => x.Active == Convert.ToInt16(true)).ProjectTo <LeadAssignResponse>(mapper.ConfigurationProvider);
            var sortedAssign = sortHelper.ApplySort(leadAssign, leadAssignParameter.OrderBy);
            var shapedAssign = dataShaper.ShapeData(sortedAssign, leadAssignParameter.Fields);

            return(await PagedList <Entity> .ToPagedList(shapedAssign, leadAssignParameter.PageNumber, leadAssignParameter.PageSize));
        }
Ejemplo n.º 8
0
        public async Task <PagedList <Client> > GetAllPagesAsync(ClientParameters parameters)
        {
            IQueryable <Client> clients = FindByConditionAsync(x => x.Id > 0);

            SearchByLastName(ref clients, parameters.LastName);
            clients = sortHelper.ApplySort(clients, parameters);
            return(await PagedList <Client> .ToPagedListAsync(clients, parameters.PageNumber, parameters.PageSize));
        }
Ejemplo n.º 9
0
        public async Task <PagedList <Car> > GetAllPagesFilteredAsync(CarParameters parameters)
        {
            IQueryable <Car> cars = FindByConditionAsync(c => c.Price >= parameters.MinPrice && c.Price <= parameters.MaxPrice);

            SearchByBrand(ref cars, parameters.Brand);
            cars = sortHelper.ApplySort(cars, parameters);
            return(await PagedList <Car> .ToPagedListAsync(cars, parameters.PageNumber, parameters.PageSize));
        }
Ejemplo n.º 10
0
        public PagedList <ShapedEntity> GetProducts(ProductParameters productParameters)
        {
            var products = FindAll();

            var sortedProducts = _sortHelper.ApplySort(products, productParameters.OrderBy);
            var shapedProducts = _dataShaper.ShapeData(sortedProducts, productParameters.Fields);

            return(PagedList <ShapedEntity> .ToPagedList(shapedProducts, productParameters.PageNumber, productParameters.PageSize));
        }
Ejemplo n.º 11
0
        public async Task <PagedList <Company> > GetAllCompanyAsync(CompanyParameters companyParameters)
        {
            var companies = FindAll().OrderBy(att => att.BranchId);

            SearchByName(ref companies, companyParameters.Name);
            var sortedCompany = _sortHelper.ApplySort(companies, companyParameters.OrderBy);

            return(await PagedList <Company> .ToPageList(sortedCompany,
                                                         companyParameters.PageNumber, companyParameters.PageSize));
        }
Ejemplo n.º 12
0
        public async Task <PagedList <Tag> > GetTagsAsync(TagParameters tagsParameters)
        {
            var tags = FindAll();

            SearchByName(ref tags, tagsParameters.Name);

            var sortedTags = _sortHelper.ApplySort(tags, tagsParameters.OrderBy);

            return(await PagedList <Tag> .ToPagedList(sortedTags, tagsParameters.PageNumber, tagsParameters.PageSize));
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Gets the lead quotes.
        /// </summary>
        /// <param name="leadQuoteParameters">The lead quote parameters.</param>
        /// <returns></returns>
        public async Task <PagedList <Entity> > GetLeadStatus(LeadStatusParameter leadStatusParameter, int leadId = 0)
        {
            var leadStatusCollections = FindByCondition(x => x.Active == Convert.ToInt16(true) && x.LeadId.Equals(leadId)).ProjectTo <LeadStatusResponse>(mapper.ConfigurationProvider);
            var sortedStories         = sortHelper.ApplySort(leadStatusCollections, leadStatusParameter.OrderBy);

            FilterByDate(ref sortedStories, leadStatusParameter.FromDate, leadStatusParameter.ToDate);
            var shapedStories = dataShaper.ShapeData(sortedStories, leadStatusParameter.Fields);

            return(await PagedList <Entity> .ToPagedList(shapedStories, leadStatusParameter.PageNumber, leadStatusParameter.PageSize));
        }
        /// <summary>
        /// Gets the lead quotes.
        /// </summary>
        /// <param name="leadQuoteParameters">The lead quote parameters.</param>
        /// <returns></returns>
        public async Task <PagedList <Entity> > GetLeadQuotes(LeadQuoteParameters leadQuoteParameters, int leadId = 0)
        {
            if (leadId > 0)
            {
                var leadCollections = FindByCondition(x => x.Active == Convert.ToInt16(true) && x.LeadId.Equals(leadId)).ProjectTo <LeadQuoteResponse>(mapper.ConfigurationProvider);
                var sortedStories   = sortHelper.ApplySort(leadCollections, leadQuoteParameters.OrderBy);
                var shapedStories   = dataShaper.ShapeData(sortedStories, leadQuoteParameters.Fields);

                return(await PagedList <Entity> .ToPagedList(shapedStories, leadQuoteParameters.PageNumber, leadQuoteParameters.PageSize));
            }
            else
            {
                var leadCollections = FindByCondition(x => x.Active == Convert.ToInt16(true)).ProjectTo <LeadQuoteResponse>(mapper.ConfigurationProvider);
                var sortedStories   = sortHelper.ApplySort(leadCollections, leadQuoteParameters.OrderBy);
                var shapedStories   = dataShaper.ShapeData(sortedStories, leadQuoteParameters.Fields);

                return(await PagedList <Entity> .ToPagedList(shapedStories, leadQuoteParameters.PageNumber, leadQuoteParameters.PageSize));
            }
        }
Ejemplo n.º 15
0
        public PaginatedList <AppUser> GetAppUsers(AppUserParameters appUserParams)
        {
            var users = FindByCondition(o => o.Id == appUserParams.Id.ToString());

            SearchByName(ref users, appUserParams.UserName);

            var sortedUsers = _sortHelper.ApplySort(users, appUserParams.OrderBy);

            return(PaginatedList <AppUser> .ToPagedList(sortedUsers, appUserParams.PageNumber, appUserParams.PageSize));
        }
Ejemplo n.º 16
0
        public async Task <PagedList <Product> > GetProductsAsync(ProductParameters productParameters)
        {
            var products = FindAll();

            SearchByName(ref products, productParameters.Name);

            var sorderProducts = _productSortHelper.ApplySort(products, productParameters.OrderBy);

            return(await PagedList <Product> .ToPagedList(sorderProducts, productParameters.PageNumber, productParameters.PageSize));
        }
Ejemplo n.º 17
0
        public async Task <PagedList <GroupOfDetail> > GetPagedGroupOfDetails(GroupOfDetailParameters parameters)
        {
            var groupOfDetails = FindByCondition(o => o.PriceOfGroupOfDetail >= parameters.MinPrice && o.PriceOfGroupOfDetail <= parameters.MaxPrice); // filtering

            SearchByName(ref groupOfDetails, parameters.State);                                                                                        // searching

            groupOfDetails = _sortHelper.ApplySort(groupOfDetails, parameters);                                                                        // sorting

            return(await PagedList <GroupOfDetail> .ToPagedList(groupOfDetails, parameters.PageNumber, parameters.PageSize));                          // paging
        }
        public async Task <PagedList <Employee> > GetAllEmployeeAsync(EmployeeParameters employeeParameters)
        {
            var employees = FindAll().OrderBy(att => att.BranchId);

            SearchByName(ref employees, employeeParameters.Name);

            var sortedEmployees = _sortHelper.ApplySort(employees, employeeParameters.OrderBy);

            return(await PagedList <Employee> .ToPageList(sortedEmployees,
                                                          employeeParameters.PageNumber, employeeParameters.PageSize));
        }
Ejemplo n.º 19
0
        public async Task <IEnumerable <Report> > ReportsByOwnerAsync(Guid ownerId, ReportParameters reportParameters)
        {
            var reportList = await this.FindByCondition(r => r.OwnerId.Equals(ownerId))
                             .ToListAsync();

            var reports = reportList.AsQueryable();

            var sortedReports = _sortHelper.ApplySort(reports, reportParameters.OrderBy);

            return(sortedReports);
        }
Ejemplo n.º 20
0
        public PagedList <ShapedEntity> GetAccountsByOwner(Guid ownerId, AccountParameters parameters)
        {
            var accounts = FindByCondition(a => a.OwnerId.Equals(ownerId));

            var sortedAccounts = _sortHelper.ApplySort(accounts, parameters.OrderBy);

            var shapedAccounts = _dataShaper.ShapeData(sortedAccounts, parameters.Fields);

            return(PagedList <ShapedEntity> .ToPagedList(shapedAccounts,
                                                         parameters.PageNumber,
                                                         parameters.PageSize));
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Gets all leads.
        /// </summary>
        /// <param name="leadParameters">The lead parameters.</param>
        /// <returns></returns>
        public async Task <PagedList <Entity> > GetAllLeads(LeadParameters leadParameters)
        {
            var leadCollections = FindByCondition(x => x.Active == Convert.ToInt16(true) && x.Leads.All(x => x.Active == Convert.ToInt16(true)))
                                  .ProjectTo <LeadDataCollectionResponse>(mapper.ConfigurationProvider);

            SearchByPhoneNoOrLeadId(ref leadCollections, leadParameters);
            FilterByDate(ref leadCollections, leadParameters.FromDate, leadParameters.ToDate);
            var sortedStories = sortHelper.ApplySort(leadCollections, leadParameters.OrderBy);
            var shapedStories = dataShaper.ShapeData(sortedStories, leadParameters.Fields);

            return(await PagedList <Entity> .ToPagedList(shapedStories, leadParameters.PageNumber, leadParameters.PageSize));
        }
Ejemplo n.º 22
0
        public PagedList <ShapedEntity> GetCategories(CategoryParameters categoryParameters)
        {
            var categorys = FindAll();

            SearchByName(ref categorys, categoryParameters.Name);
            var sortedOwners = _sortHelper.ApplySort(categorys, categoryParameters.OrderBy);
            var shapedOwners = _dataShaper.ShapeData(sortedOwners, categoryParameters.Fields);

            return(PagedList <ShapedEntity> .ToPagedList(shapedOwners,
                                                         categoryParameters.PageNumber,
                                                         categoryParameters.PageSize));
        }
        /// <summary>
        /// Gets all ServiceSubscriptions
        /// </summary>
        /// <param name="serviceSubscriptionsParameter">The ServiceSubscriptions parameters.</param>
        /// <returns></returns>
        //public async Task<PagedList<Entity>> GetAllServiceSubscriptions(ServiceSubscriptionsParameter serviceSubscriptionsParameter)
        //{
        //    {
        //        var getvendorSubscriptionsParams = new object[] {
        //        new MySqlParameter("@p_Limit", serviceSubscriptionsParameter.PageSize),
        //        new MySqlParameter("@p_Offset", (serviceSubscriptionsParameter.PageNumber - 1) * serviceSubscriptionsParameter.PageSize),
        //        new MySqlParameter("@p_IsForSingleServiceSubscription", serviceSubscriptionsParameter.IsForSingleServiceSubscription),
        //        new MySqlParameter("@p_IsForService", serviceSubscriptionsParameter.IsForService),
        //        new MySqlParameter("@p_IsForSubscription", serviceSubscriptionsParameter.IsForSubscription),
        //        new MySqlParameter("@p_ApprovalStatus", serviceSubscriptionsParameter.ApprovalStatus),
        //        new MySqlParameter("@p_PaymentStatus", serviceSubscriptionsParameter.PaymentStatus),
        //        new MySqlParameter("@p_Value", serviceSubscriptionsParameter.Value),
        //        new MySqlParameter("@p_FromDate", serviceSubscriptionsParameter.FromDate),
        //        new MySqlParameter("@p_ToDate", serviceSubscriptionsParameter.ToDate)
        //    };
        //        var servicesubscriptions = await FindAll("CALL SpSelectActiveServiceSubscription(@p_Limit, @p_Offset, @p_IsForSingleServiceSubscription,@p_IsForService,@p_IsForSubscription,@p_Value,@p_ApprovalStatus,@p_PaymentStatus, @p_FromDate, @p_ToDate)", getvendorSubscriptionsParams).ToListAsync();
        //        var mappedVendorSubscriptions = servicesubscriptions.AsQueryable().ProjectTo<ServiceSubscriptionsResponse>(mapper.ConfigurationProvider);
        //        var sortedVendorSubscriptions = sortHelper.ApplySort(mappedVendorSubscriptions, serviceSubscriptionsParameter.OrderBy);
        //        var shapedVendorSubscriptions = dataShaper.ShapeData(sortedVendorSubscriptions, serviceSubscriptionsParameter.Fields);

        //        return await PagedList<Entity>.ToPagedList(shapedVendorSubscriptions, serviceSubscriptionsParameter.PageNumber, serviceSubscriptionsParameter.PageSize);

        //    }
        //}

        public async Task <PagedList <Entity> > GetAllServiceSubscriptions(ServiceSubscriptionsParameter serviceSubscriptionsParameter)
        {
            var serviceSubscriptions = FindByCondition(x => x.Active == Convert.ToInt16(true)).ProjectTo <ServiceSubscriptionsResponse>(mapper.ConfigurationProvider);

            SearchByServiceSuubscriptions(ref serviceSubscriptions, serviceSubscriptionsParameter);
            var sortedServiceSubscriptions = sortHelper.ApplySort(serviceSubscriptions, serviceSubscriptionsParameter.OrderBy);

            FilterByDate(ref serviceSubscriptions, serviceSubscriptionsParameter.FromDate, serviceSubscriptionsParameter.ToDate);
            var shapedServiceSubscriptions = dataShaper.ShapeData(sortedServiceSubscriptions, serviceSubscriptionsParameter.Fields);

            return(await PagedList <Entity> .ToPagedList(shapedServiceSubscriptions, serviceSubscriptionsParameter.PageNumber, serviceSubscriptionsParameter.PageSize));
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Gets all CommentReplies.
        /// </summary>
        /// <param name="BenefitsParameter">The Comment Reply parameters.</param>
        /// <returns></returns>
        public async Task <PagedList <Entity> > GetAllCommentReplies(CommentReplyParameter commentReplyParameter)
        {
            {
                {
                    var getCommentReplyParams = new object[] {
                        new MySqlParameter("@p_Value", commentReplyParameter.value),
                        new MySqlParameter("@p_AprovalStatus", commentReplyParameter.ApprovalStatus),
                        new MySqlParameter("@p_IsForSingleCommentreply", commentReplyParameter.IsForSingleCommentreply),
                        new MySqlParameter("@p_IsForComment", commentReplyParameter.IsForComment),
                        new MySqlParameter("@p_IsForReply", commentReplyParameter.IsForReply),
                        new MySqlParameter("@p_IsForCildReply", commentReplyParameter.IsForChildReply)
                    };
                    var CommentReply = await FindAll("CALL SpSelectActiveCommentReply(@p_Value,@p_AprovalStatus,@p_IsForSingleCommentreply, @p_IsForComment, @p_IsForReply,@p_IsForCildReply)", getCommentReplyParams).ToListAsync();

                    var mappedCommentReply = CommentReply.AsQueryable().ProjectTo <CommentReplyResponse>(mapper.ConfigurationProvider);
                    var sortedCommentReply = sortHelper.ApplySort(mappedCommentReply, commentReplyParameter.OrderBy);
                    var shapedCommentReply = dataShaper.ShapeData(sortedCommentReply, commentReplyParameter.Fields);
                    return(await PagedList <Entity> .ToPagedList(shapedCommentReply, commentReplyParameter.PageNumber, commentReplyParameter.PageSize));
                }
            }
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Gets events by filter by name, lovation and date.
        /// </summary>
        /// <param name="eventParameters">The event parameters.</param>
        /// <returns></returns>
        public async Task <PagedList <Entity> > GetEventsByCondition(EventParameters eventParameters)
        {
            var getEventsParams = new object[] {
                new MySqlParameter("@limit", eventParameters.PageSize),
                new MySqlParameter("@offset", (eventParameters.PageNumber - 1) * eventParameters.PageSize),
                new MySqlParameter("@fromDate", eventParameters.FromDate),
                new MySqlParameter("@toDate", eventParameters.ToDate),
                new MySqlParameter("@eventName", eventParameters.EventName),
                new MySqlParameter("@eventLocation", eventParameters.Location),
                new MySqlParameter("@ReviewType", eventParameters.ReviewType),
                new MySqlParameter("@ApprovalStatusId", eventParameters.ApprovalStatus)
            };

            var events = await FindAll("CALL SpSearchActiveEvents(@limit, @offset, @ReviewType, @ApprovalStatusId, @eventName, @eventLocation, @fromDate, @toDate)", getEventsParams).ToListAsync();

            var mappedevents = events.AsQueryable().ProjectTo <EventResponse>(mapper.ConfigurationProvider);
            var sortedevents = sortHelper.ApplySort(mappedevents, eventParameters.OrderBy);
            var shapedevents = dataShaper.ShapeData(sortedevents, eventParameters.Fields);

            return(await PagedList <Entity> .ToPagedList(shapedevents, eventParameters.PageNumber, eventParameters.PageSize));
        }
Ejemplo n.º 26
0
        public IEnumerable <TaskModel> GetOrderedTasks(QueryStringParameters taskParameters)
        {
            IEnumerable <TaskModel> taskModels = null;

            if (taskParameters != null)
            {
                var temp = _context.Tasks.Where(x => x.IsCompleted == false);
                temp       = _helper.ApplySort(temp, taskParameters);
                taskModels = _mapper.Map <IEnumerable <TaskModel> >(temp);
            }
            return(taskModels);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Gets all PaymentBook.
        /// </summary>
        /// <param name="paymentBookSearchParameter">The PaymentBook Search parameters.</param>
        /// <returns></returns>
        //public async Task<List<Paymentbook>> GetAllPaymentBook(PaymentBookSearchParameter paymentBookSearchParameter)
        //{
        //    {
        //        var getPaymentBookSearchParams = new object[]
        //        {
        //            new MySqlParameter("@p_Limit", paymentBookSearchParameter.PageSize),
        //            new MySqlParameter("@p_Offset", (paymentBookSearchParameter.PageNumber - 1) * paymentBookSearchParameter.PageSize),
        //            new MySqlParameter("@p_VendorId", paymentBookSearchParameter.VendorId),
        //            new MySqlParameter("@p_PackageType", paymentBookSearchParameter.PackageType),
        //            new MySqlParameter("@p_PaymentType", paymentBookSearchParameter.PaymentType),
        //            new MySqlParameter("@p_PaymentStatus", paymentBookSearchParameter.PaymentStatus),
        //            new MySqlParameter("@p_PaymentMode", paymentBookSearchParameter.PaymentMode),
        //            new MySqlParameter("@p_VendorStatus", paymentBookSearchParameter.VendorStatus),
        //            new MySqlParameter("@p_FinanceApprovalStatus", paymentBookSearchParameter.FinanceApprovalStatus),
        //            new MySqlParameter("@p_BHStatus", paymentBookSearchParameter.BHStatus),
        //            new MySqlParameter("@p_FromDate", paymentBookSearchParameter.FromDate),
        //            new MySqlParameter("@p_ToDate", paymentBookSearchParameter.ToDate)
        //        };

        //        var paymentBook = await FindAll("CALL SpSearchPaymentBook(@p_Limit,@p_Offset,@p_VendorId,@p_PackageType,@p_PaymentType,@p_PaymentStatus,@p_PaymentMode,@p_VendorStatus,@p_FinanceApprovalStatus,@p_BHStatus,@p_FromDate,@p_ToDate)", getPaymentBookSearchParams).ToListAsync();

        //        return paymentBook;
        //    }
        //}

        public async Task <List <PaymentBookResponse> > GetAllPaymentBook(PaymentBookSearchParameter paymentBookSearchParameter)
        {
            var paymentbook = FindByCondition(x => x.Id > 0).ProjectTo <PaymentBookResponse>(mapper.ConfigurationProvider);

            SearchByWallet(ref paymentbook, paymentBookSearchParameter);
            FilterByDate(ref paymentbook, paymentBookSearchParameter.FromDate, paymentBookSearchParameter.ToDate);
            var sortedWallets = sortHelper.ApplySort(paymentbook, paymentBookSearchParameter.OrderBy);
            var pagedWallets  = sortedWallets
                                .Skip((paymentBookSearchParameter.PageNumber - 1) * paymentBookSearchParameter.PageSize)
                                .Take(paymentBookSearchParameter.PageSize);

            return(await pagedWallets.ToListAsync());
        }
Ejemplo n.º 28
0
        // public async Task<IEnumerable<Favorite>> FindFavorites(string userId, int offset, int limit, CancellationToken cancellationToken)
        // {
        //     return await _context.Favorites
        //         .Where(a => a.UserId == userId)
        //         .Include(a => a.Advertisement)
        //         .Skip(offset)
        //         .Take(limit)
        //         .ToListAsync(cancellationToken);
        // }

        public async Task<PagedList<Favorite>> FindFavorites(string userId, int offset, int limit, string sortBy, string sortDirection,
            CancellationToken cancellationToken)
        {
            
            var ads = _context.Favorites.AsQueryable();
            
            ads = ads.Where(a => a.UserId == userId);
            
            var sortAds = _sortHelper.ApplySort(ads, sortBy, sortDirection);
            
            return await PagedList<Favorite>.ToPagedListAsync(sortAds, limit, offset,
                cancellationToken);
        }
Ejemplo n.º 29
0
        public async Task <List <WalletResponse> > GetAllWallet(WalletsParameter walletsParameter)
        {
            var wallets = FindByCondition(x => x.Active == Convert.ToInt16(true)).ProjectTo <WalletResponse>(mapper.ConfigurationProvider);

            SearchByWallet(ref wallets, walletsParameter);
            FilterByDate(ref wallets, walletsParameter.FromDate, walletsParameter.ToDate);
            var sortedWallets = sortHelper.ApplySort(wallets, walletsParameter.OrderBy);
            var pagedWallets  = sortedWallets
                                .Skip((walletsParameter.PageNumber - 1) * walletsParameter.PageSize)
                                .Take(walletsParameter.PageSize);

            return(await pagedWallets.ToListAsync());
        }
Ejemplo n.º 30
0
        public PagedList <ExpandoObject> GetOwners(OwnerParameters ownerParameters)
        {
            var owners = FindByCondition(o => o.DateOfBirth.Year >= ownerParameters.MinYearOfBirth &&
                                         o.DateOfBirth.Year <= ownerParameters.MaxYearOfBirth);

            SearchByName(ref owners, ownerParameters.Name);

            var sortedOwners = _sortHelper.ApplySort(owners, ownerParameters.OrderBy);
            var shapedOwners = _dataShaper.ShapeData(sortedOwners, ownerParameters.Fields);

            return(PagedList <ExpandoObject> .ToPagedList(shapedOwners,
                                                          ownerParameters.PageNumber,
                                                          ownerParameters.PageSize));
        }