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

Activities of "rvanwoezik"

Thanx!

Thnx! you are the best!

I'm sorry, but i don't know what you mean? You mean live database?

I have about 75 clinics in my database, clinic is an extension of organizationunit. i have added Address, Phone etc. All crud operations work from application layer.

` public class ClinicClosedCheckWorker : PeriodicBackgroundWorkerBase, ISingletonDependency { private const int CheckPeriodAsMilliseconds = 1 * 60 * 60 * 24 * 1000; //1 day

    private readonly IRepository<Clinic, long> _clinicRepository;
    private readonly OrganizationUnitManager _organizationUnitManager;


    public ClinicClosedCheckWorker(
        AbpTimer timer,
        IRepository<Clinic, long> clinicRepository,
        OrganizationUnitManager organizationUnitManager
        ) : base(timer)
    {
        _clinicRepository = clinicRepository;
        _organizationUnitManager = organizationUnitManager;
        Timer.Period = CheckPeriodAsMilliseconds;
        Timer.RunOnStart = true;

        LocalizationSourceName = PhoogleConsts.LocalizationSourceName;

    }

    protected override void DoWork()
    {
        var utcNow = Clock.Now.ToUniversalTime();

        var closedClinics = _clinicRepository.GetAllList(
            clinic => clinic.ClosingDate != null);
            
        
        foreach (var clinic in closedClinics)
        {
            try
            {
                if (clinic.ClosingDate <= utcNow)
                {
                    _organizationUnitManager.Delete(clinic.Id);
                }

            }
            catch (Exception exception)
            {
                Logger.Error($"Clinic is gesloten maar kan niet worden verwijderd");
                Logger.Error(exception.Message, exception);
            }
            
        }

    }
}

`

:-) ofcourse

Looks great guys! Well done!

Thanks, I fixed it with

html

<input type="text" class="form-control" bsDatepicker [bsValue]="bsValue" [(ngModel)]="employee.dateOfBirth" />

and in ts

show(employeeId?: number): void {
        this._employeeService.getEmployeeForEdit(employeeId).subscribe(employeeResult => {
            this.employee = employeeResult.employee;
            this.jobTitles = employeeResult.jobTitles;
            this.getProfilePicture(employeeResult.profilePictureId);
            this.bsValue = moment(this.employee.dateOfBirth, 'YYYY-MM-DD').toDate();
            this.active = true;
            this.modal.show();

        });

    }

<cite>yekalkan: </cite> Adding the lines below to show method may help.

this.active = true;
  this.modal.show();

Thanks! that was stupid ;-)

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;
        }
    }
Showing 51 to 60 of 110 entries