Esempio n. 1
0
        public ResultSetPage <EmailAccountViewModel> GetEntityListBySearchParams(
            GridLoadParam param)
        {
            var propertyInfo = typeof(EmailAccountViewModel).GetProperty(param.SortField);

            var resultSet = _context.EmailAccount
                            .IgnoreQueryFilters()
                            .WhereIf(!String.IsNullOrEmpty(param.SearchTerm), a => a.DisplayName.Contains(param.SearchTerm))
                            .ToListViewModel();

            return(param.ToResultSetPage(propertyInfo, resultSet));
        }
Esempio n. 2
0
        public ResultSetPage <MeasurementUnitViewModel> GetEntityListBySearchParams(
            GridLoadParam paramList)
        {
            var propertyInfo = typeof(MeasurementUnitViewModel).GetProperty(paramList.SortField);

            var resultSet = _context.MeasurementUnit
                            .IgnoreQueryFilters()
                            .WhereIf(!String.IsNullOrEmpty(paramList.SearchTerm), a => a.Name.Contains(paramList.SearchTerm))
                            .ToListViewModel();

            return(paramList.ToResultSetPage(propertyInfo, resultSet));
        }
Esempio n. 3
0
        public ResultSetPage <UserViewModel> GetEntityListBySearchParams(
            GridLoadParam paramList)
        {
            var propertyInfo = typeof(UserViewModel).GetProperty(paramList.SortField);

            var resultSet = this._context.ApplicationUser
                            .WhereIf(!String.IsNullOrEmpty(paramList.SearchTerm), a =>
                                     a.FullName.ToLower().Contains(paramList.SearchTerm) || a.Email.ToLower().Contains(paramList.SearchTerm) || a.UserName.ToLower().Contains(paramList.SearchTerm)
                                     )
                            .ToListViewModel();

            return(paramList.ToResultSetPage(propertyInfo, resultSet));
        }
Esempio n. 4
0
        public ResultSetPage <GlobalRegionViewModel> GetEntityListBySearchParams(
            GridLoadParam paramList)
        {
            var sortfield    = paramList.SortField ?? "Name";
            var propertyInfo = typeof(GlobalRegionViewModel).GetProperty(sortfield);

            var resultSet = _context.GlobalRegion
                            .IgnoreQueryFilters()
                            .WhereIf(!String.IsNullOrEmpty(paramList.SearchTerm), a => a.Name.Contains(paramList.SearchTerm))
                            .ToListViewModel();

            return(paramList.ToResultSetPage(propertyInfo, resultSet));
        }
Esempio n. 5
0
        public ResultSetPage <QueuedEmailViewModel> GetEntityListBySearchParams(
            GridLoadParam param)
        {
            var sortfield    = param.SortField ?? "From";
            var propertyInfo = typeof(QueuedEmailViewModel).GetProperty(sortfield);

            var resultSet = _context.QueuedEmail
                            .IgnoreQueryFilters()
                            .WhereIf(!String.IsNullOrEmpty(param.SearchTerm), a => a.Subject.Contains(param.SearchTerm))
                            .ToListViewModel();

            return(param.ToResultSetPage(propertyInfo, resultSet));
        }
Esempio n. 6
0
        public ResultSetPage <TimeTrialViewModel> GetEntityListBySearchParams(
            GridLoadParam paramList)
        {
            var propertyInfo = typeof(TimeTrialViewModel).GetProperty(paramList.SortField);


            var resultSet = _context.TimeTrial
                            .Include(a => a.Calendar.Event.EventType)
                            .IgnoreQueryFilters()
                            .WhereIf(!String.IsNullOrEmpty(paramList.SearchTerm), a => a.Calendar.Event.EventType.Name.Contains(paramList.SearchTerm))
                            .ToListViewModel();

            return(paramList.ToResultSetPage(propertyInfo, resultSet));
        }
Esempio n. 7
0
        public ResultSetPage <SubscriptionTypeViewModel> GetEntityListBySearchParams(
            GridLoadParam paramList)
        {
            var propertyInfo = typeof(SubscriptionTypeViewModel).GetProperty(paramList.SortField);

            var resultSet = _context.SubscriptionType
                            .Include(a => a.CreatedUser)
                            .Include(a => a.UpdatedUser)
                            .Include(a => a.SubscriptionTypeRules).ThenInclude(x => x.SubscriptionTypeRuleAudits).ThenInclude(b => b.QuoteDetails).ThenInclude(c => c.Quote)
                            .IgnoreQueryFilters()
                            .WhereIf(!string.IsNullOrEmpty(paramList.SearchTerm), a => a.Name.Contains(paramList.SearchTerm))
                            .ToListViewModel(paramList.SessionUserId);

            return(paramList.ToResultSetPage(propertyInfo, resultSet));
        }
