SortUsers() 공개 정적인 메소드

public static SortUsers ( List users, string sortExpression, SortDirection, sortDirection ) : IEnumerable
users List
sortExpression string
sortDirection SortDirection,
리턴 IEnumerable
예제 #1
0
        protected void UsersGridView_Sorting(object sender, GridViewSortEventArgs e)
        {
            SortDirection sortDirection = SortingUtility.GetSortDirection(ViewState);

            ViewState[CarServiceConstants.SORT_DIRECTION_VIEW_STATE_ATTR]  = sortDirection;
            ViewState[CarServiceConstants.SORT_EXPRESSION_VIEW_STATE_ATTR] = e.SortExpression;
            List <CarServiceUser>        users       = GetUsers();
            IEnumerable <CarServiceUser> sortedUsers = SortingUtility.SortUsers(users, e.SortExpression, sortDirection);

            BindUsersGrid(sortedUsers);
        }
예제 #2
0
        private void BindUsersGrid()
        {
            object sortDirectionObj            = ViewState[CarServiceConstants.SORT_DIRECTION_VIEW_STATE_ATTR];
            object sortExpressionObj           = ViewState[CarServiceConstants.SORT_EXPRESSION_VIEW_STATE_ATTR];
            List <CarServiceUser>        users = GetUsers();
            IEnumerable <CarServiceUser> sortedUsers;

            if (sortDirectionObj != null && sortExpressionObj != null)
            {
                sortedUsers = SortingUtility.SortUsers(users, sortExpressionObj.ToString(),
                                                       (SortDirection)sortDirectionObj);
            }
            else
            {
                ViewState[CarServiceConstants.SORT_DIRECTION_VIEW_STATE_ATTR]  = SortDirection.Ascending;
                ViewState[CarServiceConstants.SORT_EXPRESSION_VIEW_STATE_ATTR] = CarServiceConstants.USER_NAME_SORT_EXPRESSION;
                sortedUsers = SortingUtility.SortUsers(users, CarServiceConstants.USER_NAME_SORT_EXPRESSION,
                                                       SortDirection.Ascending);
            }
            BindUsersGrid(sortedUsers);
        }