Base solution for your next web application

Activities of "kumaran"

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;

        }
    }
}

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

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

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/

Hi

My problem is similar to this support issue https://support.aspnetzero.com/QA/Questions/4328
The links inside the above support case does not work.

The issue i am having is in a modal dialog.

Here is my UI for the datetime picketr

<input class="form-control" type="datetime" [(selectedDate)]="showVar.showDate" #Show_ShowDate id="Show_ShowDate" name="Show_ShowDate" required>

In the edit mode the datetime picker control is empty instead of showing the model value.

Any reason why?

Thanks

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

I have .net core and angular subscription.

So far i have tested everthing with a staging site and everything is working fine.

After publishing to prod (new site) all i am seeing is "An error as occured" and details not sent by server. Now how do i find what is wrong.
The db is created, user is created, the api site is showing up properly.

In staging i had similar problem but that was related to multitenat and when i disable the users were created (documented here - https://support.aspnetzero.com/QA/Questions/5408)

[AbpPermissions] table is empty as well

Now i am stuck. How do i see the server error log? I need to go live today. Can anyone please help. Thanks.

Showing 41 to 47 of 47 entries