Base solution for your next web application

Activities of "kumaran"

Hi

I am using v5.5.0.0 and i am showing these dates in a modal window. This was not created by rad tool.

By the way i was able to fix it by doing the following.

Point me to the right direction to upgrade the code to the latest version because the code has been customized a lot in the project. Don't want to mess the existing code.

Thanks.

  1. In the html i had the following .. <input class="form-control" type="datetime" #Show_ShowDate id="Show_ShowDate" name="Show_ShowDate" required>

  2. In the typescript i had

ngAfterViewInit(): void { ..

    // default date picker
    $(this.Show_ShowDate.nativeElement).datetimepicker({
        locale: abp.localization.currentLanguage.name,
        format: 'L LT'
    });

}

  1. When i show the modal window, to load the data from the db, ..

            let startDateTime: Element = document.getElementById("Show_ShowDate");
    
            if (startDateTime) {
                (startDateTime as HTMLInputElement).defaultValue = moment(this.showVar.showDate).format('L LT');
            }
    

Hi

Just to let you know that i have solved my problem. This will help others who have the same issue.

The issue is my request to my controller method is in a image url where i get the image as byte array. Because of this the UI layer is not attaching the bearer token. As a workaround i moved the method that returns the array to the service layer and called through the proxy.

In order to render the image with the byte array i followed the way it is done in this link. http://www.macaalay.com/2014/09/26/rendering-images-from-byte-arrays-and-converting-images-to-byte-arrays-using-angularjs/

You should be kidding me. You want me to create a mini project just to reproduce the error for you? I cannot send you my entire project.

Hi

Sorry my initial one has no "MyTicketImage" later i added them. It still does not work.

what i can think of the difference between the profile controller and my controller is in profile controller the uploaderoption is sending the bearer token from the ui to the server.

In my case i am not sending anything from the UI. Is that the reason? If that is the reason, how i do i send the token. Mine is just a image url that renders the image by calling a controller method.

Thanks

Here is my code.

using Abp.Application.Services.Dto;
using Abp.AspNetCore.Mvc.Authorization;
using Abp.Runtime.Session;
using Events.Order;
using Events.Show;
using Events.Show.Dtos;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;

namespace Events.Web.Controllers
{
    
    public class TicketController : EventsControllerBase
    {
        private readonly IShowsAppService _showAppService;
        private readonly OrderManager _orderManager;


        public TicketController(
            OrderManager orderManager,
            IShowsAppService showAppService)
        {
            _showAppService = showAppService;
            _orderManager = orderManager;
        }

        [AbpMvcAuthorize]
        public async Task<ActionResult> GetTicketImage(int orderId)
        {
           long currentUserId = AbpSession.GetUserId();
           Order.Order order = await _orderManager.GetOrderDetails(orderId, currentUserId);

            var invalidOrder = "Invalid Order";
            byte[] ticketImagByteArr;
            if (order != null && order.OrderStatus == OrderStatus.Paid)
            {
                var showForView = await _showAppService.GetShowForView(new EntityDto(order.ShowId));
                if (showForView != null && showForView.Show != null)
                {
                    ShowDto show = showForView.Show;

                    string qrTicketDetailString = GenerateQrStringFromOrder(order, show);

                    ticketImagByteArr = OrderLibrary.GetTicketQR(qrTicketDetailString);

                    return File(ticketImagByteArr, "png", "EventOrder-" + orderId);
                }

            }

            //render an invalid order qr code.
            ticketImagByteArr = OrderLibrary.GetTicketQR(invalidOrder);

            return File(ticketImagByteArr, "png", "EventOrder-Invalid");
        }


        private static string GenerateQrStringFromOrder(Order.Order order, ShowDto show)
        {
            string output = string.Empty;

           ..
           ..
           ..

            return output;

        }
    }
}

I have a similar issue just like gowthamv. what is the solution for this. I do not find any error in the audit logs.

found the fix. I have to ignore those attributes in CustomDtoMapper.cs that are not required to be mapped. In my case the order object in the order child tables needs to be ignored otherwise you get into recursive relationship.

       configuration.CreateMap&lt;CreateOrEditOrderDetailDto, OrderDetail&gt;().ForMember(x => x.Order, opt => opt.Ignore());
       configuration.CreateMap&lt;CreateOrEditRewardDto, Reward.Reward&gt;().ForMember(x => x.Order, opt => opt.Ignore());
       configuration.CreateMap&lt;CreateOrEditOrderPromotionDto, OrderPromotion&gt;().ForMember(x => x.Order, opt => opt.Ignore());

Nope. i get the following error if the dto is different than the class.

AutoMapper.AutoMapperMappingException: Error mapping types.

Mapping types: CreateOrEditOrderDto -> Order Events.Order.Dtos.CreateOrEditOrderDto -> Events.Order.Order

Type Map configuration: CreateOrEditOrderDto -> Order Events.Order.Dtos.CreateOrEditOrderDto -> Events.Order.Order

Property: OrderDetails ---> AutoMapper.AutoMapperConfigurationException: Unmapped members were found. Review the types and members below. Add a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type For no matching constructor, add a no-arg ctor, add optional arguments, or map all of the constructor parameters ========================================================================= CreateOrEditOrderDetailDto -> OrderDetail (Destination member list) Events.Order.Dtos.CreateOrEditOrderDetailDto -> Events.Order.OrderDetail (Destination member list)

Unmapped properties: Order

at AutoMapper.ConfigurationValidator.AssertConfigurationIsValid(IEnumerable`1 typeMaps) at lambda_method(Closure , CreateOrEditOrderDto , Order , ResolutionContext ) --- End of inner exception stack trace --- at lambda_method(Closure , CreateOrEditOrderDto , Order , ResolutionContext ) at lambda_method(Closure , Object , Object , ResolutionContext ) at AutoMapper.Mapper.AutoMapper.IMapper.Map[TDestination](Object source) at Events.Order.OrdersAppService.Create(CreateOrEditOrderDto input) in C:\Kumaran\AspnetZero\Events\aspnet-core\src\Events.Application\Order\OrdersAppService.cs:line 352 at Events.Order.OrdersAppService.CreateOrEdit(CreateOrEditOrderDto input) in C:\Kumaran\AspnetZero\Events\aspnet-core\src\Events.Application\Order\OrdersAppService.cs:line 341 at Events.MultiTenancy.Payments.PaymentAppService.CreateShowPayment(ShowPaymentInfoInput input) in C:\Kumaran\AspnetZero\Events\aspnet-core\src\Events.Application\MultiTenancy\Payments\PaymentAppService.cs:line 148 at lambda_method(Closure , Object ) at Mic...

I will give a try. thanks

here is the dto and the class model for example In the following dto, i removed the order reference and get the error.

public class OrderDetail : Entity&lt;int&gt;
{
    [ForeignKey("OrderId")]
    public virtual Events.Order.Order Order { get; set; }
    public virtual int OrderId { get; set; }
    [Required]
    public virtual int ShowTicketId { get; set; }

    public virtual string TicketName { get; set; }
    public virtual int TicketCount { get; set; }
    public virtual double TotalTicketAmount { get; set; }


}

public class CreateOrEditOrderDetailDto : Entity<int> { [Required] public int OrderId { get; set; }

    [Required]
    public int ShowTicketId { get; set; }

    public string TicketName { get; set; }
    public int TicketCount { get; set; }
    public double TotalTicketAmount { get; set; }
}
Showing 1 to 10 of 35 entries