Starts in:
0 DAY
17 HRS
24 MIN
17 SEC
Starts in:
0 D
17 H
24 M
17 S

Activities of "sunivycsm"

Hi, I've tried but still get error. In my azure ad, i setup to localhost:

But after call to microsft account successfull, it still gets the error:

My config in module is:

Plz help me.

My app has been in development for a while and is not a new creation. If it was a new creation, the conversion would be simple.

@liangshiwei Here is my source code. When I add AsNoTracking I get the following error: Should I add any additional libraries?

using CMCUNI_THUCTAP.NganhHocs; using Volo.Abp.Identity; using CMCUNI_THUCTAP.TrinhDos; using CMCUNI_THUCTAP.Khoas; using System; using System.IO; using System.Linq; using System.Collections.Generic; using System.Threading.Tasks; using System.Linq.Dynamic.Core; using Microsoft.AspNetCore.Authorization; using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; using Volo.Abp.Domain.Repositories; using CMCUNI_THUCTAP.Permissions; using CMCUNI_THUCTAP.GiangViens; using MiniExcelLibs; using Volo.Abp.Content; using Volo.Abp.Authorization; using Volo.Abp.Caching; using Microsoft.Extensions.Caching.Distributed; using CMCUNI_THUCTAP.Shared;

namespace CMCUNI_THUCTAP.GiangViens {

[Authorize(CMCUNI_THUCTAPPermissions.GiangViens.Default)]
public abstract class GiangViensAppServiceBase : CMCUNI_THUCTAPAppService
{
    protected IDistributedCache<GiangVienExcelDownloadTokenCacheItem, string> _excelDownloadTokenCache;
    protected IGiangVienRepository _giangVienRepository;
    protected GiangVienManager _giangVienManager;
    protected IRepository<Khoa, Guid> _khoaRepository;
    protected IRepository<TrinhDo, Guid> _trinhDoRepository;
    protected IRepository<IdentityUser, Guid> _identityUserRepository;
    protected IRepository<NganhHoc, Guid> _nganhHocRepository;

    public GiangViensAppServiceBase(IGiangVienRepository giangVienRepository, GiangVienManager giangVienManager, IDistributedCache<GiangVienExcelDownloadTokenCacheItem, string> excelDownloadTokenCache, IRepository<Khoa, Guid> khoaRepository, IRepository<TrinhDo, Guid> trinhDoRepository, IRepository<IdentityUser, Guid> identityUserRepository, IRepository<NganhHoc, Guid> nganhHocRepository)
    {
        _excelDownloadTokenCache = excelDownloadTokenCache;
        _giangVienRepository = giangVienRepository;
        _giangVienManager = giangVienManager; _khoaRepository = khoaRepository;
        _trinhDoRepository = trinhDoRepository;
        _identityUserRepository = identityUserRepository;
        _nganhHocRepository = nganhHocRepository;
    }

    public virtual async Task<PagedResultDto<GiangVienWithNavigationPropertiesDto>> GetListAsync(GetGiangViensInput input)
    {
        var totalCount = await _giangVienRepository.GetCountAsync(input.FilterText, input.MaGiangVien, input.TenGiangVien, input.KhoaId, input.TrinhDoId, input.IdentityUserId, input.NganhHocId);
        var items = await _giangVienRepository.GetListWithNavigationPropertiesAsync(input.FilterText, input.MaGiangVien, input.TenGiangVien, input.KhoaId, input.TrinhDoId, input.IdentityUserId, input.NganhHocId, input.Sorting, input.MaxResultCount, input.SkipCount);

        return new PagedResultDto<GiangVienWithNavigationPropertiesDto>
        {
            TotalCount = totalCount,
            Items = ObjectMapper.Map<List<GiangVienWithNavigationProperties>, List<GiangVienWithNavigationPropertiesDto>>(items)
        };
    }

    public virtual async Task<GiangVienWithNavigationPropertiesDto> GetWithNavigationPropertiesAsync(Guid id)
    {
        return ObjectMapper.Map<GiangVienWithNavigationProperties, GiangVienWithNavigationPropertiesDto>
            (await _giangVienRepository.GetWithNavigationPropertiesAsync(id));
    }

    public virtual async Task<GiangVienDto> GetAsync(Guid id)
    {
        return ObjectMapper.Map<GiangVien, GiangVienDto>(await _giangVienRepository.GetAsync(id));
    }

    public virtual async Task<PagedResultDto<LookupDto<Guid>>> GetKhoaLookupAsync(LookupRequestDto input)
    {
        var query = (await _khoaRepository.GetQueryableAsync())
            .WhereIf(!string.IsNullOrWhiteSpace(input.Filter),
                x => x.TenKhoa != null &&
                     x.TenKhoa.Contains(input.Filter));

        var lookupData = await query.PageBy(input.SkipCount, input.MaxResultCount).ToDynamicListAsync<Khoa>();
        var totalCount = query.Count();
        return new PagedResultDto<LookupDto<Guid>>
        {
            TotalCount = totalCount,
            Items = ObjectMapper.Map<List<Khoa>, List<LookupDto<Guid>>>(lookupData)
        };
    }

    public virtual async Task<PagedResultDto<LookupDto<Guid>>> GetTrinhDoLookupAsync(LookupRequestDto input)
    {
        var query = (await _trinhDoRepository.GetQueryableAsync())
            .WhereIf(!string.IsNullOrWhiteSpace(input.Filter),
                x => x.TenTrinhDo != null &&
                     x.TenTrinhDo.Contains(input.Filter));

        var lookupData = await query.PageBy(input.SkipCount, input.MaxResultCount).ToDynamicListAsync<TrinhDo>();
        var totalCount = query.Count();
        return new PagedResultDto<LookupDto<Guid>>
        {
            TotalCount = totalCount,
            Items = ObjectMapper.Map<List<TrinhDo>, List<LookupDto<Guid>>>(lookupData)
        };
    }

