Exemplo n.º 1
0
        /// <summary>
        /// pList nesnesi icindeki filtre ifadesini olusturur. (volkansendag - 13.01.2016)
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="prms"></param>
        /// <returns></returns>
        private static Expression <Func <T, bool> > GetFilter <T>(pList prms)
        {
            if (prms == null || prms.filter == null || prms.filter.filters == null || prms.filter.filters.Count <= 0)
            {
                return(null);
            }

            List <Filter> filters = GetFilterList <T>(prms.filter.filters);

            return(GetFilter <T>(filters));
        }
Exemplo n.º 2
0
 public rList(IQueryable <T> query, pList prms)
 {
     if (prms.take > 0)
     {
         this.Values = query.Skip(prms.skip).Take(prms.take).ToList();
         this.Count  = query.Count();
     }
     else
     {
         this.Values = query.ToList();
         this.Count  = this.Values.Count;
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// pList nesnesi icindeki filtre ve orderby ifadesini olusturur. IQueryable nesneye uygular. (volkansendag - 13.01.2016)
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="query"></param>
        /// <param name="prms"></param>
        /// <returns></returns>
        public static IQueryable <T> GetFilter <T>(this IQueryable <T> query, pList prms)
        {
            var deleg = GetFilter <T>(prms);

            if (prms.sort != null && prms.sort.Count > 0 && !String.IsNullOrEmpty(prms.sort.First().field))
            {
                query = query.OrderBy(prms.sort.First().field, prms.sort.First().dir);
            }
            if (deleg != null)
            {
                return(query.Where(deleg));
            }
            return(query);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Linq ile hazırlanmis sorgunun filtrelerini uygular.
        /// Order By islemini uygular.
        /// Sayfalama yaparak rList olarak donus yapar.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="query"></param>
        /// <param name="prms"></param>
        /// <returns>rList<typeparamref name="T"/></returns>
        public static rList <T> toSingle <T>(this IQueryable <T> query, pList prms)
        {
            query = query.GetFilter <T>(prms);

            return(new rList <T>(query, prms));
        }