コード例 #1
0
        /// <summary>
        /// 查询墓碑
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public PagedResult <TombstoneDTO> Find(TombstoneQuery tombstoneQuery)
        {
            Check.Argument.IsNotNull(tombstoneQuery, "tombstoneQuery");

            //Apply filtering
            var query = _databaseContext.Tombstones.Where(tombstoneQuery);

            if (tombstoneQuery.filter.Area != null)
            {
                query = query.Join(_databaseContext.CemeteryAreas.Where(a => a.Alias == tombstoneQuery.filter.Area.Alias.Substring(0, 3))
                                   , tmb => tmb.AreaId, area => area.Id, (tmb, area) => tmb);
            }
            if (tombstoneQuery.filter.Row != null && tombstoneQuery.filter.Column.Alias.Length >= 5)
            {
                query = query.Join(_databaseContext.CemeteryRows.Where(a => a.Alias == tombstoneQuery.filter.Row.Alias.Substring(3, 2))
                                   , tmb => tmb.RowId, row => row.Id, (tmb, row) => tmb);
            }
            if (tombstoneQuery.filter.Column != null && tombstoneQuery.filter.Column.Alias.Length == 7)
            {
                query = query.Join(_databaseContext.CemeteryColumns.Where(a => a.Alias == tombstoneQuery.filter.Column.Alias.Substring(5, 2))
                                   , tmb => tmb.ColumnId, col => col.Id, (tmb, col) => tmb);
            }


            var total = query.Count();

            query = SortMemeberHelper.SortingAndPaging <Tombstone>(query, tombstoneQuery.sort, tombstoneQuery.dir
                                                                   , tombstoneQuery.page, tombstoneQuery.limit);


            var resultSet = query.AsNoTracking().ToList().Select(r => _tombstoneMapper.Map(r, true)).ToList();

            return(new PagedResult <TombstoneDTO>(resultSet, total));
        }
コード例 #2
0
        /// <summary>
        /// 查询墓碑区域
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public PagedResult <CemeteryAreasDTO> Find(CemeteryAreasQuery cemeteryAreasQuery)
        {
            Check.Argument.IsNotNull(cemeteryAreasQuery, "cemeteryAreasQuery");

            //Apply filtering
            var query = _databaseContext.CemeteryAreas.Where(cemeteryAreasQuery);
            var total = query.Count();

            query = SortMemeberHelper.SortingAndPaging <CemeteryAreas>(query, cemeteryAreasQuery.sort, cemeteryAreasQuery.dir
                                                                       , cemeteryAreasQuery.page, cemeteryAreasQuery.limit);


            var resultSet = query.AsNoTracking().ToList().Select(r => _cemeteryAreasMapper.Map(r)).ToList();

            return(new PagedResult <CemeteryAreasDTO>(resultSet, total));
        }
コード例 #3
0
        /// <summary>
        /// 查询角色
        /// </summary>
        /// <param name="roleQuery"></param>
        /// <returns></returns>
        public PagedResult <RoleDTO> Find(RoleQuery roleQuery)
        {
            Check.Argument.IsNotNull(roleQuery, "roleQuery");

            //Apply filtering
            var query = _databaseContext.Roles.Where(roleQuery);

            var total = query.Count();

            query = SortMemeberHelper.SortingAndPaging <Role>(query, roleQuery.sort, roleQuery.dir
                                                              , roleQuery.page, roleQuery.limit);


            var resultSet = query.AsNoTracking().ToList().Select(r => _roleMapper.Map(r)).ToList();

            return(new PagedResult <RoleDTO>(resultSet, total));
        }
コード例 #4
0
        /// <summary>
        /// 查询功能
        /// </summary>
        /// <param name="functionQuery"></param>
        /// <returns></returns>
        public PagedResult <FunctionDTO> Find(FunctionQuery functionQuery)
        {
            Check.Argument.IsNotNull(functionQuery, "functionQuery");

            //Apply filtering
            var query = _databaseContext.Functions.Where(functionQuery);

            var total = query.Count();

            query = SortMemeberHelper.SortingAndPaging <Function>(query, functionQuery.sort, functionQuery.dir
                                                                  , functionQuery.page, functionQuery.limit);


            var resultSet = query.AsNoTracking().ToList().Select(r => _functionMapper.Map(r)).ToList();

            return(new PagedResult <FunctionDTO>(resultSet, total));
        }
コード例 #5
0
        /// <summary>
        /// 查询日志
        /// </summary>
        /// <param name="sysLogQuery"></param>
        /// <returns></returns>
        public PagedResult<SysLogDTO> Find(SysLogQuery sysLogQuery)
        {
            Check.Argument.IsNotNull(sysLogQuery, "sysLogQuery");

            //Apply filtering    
            var query = _databaseContext.SysLogs.Where(sysLogQuery);
            if (sysLogQuery.filter.User != null)
            {
                query = query.Join(_databaseContext.Users.Where(a => a.Name.Contains(sysLogQuery.filter.User.Name))
                    , log => log.UserId, user => user.Id, (log, user) => log);
            }

            var total = query.Count();
            query = SortMemeberHelper.SortingAndPaging<SysLog>(query, sysLogQuery.sort, sysLogQuery.dir
                , sysLogQuery.page, sysLogQuery.limit);


            var resultSet = query.AsNoTracking().ToList().Select(r => _sysLogMapper.Map(r)).ToList();

            return new PagedResult<SysLogDTO>(resultSet, total);
        }
コード例 #6
0
ファイル: UserService.cs プロジェクト: shanda506365/MVC-EXTJS
        /// <summary>
        /// 查询用户
        /// </summary>
        /// <param name="userQuery"></param>
        /// <returns></returns>
        public PagedResult <UserDTO> Find(UserQuery userQuery)
        {
            Check.Argument.IsNotNull(userQuery, "userQuery");

            //Apply filtering
            var query = _databaseContext.Users.Where(userQuery);

            if (userQuery.filter.Department != null)
            {
                query = query.Join(_databaseContext.Departments.Where(a => a.Name == userQuery.filter.Department.Name)
                                   , user => user.DepartmentId, depart => depart.Id, (user, depart) => user);
            }

            var total = query.Count();

            query = SortMemeberHelper.SortingAndPaging <User>(query, userQuery.sort, userQuery.dir
                                                              , userQuery.page, userQuery.limit);


            var resultSet = query.AsNoTracking().ToList().Select(r => _userMapper.Map(r, true)).ToList();

            return(new PagedResult <UserDTO>(resultSet, total));
        }