Base solution for your next web application

Activities of "ISTeam"

Even after two years, surprisingly same thing happened like comment by @outdoored on thread 5403 https://support.aspnetzero.com/QA/Questions/5403

I was spending more than two days to resolve the problem of ObjectDisposedException to access repository in my own separate console applicaiton to be used as a task scheduler job independently just to import data.

To make life simple, I first used the exact same code of 'X.Migrator' application and just added my code in the 'MultiTenantMigrateExecuter.Run()' method to access some other reposiotry of the same database. But unfortunately I was getting same error. Even [UnitOfWork] did not work for me.

And as last hope, I restarted my machine and suddenly after restart it is working with [UnitOfWork]! with Tenant repository onlu which is defined by Abp. But not for any other entities created by us.

Fixed it by adding virtual keyword in the method!

@ismcagdas this issue is still present in MVC Core & jQuery template. I followed exact steps to create my first dashboard widget mentioned in the documentation then I got an error :

abpexception there is no permission with name "HelloWorld".

And in fact in the documentation URL there is no mention of how to setup the permission for this particular Widget which they are describing.

So, in addition to adding ".ToList()" change for generalStats, I had to completely remove the HelloWorld permission. Because all the permissions setup are for pages and there is no specific permission for particular Widget. (i.e. tenantWidgetsDefaultPermission is nothing but AppPermissions.Pages_Tenant_Dashboard)

And yes even today, the tenant dashboard is empty because of the AuditLog permission mentioned above!

Thanks @dmux for your explaination and sharing the solution as well!

To use HTTPs URL is a good option. This issue persist even in development machine!

We have developed few widgets using morris.js library to display bar charts and pie charts.

We need to redirect the user to specific page when user clicks on some portion of the chart. Currentlly, on all pages service methods are being called with get* methods to retrieve data from the server.

But unable to find a way how to redirect to another page by calling a controller action method from jQuery of some widget.

  • I have tried, this way but unable to redirect to different page.

Faced errors like,

  1. HttpPost method issue
  2. [FormBody] attribute
  3. Mvc.ExceptionHandling.AbpExceptionFilter - A non-empty request body is required. () - Mvc.ExceptionHandling.AbpExceptionFilter - Method arguments are not valid! See ValidationErrors for details.
  4. Resource not found etc.

Sample attempts of JS code :

    try {
        var test = JSON.stringify({ MinMonthsRemaining: minMonth, MaxMonthsRemaining: maxMonth });
        $.ajax({
            type: 'GET',
            //type: 'POST',
            //url: abp.appPath + 'App/Inventories/IndexFiltered',
            url: '@Url.Action("Inventories","IndexFiltered")',
            data: test,
            success: function () { }
        });
    } catch (e) {
        // never reached here!
        console.log(e);
    }

Controller action :

    //[HttpPost]
    public ActionResult IndexFiltered(InventoryItemsModel input)
    {
        var model = new InventoryItemsViewModel
        {
            FilterText = string.Empty,
            MinMonthsRemainingFilter = input.MinMonthsRemaining,
            MaxMonthsRemainingFilter = input.MaxMonthsRemaining
        };

        return View("Index",model);
    }

Thank you for your answer @musa.demir. But I am not sure why I think there could be some better alternative available.

The issue is, I have three scenarios as below :

  1. < 3 months (0,2)
  2. 3 to 12 months (3,12)
  3. > 12 months (12, null)

Now, in the default service method generated using PowerTools, contains getAll() method. I need to apply filter on one of the field/column inside this service method. In last case, it seems hard to configure null scenario and I am getting below exception:

While on the UI it works like below:

Filter applied in the service method is as below :

var validInventory = _inventoryItemRepository.GetAll() ..... .WhereIf(input.MinMonthsRemainingFilter != null, e => e.MonthsRemaining >= input.MinMonthsRemainingFilter) .WhereIf(input.MaxMonthsRemainingFilter != null, e => e.MonthsRemaining <= input.MaxMonthsRemainingFilter) .....

Not sure why the abp.ajax method should not work or there is any other elegant way for this?

App launches for two ports :

  1. http => 5000
  2. https => 5001

As per first answer by @Riaan.Smit I just updated the appsettings.json with https://localhost:5001/ instead of all http URLs and the issue is now fixed. It was happening only in Chrome and continuous request to signalr-chat service/hub stopped after putting correct URLs. Now prefereing to use only https URL even in development environment because of Chrome security updates.

Ref of Chrome issue.

App info

  • What is your product version? .NET Core MVC & jQuery 8.3
  • What is your product type (Angular or MVC)? MVC
  • What is product framework type (.net framework or .net core)? .NET Core

Issue

I need to perform left out join with group by and sum between two tables/repository using dapper and raw SQL query. But I am not able to get connection string to use dapper module in the Application project in WidgetAppService.

private readonly IConfiguration _appConfiguration;

is not getting initialized with appsettings.json data and so I am not able to get the connection string information in the Application project. Is it possible? If yes, how?

`string sqlQuery = $";WITH CTE_POItems AS(SELECT SONo, SUM(ISNULL(Quantity, 0)) AS Quantity, SUM(ISNULL(Amount, 0)) AS Amount FROM app_PurchaseOrderItem GROUP BY SONo), CTE_POS AS(SELECT DATEPART(MONTH, P.OrderDate) AS Month, SUM(ISNULL(I.Amount,0)) AS OrdersValue, SUM(ISNULL(I.Quantity, 0)) AS Units, COUNT(ISNULL(I.SONo, 0)) AS TotalSOs FROM app_PurchaseOrder P LEFT JOIN CTE_POItems I ON P.SONo = I.SONo WHERE P.CustomerNo IN({associatedClients}) AND P.OrderDate BETWEEN '{CurrentYearStartDate.ToShortDateString()}' AND '{TomorrowDate.ToShortDateString()}' GROUP BY DATEPART(MONTH, P.OrderDate)) SELECT* FROM CTE_POS";

        using (SqlConnection db = new SqlConnection(***DefaultConnString***))
        {
            db.Open();
            data.AddRange(db.Query<OrdersInLastNMonths>(sqlQuery));
            db.Close();
        }`

Thanks.

Thank you. Your answer helped me to get the connection string in appservice to use raw SQL using dapper!

I found the answer from ticket #9235.

Is there any other way to get it or the one mentioned is the best way?

Showing 11 to 20 of 32 entries