Declined
Last Updated: 29 Sep 2014 12:22 by ADMIN
Shurland
Created on: 22 Sep 2014 22:33
Category: Kendo UI for jQuery
Type: Feature Request
2
I want to get this appt. to
I need to create this ...

        ''' <summary>
        ''' Gets all categories
        ''' </summary>
        ''' <param name="categoryName">Category name</param>
        ''' <param name="pageIndex">Page index</param>
        ''' <param name="pageSize">Page size</param>
        ''' <param name="showHidden">A value indicating whether to show hidden records</param>
        ''' <returns>Categories</returns>
        Public Overridable Function GetCategories(Optional categoryName As String = "", Optional pageIndex As Integer = 0, Optional pageSize As Integer = Integer.MaxValue, Optional showHidden As Boolean = False) As IPagedList(Of Category) Implements ICategoryService.GetCategories
            Dim query = _categoryRepository.SelectOne
            If Not showHidden Then
                query = query.Where(Function(c) c.Published)
            End If
            If Not [String].IsNullOrWhiteSpace(categoryName) Then
                query = query.Where(Function(c) c.Name.Contains(categoryName))
            End If
            query = query.Where(Function(c) Not c.Deleted)
            query = query.OrderBy(Function(c) c.ParentCategoryId).ThenBy(Function(c) c.DisplayOrder)

            If Not showHidden Then
                'ACL (access control list)
                Dim allowedRolesIds = Ctx.CurrentUser.Roles.Where(Function(cr) cr.Active).[Select](Function(cr) cr.EntityId).ToList()
				query = From c In query Join acl In _aclRepository.SelectOne On _
				    New With { _
					 .c1 = c.EntityId, _
					 .c2 = "Category" _
				 Equals acl Select Var = acl
				} = New With { _
					 .c1 = acl.EntityId, _
					 .c2 = acl.EntityName _
				} Into c_acl From acl In c_acl.DefaultIfEmpty() Where Not c.SubjectToAcl OrElse allowedRolesIds.Contains(acl.RoleId) Select c

                'Store mapping
                Dim currentStoreId = _storeContext.CurrentStore.EntityId
				query = From c In query Join sm In _storeMappingRepository.SelectOne On _
				    New With { _
					 .c1 = c.EntityId, _
					 .c2 = "Category" _
				 Equals sm Select Var2 = sm
				} = New With { _
					 .c1 = sm.EntityId, _
					 .c2 = sm.EntityName _
				} Into c_sm From sm In c_sm.DefaultIfEmpty() Where Not c.LimitedToStores OrElse currentStoreId = sm.StoreId Select c

                'only distinct categories (group by ID)
				query = From cGroup In From c In query Group c By c.EntityId  Into cGroup.Key cGroup.FirstOrDefault()
                query = query.OrderBy(Function(c) c.ParentCategoryId).ThenBy(Function(c) c.DisplayOrder)
            End If

            Dim unsortedCategories = query.ToList()

            'sort categories
            Dim sortedCategories = unsortedCategories.SortCategoriesForTree()

            'paging
            Return New PagedList(Of Category)(sortedCategories, pageIndex, pageSize)
        End Function


How do I get in VB.net
1 comment
ADMIN
Telerik Admin
Posted on: 29 Sep 2014 12:22
For support queries related to our products, please use our forums or support system on telerik.com. Thank you for your understanding.