Пример #1
0
        public CensusFamily(Family f, CensusDate censusDate)
            : base(f)
        {
            BaseFamily   = f;
            CensusDate   = censusDate;
            BestLocation = null;
            int position = 1;

            if (f.Wife != null)
            {
                Wife = new CensusIndividual(position++, f.Wife, this, CensusIndividual.WIFE);
            }

            if (f.Husband != null)
            {
                Husband = new CensusIndividual(position++, f.Husband, this, CensusIndividual.HUSBAND);
            }
            Children = new List <CensusIndividual>();
            foreach (Individual child in f.Children)
            {
                CensusIndividual toAdd = new CensusIndividual(position++, child, this, CensusIndividual.CHILD);
                Children.Add(toAdd);
            }
            FamilyChildren = new List <CensusIndividual>(Children); // Family children is all children alive or dead at census date
        }
Пример #2
0
        private bool IsValidIndividual(CensusIndividual indiv, bool censusDone, bool parentCheck, bool checkCensus)
        {
            if (indiv == null)
            {
                return(false);
            }
            DateTime     birth        = indiv.BirthDate.StartDate;
            DateTime     death        = indiv.DeathDate.EndDate;
            FactLocation bestLocation = indiv.BestLocation(CensusDate);

            if (birth <= CensusDate.StartDate && death >= CensusDate.StartDate)
            {
                if ((checkCensus && indiv.IsCensusDone(CensusDate) == censusDone && !indiv.OutOfCountry(CensusDate)) || !checkCensus)
                {
                    if (parentCheck) // Husband or Wife with valid date range
                    {
                        return(true);
                    }
                    else // individual is a child so remove if married before census date
                    {
                        return(!indiv.IsMarried(CensusDate));
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Пример #3
0
        public override int Compare(CensusIndividual x, CensusIndividual y)
        {
            int r = x.CensusSurname.CompareTo(y.CensusSurname);

            if (r == 0)
            {
                r = base.Compare(x, y);
            }
            return(r);
        }
        public override int Compare(CensusIndividual x, CensusIndividual y)
        {
            int r = string.Compare(x.CensusSurname, y.CensusSurname, StringComparison.Ordinal);

            if (r == 0)
            {
                r = base.Compare(x, y);
            }
            return(r);
        }
        public override int Compare(CensusIndividual r1, CensusIndividual r2)
        {
            FactLocation l1   = r1.CensusLocation;
            FactLocation l2   = r2.CensusLocation;
            int          comp = l1.CompareTo(l2, level);

            if (comp == 0)
            {
                comp = base.Compare(r1, r2);
            }
            return(comp);
        }
Пример #6
0
        bool IsValidIndividual(CensusIndividual indiv, bool censusDone, bool parentCheck, bool checkCensus)
        {
            if (indiv is null)
            {
                return(false);
            }

            DateTime     birth        = indiv.BirthDate.StartDate;
            DateTime     death        = indiv.DeathDate.EndDate;
            FactLocation bestLocation = indiv.BestLocation(CensusDate);

            if (birth <= CensusDate.StartDate && death >= CensusDate.StartDate)
            {
                if ((checkCensus && indiv.IsCensusDone(CensusDate) == censusDone && !indiv.OutOfCountry(CensusDate)) || !checkCensus)
                {
                    return(parentCheck || !indiv.IsMarried(CensusDate));
                }
                return(false);
            }
            return(false);
        }