Base solution for your next web application

Activities of "BobIngham"

Zero 10.4.0, .NETCore 5, Abp 6.40

Can someone tell me how customizable dashboard settings are loaded? In a development project trying to implement these I followed the instructions at the Customizable Dashboard page. Which seems to miss the all-important step of adding a new widget to the AppSettingProvider. When I ran my project my new widget was never in the settings.

To investigate further I reverted back to a standard 10.4.0 install with no changes.

I changed the setting of one widget from a height of 4 to 2 and width of 12 to 4.

I then run my project and put a breakpoint on where these settings are passed after the GetAll command:

Then I capture the response from the GetAll command in my network tab and paste into jsonviewer:

Why have the changes not been loaded into settings? My database is clear of any settings at this stage so surely the default value should be loaded? How do i add a new dashboard widget to my settings, am I missing something?

Any help appreciated.

Cheers, Bob

v10.4.0, Angular, .NET Core 5.0, Abp 6.4.0 (I think)

Referring to this entry which seems to be unresolved: Disable logging all SQL statements On a clean install I have these entries in the log file: This is far too verbose especially when I use Application Insights for log analysis. How do I switch the option off?

Cheers, Bob

Question

10.4.0, Angular, .net core Hi Guys,

Finally making the jump from 6.8.0 to 10.4.0. When I compile the .NET Core solution I have to suppress warning 1591 (XML comments) in Web.Core, Web.Host and Application projects. Shouldn't you add this as standard to suppress warnings?

There is also the following warning: warning CS0618: 'IAbpAutoMapperConfiguration.UseStaticMapper' is obsolete: 'Automapper will remove static API. See https://github.com/aspnetboilerplate/aspnetboilerplate/issues/4667' Is that an issue?

Cheers, Bob

dotnetZero 6.8.0, aspnet Framework 4.6, dotnet core 2.2, angular

This is a question from a very old version. I select three organization units, one parent and two children and the client sends an array of four integers where the parent is repeated for each child. The same goes when I select three children, I have three parent integers, all the same.

My question is, is this normal behaviour? I have updated my organization-unit-tree.component.ts to the latest version (not taking the last update to lodash-es). to bring in some bug fixes, nothing major. I still get the same result.

My decision was to change two instances of the following line in my UserAppService:

//Organization Units await UserManager.SetOrganizationUnitsAsync(user, input.OrganizationUnits.ToArray());

To: //Organization Units await UserManager.SetOrganizationUnitsAsync(user, input.OrganizationUnit.Distinct().ToArray());

This has fixed the problem but I'm wondering if the problem is also there in the latest version?

version irrelevant I use Kendo grid extensively throughout my system. In this scenario I call a KendoGridController in my Web.Host project which calls a method in my Application project which calls a stored procedure in an SQL repository. This works great and by using an IQueryable throughout the final query is built using the Kendo.DataSourceRequest and finally converted back to JSON using query.ToDataSourceResultAsync(request).ConfigureAwait(false). All of this works well but the dates passed back to the Angular component are in UTC, they by-pass Zero's ClockProvider.

That means I have to parse the dates in Angular and convert them back to the timezone of the tenant, not the user or the browser default, to display same in the Kendo grid. And then, because Kendo does not support Moment I have to convert back to vanilla javascript date. Here is my code:

