Base solution for your next web application

Activities of "evbenerji"

Dear support,

I've reviewed what you wrote before about data protection; https://support.aspnetzero.com/QA/Questions/247

Could you please give me more information about how to integrate Data Protection mechanism into Asp.net zero?

Regards.

Re-generate solve the problem. Thank you so much.

Dear support team,

I'm using ASP.NET Core with jquery v7.1.0.0

When I "Logout" the .\admin account, the Login page comes. In Login page I try to login with different Tenant Name.

When I click the switch to tenant, Tenancy Name Input box still disabled. And also $switchToTenant.change function not fired in Default.js

I researched the problem, nobody getting error like me.

Thanks.

Hi, When you click the "kt_aside_toggler" button below the Brand, you sould take the error message.

Regards.

Dear Support Team,

After the update code with new version there is error in ...Web.Mvc\wwwroot\metronic\themes\default\js\layout.js Error Details; headerMenuOffcanvas.pauseDropdownHover is not a function

// Sidebar toggle var initAsideToggler = function() { ... headerMenu.pauseDropdownHover(800); //ERROR asideMenu.pauseDropdownHover(800); }); ... }

I am waiting for your advice.

Regards.

Hi @ryancyq This problem solved when I map the userContacts in _CreateOrEditModal.js like;

this.save = function () {
            ...
            var user = $('#UserInformationsForm,#UserDetailsForm').serializeFormToObject();
            var userCont = $.map(user.UserContacts, function (el) { return el });
            ...
            _userService.createOrUpdateUser({
                user: user,
                ...
                relatedUserContacts: userCont
            }).done(function () {
                abp.notify.info(app.localize('SavedSuccessfully'));
                _modalManager.close();
                abp.event.trigger('app.createOrEditUserModalSaved');
            }).always(function () {
                ...
            });
        };

Thanks for your suggestions and thanks for your interest.

Mvc.ExceptionHandling.AbpExceptionFilter - Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1[Project.Resource.Dtos.UserContactDto]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path 'relatedUserContacts.0', line 1, position 667. (relatedUserContacts.0)

Hi all, Can anybody help to solving this problem. I try to add list of UserContacts to the User using repeater. (One to many relation) I get error about Json to Json array deserialization.

Entities;

User

public class User : AbpUser<User>
    {
        public virtual Guid? ProfilePictureId { get; set; }
        ...
        public virtual ICollection<UserContact> UserContacts { get; set; }
    }

UserContacts

[Table("UserContacts")]
public class UserContact : FullAuditedEntity<long> 
    {
        [Required]
	public virtual string ContactName { get; set; }
		
	[Required]
	public virtual string ContactPhone { get; set; }
        
	public virtual long UserId { get; set; }
	public User User { get; set; }
    }

DTO

    public class UserContactDto : EntityDto<long>
    {
        public string ContactName { get; set; }

        public virtual string ContactPhone { get; set; }

        public long UserId { get; set; } 
    }

UserAppService

public async Task<GetUserForEditOutput> GetUserForEdit(NullableIdDto<long> input)
        {
            //Getting all available roles
            ...

            var relatedUserContacts = await _userContactRepository.GetAll().Where(c=>c.UserId == input.Id.Value).ToListAsync();

            var output = new GetUserForEditOutput
            {
                Roles = userRoleDtos,
                ...
                RelatedUserContacts = ObjectMapper.Map<List<UserContactDto>>(relatedUserContacts)
            };

            if (!input.Id.HasValue)
            {
                ...
            }
            else
            {
                ...
            }

            return output;
        }

CreateOrUpdateUserInput

public class CreateOrUpdateUserInput
    {
        [Required]
        public UserEditDto User { get; set; }

        ...

        public List<UserContactDto> RelatedUserContacts { get; set; }

        public CreateOrUpdateUserInput()
        {
            ...
            RelatedUserContacts = new List<UserContactDto>();
        }
    }

