public bool ValidateIndividuals() { int errorNo = 0; int count = 0; int progressTickSize = individualList.Count / 100; IEnumerator <IndividualClass> enumerator = individualList.Values.GetEnumerator(); ValidationData validationData; validationData = new ValidationData(); while (enumerator.MoveNext()) { IndividualClass indi = enumerator.Current; if (!indi.Validate(this, ref validationData)) { errorNo++; } count++; } if (validationData != null) { trace.TraceInformation("Validated: " + validationData.familyNo + " families, " + validationData.submitterNo + " submitters, :" + validationData.individualNo + " individuals, " + validationData.noteNo + " notes"); } trace.TraceInformation("ValidateIndividuals: " + errorNo + " errors of " + individualList.Count + " validations."); validationData = null; return(true); }
void AddPersonToListView(IndividualClass person) { string birthAddress = ""; string deathAddress = ""; IndividualEventClass birthEv = person.GetEvent(IndividualEventClass.EventType.Birth); if (birthEv != null) { AddressClass address = birthEv.GetAddress(); if (address != null) { birthAddress = address.ToString(); } } IndividualEventClass deathEv = person.GetEvent(IndividualEventClass.EventType.Death); if (deathEv != null) { AddressClass address = deathEv.GetAddress(); if (address != null) { deathAddress = address.ToString(); } } ListViewItem item = new ListViewItem(person.GetName()); item.SubItems.AddRange(new string[] { person.GetDate(IndividualEventClass.EventType.Birth).ToString(), birthAddress, person.GetDate(IndividualEventClass.EventType.Death).ToString(), deathAddress }); item.Tag = person.GetXrefName(); resultList.Items.Add(item); }
void AddItemToListView(AncestorLineInfo ancestor, SanityCheckLimits limits) { IndividualClass person = familyTree.GetIndividual(ancestor.rootAncestor); if (person != null) { trace.TraceInformation(" " + ancestor.depth + " generations: " + person.GetName() + " " + person.GetDate(IndividualEventClass.EventType.Birth) + " - " + person.GetDate(IndividualEventClass.EventType.Death)); ListViewItem oldItem = resultList.FindItemWithText(person.GetName()); if (oldItem != null) { if (oldItem.Tag.ToString() == ancestor.rootAncestor) { resultList.Items.Remove(oldItem); } } string detailString = ancestor.GetDetailString(limits); if (detailString.Length > 0) { ListViewItem item = new ListViewItem(person.GetName()); item.SubItems.AddRange(new string[] { ancestor.depth.ToString(), ancestor.relationPath.GetDistance(), person.GetDate(IndividualEventClass.EventType.Birth).ToString(), person.GetDate(IndividualEventClass.EventType.Death).ToString(), detailString }); item.ToolTipText = ancestor.relationPath.ToString(familyTree, false); item.Tag = person.GetXrefName(); resultList.Items.Add(item); } //list.Items. } else { trace.TraceEvent(TraceEventType.Error, 0, " Error could not fetch " + ancestor.rootAncestor + " from tree " + ancestor.depth + " generations " + ancestor.GetDetailString(limits)); } }
void CheckF2iReferences(ref IndividualClass individual) { if (parentsF2iReference.ContainsKey(individual.GetXrefName())) { IList <string> spouses = parentsF2iReference[individual.GetXrefName()]; if (spouses.Count > individual.GetFamilySpouseList().Count) { trace.TraceData(TraceEventType.Verbose, 0, individual.GetXrefName() + " missing spouse to individual " + spouses.Count + " > " + individual.GetFamilySpouseList().Count); foreach (string parent in spouses) { individual.AddRelation(new FamilyXrefClass(parent), IndividualClass.RelationType.Spouse); trace.TraceData(TraceEventType.Verbose, 0, individual.GetXrefName() + " adding spouse-family to individual " + parent + " to " + individual.GetName()); } } } if (childrenI2fReference.ContainsKey(individual.GetXrefName())) { IList <string> children = childrenI2fReference[individual.GetXrefName()]; if (children.Count > individual.GetFamilyChildList().Count) { trace.TraceData(TraceEventType.Verbose, 0, individual.GetXrefName() + " missing child-family in individual " + children.Count + " > " + individual.GetFamilyChildList().Count); foreach (string child in children) { individual.AddRelation(new FamilyXrefClass(child), IndividualClass.RelationType.Child); trace.TraceData(TraceEventType.Verbose, 0, individual.GetXrefName() + " adding child-family to individual " + child + " to " + individual.GetName()); } } } }
private void CheckPersonButton(string xref, int gen, bool force) { if (personControlList.ContainsKey(xref)) { IndividualButton personButton = personControlList[xref]; personButton.CheckPosition(force); if (personButton.individual != null) { IndividualClass person = personButton.individual; IList <FamilyXrefClass> parentList = person.GetFamilyChildList(); if (parentList != null) { foreach (FamilyXrefClass parentXref in parentList) { CheckFamilyButton(parentXref.GetXrefName(), gen + 1, force); } } } else { trace.TraceData(TraceEventType.Warning, 0, "Not yet cached person:" + gen + " " + xref); } } else { trace.TraceData(TraceEventType.Warning, 0, "Not buttoned person:" + gen + " " + xref); } }
void FormatPerson(IndividualClass person, bool html, StreamWriter exportFile) { if (!html) { exportFile.Write(UrlsToString(person)); exportFile.Write("\t"); exportFile.Write(person.GetName()); exportFile.Write("\t"); exportFile.Write(GetEventDateString(person, IndividualEventClass.EventType.Birth)); exportFile.Write("\t"); exportFile.Write(GetEventDateString(person, IndividualEventClass.EventType.Death)); exportFile.Write("\t"); } else { exportFile.Write("\n<td><a href=\""); exportFile.Write(UrlsToString(person)); exportFile.Write("\">"); exportFile.Write(person.GetName()); exportFile.Write(" ("); exportFile.Write(GetEventDateString(person, IndividualEventClass.EventType.Birth)); exportFile.Write(" - "); exportFile.Write(GetEventDateString(person, IndividualEventClass.EventType.Death)); exportFile.Write(")</a></td>\n"); } }
public static bool ComparePerson(IndividualClass person1, IndividualClass person2, NameEquivalenceDb nameEqDb) { if (IsNamesEqual(person1.GetName(), person2.GetName(), nameEqDb)) { IndividualEventClass birth1 = person1.GetEvent(IndividualEventClass.EventType.Birth); IndividualEventClass birth2 = person2.GetEvent(IndividualEventClass.EventType.Birth); IndividualEventClass death1 = person1.GetEvent(IndividualEventClass.EventType.Death); IndividualEventClass death2 = person2.GetEvent(IndividualEventClass.EventType.Death); DateMatch birthMatch = DateMatch.Unknown, deathMatch = DateMatch.Unknown; if ((birth1 != null) && (birth2 != null)) { birthMatch = MatchDates(birth1.GetDate(), birth2.GetDate()); } if ((death1 != null) && (death2 != null)) { deathMatch = MatchDates(death1.GetDate(), death2.GetDate()); } if ((birthMatch == DateMatch.Unknown) && (deathMatch == DateMatch.Unknown)) { return(false); } if ((birthMatch == DateMatch.Bad) || (deathMatch == DateMatch.Bad)) { return(false); } return((birthMatch == DateMatch.Good) || (deathMatch == DateMatch.Good)); } return(false); }
private void UpdateIndividualSync(string xref, IndividualClass person) { if (person == null) { trace.TraceData(TraceEventType.Error, 0, "Requested person is null!" + xref); return; } if (xref != person.GetXrefName()) { trace.TraceData(TraceEventType.Error, 0, "Requested person doesn't match response!" + xref + "!=" + person.GetXrefName()); } if (personThreadList.ContainsKey(xref)) { personThreadList.Remove(xref); } else { trace.TraceData(TraceEventType.Error, 0, "Individual thread not added!" + xref); } if (personControlList.ContainsKey(xref)) { if (person != null) { IndividualButton personButton = personControlList[xref]; UpdateIndividual(person, layout, ref personButton); } } else { trace.TraceData(TraceEventType.Error, 0, "Individual button not added!" + xref); } }
private void UpdateIndividual(IndividualClass person, TreeViewLayout layout, ref IndividualButton personButton, FamilyButton parentButton = null) { trace.TraceInformation("UpdateIndividual(" + person.GetXrefName() + "),gen:" + personButton.bLayout.generation + ",name:" + person.GetPersonalName().GetName()); if (personButton.individual == null) { personButton.individual = person; personButton.Refresh(); } if (!personButton.Visible) { if (!personButton.SetLayout(layout, parentButton)) { trace.TraceInformation("UpdateIndividual(" + person.GetXrefName() + "),gen:" + personButton.bLayout.generation + ")-aborted,hidden"); return; } } if (layout.VisibleButton(personButton.bLayout)) { if (layout.SearchChildren()) { UpdateFamilyList(person.GetFamilySpouseList(), personButton); } if (layout.SearchParents()) { UpdateFamilyList(person.GetFamilyChildList(), personButton); } trace.TraceInformation("UpdateIndividual(" + person.GetXrefName() + ", " + personButton.bLayout.generation + ")-done"); } else { trace.TraceInformation("UpdateIndividual(" + person.GetXrefName() + ", " + personButton.bLayout.generation + ") not visible generation => stop!"); } }
public override void OnSelectedPersonChangedEvent(object sender, PersonChangeEvent e) { if (familyTree != null) { selectedIndividual = e.selectedPerson; } }
public void DoWork(object sender, DoWorkEventArgs e) { string tXref = (string)e.Argument; if (familyTree != null) { trace.TraceData(TraceEventType.Information, 0, "Ask for person :" + tXref + " thread:" + Thread.CurrentThread.ManagedThreadId); IndividualClass person = familyTree.GetIndividual(tXref); if (person != null) { trace.TraceInformation("FindPersonThread(" + personXref + ")-done-ok"); if (person.GetXrefName() != tXref) { trace.TraceData(TraceEventType.Error, 0, "Wrong person found:" + person.GetXrefName() + "!=" + tXref + " thread:" + Thread.CurrentThread.ManagedThreadId); return; } personCallback(tXref, person); this.Dispose(); return; } } trace.TraceInformation("FindPersonThread(" + personXref + ")-failed"); personCallback(tXref, null); this.Dispose(); }
public bool UpdateIndividual(IndividualClass tempIndividual, PersonUpdateType updateType) { if (individualList.ContainsKey(tempIndividual.GetXrefName())) { IndividualClass updatePerson = individualList[tempIndividual.GetXrefName()]; if ((updateType & PersonUpdateType.ChildFamily) != 0) { updatePerson.SetFamilyChildList(tempIndividual.GetFamilyChildList()); } if ((updateType & PersonUpdateType.SpouseFamily) != 0) { updatePerson.SetFamilySpouseList(tempIndividual.GetFamilySpouseList()); } if ((updateType & PersonUpdateType.Name) != 0) { updatePerson.SetPersonalName(tempIndividual.GetPersonalName()); } if ((updateType & PersonUpdateType.Events) != 0) { updatePerson.SetEventList(tempIndividual.GetEventList()); } individualList[tempIndividual.GetXrefName()] = updatePerson; return(true); } else { trace.TraceEvent(TraceEventType.Error, 0, "Error: Can't update {0} as it is not in the database!", tempIndividual.GetXrefName()); } return(false); }
private void ReportMatchingProfiles(FamilyTreeStoreBaseClass familyTree1, string person1, FamilyTreeStoreBaseClass familyTree2, string person2) { IndividualClass person1full = familyTree1.GetIndividual(person1); IndividualClass person2full = familyTree2.GetIndividual(person2); resultReporterFunction(CreateListItem(familyTree1, person1full, familyTree2, person2full)); }
public IndividualButton(TreeViewPanel5 parent, IndividualClass individual, Point size, Font font) { this.parent = parent; this.individual = individual; this.Text = individual.GetName(); this.Font = font; if (size.Y > 15) { this.Text += "\n" + individual.GetDate(IndividualEventClass.EventType.Birth).ToString() + " - " + individual.GetDate(IndividualEventClass.EventType.Death).ToString(); } TextAlign = ContentAlignment.MiddleLeft; AutoEllipsis = true; details = new ToolTip(); //details.IsBalloon = true; FlatStyle = FlatStyle.Flat; //AutoSize = true; Anchor = AnchorStyles.Left | AnchorStyles.Top; Click += new System.EventHandler(Clicked); //BackColor = Color.Beige; //Margin = new Padding(-3,-3,-3,-3); //details.AutomaticDelay = 10000; details.AutoPopDelay = 600000; //string toolTip = ; details.SetToolTip(this, CreateToolString()); //details.ToolTipTitle = individual.GetName(); //details.ToolTipIcon = ToolTipIcon.Info; AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; AutoSize = false; Height = size.Y; Width = size.X; }
public static void CompareTrees(FamilyTreeStoreBaseClass familyTree1, FamilyTreeStoreBaseClass familyTree2, ReportCompareResult reportDuplicate, ProgressReporterInterface reporter = null) { IEnumerator <IndividualClass> iterator1; int cnt1 = 0; iterator1 = familyTree1.SearchPerson(null, reporter); trace.TraceInformation("CompareTrees() started"); if (iterator1 != null) { do { IndividualClass person1 = iterator1.Current; cnt1++; if (person1 != null) { trace.TraceInformation(" 1:" + person1.GetName()); SearchDuplicates(person1, familyTree1, familyTree2, reportDuplicate, reporter); } } while (iterator1.MoveNext()); iterator1.Dispose(); } else { trace.TraceInformation("iter=null"); } trace.TraceInformation("CompareTrees() done"); }
public static SearchDescriptor GetSearchDescriptor(IndividualClass person) { SearchDescriptor searchDescriptor = new SearchDescriptor(); searchDescriptor.FirstName = person.GetPersonalName().GetName(PersonalNameClass.PartialNameType.GivenName); searchDescriptor.LastName = person.GetPersonalName().GetName(PersonalNameClass.PartialNameType.Surname); searchDescriptor.BirthName = person.GetPersonalName().GetName(PersonalNameClass.PartialNameType.BirthSurname); if (searchDescriptor.BirthName.Length == 0) { searchDescriptor.BirthName = null; } IndividualEventClass birth = person.GetEvent(IndividualEventClass.EventType.Birth); if (!birth.badDate && birth.GetDate().ValidDate()) { DateTime date = birth.GetDate().ToDateTime(); searchDescriptor.BirthDate = date.ToString("yyyyMMdd"); } IndividualEventClass death = person.GetEvent(IndividualEventClass.EventType.Death); if (!death.badDate && death.GetDate().ValidDate()) { DateTime date = death.GetDate().ToDateTime(); searchDescriptor.DeathDate = date.ToString("yyyyMMdd"); } return(searchDescriptor); }
private void ShowSelectedPerson() { trace.TraceInformation("PersonViewPanel1::ShowSelectedPerson()"); foreach (CustomProperty property in propertyList) { property.Value = null; } if ((familyTree == null) || !this.Visible) { return; } if (selectedIndividual != null) { IndividualClass person = selectedIndividual; GetPersonProperties(person); } else { trace.TraceEvent(TraceEventType.Error, 0, "error no selected person"); } propertyGrid1.Refresh(); }
private void SetPersonProperties(ref IndividualClass person) { if (propertyList != null) { person.GetPersonalName().SetName(PersonalNameClass.PartialNameType.GivenName, propertyList[0].Value.ToString()); person.GetPersonalName().SetName(PersonalNameClass.PartialNameType.MiddleName, propertyList[1].Value.ToString()); person.GetPersonalName().SetName(PersonalNameClass.PartialNameType.Surname, propertyList[2].Value.ToString()); person.GetPersonalName().SetName(PersonalNameClass.PartialNameType.BirthSurname, propertyList[3].Value.ToString()); person.GetPersonalName().SetName(PersonalNameClass.PartialNameType.NameString, propertyList[4].Value.ToString()); person.GetPersonalName().SetName(PersonalNameClass.PartialNameType.PublicName, propertyList[5].Value.ToString()); switch ((PersonPropertySex)propertyList[SexIndex].Value) { case PersonPropertySex.Female: person.SetSex(IndividualClass.IndividualSexType.Female); break; case PersonPropertySex.Male: person.SetSex(IndividualClass.IndividualSexType.Male); break; case PersonPropertySex.Unknown: person.SetSex(IndividualClass.IndividualSexType.Unknown); break; } IList <IndividualEventClass> eventList = person.GetEventList(); familyTree.UpdateIndividual(person, PersonUpdateType.ChildFamily | PersonUpdateType.Events | PersonUpdateType.Name | PersonUpdateType.SpouseFamily); } else { trace.TraceEvent(TraceEventType.Error, 0, "error no proplist"); } }
public IndividualClass DecodeIndividual(HttpPerson person) { if (person != null) { IndividualClass individual = new IndividualClass(); PersonalNameClass name = new PersonalNameClass(); if (person.id != null) { individual.SetXrefName(person.id.Substring(8)); // skip "profile-" } if (person.first_name != null) { name.SetName(PersonalNameClass.PartialNameType.GivenName, person.first_name); } if (person.last_name != null) { name.SetName(PersonalNameClass.PartialNameType.Surname, person.last_name); } if (person.former_name != null) { name.SetName(PersonalNameClass.PartialNameType.BirthSurname, person.former_name); } name.SanityCheck(); individual.SetPersonalName(name); if (person.gender != null) { switch (person.gender) { case "male": individual.SetSex(IndividualClass.IndividualSexType.Male); break; case "female": individual.SetSex(IndividualClass.IndividualSexType.Female); break; } } if (person.birth_date != null) { FamilyDateTimeClass birthDate = new FamilyDateTimeClass( person.birth_date.gedcom); individual.AddEvent(new IndividualEventClass(IndividualEventClass.EventType.Birth, birthDate)); } if (person.death_date != null) { FamilyDateTimeClass deathDate = new FamilyDateTimeClass( person.death_date.gedcom); individual.AddEvent(new IndividualEventClass(IndividualEventClass.EventType.Death, deathDate)); } return(individual); } return(null); }
public IndividualControl4(IndividualClass individual) { //::InitializeComponent(); m_Individual = individual; Text = m_Individual.GetName(); trace.TraceInformation("indictrl: " + Text); }
public void SetSelectedIndividual(String xrefName) { trace.TraceInformation("CompletenessViewPanel1::SetSelectedIndividual(" + xrefName + ")"); if (familyTree != null) { selectedIndividual = (IndividualClass)familyTree.GetIndividual(xrefName); } }
public void SetIndividual(IndividualClass individual) { m_Individual = individual; Text = m_Individual.GetName(); trace.TraceInformation("indictrl4: set " + Text); this.Width = 100; this.Height = 100; }
public void ClickPerson(IndividualClass person) { selectedIndividual = person; if (parentForm != null) { parentForm.SetSelectedIndividual(person.GetXrefName()); } }
public void SetSelectedIndividual(String xrefName) { trace.TraceInformation("RelationFinderPanel::SetSelectedIndividual(" + xrefName + ")"); if (familyTree != null) { selectedIndividual = (IndividualClass)familyTree.GetIndividual(xrefName); } }
public bool AddIndividual(IndividualClass tempIndividual) { if (tempIndividual.GetXrefName().Length > 0) { individualList.Add(tempIndividual.GetXrefName(), tempIndividual); return(true); } return(false); }
public void ClickPerson(IndividualClass person) { trace.TraceInformation("TreeViewPanel5::SetSelectedIndividual(" + person + ")"); if (familyTree != null) { selectedIndividual = person; ShowActiveFamily(); } }
public void ClickPerson(IndividualClass person) { trace.TraceInformation("AsyncTreePanel1::SetSelectedIndividual(" + person + ")"); if (familyTree != null) { selectedIndividual = person; parentForm.SetSelectedIndividual(person.GetXrefName()); } }
public void HandleNewIndividual_Function(string xref, IndividualClass person) { if (InvokeRequired) { Invoke(new Action(() => UpdateIndividualSync(xref, person))); } else { UpdateIndividualSync(xref, person); } }
void AddToSearchResults(IndividualClass person) { if (resultList.InvokeRequired) { Invoke(new Action(() => AddPersonToListView(person))); } else { AddPersonToListView(person); } }
/*void ImageViewPanel1_Layout(object sender, LayoutEventArgs e) * { * if (printMode) * { * Debug.WriteLine("ImageViewPanel1::ImageViewPanel1_Layout()"); * } * * //visible = this.CanFocus; * * ShowActiveFamily(); * * }*/ /*void ImageViewPanel1_GotFocus(object sender, EventArgs e) * { * Debug.WriteLine("ImageViewPanel1::ImageViewPanel1_GotFocus()"); * } * * void ImageViewPanel1_Enter(object sender, EventArgs e) * { * Debug.WriteLine("ImageViewPanel1::ImageViewPanel1_Enter()"); * * }*/ private void OnSelectedPersonChangedEvent(object sender, SelectedPersonChangedEvent e) { if (familyTree != null) { selectedIndividual = e.selectedPerson; //visible = this.CanFocus; layoutDone = false; ShowActiveFamily(); } }