Activities of "Tony_Albutt"

Hi

Finished real time notification via background job and a NotificationHub

Can you please close this issue

Thanks and regards Tony

Thanks, I wont use shared data tables.

I will look at Distributed Event again.

I don't see yet how this will work with SignalR to send multiple notifications to multiple UI elements.

My goal was to centralize all chats, chat bots and in app notifications to the user.

Regards Tony

So many breaking changes, all over the place.

I have been dreading updating to .net core 6 and ABP.IO version 5.x This is the third attempt. It took 4 days to move to .net core 5 and AMB.IO version 4.x Going to take a week to fix all the modal functionality that no longer works.

**PLEASE **fix my access to the source code : The user "anthony.albutt@gmail.com" has no active ABP Commercial license!

Have a good one. Regards Tony

I found the Volo Account and Lepton modules in new location

After replacing all files for account and implementing my changes, and replacing all Version="$(MicrosoftPackageVersion)" with correct version, I how get the application to run and the web browser to display the Lepton theme errors to display the bootstrap5 errors.

Next step is to move lepton module file and re-implement my custom theme.

Working again Custom themes are a bust. Will have to re-create them

This was one of the problems.

Restored packages, added migrations and updated database as well.

I am still having the same error.

  • ABP Framework version: v4.4.0
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace: Can't compile, see two types of errors below
  • Steps to reproduce the issue:" Upgrade from version 4.4.0 to 5.14

I have been having problems upgrading to version 5.x from 4.4 for some time now... I want to view some source code in the demo, to verify that you have not introduced some breaking changes Please enable access to my account to view source code of samples.

I am getting the following two types of errors in 350+ places after updating. to version 5.1.4 and dot net core 6

All was working before version 5.x

Sample IQueryable error
CODE:

        private int GetNextLineNumber(Guid TravelRequestId)
        {
            var LastLine = _expenseItemRepository.Where(p => p.TravelRequestId == TravelRequestId).Max(p => (int?)p.Line);
            return LastLine == null ? 1 : (int)LastLine + 1;
        }

Error: Severity Code Description Project File Line Suppression State Error CS1929 'IExpenseItemRepository' does not contain a definition for 'Where' and the best extension method overload 'DynamicQueryableExtensions.Where(IQueryable, string, params object[])' requires a receiver of type 'IQueryable' ITX.Application C:\Users\Anthony\source\repos\ITX_New\ITX\aspnet-core\src\ITX.Application\ExpenseItems\ExpenseItemAppService.cs 228 Active

Sample IEnumerable error - CODE:

        public virtual async Task<PagedResultDto<LookupDto<Guid>>> GetEmployeeLookupAsync(LookupRequestDto input)
        {
            var query = _employeeRepository.AsQueryable()
                .WhereIf(!string.IsNullOrWhiteSpace(input.Filter),
                    x => x.FullName != null &&
                         x.FullName.Contains(input.Filter));
            var lookupData = await query.PageBy(input.SkipCount, input.MaxResultCount).ToDynamicListAsync<Employee>();
            var totalCount = query.Count();
            return new PagedResultDto<LookupDto<Guid>>
            {
                TotalCount = totalCount,
                Items = ObjectMapper.Map<List<Employee>, List<LookupDto<Guid>>>(lookupData)
            };
        }

Severity Code Description Project File Line Suppression State Error CS1929 'IRepository<Employee, Guid>' does not contain a definition for 'AsQueryable' and the best extension method overload 'Queryable.AsQueryable(IEnumerable)' requires a receiver of type 'IEnumerable' ITX.Application C:\Users\Anthony\source\repos\ITX_New\ITX\aspnet-core\src\ITX.Application\ExpenseItems\ExpenseItemAppService.cs 169 Active

