コード例 #1
0
        private DateTime CalculateToDate(TenantEntity tenant, DateTime today)
        {
            var toDate = UseFullPeriod ? GetPeriodEndDate(tenant, today) : today;

            if (tenant.VacatingBefore(toDate))
            {
                toDate = tenant.VacatingDate.AsDateOnly();
            }

            return toDate;
        }
コード例 #2
0
        public int CalculateDays(TenantEntity tenant)
        {
            DateTime today = Today();

            DateTime fromDate = CalculateFromDate(tenant, today);
            DateTime toDate = CalculateToDate(tenant, today);

            var days =  (toDate - fromDate).Days;

            return days - tenant.CreditedDays;
        }
コード例 #3
0
 private static DateTime GetPeriodEndDate(TenantEntity tenant, DateTime today)
 {
     var rentalPeriod = tenant.GetRentalPeriod();
     return rentalPeriod.CalculateNextPeriodEndDateFrom(today);
 }
コード例 #4
0
 private static DateTime CalculateFromDate(TenantEntity tenant, DateTime today)
 {
     return tenant.PaidTo == null ? today : tenant.PaidTo.AsDateOnly();
 }