Esempio n. 8
0
        public ResultSetPage <BannerImageViewModel> GetEntityListBySearchParams(
            GridLoadParam paramList)
        {
            var propertyInfo = typeof(BannerImageViewModel).GetProperty(paramList.SortField);

            var resultSet = _context.BannerImage
                            .Include(a => a.Document)
                            .Include(a => a.UpdatedUser)
                            .Include(a => a.CreatedUser)
                            .IgnoreQueryFilters()
                            .WhereIf(!String.IsNullOrEmpty(paramList.SearchTerm), a => a.Document.Name.Contains(paramList.SearchTerm))
                            .ToListViewModel();

            return(paramList.ToResultSetPage(propertyInfo, resultSet));
        }
        public ResultSetPage <RaceResultImportViewModel> GetEntityListBySearchParams(
            GridLoadParam paramList)
        {
            var propertyInfo = typeof(RaceResultImportViewModel).GetProperty(paramList.SortField);



            var resultSet = _context.RaceResultImport
                            .IgnoreQueryFilters()
                            .Where(a => a.PersonId.HasValue)
                            .WhereIf(!String.IsNullOrEmpty(paramList.SearchTerm), a => a.Person.FullName.Contains(paramList.SearchTerm))
                            .ToListViewModel();

            return(paramList.ToResultSetPage(propertyInfo, resultSet));
        }
Esempio n. 10
0
        public ResultSetPage <TrainingPlanViewModel> GetEntityListBySearchParams(
            GridLoadParam paramList)
        {
            var propertyInfo = typeof(TrainingPlanViewModel).GetProperty(paramList.SortField);

            var data = _context.TrainingPlan;

            var resultSet = _context.TrainingPlan
                            .IgnoreQueryFilters()
                            .WhereIf(!String.IsNullOrEmpty(paramList.SearchTerm), a => a.Name.Contains(paramList.SearchTerm) || a.Objective.Contains(paramList.SearchTerm) ||
                                     a.Event.Name.Contains(paramList.SearchTerm))
                            .ToListViewModel();

            return(paramList.ToResultSetPage(propertyInfo, resultSet));
        }
        public ResultSetPage <SubscriptionTypeAttributeViewModel> GetEntityListBySearchParams(
            GridLoadParam paramList)
        {
            var propertyInfo = typeof(SubscriptionTypeAttributeViewModel).GetProperty(paramList.SortField);

            var resultSet = _context.SubscriptionTypeAttribute
                            .Include(a => a.SubscriptionType)
                            .Include(a => a.CreatedUser)
                            .Include(a => a.UpdatedUser)
                            .IgnoreQueryFilters()
                            .WhereIf(!string.IsNullOrEmpty(paramList.SearchTerm), a => a.Name.Contains(paramList.SearchTerm))
                            .ToListViewModel();

            return(paramList.ToResultSetPage(propertyInfo, resultSet));
        }
Esempio n. 12
0
        public ResultSetPage <RaceResultViewModel> GetEntityListBySearchParams(
            GridLoadParam paramList)
        {
            var propertyInfo = typeof(RaceResultViewModel).GetProperty(paramList.SortField);

            var resultSet = _context.RaceResult
                            .Include(a => a.Member.Person)
                            .Include(a => a.RaceDistance.Race)
                            .IgnoreQueryFilters()
                            .Where(a => a.RaceDistance.RaceId == paramList.ParentId)
                            .WhereIf(!String.IsNullOrEmpty(paramList.SearchTerm), a => a.Member.Person.FullName.Contains(paramList.SearchTerm))
                            .ToListViewModel();

            return(paramList.ToResultSetPage(propertyInfo, resultSet));
        }
Esempio n. 13
0
        public ResultSetPage <CartViewModel> GetEntityListBySearchParams(
            GridLoadParam paramList)
        {
            var propertyInfo = typeof(CartViewModel).GetProperty(paramList.SortField);

            var resultSet = _context.Cart
                            .Include(a => a.ProductSize.Product.ProductCategory)
                            .Include(a => a.ProductSize.Size)
                            .Include(a => a.UpdatedUser)
                            .Include(a => a.CreatedUser)
                            .IgnoreQueryFilters()
                            .WhereIf(!String.IsNullOrEmpty(paramList.SearchTerm), a => a.ProductSize.Product.Name.Contains(paramList.SearchTerm))
                            .ToListViewModel();

            return(paramList.ToResultSetPage(propertyInfo, resultSet));
        }