GetUserForEditOutput

public class GetUserForEditOutput
    {
        ...

        public UserEditDto User { get; set; }

        ...

        public List<UserContactDto> RelatedUserContacts { get; set; } 
    }

_CreateOrEditModal.cshtml

@model CreateOrEditUserModalViewModel

...
<div id="UserContacts" name="userContacts">
                    <div class="form-group m-form__group" id="UserContacts">
                        <label>@L("UserContacts")</label>
                        <div data-repeater-list="UserContacts" class="col-lg-10">
                            @foreach (var userContact in Model.RelatedUserContacts)
                            {
                                <div data-repeater-item class="form-group m-form__group row align-items-center">
                                    <div class="col-md-4">
                                        <input type="hidden" name="Id" value="@userContact.Id" />
                                        <div class="m-form__group m-form__group--inline">
                                            <div class="m-form__label">
                                                <label>@L("ContactName"):</label>
                                            </div>
                                            <div class="m-form__control">
                                                <input id="ContactName" type="text" name="contactName" value="@userContact.ContactName" class="form-control m-input">
                                            </div>
                                        </div>
                                        <div class="d-md-none m--margin-bottom-10"></div>
                                    </div>
                                    <div class="col-md-4">
                                        <div class="m-form__group m-form__group--inline">
                                            <div class="m-form__label">
                                                <label class="m-label m-label--single">@L("ContactPhone"):</label>
                                            </div>
                                            <div class="m-form__control">
                                                <input id="ContactPhone" type="text" name="contactPhone" value="@userContact.ContactPhone" class="form-control m-input">
                                            </div>
                                        </div>
                                        <div class="d-md-none m--margin-bottom-10"></div>
                                    </div>
                                    <div class="col-md-4">
                                        <div data-repeater-delete="" class="btn-sm btn btn-danger m-btn m-btn--icon m-btn--pill">
                                            <span>
                                                <i class="la la-trash-o"></i>
                                                <span>@L("Delete")</span>
                                            </span>
                                        </div>
                                    </div>
                                </div>
                            }
                        </div>
                    </div>
                    <div class="m-form__group form-group row">
                        <label class="col-lg-2 col-form-label"></label>
                        <div class="col-lg-4">
                            <div data-repeater-create="" class="btn btn btn-sm btn-brand m-btn m-btn--icon m-btn--pill m-btn--wide">
                                <span>
                                    <i class="la la-plus"></i>
                                    <span>Add</span>
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
                ...

_CreateOrEditModal.js

            ...
            $("#UserContacts").repeater({
                initEmpty: false,
                show: function () {
                    $(this).slideDown()
                },
                hide: function (e) {
                    $(this).slideUp(e)
                }
            })
            ...
            
            this.save = function () {
            ...
            _userService.createOrUpdateUser({
                user: user,
                assignedRoleNames: assignedRoleNames,
                sendActivationEmail: user.SendActivationEmail,
                SetRandomPassword: user.SetRandomPassword,
                organizationUnits: _organizationTree.getSelectedOrganizations(),
                relatedUserContacts: JSON.stringify(user.UserContacts)
            }).done(function () {
                ...
            }).always(function () {
                ...
            });
        };

Firstly, I know the description a little bit long but I am confused and stuck. Thanks.

Hi, The problem before I wrote that Default Tenancy Code Name not change. When I add that code in the Tenant.cs file public new const string DefaultTenantName = "NewDefaultTenantName";

My process, Add related code in Tenan.cs (.Core/MultiTenancy/Tenant.cs) *Update-Database (First Time) *Login as Admin *Then Default Tenant comes again.

By the way, my project ASP.NET Core + Jquery

Thanks.

Dear ASP.NET ZERO Support Team,

Is it possible to change Default "Tenancy Code Name" I also check the question #2767 This way not working.

Thanks.

Showing 1 to 10 of 10 entries