    public virtual async Task<PagedResultDto<LookupDto<Guid>>> GetIdentityUserLookupAsync(LookupRequestDto input)
    {
        var query = (await _identityUserRepository.GetQueryableAsync())
            .WhereIf(!string.IsNullOrWhiteSpace(input.Filter),
                x => x.Name != null &&
                     x.Name.Contains(input.Filter));

        var lookupData = await query.PageBy(input.SkipCount, input.MaxResultCount).ToDynamicListAsync<IdentityUser>();
        var totalCount = query.Count();
        return new PagedResultDto<LookupDto<Guid>>
        {
            TotalCount = totalCount,
            Items = ObjectMapper.Map<List<IdentityUser>, List<LookupDto<Guid>>>(lookupData)
        };
    }

    public virtual async Task<PagedResultDto<LookupDto<Guid>>> GetNganhHocLookupAsync(LookupRequestDto input)
    {
        var query = (await _nganhHocRepository.GetQueryableAsync())
            .WhereIf(!string.IsNullOrWhiteSpace(input.Filter),
                x => x.TenNganh != null &&
                     x.TenNganh.Contains(input.Filter));

        var lookupData = await query.PageBy(input.SkipCount, input.MaxResultCount).ToDynamicListAsync<NganhHoc>();
        var totalCount = query.Count();
        return new PagedResultDto<LookupDto<Guid>>
        {
            TotalCount = totalCount,
            Items = ObjectMapper.Map<List<NganhHoc>, List<LookupDto<Guid>>>(lookupData)
        };
    }

    [Authorize(CMCUNI_THUCTAPPermissions.GiangViens.Delete)]
    public virtual async Task DeleteAsync(Guid id)
    {
        await _giangVienRepository.DeleteAsync(id);
    }

    [Authorize(CMCUNI_THUCTAPPermissions.GiangViens.Create)]
    public virtual async Task<GiangVienDto> CreateAsync(GiangVienCreateDto input)
    {
        if (input.KhoaId == default)
        {
            throw new UserFriendlyException(L["The {0} field is required.", L["Khoa"]]);
        }
        if (input.TrinhDoId == default)
        {
            throw new UserFriendlyException(L["The {0} field is required.", L["TrinhDo"]]);
        }

        var giangVien = await _giangVienManager.CreateAsync(
        input.NganhHocIds, input.KhoaId, input.TrinhDoId, input.IdentityUserId, input.MaGiangVien, input.TenGiangVien
        );

        return ObjectMapper.Map<GiangVien, GiangVienDto>(giangVien);
    }

    [Authorize(CMCUNI_THUCTAPPermissions.GiangViens.Edit)]
    public virtual async Task<GiangVienDto> UpdateAsync(Guid id, GiangVienUpdateDto input)
    {
        if (input.KhoaId == default)
        {
            throw new UserFriendlyException(L["The {0} field is required.", L["Khoa"]]);
        }
        if (input.TrinhDoId == default)
        {
            throw new UserFriendlyException(L["The {0} field is required.", L["TrinhDo"]]);
        }

        var giangVien = await _giangVienManager.UpdateAsync(
        id,
        input.NganhHocIds, input.KhoaId, input.TrinhDoId, input.IdentityUserId, input.MaGiangVien, input.TenGiangVien, input.ConcurrencyStamp
        );

        return ObjectMapper.Map<GiangVien, GiangVienDto>(giangVien);
    }

    [AllowAnonymous]
    public virtual async Task<IRemoteStreamContent> GetListAsExcelFileAsync(GiangVienExcelDownloadDto input)
    {
        var downloadToken = await _excelDownloadTokenCache.GetAsync(input.DownloadToken);
        if (downloadToken == null || input.DownloadToken != downloadToken.Token)
        {
            throw new AbpAuthorizationException("Invalid download token: " + input.DownloadToken);
        }

        var giangViens = await _giangVienRepository.GetListWithNavigationPropertiesAsync(input.FilterText, input.MaGiangVien, input.TenGiangVien, input.KhoaId, input.TrinhDoId, input.IdentityUserId, input.NganhHocId);
        var items = giangViens.Select(item => new
        {
            MaGiangVien = item.GiangVien.MaGiangVien,
            TenGiangVien = item.GiangVien.TenGiangVien,

            Khoa = item.Khoa?.TenKhoa,
            TrinhDo = item.TrinhDo?.TenTrinhDo,
            IdentityUser = item.IdentityUser?.Name,

        });

        var memoryStream = new MemoryStream();
        await memoryStream.SaveAsAsync(items);
        memoryStream.Seek(0, SeekOrigin.Begin);

        return new RemoteStreamContent(memoryStream, "GiangViens.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
    }

    public virtual async Task<CMCUNI_THUCTAP.Shared.DownloadTokenResultDto> GetDownloadTokenAsync()
    {
        var token = Guid.NewGuid().ToString("N");

        await _excelDownloadTokenCache.SetAsync(
            token,
            new GiangVienExcelDownloadTokenCacheItem { Token = token },
            new DistributedCacheEntryOptions
            {
                AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(30)
            });

        return new CMCUNI_THUCTAP.Shared.DownloadTokenResultDto
        {
            Token = token
        };
    }
}

}

Sorry, this code doesn't work.

Hi, Thank you. I will give it a try.

Hello, What should I do next?

I found the cause. The reason is because my server lost some services. Thank you for your help.

Hi, I didn't find any such code in my source. ! image.png

Hi,

I guess you are using the Response compression.

Can you try to disable it to test again?

Where can I turn them off?

Showing 1 to 10 of 36 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06