Esempio n. 14
0
        public ResultSetPage <MemberViewModel> GetEntityListBySearchParams(
            GridLoadParam paramList)
        {
            var propertyInfo = typeof(MemberViewModel).GetProperty(paramList.SortField);

            var resultSet = _context.Member
                            .IgnoreQueryFilters()
                            .WhereIf(!String.IsNullOrEmpty(paramList.SearchTerm), a => a.MemberNo.Contains(paramList.SearchTerm.ToLower()) ||
                                     a.Person.FullName.ToLower().Contains(paramList.SearchTerm.ToLower()) ||
                                     a.Person.AgeGroup.Name.ToLower().Contains(paramList.SearchTerm.ToLower()) ||
                                     a.Person.Gender.Name.ToLower().Contains(paramList.SearchTerm.ToLower())
                                     )
                            .ToListViewModel();

            return(paramList.ToResultSetPage(propertyInfo, resultSet));
        }
Esempio n. 15
0
        /// <summary>
        /// Transform parameters into GridloadParams class
        /// </summary>
        ///<param name="userID">Current UserID</param>
        ///<param name="skip">Records to skip</param>
        ///<param name="take">Record to return</param>
        ///<param name="isDescending">Sort direction</param>
        ///<param name="sortField">Sort Field</param>
        ///<param name="searchFilter">Term to filter records</param>
        ///<returns>GridLoadParam</returns>
        public static GridLoadParam ToGridLoadParam(this string userID,
                                                    int skip,
                                                    int take,
                                                    bool isDescending,
                                                    string sortField,
                                                    string searchFilter)
        {
            var param = new GridLoadParam
            {
                SessionUserId = userID,
                Skip          = skip,
                Take          = take,
                IsDescending  = isDescending,
                SortField     = sortField,
            };

            return(param);
        }
Esempio n. 16
0
        public ResultSetPage <QuoteViewModel> GetEntityListBySearchParams(
            GridLoadParam paramList)
        {
            var propertyInfo = typeof(QuoteViewModel).GetProperty(paramList.SortField);

            var resultSet = _context.Quote
                            .Include(a => a.QuoteStatus)
                            .Include(a => a.QuoteDetails).ThenInclude(b => b.SubscriptionTypeRuleAudit)
                            .Include(a => a.FinYear)
                            .Include(a => a.QuoteUser)
                            .Include(a => a.QuoteDetails).ThenInclude(b => b.CreatedUser)
                            .Include(a => a.QuoteDetails).ThenInclude(a => a.UpdatedUser)
                            .IgnoreQueryFilters()
                            .WhereIf(!String.IsNullOrEmpty(paramList.SearchTerm), a => a.QuoteNo.Contains(paramList.SearchTerm) || a.QuoteStatus.Name.Contains(paramList.SearchTerm))
                            .ToListViewModel();

            return(paramList.ToResultSetPage(propertyInfo, resultSet));
        }
Esempio n. 17
0
        public ResultSetPage <AwardTrophyViewModel> GetEntityListBySearchParams(
            GridLoadParam paramList)
        {
            var propertyInfo = typeof(AwardTrophyViewModel).GetProperty(paramList.SortField);

            var resultSet = _context.AwardTrophy
                            .Include(a => a.FinYear)
                            .Include(a => a.Award)
                            .Include(a => a.Trophy)
                            .Include(c => c.Award.Gender)
                            .Include(a => a.CreatedUser)
                            .Include(a => a.UpdatedUser)
                            .IgnoreQueryFilters()
                            .WhereIf(!string.IsNullOrEmpty(paramList.SearchTerm), a => a.Award.Name.Contains(paramList.SearchTerm))
                            .ToListViewModel();

            return(paramList.ToResultSetPage(propertyInfo, resultSet));
        }
Esempio n. 18
0
        public ResultSetPage <TrophyViewModel> GetEntityListBySearchParams(
            GridLoadParam paramList)
        {
            try
            {
                var propertyInfo = typeof(TrophyViewModel).GetProperty(paramList.SortField);

                var trophy = _context.Trophy.ToList();

                var resultSet = _context.Trophy
                                .IgnoreQueryFilters()
                                .WhereIf(!String.IsNullOrEmpty(paramList.SearchTerm), a => a.Document.Name.Contains(paramList.SearchTerm))
                                .IgnoreQueryFilters()
                                .ToListViewModel();

                return(paramList.ToResultSetPage(propertyInfo, resultSet));
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        public static ResultSetPage <T> ToResultSetPage <T>(
            this GridLoadParam param,
            System.Reflection.PropertyInfo propertyInfo,
            IEnumerable <T> entityList)
        {
            try
            {
                var recordCount = param.Take == -1 ? entityList.Count() : param.Take;

                return(new ResultSetPage <T>(
                           param.Skip,
                           entityList.Count(),
                           entityList.ToList()
                           .OrderByWithDirection(x => propertyInfo.GetValue(x, null), param.IsDescending)
                           .Skip(param.Skip)
                           .Take(recordCount)
                           .ToList()));
            }
            catch (Exception ex)
            {
                throw;
            }
        }