... code removed for brevity
).subscribe((data) => {

let tenantTimezone = abp.timing.timeZoneInfo.iana.timeZoneId;

data.data.forEach((d) => {
  if (d.nextReviewTime) {
    let test = new Date(moment.tz(d.nextReviewTime, tenantTimezone).format());
    d.nextReviewTime = new Date(moment.utc(d.nextReviewTime).tz(tenantTimezone).format());
  }
... code removed for brevity

My value for d.nextReviewTime is 29/08/2020 23:00, perfect because it's the UTC value for a review on 30th August (entered in the UK). I am trying to cast this value back to the timezone of the tenant which I have changed to "South Africa Standard Time" (Windows) and "Africa/Johannesburg" (iana):

Can anyone tell me why the code results in a cast to GMT (British Summer Time) as per below?

I apologise in advance should I have missed something, I have tried every option available at Moment Timezone Documentation and can find no way of getting my UTC date to a South African datetime.

Can anyone point me in the right direction?

dotnet core, angular, aspnet framework, Zero 6.8.0 I apologise for asking a question about such an old version of the product but an upgrade when we are so close to general market is out of the question! Having said this I would like to upgrade my Zero 6.8.0 system version to run with Azure's Key Vault. Am I correct that if I make the changes here: Added Azure Vault Configuration Provider support and follow the instructions here: Azure Key Vault Support and here: Using Azure Key Vault with ASP.NET Core that I should be able to implement? Is there any need for the plumbing outlined here: Azure Vault Configuration Provider or here: Azure Vault - Configuration Provider?

Any help, guidance or gotchas gratefully received.

dotnetcore, angular, aspnet framework Zero 6.8.0 I am working with stored procedures and need to pass a "From" date parameter which is midnight in utc as calculated by the timezone of the tenant. In my web module I have:

Clock.Provider = ClockProviders.Utc;

I have a tenant in the UK: (currently GMT + 1) and a tenant in South Africa: (currently GMT + 2)

The relevant method in my SQLRepository class is set up as follows:

public async Task<IQueryable<GetEntitiesForKendoGrid_Result>> GetNcEntitiesForKendoGrid(int tenantId, long userId, int isDeleted)
{
    await EnsureConnectionOpen();

    var parms = new SqlParameter[4];
    parms[0] = new SqlParameter("@TenantId", tenantId);
    parms[1] = new SqlParameter("@UserId", userId);
    parms[2] = new SqlParameter("@IsDeleted", isDeleted);
    parms[3] = new SqlParameter("@From", Clock.Now.Date.ToUniversalTime());


    using (var command = CreateCommand("GetEntitiesForKendoGrid", CommandType.StoredProcedure, parms))
    .. code removed for brevity

Times in my database are all set to UTC. Regardless of changing the timezone for the client the following code line:

var timeZoneInfo = await _timeZoneService.GetDefaultTimezoneAsync(SettingScopes.Tenant, AbpSession.TenantId);

always gives me "GMT Standard Time"

The purpose of the exercise is to return midnight last night in UTC. My UK value should be "2020-08-17 23:00" My South African value should be "2020-08-17 22:00"

I have tried to inject ITimeZoneConverter to get something like midnight:

var midnight = _timeZoneConverter.Convert(Clock.Now.Date);

which gives me "2020-08-18 00:00".

  1. What am I doing wrong to get the incorrect timezone from settings?
  2. How do I get the value of midnight last night offset by the relevant timezone?

The nearest I have come to finding a solution is:

public async Task<IQueryable<GetEntitiesForKendoGrid_Result>> GetNcEntitiesForKendoGrid(int tenantId, long userId, int isDeleted)
{
    await EnsureConnectionOpen();

    var timeZoneInfo = await _timeZoneService.GetDefaultTimezoneAsync(SettingScopes.Tenant, AbpSession.TenantId);
    var tz = TimeZoneInfo.FindSystemTimeZoneById(timeZoneInfo);
    var midnight = new DateTime(Clock.Now.Date.Ticks, DateTimeKind.Unspecified);
    var midnightUTC = TimeZoneInfo.ConvertTimeToUtc(midnight, tz);

    var parms = new SqlParameter[4];
    parms[0] = new SqlParameter("@TenantId", tenantId);
    parms[1] = new SqlParameter("@UserId", userId);
    parms[2] = new SqlParameter("@IsDeleted", isDeleted);
    parms[3] = new SqlParameter("@From", midnightUTC);


    using (var command = CreateCommand("GetEntitiesForKendoGrid", CommandType.StoredProcedure, parms))
    .. code removed for brevity

Which seems a little cumbersome but I still can't figure out why i can'e get the relevant timezone for the tenant. Any help most appreciated.

Question

dotnetcore, angular, aspnet framework, Zero 6.8.0 Hi Guys,

I'm on an old version of the system and hope to upgrade soon. In the meantime is there any way to implement stacking of sweet alert notifications? I find that one alert is overwritten with another when results are almost instantantaneous. Is there any setting to insert new alerts under the old alerts?

Thanks, in anticipation of your help.

I have a SignalR hub in my solution for devices. I'm having a problem finding which devices are connected. I implemented an ITypedCache (GetNcDeviceOnlineCache) to handle connections which I thought would do the job. But the cache does not allow me to get a list of all connected devices when I want to display a devices grid. For now I persist the value "IsOnline" in my database on connection and disconnection to the hub. At the moment this works but if SignalR and the database get out of sync (and I figure they will on account of both being agnostic of the other) I have a problem. I am worried about the supportability of this, I just don't believe it will be 100% accurate as I scale up.

For online users the solution is simple, there is no database persistence and I initially show connected users using IOnlineClient which allows me to get a list of all uses connected to the hub for each individual tenant. I then subscribe to, and override abp's version of SignalR's OnConnectedAsync() and OnDisconnectedAsync(Exception exception) methods. The server code is below:

       public List<IOnlineClient> GetOnlineUsers()
        {
            return this.OnlineClientManager.GetAllClients().Where(c => c.TenantId == AbpSession.TenantId).ToList();
        }

        public override async Task OnConnectedAsync()
        {
            await base.OnConnectedAsync();
            await Clients.All.SendAsync("userConnected", Convert.ToInt64(Context.UserIdentifier));
            Logger.Debug("A client connected to NcChatHub: " + Context.ConnectionId);
        }

        public override async Task OnDisconnectedAsync(Exception exception)
        {
            await base.OnDisconnectedAsync(exception);
            await Clients.All.SendAsync("userDisconnected", Convert.ToInt64(Context.UserIdentifier));
            Logger.Debug("A client connected to NcChatHub: " + Context.ConnectionId);
        }

The key piece of code here is this.OnlineClientManager.GetAllClients().Where(c => c.TenantId == AbpSession.TenantId).ToList(); I have searched the github code for abpboilerplate and cannot find the implementation of OnlineClientManager.

I really appreciate the fact that you guys are the wizards and I am very much an apprentice. But can anyone tell me how to get a list of connected devices without having to persist the value in the database? i.e. something like the elusive implementation of OnlineClientManager?

Your attention, advice and direction would be most appreciated.

Given the following notification when a device is added to my app:

                    var notificationData = new LocalizableMessageNotificationData(
                        new LocalizableString(
                            "NewDeviceRegisteredNotificationDefinition",
                            NuagecareConsts.LocalizationSourceName
                            )
                        );
                    _notificationPublisher.Publish(AppNotificationNames.NewDeviceRegistered, notificationData, severity: NotificationSeverity.Info);

How do I inject variables into the language string to show the manufacturer, model of the device and the date the device was added?

Showing 11 to 20 of 142 entries