示例#1
0
        public DateTime?GetDateTimeFromModel(PersonWithMetadata nextPerson, string value)
        {
            if (!nextPerson.Person.DateOfBirth.HasValue)
            {
                return(null);
            }

            var diffPercent = !string.IsNullOrEmpty(value) ? DateDifference[value].Sample(nextPerson.Randy) : (DateDifference.ContainsKey(_novalue) ? DateDifference[_novalue].Sample(nextPerson.Randy) : DateDifference[string.Empty].Sample(nextPerson.Randy));

            if (!diffPercent.HasValue)
            {
                return(null);
            }

            var recreatedDatestatus = (int)Math.Round((diffPercent.Value / 100.0) * CommonFunctions.GetAge(nextPerson.Person.DateOfBirth.Value) + nextPerson.Person.DateOfBirth.Value.Year);

            return(NinModel.GetBirthday(DateTime.Now.Year - recreatedDatestatus, nextPerson.Randy));
        }
示例#2
0
        public void SetProperties(PersonWithMetadata person)
        {
            var howManyAdressObjects = _model.Statistics.AdressStatistics.NumberOfAdressObjects.Sample(person.Randy);

            if (!howManyAdressObjects.HasValue || howManyAdressObjects == 0)
            {
                return;
            }

            if (person.Person.Addresses == null)
            {
                person.Person.Addresses = new Address[howManyAdressObjects.Value];
            }

            for (int i = 0; i < howManyAdressObjects; i++)
            {
                var adressObject = GetAdressObject(person);
                if (i == 0)
                {
                    adressObject.CurrentAddress = true;
                }

                adressObject.PostalType     = _model.Statistics.AdressStatistics.PostalType.Sample(person.Randy);
                adressObject.DatePostalType = adressObject.PostalType.HasValue && _adressStatistics.HasDatePostalPlace.Sample(person.Randy) ? DateTime.Now.AddDays(person.Randy.Next(500)) : (DateTime?)null;

                if (_model.Statistics.AdressStatistics.HasDateAdrFrom.Sample(person.Randy))
                {
                    adressObject.DateAdrFrom = NinModel.GetBirthday(person.Randy.Next(person.GetAge()), person.Randy);
                }

                if (person.HasDnummer)
                {
                    adressObject.St = GetRekvirentKode(person.Randy);
                }

                adressObject.NIN           = person.Person.NIN;
                person.Person.Addresses[i] = adressObject;
            }

            ReplacePostalcodeForSammenslaatteKommuner(person.Person);
        }