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

Activities of "rvanwoezik"

Hi, excuse me for maybe a stupid question, but i have created an modal.component like the create-or-edit-user-modal.component which i open from dropdown in datatable

<div class="btn-group dropdown" normalizePosition>
                                 <button class="dropdown-toggle btn btn-sm btn-primary"
                                                    data-toggle="dropdown"
                                                    aria-haspopup="true"
                                                    aria-expanded="false">
                                                <i class="fa fa-cog"></i><span class="caret"></span> {{l("Actions")}}
                                            </button>
                                            <ul class="dropdown-menu">
                                                <li>
                                                    <a *ngIf="permission.isGranted('Pages.Tenant.Hrm.Employees.Edit')"
                                                       (click)="editEmployeeModal.show(record.id)">{{l('Edit')}}</a>
                                                </li>
                                               
                                            </ul>
                                        </div>

And in my edit-employee-modal.component.ts

show(employeeId?: number): void {
        this._employeeService.getEmployeeForEdit(employeeId).subscribe(employeeResult => {
            this.employee = employeeResult.employee;

            this.getProfilePicture(employeeResult.profilePictureId);

        });
    }

My application layer returns the correct EmployeeEditDto but my Modal doesn't open, no errors in browser console nothing.

What am i missing? How can i debug the show?

I've found it, with help from [https://docs.microsoft.com/en-us/ef/core/modeling/owned-entities#mapping-owned-types-with-table-splitting])

Removing CreationAuditedEntity<long> from the Owned class PhysicalAddress and PostalAddress is the fix.

<cite>alper: </cite> weird! how about declaring those properties in the DbContext

modelBuilder.Entity<User>(u=>
{     
   u.HasOne(e => e.HomeAddress)
       .HasForeignKey(e => e.HomeAddressId);

   u.HasOne(e => e.PostalAddress)
       .HasForeignKey(e => e.PostalAddressId);
}

What i have now, which works in EF Core 2.0 is

modelBuilder.Entity<User>(b =>
            {
                b.OwnsOne(u => u.HomeAddress);
                b.OwnsOne(u => u.PostalAddress);
            });

Here is extension of user class:

...
  public virtual MaritalStatusType MaritalStatus { get; set; }

  public virtual PhysicalAddress HomeAddress { get; set; }

  public virtual PostalAddress PostalAddress { get; set; }

And here is my PhysicalAddress class

[Table("PhysicalAddresses")]
    public class PhysicalAddress : CreationAuditedEntity<long>
    {
        public const int MaxStreetNameLength = 64;
        public const int MaxStateOrProvinceLength = 2;
        public const int MaxPostCodeLength = 7;
        public const int MaxCityNameLength = 32;

        [Required]
        [MaxLength(MaxCityNameLength)]
        public virtual string City { get; set; }

        [Required]
        [MaxLength(MaxStreetNameLength)]
        public virtual string Street { get; set; }

        [Required]
        [MaxLength(MaxPostCodeLength)]
        public virtual string PostalCode { get; set; }

        public virtual string Number { get; set; }

        [MaxLength(MaxStateOrProvinceLength)]
        public virtual string StateOrProvince { get; set; }

        public virtual string Latitude { get; set; }

        public virtual string Longitude { get; set; }

        [NotMapped]
        public virtual string StreetAddress => (this.Street + ' ' + this.Number).TrimEnd();

        public PhysicalAddress()
        {
        }

        public PhysicalAddress(string city, string street, string number, string postalCode, string stateOrProvince)
        {
            City = city;
            Street = street;
            Number = number;
            PostalCode = postalCode;
            StateOrProvince = stateOrProvince;
        }
    }

Same db, same code only EF Core is newer

Hi, I've extended User with HomeAddress, in EF core 2.0 i load the related entity like this:

var query = UserManager.Users
                .Include(e => e.HomeAddress)
                .Include(e => e.PostalAddress)
                .WhereIf(
                    !input.Filter.IsNullOrWhiteSpace(),
                    u =>
                        u.Name.Contains(input.Filter) ||
                        u.Surname.Contains(input.Filter) ||
                        u.UserName.Contains(input.Filter) ||
                        u.EmailAddress.Contains(input.Filter)
                );

Now in EF Core 2.1 my HomeAddress is empty. What am i forgetting? Thanks in advance

I'm updating my project from Jquery to Angular and i have a usergrid like this:

<div class="col-lg-3 col-md-4 col-sm-6 col-xs-12" *ngFor="let user of coworkers">
                            <div class="mt-card-item">
                                <div class="mt-card-content">
                                    <img src="/Profile/GetProfilePictureById?id={{user.profilePictureId}}" class="card-img" />
                                    <p></p>
                                    <h3 class="mt-card-name">{{user.preferredFullName}}</h3>
                                    <h3 class="mt-card-desc m--font-warning"><i class="m-nav__link-icon la la-phone"></i> {{user.phoneNumber}}</h3>
                                    <h3 class="mt-card-desc m--font-primary">Toestel: {{user.phoneExtension}}</h3>
                                    <h4 class="mt-card-desc m--font-info"><i class="m-nav__link-icon la la-home"></i> {{user.homeAddress.city}}</h4>
                                    <p class="mt-card-desc font-grey-mint">{{user.jobTitle}}</p>
                                </div>
                            </div>
                        </div>

Problem is that profilepicture is not shown, how to show profilepicture in a foreach loop?

Thnx! A RTFM situation!

Is it possible to search in soft-deleted users only?

Oops, found it: gulp --prod + refresh cache

i've just updated to 5.2 Mvc/jquery and now datatables are not working. Please advice

Showing 101 to 110 of 179 entries