private async Task <PagedResultDto <QuanLyTaiKhoanPageListDto> > GetTaiKhoanNoiBo(QuanLyTaiKhoanInputPageDto input, List <int> listRole_level) { var query = (from user in _userRepos.GetAll().Where(x => listRole_level.Contains(x.RoleLevel.Value)) join ur in _userRoleRepository.GetAll() on user.Id equals ur.UserId join role in _roleRepository.GetAll() on ur.RoleId equals role.Id join r_phongBan in _phongBanRepository.GetAll() on user.PhongBanId equals r_phongBan.Id into tb_phongBan from phongBan in tb_phongBan.DefaultIfEmpty() select new QuanLyTaiKhoanPageListDto { Id = user.Id, Name = user.Name, Surname = user.Surname, EmailAddress = user.EmailAddress, PhoneNumber = user.PhoneNumber, StrPhongBan = phongBan.TenPhongBan, UserName = user.UserName, IsActive = user.IsActive, LastLoginTime = user.LastLoginTime, Role_Level = user.RoleLevel } into tabTemp group tabTemp by tabTemp into tbGroup select tbGroup.Key) .WhereIf(!input.Filter.IsNullOrWhiteSpace(), u => u.Name.Contains(input.Filter) || u.Surname.Contains(input.Filter) || u.UserName.Contains(input.Filter) || u.StrPhongBan.Contains(input.Filter) || u.EmailAddress.Contains(input.Filter)); var count = await query.CountAsync(); var dataGrids = await query .OrderBy(o => o.Id) .PageBy(input) .ToListAsync(); return(new PagedResultDto <QuanLyTaiKhoanPageListDto>(count, dataGrids)); }
public async Task <PagedResultDto <QuanLyTaiKhoanPageListDto> > GetAllServerPaging(QuanLyTaiKhoanInputPageDto input) { var pageRes = new PagedResultDto <QuanLyTaiKhoanPageListDto>(); var listRoleLevelEnum = GetROLE_LEVELs(input.LoaiTaiKhoan); var listRoleLevelEnumInt = listRoleLevelEnum.Cast <int>().ToList(); switch (input.LoaiTaiKhoan) { case LOAI_TAI_KHOAN.TAI_KHOAN_CUC: pageRes = await GetTaiKhoanNoiBo(input, listRoleLevelEnumInt); break; case LOAI_TAI_KHOAN.TAI_KHOAN_CHUYEN_GIA: pageRes = await GetTaiKhoanChuyenGia(input, listRoleLevelEnumInt); break; case LOAI_TAI_KHOAN.TAI_KHOAN_SO_Y_TE: pageRes = await GetTaiKhoanSoYTe(input, listRoleLevelEnumInt); break; default: break; } return(pageRes); }