I have made 1800+ changes to my code to fix the breaking changes as below e.g. var queryable = await _employeeRepository.GetQueryableAsync();

        public virtual async Task<PagedResultDto<LookupDto<Guid>>> GetEmployeeLookupAsync(LookupRequestDto input)
        {
            IQueryable<Employee> queryable = await _employeeRepository.GetQueryableAsync();
            var query = queryable
                .WhereIf(!string.IsNullOrWhiteSpace(input.Filter),
                    x => x.FullName != null &&
                         x.FullName.Contains(input.Filter));
            var lookupData = await query.PageBy(input.SkipCount, input.MaxResultCount).ToDynamicListAsync<Employee>();
            var totalCount = query.Count();
            return new PagedResultDto<LookupDto<Guid>>
            {
                TotalCount = totalCount,
                Items = ObjectMapper.Map<List<Employee>, List<LookupDto<Guid>>>(lookupData)
            };
        }

The application now compiles, but does not run

I re-added the Account and the Lepton Theme modules. This did not work as the ABP Suite application added a Angular folder with the two modules.

I am getting the below error when running the application

[17:17:51 INF] Starting web host. [17:17:52 FTL] Host terminated unexpectedly! Volo.Abp.AbpInitializationException: An error occurred during ConfigureServices phase of the module Volo.Abp.AspNetCore.Mvc.AbpAspNetCoreMvcModule, Volo.Abp.AspNetCore.Mvc, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null. See the inner exception for details. ---> System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Could not load type 'Volo.Abp.Identity.ProfileDto' from assembly 'Volo.Abp.Identity.Pro.Application.Contracts, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null'. Could not load type 'Volo.Abp.Identity.ProfileDto' from assembly 'Volo.Abp.Identity.Pro.Application.Contracts, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null'.

More info on error

Exception thrown: 'System.Reflection.ReflectionTypeLoadException' in System.Private.CoreLib.dll Exception thrown: 'Volo.Abp.AbpInitializationException' in Volo.Abp.Core.dll 'ITX.Web.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.2\System.Reflection.Metadata.dll'. The thread 0x6964 has exited with code 0 (0x0). The thread 0x5790 has exited with code 0 (0x0). The program '[33564] ITX.Web.exe' has exited with code 1 (0x1).

Are you able to help?

Thanks and regards Tony

I want to have a user called System-Notifications. I want to use the Chat module to display notifications to users, and will contain a link to a task that they need to perform. What is the recommended method to use, so that I can send Chat notifications to users from within a Background Job?

Below, I have tested the conversationAppService.SendMessageAsync , and works from a web page calling an AppService method This does not work when I impersonate a user. How would I correct this?

I am unable to send a chat message using conversationAppService.SendMessageAsync when impersonating a user : using (_currentPrincipalAccessor.Change(newPrincipal)) I get an exception "Exception of type 'Volo.Abp.Authorization.AbpAuthorizationException' was thrown" when impersonating, although the impersonated CurrentUser.IsAuthenticated == true

