public IEnumerator <IndividualClass> SearchPerson(String individualName, IProgressReporterInterface progressReporter = null) { IEnumerator <IndividualClass> enumerator = individualList.Values.GetEnumerator(); string searchName = ""; ProgressReporterClass progress = new ProgressReporterClass(individualList.Count); int i = 0; if (individualName != null) { searchName = individualName.ToUpper(); } trace.TraceInformation("SearchPerson()"); while (enumerator.MoveNext()) { String name = enumerator.Current.GetName().ToUpper(); if (progressReporter != null) { if (progress.Update(i++)) { progressReporter.ReportProgress(progress.GetPercent()); } } if (name != null) { if (name.Contains(searchName)) { yield return(enumerator.Current); } } else { yield return(enumerator.Current); } } trace.TraceInformation("SearchPerson(" + searchName + ") done"); }
public IEnumerator <NoteClass> SearchNote(String noteString = null, IProgressReporterInterface progressReporter = null) { IEnumerator <NoteClass> enumerator = noteList.Values.GetEnumerator(); ProgressReporterClass progress = new ProgressReporterClass(noteList.Count); int i = 0; trace.TraceInformation("SearchNote()"); while (enumerator.MoveNext()) { if (progressReporter != null) { if (progress.Update(i++)) { progressReporter.ReportProgress(progress.GetPercent()); } } if (noteString != null) { String noteStr = enumerator.Current.note; if (noteStr != null) { if (noteStr.Contains(noteString)) { yield return(enumerator.Current); } } } else { yield return(enumerator.Current); } } trace.TraceInformation("SearchNote(" + noteString + "): null"); }
public IEnumerator <FamilyClass> SearchFamily(String familyXrefName = null, IProgressReporterInterface progressReporter = null) { IEnumerator <FamilyClass> enumerator = familyList.Values.GetEnumerator();; ProgressReporterClass progress = new ProgressReporterClass(familyList.Count); int i = 0; trace.TraceInformation("SearchFamily()"); while (enumerator.MoveNext()) { if (progressReporter != null) { if (progress.Update(i++)) { progressReporter.ReportProgress(progress.GetPercent()); } } if (familyXrefName != null) { String name = enumerator.Current.GetXrefName(); if (name != null) { if (name.Contains(familyXrefName)) { yield return(enumerator.Current); } } } else { yield return(enumerator.Current); } } trace.TraceInformation("SearchFamily(" + familyXrefName + "): null"); }
public IEnumerator <SubmitterClass> SearchSubmitter(String submitterString = null, IProgressReporterInterface progressReporter = null) { IEnumerator <SubmitterClass> enumerator = submitterList.Values.GetEnumerator(); ProgressReporterClass progress = new ProgressReporterClass(submitterList.Count); int i = 0; while (enumerator.MoveNext()) { if (progressReporter != null) { if (progress.Update(i++)) { progressReporter.ReportProgress(progress.GetPercent()); } } if (submitterString != null) { String submitterStr = enumerator.Current.GetName(); if (submitterStr != null) { if (submitterStr.Contains(submitterString)) { yield return(enumerator.Current); } } } else { yield return(enumerator.Current); } } trace.TraceInformation("SearchSubmitter(" + submitterString + "): null"); }
public IEnumerator <SubmissionClass> SearchSubmission(String submissionString = null, IProgressReporterInterface progressReporter = null) { return(null); }
public IEnumerator <SourceClass> SearchSource(String sourceString = null, IProgressReporterInterface progressReporter = null) { return(null); }
public IEnumerator <RepositoryClass> SearchRepository(String repositoryString = null, IProgressReporterInterface progressReporter = null) { return(null); }
public IEnumerator <MultimediaObjectClass> SearchMultimediaObject(String mmoString = null, IProgressReporterInterface progressReporter = null) { return(null); }
public static void CompareTrees(IFamilyTreeStoreBaseClass familyTree1, IFamilyTreeStoreBaseClass familyTree2, ReportCompareResult reportDuplicate, IProgressReporterInterface reporter = null) { IEnumerator <IndividualClass> iterator1; int cnt1 = 0; NameEquivalenceDb equivDb = NameEquivalenceDb.LoadFile(NameEquivalenceDb.GetDefaultFilePath()); if (equivDb == null) { equivDb = new DefaultNameEquivalenceDb(); equivDb.LoadDefault(); bool result = NameEquivalenceDb.SaveFile(NameEquivalenceDb.GetDefaultFilePath(), equivDb); if (!result) { trace.TraceData(TraceEventType.Warning, 0, "File db write failed"); } else { trace.TraceData(TraceEventType.Information, 0, "File db write ok"); } } iterator1 = familyTree1.SearchPerson(null, reporter); trace.TraceData(TraceEventType.Information, 0, "CompareTrees() started"); if (iterator1 != null) { do { IndividualClass person1 = iterator1.Current; cnt1++; if (person1 != null) { trace.TraceData(TraceEventType.Information, 0, " 1:" + cnt1 + " " + person1.GetName()); SearchDuplicates(person1, familyTree1, familyTree2, reportDuplicate, reporter, equivDb); } else { trace.TraceData(TraceEventType.Warning, 0, " 1: person is null" + cnt1); } } while (iterator1.MoveNext()); iterator1.Dispose(); } else { trace.TraceInformation("iter=null"); } trace.TraceInformation("CompareTrees() done"); }
public static void SearchDuplicates(IndividualClass person1, IFamilyTreeStoreBaseClass familyTree1, IFamilyTreeStoreBaseClass familyTree2, ReportCompareResult reportDuplicate, IProgressReporterInterface reporter = null, NameEquivalenceDb nameEqDb = null) { IndividualEventClass birth = person1.GetEvent(IndividualEventClass.EventType.Birth); IndividualEventClass death = person1.GetEvent(IndividualEventClass.EventType.Death); if (reporter != null) { trace.TraceInformation(reporter.ToString()); } if (((birth != null) && (birth.GetDate() != null) && (birth.GetDate().ValidDate())) || ((death != null) && (death.GetDate() != null) && (death.GetDate().ValidDate()))) { string searchString; if (familyTree2.GetCapabilities().jsonSearch) { searchString = SearchDescriptor.ToJson(SearchDescriptor.GetSearchDescriptor(person1)); } else { searchString = person1.GetName().Replace("*", ""); } IEnumerator <IndividualClass> iterator2 = familyTree2.SearchPerson(searchString); int cnt2 = 0; if (iterator2 != null) { int cnt3 = 0; do { IndividualClass person2 = iterator2.Current; if (person2 != null) { cnt3++; //trace.TraceInformation(reporter.ToString() + " 2:" + person2.GetName()); if ((familyTree1 != familyTree2) || (person1.GetXrefName() != person2.GetXrefName())) { if (ComparePerson(person1, person2, nameEqDb)) { trace.TraceData(TraceEventType.Information, 0, " 2:" + person2.GetName() + " " + person1.GetXrefName() + " " + person2.GetXrefName()); reportDuplicate(familyTree1, person1.GetXrefName(), familyTree2, person2.GetXrefName()); } cnt2++; } } } while (iterator2.MoveNext()); iterator2.Dispose(); trace.TraceInformation(" " + searchString + " matched with " + cnt2 + "," + cnt3); } if (cnt2 == 0) // No matches found for full name { if ((person1.GetPersonalName().GetName(PersonalNameClass.PartialNameType.BirthSurname).Length > 0) && (person1.GetPersonalName().GetName(PersonalNameClass.PartialNameType.Surname).Length > 0) && !person1.GetPersonalName().GetName(PersonalNameClass.PartialNameType.Surname).Equals(person1.GetPersonalName().GetName(PersonalNameClass.PartialNameType.BirthSurname))) { String strippedName = person1.GetName().Replace("*", ""); if (strippedName.Contains(person1.GetPersonalName().GetName(PersonalNameClass.PartialNameType.Surname))) { String maidenName = strippedName.Replace(person1.GetPersonalName().GetName(PersonalNameClass.PartialNameType.Surname), "").Replace(" ", " "); IEnumerator <IndividualClass> iterator3 = familyTree2.SearchPerson(maidenName); //trace.TraceInformation(" Searching Maiden name " + maidenName); if (iterator3 != null) { int cnt3 = 0; do { IndividualClass person2 = iterator3.Current; if (person2 != null) { if ((familyTree1 != familyTree2) || (person1.GetXrefName() != person2.GetXrefName())) { cnt3++; if (ComparePerson(person1, person2, nameEqDb)) { trace.TraceData(TraceEventType.Information, 0, " 2b:" + person2.GetName()); reportDuplicate(familyTree1, person1.GetXrefName(), familyTree2, person2.GetXrefName()); } } } } while (iterator3.MoveNext()); iterator3.Dispose(); trace.TraceInformation(" Maiden name " + maidenName + " mathched with " + cnt3); } } if (strippedName.Contains(person1.GetPersonalName().GetName(PersonalNameClass.PartialNameType.BirthSurname))) { String marriedName = strippedName.Replace(person1.GetPersonalName().GetName(PersonalNameClass.PartialNameType.BirthSurname), "").Replace(" ", " "); IEnumerator <IndividualClass> iterator3 = familyTree2.SearchPerson(marriedName); //trace.TraceInformation(" Searching Married name " + marriedName); if (iterator3 != null) { int cnt3 = 0; do { //IndividualClass person1 = iterator1.Current; IndividualClass person2 = iterator3.Current; if (person2 != null) { //trace.TraceInformation(reporter.ToString() + " 2:" + person2.GetName()); if ((familyTree1 != familyTree2) || (person1.GetXrefName() != person2.GetXrefName())) { cnt3++; if (ComparePerson(person1, person2, nameEqDb)) { trace.TraceData(TraceEventType.Information, 0, " 2c:" + person2.GetName()); reportDuplicate(familyTree1, person1.GetXrefName(), familyTree2, person2.GetXrefName()); } } } } while (iterator3.MoveNext()); iterator3.Dispose(); trace.TraceInformation(" Married name " + marriedName + " matched to " + cnt3); } } } } } else { trace.TraceData(TraceEventType.Information, 0, "No valid birth or death date for " + person1.GetName().ToString() + " skip duplicate search"); } }