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

Activities of "alukaszewski"

Nevermind my original assumption of doing something stupid was justified.

Hi,

Thanks for replying.

Which file are you wanting to see? Is it the *CoreModule.cs class from the Core project?

I've just published base 8.9.2 to our staging appservice and it worked fine, so something in our code is causing the issue or I am messing something up in the merge. I'm not able to share the project as it has sensitive information in the codebase (keys). If there's nothing more obvious other than the dbcontext onmodelcreating call, I'll have to try and trace the issue in our code.

Thank you for replying

I think I solved this, by adding myParams to new modalManager modal;

var _myCustomModal = new app.ModalManager({
        viewUrl: abp.appPath + 'Mpa/Modals/MyCustomModal',
        scriptUrl: abp.appPath + 'Areas/Mpa/Views/Common/Modals/_MyCustomModal.js',
        modalClass: 'MyCustomModal',
        myParams: { "param1": "16777328", "param2": "XX1XX1XX2" }
    });

I added some extra functionality to ModalManager.js;

I include myParams in ModalManager.js _normalizeOptions;

return function (options) {

            _normalizeOptions(options);

            var _$modal = null;
            var _modalId = options.modalId;
            var _modalSelector = '#' + _modalId;
            var _modalObject = null;
            var _myParams = options.myParams;

I then have an extra custom Api call which returns my parameters;

getMyParams: function () {
                    return _myParams
                },

Then in _MyCustomModal.js I can use;

var myParams = _modalManager.getMyParams();
            var myParam1 = myParams.param1;

before I run any other code such as DataTables or AmChart.

Bah, this does not appear to work with modals/modalManager. The parameters passed in the URL are not available when the modal loads. There must be a way to extend modal Manager - I can see an 'Args' I wonder what those are?

Ah, good idea thanks.

I had previously not been using the modalManager to show modals, instead including modal html and code on the page or loading from another controller - with that method I could throw a value into a field on the modal before modal.shown and then have the modal execute code based on the value in that field during modal.shown. With modalManager, the modal DOM elements are not available until modal Manager.open but I don't want modal code to execute until I have first established an id value.

In User.cs I already tried this;

public static User CreateTenantAdminUser(int tenantId, string emailAddress, string password)
        {
            return new User
                   {
                       TenantId = tenantId,
                       UserName = AdminUserName,
                       Name = AdminUserName,
                       Surname = AdminUserName,
                       EmailAddress = emailAddress,
                       Password = new PasswordHasher().HashPassword(password),
                       RefreshInterval = 300
                   };
        }

...but when new user accounts are created by LDAP or by admin user, the RefreshInterval is not set to 300. It is still 0 (zero).

As a temporary workaround in my _CreateOrEditModal.cshtml I have this;

<input id="EditUser_RefreshInterval" type="text" name="RefreshInterval" class="form-control edited" @Html.Raw(Model.User.RefreshInterval < 60 ? "value=\"300\"" : "value=\"" + Model.User.RefreshInterval + "\"") maxlength="5">

It's not ideal.

Do you please have an example of setting a default value for a new integer property in the constructor?

What is "EF" ?

Where do I set a default value in the constructor of a User? Is there an example? I was looking to see how existing code works but I cannot find any existing property which uses an integer and sets a default value.

I'm not creating a new Entity, I'm extending the existing User Entity by adding additional property.

If I set a value of 300, this is saved and retrieved fine by the user settings modal and the user edit modal. Here is what I have in my Migration;

public partial class Added_RefreshInterval_To_User : DbMigration
    {
        public override void Up()
        {
            AddColumn("dbo.AbpUsers", "RefreshInterval", c => c.Int(nullable: false, defaultValue: 300));
        }
        
        public override void Down()
        {
            DropColumn("dbo.AbpUsers", "RefreshInterval");
        }
    }

The design of the table for the "RefreshInterval" column added to the database shows as having default value of 300, but a value of 300 is not displayed by new user modal or set when a new user is created by LDAP Auth.

I believe problem is that the LDAP user creation user process and the user create modal need to know what default value to display/use and insert into the table, otherwise it inserts 0 (zero). Does that make sense? It is no use having default value set on database table column design as the creation process is overriding this with 0.

Showing 1 to 10 of 43 entries