Exemple #1
0
        public ObservableCollection <PersonModel> AllPossibleFathers()
        {
            IObjectContainer db = Db4oFactory.OpenFile("person.data");
            ObservableCollection <PersonModel> possibleFathers = new ObservableCollection <PersonModel>();
            var allMenInDatabase = db.QueryByExample(new PersonModel(EGender.Male));

            foreach (var man in allMenInDatabase)
            {
                possibleFathers.Add((PersonModel)man);
            }
            db.Close();
            possibleFathers = PossibleFathersHelper.RemovePossiblyWrongImportedFathers(possibleFathers);
            if (BirthDate != null)
            {
                possibleFathers = PossibleFathersHelper.RemovePossiblyFathersWithWrongAge(possibleFathers, BirthDate.Value);
            }
            return(possibleFathers);
        }
Exemple #2
0
        public BindableCollection <PersonModel> AllPossibleFathers(PersonModel selectedPerson, DateTime birthDate)
        {
            IObjectContainer db = Db4oFactory.OpenFile("person.data");
            BindableCollection <PersonModel> possibleFathers = new BindableCollection <PersonModel>();
            var allMenInDatabase = db.QueryByExample(new PersonModel(EGender.Male));

            foreach (var man in allMenInDatabase)
            {
                possibleFathers.Add((PersonModel)man);
            }
            db.Close();
            possibleFathers = PossibleFathersHelper.RemovePossiblyWrongImportedFathers(possibleFathers) as BindableCollection <PersonModel>;
            if (selectedPerson != null)
            {
                possibleFathers = PossibleFathersHelper.RemovePossiblyFathersWithWrongAge(possibleFathers, birthDate) as BindableCollection <PersonModel>;
                possibleFathers = PossibleFathersHelper.RemoveDescendantsFromPossibleFathers(possibleFathers, selectedPerson) as BindableCollection <PersonModel>;
            }
            possibleFathers.Add(new PersonModel("-brak-"));
            return(possibleFathers);
        }