Activities of "Anjali_Musmade"

Hello chris.b@mindmill.co.uk,

Could you please add below code and try to resolve it. After adding this code it works at my end.

  1. index.cshtml.cs
 public async Task OnGetAsync()
    {
        CustomTestCategoryLookupList.AddRange((
                await _customTestsAppService.GetCustomTestCategoryLookupAsync(new LookupRequestDto
                {
                    MaxResultCount = LimitedResultRequestDto.MaxMaxResultCount
                })).Select(t => new SelectListItem(t.Name, t.Info)).ToList()
        );

        await Task.CompletedTask;
    }
  1. CustomTestsAppService
public async Task<List<CustomTestCategoryDto>> GetCustomTestCategoryLookupAsync(LookupRequestDto input)
        {
            var query = _dbContext.Set<CustomTestCategory>().AsQueryable();

            var categories = await query
                .Take(input.MaxResultCount)
                .ToListAsync();

            return categories.Select(c => new CustomTestCategoryDto
            {
                Name = c.Name,
                Info = c.Info
            }).ToList();
        }
  1. Add this line to ConfigureServices in WebModule
context.Services.AddTransient<ICustomTestsAppService, CustomTestsAppService>();

Please do let me know if anything else is needed.

Thank You, Anjali

Hello Sergei.Gorlovetsky,

I apologies for delay in response, Actually the issue is at our side.

For time being please add below code:-

Create a AppBsonClassMapSerializer class in {Projectname}.MongoDB and add this code

using MongoDB.Bson.Serialization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Data;
using Volo.Abp.Domain.Entities;
namespace {ProjectName}.MongoDb
{
    public class AppBsonClassMapSerializer< TClass > : BsonClassMapSerializer< TClass >, IBsonDocumentSerializer
    {
        public AppBsonClassMapSerializer(BsonClassMap classMap) : base(classMap)
        {
        }
        public override TClass Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
        {
            var result = base.Deserialize(context, args);
            try
            {
                Type type = result.GetType();
                if (type == null)
                {
                    return result;
                }
                PropertyInfo propertyInfo = type.GetProperty(nameof(AggregateRoot.ExtraProperties));
                if (propertyInfo != null && propertyInfo.CanWrite)
                {
                    if (propertyInfo.GetValue(result) == null)
                    {
                        propertyInfo.SetValue(result, new ExtraPropertyDictionary());
                    }
                }
                return result;
            }
            catch (Exception)
            {
                return result;
            }
        }
    }
    public class AppBsonSerializationProvider : IBsonSerializationProvider
    {
        public IBsonSerializer GetSerializer(Type type)
        {
            if (type.BaseType == typeof(Volo.Abp.Domain.Entities.Auditing.FullAuditedAggregateRoot<Guid>))
            {
                Type serializerType = typeof(AppBsonClassMapSerializer<>).MakeGenericType(type);
                return (IBsonSerializer)Activator.CreateInstance(serializerType, BsonClassMap.LookupClassMap(type));
            }
            return null;
        }
    }
}

Add BsonSerializer.RegisterSerializationProvider(new AppBsonSerializationProvider()); into {Projectname}MongoDbModule.cs

We will fix it in next version and your ticket will be refunded. Can we close this ticket if your query is resolved? Please confirm.

Awaiting for your valuable response.

Thank You, Anjali

Hello sanobarm@cloudassert.com,

Can you please try to add API URL entry in CORS section of Auth Server and check whether login works or not for API and can you please provide both a screenshot and the error logs that you are encountering

Thank you, Anjali

Hello Dev2ng,

Please do let us know if this solution has worked for you?

Can we close this ticket if your query is resolved? Please confirm.

Awaiting for your valuable response.

Thank You, Anjali

Hello ed_developer3,

Hope you are doing well.

Please do let us know if we can help you with something else?

Can we close this ticket if your query is resolved? Please Confirm.

Thank You, Anjali

Hello alicaner,

Hope you are doing well.

Please do let us know if the above shared solution has worked for you?

Can we close this ticket if your query is resolved? Please confirm.

Awaiting for your valuable response.

Thank You, Anjali

Answer

Hello darutter,

I got your point, I will check and get back to you asap.

Thank you, Anjali

Hello sanobarm@cloudassert.com,

Could you please check the similar issue https://support.abp.io/QA/Questions/5679 ?

If this doesn't help you then Please share your appsettings.json file of AuthServer and Host so that we can help you better.

Thank you, Anjali

Hello nanohealthserviceaccount,

Could you please share your appsettings.json file from AuthServer and environment.ts file from Angular so that we can help you better.

Thank you, Anjali

Answer

Hello darutter,

I have followed the below steps to get the desired output:

  1. I have created Entity Person -> Name, Address, City, State, PostalCode
  2. Second Entity ItemSet1 -> Name, Data
  3. Third Entity ItemDataSet2 -> Name,Data
  4. I have added Navigation (1tomany) from Person to ItemSet1 and ItemDataSet2.
  5. I have used below API to exporttoexcel
 public virtual async Task<IRemoteStreamContent> GetListAsExcelFileAsync(PersonExcelDownloadDto input)
        {
            var downloadToken = await _excelDownloadTokenCache.GetAsync(input.DownloadToken);
            if (downloadToken == null || input.DownloadToken != downloadToken.Token)
            {
                throw new AbpAuthorizationException("Invalid download token: " + input.DownloadToken);
            }

            var people = await _personRepository.GetListWithNavigationPropertiesAsync(input.FilterText, input.Name, input.Address, input.City, input.State, input.PostalCodeMin, input.PostalCodeMax);
            var items = people.Select(item => new
            {
                Name = item.Person.Name,
                Address = item.Person.Address,
                City = item.Person.City,
                State = item.Person.State,
                PostalCode = item.Person.PostalCode,

                Itemset1 = item.Itemset1?.Item1Name,
                ItemDataset2 = item.ItemDataset2?.Item2Name,

            });

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

            return new RemoteStreamContent(memoryStream, "People.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
        }
  1. After running application I am getting output like

  1. I am getting following excel file after exporting

Please do let me know if anything else is needed.

Thanks, Anjali

Showing 901 to 910 of 1087 entries
Made with ❤️ on ABP v9.0.0-preview Updated on September 20, 2024, 08:30