Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "BobIngham"

Hi Kansoftware,

I am upgrading from 6.80 to 10.4.0 and found I had to make the following changes to my SQLRepository:

        ... code removed for brevity
        
        /// <summary>
        /// Returns a list of abpUsers with links to entities in nuagecare
        /// </summary>
        /// <param name="tenantId">long</param>
        /// <param name="UserId">long</param>
        /// <param name="isDeleted">bool?</param>
        /// <returns>Task<IQueryable<GetStaffForKendoGrid_Result>></returns>

        public async Task<IQueryable<GetStaffForKendoGrid_Result>> GetStaffForKendoGrid(int tenantId, long userId, bool isDeleted)
        {
            await **EnsureConnectionOpen();**

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

            using (var command =** CreateCommand("GetStaffForKendoGrid", CommandType.StoredProcedure, parms)**)
            {
                using (var dataReader = await command.ExecuteReaderAsync())
                {
                    var result = new List<GetStaffForKendoGrid_Result>();

                    while (dataReader.Read())
                    {
                        var model = new GetStaffForKendoGrid_Result();
                        
                        ... model population here

                        result.Add(model);
                    }
                    dataReader.Close();
                    return result.AsQueryable();
                }
            }
        }

....

        #region helper methods
        /// <summary>
        /// 
        /// </summary>
        /// <param name = "commandText" ></param >
        /// < param name="commandType"></param>
        /// <param name = "parameters" ></param >
        /// < returns ></returns >
        DbCommand CreateCommand(string commandText, CommandType commandType, params SqlParameter[] parameters)
        {
            var command = **GetConnection().CreateCommand();**

            command.CommandText = commandText;
            command.CommandType = commandType;
            command.Transaction = GetActiveTransaction();

            foreach (var parameter in parameters)
            {
                command.Parameters.Add(parameter);
            }
            return command;
        }

        /// <summary>
        /// Opens an SQL connection if one does not already exist.
        /// 20191020 - changed to OpenAsync()
        /// </summary>
        async Task EnsureConnectionOpen()
        {
            var connection = GetConnection();

            if (connection.State != ConnectionState.Open)
            {
                await connection.OpenAsync();
            }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        DbTransaction GetActiveTransaction()
        {
            return (DbTransaction)_transactionProvider.GetActiveTransaction(new ActiveTransactionProviderArgs
            {
                {"ContextType", typeof(NuagecareDbContext) },
                {"MultiTenancySide", MultiTenancySide }
            });
        }
        #endregion helper methods

I also had to change my using statement from; using System.Data.SqlClient; to using Microsoft.Data.SqlClient; But I think that's more down to the fact that I was previously on aspnet framework 4.6.0 with donetcore 2.1.

Hope that helps.

Basically all SQL commands executed by EF Core seems to be logged which makes the log files huge.

I have a fresh install of 10.4.0 and this is happenning. How can I switch it off?

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

Hi @ismcagdas,

I think you misunderstand, why do I have two or three parents for two or three children?

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?

@raggadee

Try this link. https://dev.azure.com/nuageholdings/_git/Ionic%20app%20with%20Zero%20integration

If you need some third-party coding on this base let me know.

Hi @ismcagdas, I reached out to people how are better than me at this to no avail. Given my implementation of Zero (6.8.0) using aspnet framework 4.6 running dotnet core 2.2 I am concluding this is not possible. I understand your reluctance to support this framework so I'm closing this one. The solution is to upgrade my Zero version.

Answer

I'm on a very old version of Zero but I'll try help. Add nuget packages to Web.Host: Implement AI in Azure and get the instrumentation key and add to appsettings.production.json:

    "ApplicationInsights": {
        "InstrumentationKey": "f6898a23-ea45-40e9-a781-6084fce5621f"
    },

Implement in StartUp.cs (Web.Host):

//BI 20191115 0.14.1
// The following line enables Application Insights telemetry collection.
services.AddApplicationInsightsTelemetry();
#if DEBUG
    TelemetryConfiguration.Active.DisableTelemetry = true;
    TelemetryDebugWriter.IsTracingDisabled = true;
#endif

I had to jump through hoops to get the SnapshotCollector to work but that's because my version of Zero is 6.8.0 on aspnet framework 4.6 running dotnetcore 2.2. Given my old version hopefully this should give you enough pointers to get started, I doubt it will work out of the box because it's simpler with more modern configurations.

Hi @ismacagdas, Thanks for getting back. Maybe I'm a little confused here and not looking at the correct thing. The iana value "Africa/Johannesburg" is currently two hours ahead of UTC, therefore I would expect a conversion of date value "2020-08-26 23:00:00" to be converted to "2020-08-27 01:00:00": However, after the conversion only one hour is added to give me "2020-08-27 00:00:00": Am I not understanding this correctly? The idea is that a tenant in South Africa would always see date times in "South Africa Standard Time" and a tenant in the UK would always see date times in "GMT Standard Time" regardless of browser or user settings. What am I missing? Strictly speaking this may not be a Zero so thanks for any pointers.

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?

Showing 31 to 40 of 619 entries