Example #1
0
        public void CalculateAge()
        {
            TimeSpan age   = DateTime.Now - Birthdate;
            int      years = DateTime.Now.Year - Birthdate.Year;

            if (Birthdate.AddYears(years) > DateTime.Now)
            {
                years--;
            }

            Age = years;
        }
Example #2
0
        /// <summary>
        /// Checks if the resource delegate has expired.
        /// </summary>
        /// <param name="resourceHDID">The resource hdid.</param>
        /// <returns>True if expired, false otherwise.</returns>
        private bool IsExpired(string resourceHDID)
        {
            if (!this.maxDependentAge.HasValue)
            {
                this.logger.LogInformation($"Delegate expired check on resource {resourceHDID} skipped as max dependent age is null");
                return(false);
            }

            RequestResult <PatientModel> patientResult = Task.Run(async() =>
            {
                return(await this.patientService.GetPatient(resourceHDID, PatientIdentifierType.HDID).ConfigureAwait(true));
            }).Result;

            return(patientResult.ResourcePayload !.Birthdate.AddYears(this.maxDependentAge.Value) < DateTime.Now);
        }