If you're creating a bug/problem report, please include followings:

  • ABP Framework version: v4.4.4
  • UI type: **MVC **
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace: Exception of type 'Volo.Abp.Authorization.AbpAuthorizationException' was thrown. **** below for the stack trace
  • Steps to reproduce the issue: This code rases the exception.
  • using (_currentPrincipalAccessor.Change(newPrincipal)) { var userName = CurrentUser.UserName; //See below **ii for contents await _conversationAppService.SendMessageAsync( // This is where the exception is triggered new SendMessageInput { TargetUserId = targetUserId, Message = args.Message, } ); }
  • * See below for the full code.

The purpose of the code is so that I can use the Chat module for In-App Notifications from a BackgroundJob

When I test from a web page calling an AppService, I can send the message as a logged in user using CurrentUser When I impersonate using currentPrincipalAccessor , I get an Exception of type 'Volo.Abp.Authorization.AbpAuthorizationException' was thrown.

* See below for my code.

    public async Task SendNotify(NotifyArgs args)
    {
        try
        {

            Guid.TryParse("54e53b63-14be-4e22-5a0b-39fe42671983", out var targetUserId);
            Guid.TryParse("5e328781-65e6-5d29-e83d-39fe195a5a22", out var senderUserId);

            //// Sends a SignalR message, does not save to DB, but works if the user is looking at the page
            //var chatMessage = new ChatMessageRdto()
            //{
            //    SenderUserId = senderUserId,
            //    SenderUsername = "user1@mail.com",
            //    SenderName = "User",
            //    SenderSurname = "One",
            //    Text = args.Message
            //};
            //await _realTimeChatMessageSender.SendAsync(targetUserId, chatMessage);

            //Sends a message and saves to DB
            var realUser = CurrentUser; //See below ** for content of CurrentUser
            var realUserName = CurrentUser.UserName; //returns "john"
            await _conversationAppService.SendMessageAsync(
               new SendMessageInput
               {
                   TargetUserId = targetUserId,
                   Message = args.Message,
               }
            );

            var newPrincipal = new ClaimsPrincipal(
                                    new ClaimsIdentity(
                                        new Claim[]
                                        {
                                                new Claim(AbpClaimTypes.TenantId, CurrentUser.TenantId.ToString()),
                                                new Claim(AbpClaimTypes.UserId, CurrentUser.Id.ToString()),
                                                new Claim(AbpClaimTypes.ImpersonatorTenantId, CurrentUser.TenantId.ToString()),
                                                new Claim(AbpClaimTypes.ImpersonatorUserId, "3e1c2476-ad49-85c7-9101-39fe18cffd26"),
                                                new Claim(AbpClaimTypes.Email, "user1@mail.com"),
                                                new Claim(AbpClaimTypes.UserName, "user1@mail.com"),
                                                new Claim(AbpClaimTypes.Name, "User"),
                                                new Claim(AbpClaimTypes.SurName, "One"),
                                                new Claim(AbpClaimTypes.Role, "Traveller")
                                        }
                                    )
                                );

            using (_currentPrincipalAccessor.Change(newPrincipal))
            {
                var userName = CurrentUser.UserName; //See below *** for content of CurrentUser
                await _conversationAppService.SendMessageAsync( // This is where the exception is triggered
                   new SendMessageInput
                   {
                       TargetUserId = targetUserId,
                       Message = args.Message,
                   }
               );
            }

        }
        catch (Exception ex)
        {
            //throw;
        }

    }

** realUser = CurrentUser

*** CurrentUser = newPrincipal

**** Exception message and stack trace

All widgets are now working. The second widget had the same problem, but kept reporting the error. Deleted widget and re-created, and still reported the problem. Remed out all UI on Default.chtml and then workerd. Re-enabled UI and then worked ??? A referance may have been cached someware.

All good

Thanks

I may have found a problem. First widget is longer reporting an error. Next one is still reporting a problem

Solution for first problem is as follows

  1. Widget folder is TravelCostsWidget.
  2. Controller name space is namespace ITX.Web.Pages.Shared.Components.TravelCostsWidget
  3. ViewComponent name space is ITX.Web.Pages.Shared.Components.TravelCosts
  4. ViewModel name space is TX.Web.Pages.Shared.Components.TravelCosts

Solved first Widget error by renaming name space from TravelCosts to TravelCostsWidget

I will update again later

This is the widget location /Pages/Shared/Components/TravelCostsWidget/Default.cshtml The same location that is reported in the log file above indicating could not be found

	TravelRequests/Details.schtml
    <form method="get" id="TravelCostsFilterForm">
                    <abp-input asp-for="TravelRequestId" />
                    <abp-row>
                        <div class="row" style="padding-left:24px;padding-bottom:12px;">
                            <abp-button style="float: right;" id="RefreshTravelCostsButton"
                                        text="@L["Refresh"].Value"
                                        icon="refresh"
                                        button-type="Primary"
                                        type="Submit" />
                        </div>
                    </abp-row>
                </form>
                <div id="TravelCostsWidgetArea" data-widget-filter="#TravelCostsFilterForm">
                    @await Component.InvokeAsync("TravelCostsWidget", new { travelRequestId = Model.TravelRequestId })
                </div>

	TravelCostsWidgetController.cs	
    namespace ITX.Web.Pages.Shared.Components.TravelCostsWidget
		{
		    [Route("TravelRequests/Widgets")]
		    public class TravelCostsWidgetController : AbpController
		    {
		
		        [HttpGet]
		        [Route("RefreshTravelCosts")]
		        public IActionResult RefreshTravelCosts(Guid travelRequestId)
		        {
		            return ViewComponent("TravelCostsWidget", new { travelRequestId });
		        }
		    }
		}
        
        
	TravelCostsViewModel.cs	
    namespace ITX.Web.Pages.Shared.Components.TravelCosts
		{
		    public class TravelCostsViewModel
		    {
		        public List<TravelCostDto> TravelCosts { get; set; }
		    }
		}
	
    
    TravelCostsWidgetViewComponent.cs	
    namespace ITX.Web.Pages.Shared.Components.TravelCosts
		{
		    [Widget(
		    StyleFiles = new[] { "/Pages/Shared/Components/TravelCostsWidget/Default.css" },
		    ScriptFiles = new[] { "/Pages/Shared/Components/TravelCostsWidget/Default.js" },
		    RefreshUrl = "Widgets/RefreshTravelCosts",
		    AutoInitialize = true
		    )]
		    public class TravelCostsWidgetViewComponent : AbpViewComponent
		    {
		        private readonly ITravelCostsAppService _travelCostsAppService;
		
		        public TravelCostsWidgetViewComponent(ITravelCostsAppService travelCostsAppService)
		        {
		            _travelCostsAppService = travelCostsAppService;
		        }
		
		        public IViewComponentResult Invoke(Guid travelRequestId)
		        {
                    List<TravelCostDto> travelCosts = new();
                    if (travelRequestId != Guid.Empty)
                    {
                        travelCosts = _travelCostsAppService.GetTravelCostsForTravelRequest(travelRequestId);
                    }
                    return View(new TravelCostsViewModel { TravelCosts = travelCosts });
		        }
		    }
		}
	
    
    Default.js	
    $(function () {
		    var myWidgetManager = new abp.WidgetManager('#TravelCostsWidgetArea');
		    myWidgetManager.init();
		})
	
    
    Default.cshtml	
    @using System.Globalization
		@using ITX.Localization
		@using Microsoft.AspNetCore.Mvc.Localization
		@model ITX.Web.Pages.Shared.Components.TravelCosts.TravelCostsViewModel
		@inject IHtmlLocalizer<ITXResource> L
		@{
		    decimal Total = 0.00m;
		
		}
		
		<table class="table table-striped">
		    <thead>
		        <tr class="line">
		            <td><strong>#</strong></td>
		            <td class="text-left"><strong>@L["Description"]</strong></td>
		            <td class="text-center"><strong>@L["Qty"]</strong></td>
		            <td class="text-right"><strong>@L["Price"]</strong></td>
		            <td class="text-right"><strong>@L["Total"]</strong></td>
		        </tr>
		    </thead>
		    <tbody>
		        @foreach (var item in Model.TravelCosts)
		        {
		            <tr>
		                <td>@item.ItemNumber</td>
		                <td class="text-left">@item.Description</td>
		                <td class="text-center">@item.Qty</td>
		                <td class="text-center">@item.Price</td>
		                <td class="text-right">@item.Total</td>
		            </tr>
		            {
		                Total = Total + item.Total;
		            }
		        }
		            <tr>
		                <td colspan="3">
		                </td>
		                <td class="text-right"><strong>Total</strong></td>
		                <td class="text-right"><strong>@Total</strong></td>
		            </tr>
		        </tbody>
		</table>

Showing 21 to 30 of 43 entries
Made with ❤️ on ABP v9.2.0-preview. Updated on January 14, 2025, 14:54