Esempio n. 1
0
        protected override IQueryable <TAggregateRoot> DoGetAll(SortGroup sortGroup             = null,
                                                                FilterCondition filterCondition = null,
                                                                Expression <Func <TAggregateRoot, dynamic> >[] eagerLoadingProperties = null)
        {
            IQueryable <TAggregateRoot> query = EFContext.Context.Set <TAggregateRoot>();

            if (eagerLoadingProperties != null)
            {
                for (var i = 1; i < eagerLoadingProperties.Length; i++)
                {
                    var eagerLoadingProperty = eagerLoadingProperties[i];
                    var eagerLoadingPath     = GetEagerLoadingPath(eagerLoadingProperty);
                    query = query.Include(eagerLoadingPath);
                }
            }
            if (filterCondition != null)
            {
                query = query.Filter(filterCondition);
            }
            if (sortGroup != null)
            {
                query = query.Sort(sortGroup);
            }
            return(query);
        }
        void AddSortEntry(TrueShadow shadow)
        {
            var entry    = new SortEntry(shadow);
            var group    = new SortGroup(entry);
            var oldIndex = sortGroups.IndexOf(group);

            if (oldIndex > -1)
            {
                sortGroups[oldIndex].Add(entry);
            }
            else
            {
                sortGroups.Add(group);
            }
        }
Esempio n. 3
0
        public static IQueryable Sort(this IQueryable source, SortGroup sortGroup)
        {
            var parameters = new[] { Expression.Parameter(source.ElementType, "e") };
            var orderings  = sortGroup.ToDynamicOrderings(source.ElementType, parameters);
            var queryExpr  = source.Expression;
            var methodAsc  = "OrderBy";
            var methodDesc = "OrderByDescending";

            foreach (var ordering in orderings)
            {
                queryExpr = Expression.Call(typeof(Queryable),
                                            ordering.SortOrder == SortOrder.Ascending ? methodAsc : methodDesc,
                                            new[] { source.ElementType, ordering.Selector.Type },
                                            queryExpr, Expression.Quote(Expression.Lambda(ordering.Selector, parameters)));
                methodAsc  = "ThenBy";
                methodDesc = "ThenByDescending";
            }
            return(source.Provider.CreateQuery(queryExpr));
        }
Esempio n. 4
0
        public async Task <IEnumerable <CategoryDto> > GetCategories(SortGroup sortGroup, FilterCondition filters)
        {
            var entities = _categoryRepository.GetAll(sortGroup, filters);

            return(entities.To <List <CategoryDto> >());
        }
Esempio n. 5
0
 public static IQueryable <T> Sort <T>(this IQueryable <T> source, SortGroup sortGroup)
 {
     return((IQueryable <T>)Sort((IQueryable)source, sortGroup));
 }
Esempio n. 6
0
 void EditLabel(int check)
 {
     if (check == 0)
     {
         label1.Hide();
         label2.Hide();
         label3.Hide();
         label4.Hide();
         label5.Hide();
         textBox2.Hide();
         textBox3.Hide();
         textBox4.Hide();
         textBox5.Hide();
         textBox6.Hide();
         button6.Hide();
         DeleteBtn.Hide();
         SearchBtn.Hide();
         SortName.Hide();
         SortGroup.Hide();
         SortPoint.Hide();
     }
     if (check == 1)
     {
         label1.Show();
         label2.Show();
         label3.Show();
         label4.Show();
         label5.Show();
         textBox2.Show();
         textBox3.Show();
         textBox4.Show();
         textBox5.Show();
         textBox6.Show();
         button6.Show();
         DeleteBtn.Hide();
         SortName.Hide();
         SortGroup.Hide();
         SortPoint.Hide();
     }
     if (check == 2)
     {
         DeleteBtn.Show();
         label1.Show();
         label2.Hide();
         label3.Hide();
         label4.Hide();
         label5.Hide();
         textBox2.Show();
         textBox3.Hide();
         textBox4.Hide();
         textBox5.Hide();
         textBox6.Hide();
         button6.Hide();
         SearchBtn.Hide();
         SortName.Hide();
         SortGroup.Hide();
         SortPoint.Hide();
     }
     if (check == 3)
     {
         SearchBtn.Show();
         label1.Show();
         label2.Hide();
         label3.Hide();
         label4.Hide();
         label5.Hide();
         textBox2.Show();
         textBox3.Hide();
         textBox4.Hide();
         textBox5.Hide();
         textBox6.Hide();
         button6.Hide();
         DeleteBtn.Hide();
         SortName.Hide();
         SortGroup.Hide();
         SortPoint.Hide();
     }
     if (check == 4)
     {
         SearchBtn.Hide();
         label1.Hide();
         label2.Hide();
         label3.Hide();
         label4.Hide();
         label5.Hide();
         textBox2.Hide();
         textBox3.Hide();
         textBox4.Hide();
         textBox5.Hide();
         textBox6.Hide();
         button6.Hide();
         DeleteBtn.Hide();
         SortName.Show();
         SortGroup.Show();
         SortPoint.Show();
     }
 }
Esempio n. 7
0
 public IQueryable <TAggregateRoot> GetAll(SortGroup sortGroup = null, FilterCondition filterCondition = null, Expression <Func <TAggregateRoot, dynamic> >[] eagerLoadingProperties = null)
 {
     return(DoGetAll(sortGroup, filterCondition, eagerLoadingProperties));
 }
Esempio n. 8
0
 protected abstract IQueryable <TAggregateRoot> DoGetAll(SortGroup sortGroup = null, FilterCondition filterCondition = null, Expression <Func <TAggregateRoot, dynamic> >[] eagerLoadingProperties = null);