public formFamily(Form parentForm, Quatre quatre) { this.parentform = parentForm; this.quatre = quatre; family = new Family(); isnew = true; family.ID = quatre.NextFamilyID; InitializeComponent(); }
public formFamily(Form parentForm, Quatre quatre, Family family) { this.family = family; this.parentform = parentForm; this.familyid = family.ID; this.quatre = quatre; isnew = false; InitializeComponent(); }
public formIndividual(Form parentForm, Quatre quatre, Family fromFamily) { this.quatre = quatre; this.parentform = parentForm; isnew = true; individual = new Individual(); individual.ID = quatre.NextIndividualID; individual.FromFamily = fromFamily; InitializeComponent(); }
public listIndividualsForm(Quatre quatre, Form parentForm, bool selectOnly, enums.ListFilter filter, Family fromFamily) { this.quatre = quatre; this.parentform = parentForm; this.selectonly = selectOnly; this.filter = filter; this.fromfamily = fromFamily; InitializeComponent(); if (!this.selectonly) { buttonSelect.Text = "Edit"; } }
public formFamily(Form parentForm, Quatre quatre, Individual husbandOrWife) { this.parentform = parentForm; this.quatre = quatre; family = new Family(); isnew = true; family.ID = quatre.NextFamilyID; if (husbandOrWife.Sex.Equals(enums.Sex.Male)) { family.Husband = husbandOrWife; } else { family.Wife = husbandOrWife; } InitializeComponent(); }
private String buildChildren(Family family) { Boolean ploral = family.Ploral; Boolean primaryMale = family.PrimaryMale; String response = ""; if (family.Children.Count > 0) { response += "<ol type=\"i\">"; if (ploral) { response += "They had the following children"; } else { if (primaryMale) { response += "He had the following children"; } else { response += "She had the following children"; } } int childcounter = 1; foreach (Individual child in family.Children) { response += "<li type=\"i\" id=\"I" + child.ID + "\">"; //response += "<label style=\"width:30px\">(" + Utilities.ToRoman(childcounter) + ")</label>"; if (child.Sex.Equals(enums.Sex.Male)) response += " (M) "; if (child.Sex.Equals(enums.Sex.Female)) response += " (F) "; if (child.Sex.Equals(enums.Sex.Unknown)) response += " (X) "; String linktext = child.DisplayName; if (child.Families.Count > 0) { if (!child.Families.Count.Equals(1)) { String anchorhref = "/genealogy/" + getGenerationString(child.Generation) + "-generation/#I" + child.ID.ToString(); response += "<a href=\"" + anchorhref + "\">" + linktext + "</a>"; if (!child.DOB.Equals("")) { response += " born on " + child.DOB; } } foreach (Family childfamily in child.Families.Values) { if (child.Families.Count.Equals(1)) { String anchorhref = "/genealogy/" + getGenerationString(child.Generation) + "-generation/#F" + childfamily.ID.ToString(); response += "<a href=\"" + anchorhref + "\">" + linktext + "</a>"; } else { response += "<div>"; response += " married "; Individual spouse; if (childfamily.Husband != null) { if (childfamily.Husband.ID.Equals(child.ID)) { spouse = childfamily.Wife; } else { spouse = childfamily.Husband; } } else { if (childfamily.Wife.ID == child.ID) { spouse = new Individual(); spouse.Name = "Unknown"; spouse.Givenname = "Unknown"; } else { spouse = childfamily.Wife; } } if (spouse != null) { String anchorhref = "/genealogy/" + getGenerationString(child.Generation) + "-generation/#F" + childfamily.ID.ToString(); response += "<a href=\"" + anchorhref + "\">" + spouse.DisplayName + "</a>"; if (!spouse.DOB.Equals("")) { response += ", born on " + spouse.DOB; } } if (childfamily.DateDivorsed.Equals("")) { if (!childfamily.DateMarried.Equals("")) { response += ", married on " + childfamily.DateMarried; } } else { response += ", the marriage ended in divorce on " + childfamily.DateDivorsed; } response += "</div>"; } } } else { response += linktext; } childcounter++; response += "</li>"; } response += "</ol>"; } return response; }
private String buildFromFamily(Family family, HashSet<int> fromfamiliesbuilt) { String response = ""; if (!fromfamiliesbuilt.Contains(family.ID)) { Individual primary = family.Primary; Individual secondary = family.Secondary; String anchorhref = "/genealogy/" + getGenerationString(primary.Generation) + "-generation/#I" + primary.ID.ToString(); response = "<a href=\"" + anchorhref + "\">" + primary.Givenname + " " + primary.Surname.ToUpper() + "</a>"; fromfamiliesbuilt.Add(family.ID); if (primary.FromFamily != null) { String subresponse = buildFromFamily(primary.FromFamily, fromfamiliesbuilt); if (!response.Equals("")) response += ","; response += subresponse; } } return response; }
private void performSelect() { if (listFamilies.SelectedItems.Count > 0) { this.selectedfamily = (Family)this.families[(int)listFamilies.SelectedItems[0].Tag]; this.Close(); } }
private Family getFamily(int familyId) { if (families.ContainsKey(familyId)) { return (Family)families[familyId]; } else { Family family = new Family(); family.ID = familyId; families.Add(familyId, family); return family; } }
public void AddFamily(int familyId, Family family) { if (this.families.ContainsKey(familyId)) { this.families[familyId] = family; } else { this.families.Add(familyId, family); } }
private void buildFromFamily(Family family, LinkLabel previousLinkLabel) { if (!fromfamiliesbuilt.Contains(family.ID)) { Individual primary = family.Primary; Individual secondary = family.Secondary; LinkLabel linklabel = new LinkLabel(); linklabel.Text = primary.Givenname + " " + primary.Surname.ToUpper(); linklabel.AutoSize = true; linklabel.Tag = family.ID; linklabel.Click += linklabel_Click; if (previousLinkLabel!=null) { if ((linklabel.Width + previousLinkLabel.Right) >= panelFamilies.Width) { linklabel.Left = 0; linklabel.Top = previousLinkLabel.Top + 15; } else { linklabel.Top = previousLinkLabel.Top; linklabel.Left = previousLinkLabel.Right; } panelFamilies.Height = linklabel.Bottom + 5; lblDetails.Top = panelFamilies.Bottom; panelChildren.Top = lblDetails.Bottom; } panelFamilies.Controls.Add(linklabel); this.fromfamiliesbuilt.Add(family.ID); if (primary.FromFamily != null) { buildFromFamily(primary.FromFamily, linklabel); } } }
private void buildDetails(Family family) { lblDetails.Text = family.Primary.Details + "\n\n" + family.Details; lblDetails.MaximumSize = new System.Drawing.Size(groupBox1.Width-5, lblDetails.MaximumSize.Height); lblDetails.Visible = true; }
private void buildChildren(Family family) { panelChildren.Top = lblDetails.Bottom + 10; panelChildList.Controls.Clear(); Boolean ploral = family.Ploral; Boolean primaryMale = family.PrimaryMale; if (family.Children.Count > 0) { if (ploral) { lblChildren.Text = "They had the following children"; } else { if (primaryMale) { lblChildren.Text = "He had the following children"; } else { lblChildren.Text = "She had the following children"; } } int heightcounter = 0; int childcounter = 1; foreach (Individual child in family.Children) { Label labelcounter = new Label(); labelcounter.Text = "(" + Utilities.ToRoman(childcounter) + ")"; labelcounter.Top = heightcounter; labelcounter.AutoSize = true; labelcounter.Width = 35; panelChildList.Controls.Add(labelcounter); Label labelsex = new Label(); if (child.Sex.Equals(enums.Sex.Male)) labelsex.Text = "M"; if (child.Sex.Equals(enums.Sex.Female)) labelsex.Text = "F"; if (child.Sex.Equals(enums.Sex.Unknown)) labelsex.Text = ""; labelsex.Top = heightcounter; labelsex.Left = 35; labelsex.AutoSize = true; labelsex.Width = 10; panelChildList.Controls.Add(labelsex); String linktext = "(" + child.ID + ") " + child.DisplayName; if (child.Families.Count > 0) { if (!child.Families.Count.Equals(1)) { Label childlink = new Label(); childlink.Left = labelsex.Right; childlink.Text = linktext; childlink.AutoSize = true; childlink.Top = heightcounter; panelChildList.Controls.Add(childlink); if (!child.DOB.Equals("")) { Label bornlabel = new Label(); bornlabel.Text = "born on " + child.DOB; bornlabel.Top = heightcounter; bornlabel.Left = childlink.Right; bornlabel.AutoSize = true; panelChildList.Controls.Add(bornlabel); } heightcounter += 15; } foreach (Family childfamily in child.Families.Values) { if (child.Families.Count.Equals(1)) { LinkLabel childlink = new LinkLabel(); childlink.Left = labelsex.Right; childlink.Text = linktext; childlink.AutoSize = true; childlink.Top = heightcounter; childlink.Tag = childfamily.ID; childlink.Click += linklabel_Click; panelChildList.Controls.Add(childlink); heightcounter += 15; } else { Label label1 = new Label(); label1.Left = 53; label1.Top = heightcounter; label1.Text = "married "; label1.Width = 45; label1.AutoSize = true; Individual spouse; if (childfamily.Husband.ID.Equals(child.ID)) { spouse = childfamily.Wife; } else { spouse = childfamily.Husband; } LinkLabel childlink = new LinkLabel(); childlink.Text = spouse.DisplayName; childlink.AutoSize = true; childlink.Top = heightcounter; childlink.Left = label1.Right; childlink.Tag = childfamily.ID; childlink.Click += linklabel_Click; panelChildList.Controls.Add(childlink); Label label2 = new Label(); label2.Left = childlink.Right; label2.Top = heightcounter; if (!spouse.DOB.Equals("")) { label2.Text = ", born on " + spouse.DOB; } if (childfamily.DateDivorsed.Equals("")) { if (!childfamily.DateMarried.Equals("")) { label2.Text += ", married on " + childfamily.DateMarried; } } else { label2.Text = ", the marriage ended in divorce on " + childfamily.DateDivorsed; } label2.AutoSize = true; panelChildList.Controls.Add(label1); panelChildList.Controls.Add(childlink); panelChildList.Controls.Add(label2); heightcounter += 15; } } } else { Label childlink = new Label(); childlink.Left = labelsex.Right; childlink.Text = linktext; childlink.AutoSize = true; childlink.Top = heightcounter; panelChildList.Controls.Add(childlink); heightcounter += 15; } childcounter++; } panelChildren.Height = heightcounter + 20; panelChildren.Visible = true; } else { panelChildren.Visible = false; } }
private void loadFamily() { Hashtable families = quatre.Families; family = (Family)families[this.familyid]; }
private void cancelButton_Click(object sender, EventArgs e) { this.family = null; this.Close(); }
public GEDReader(String filePath) { StreamReader file = new StreamReader(filePath); Boolean donereading = false; String line = file.ReadLine(); while(!donereading){ if (line != null) { if (line.EndsWith("INDI")) { Individual indi = new Individual(); indi.ID = line.Substring(2, line.Length - 7); String indiline = ""; while (!indiline.Trim().Equals("1 CHAN")) { indiline = file.ReadLine(); if (indiline.StartsWith("1 NAME")) indi.Name = indiline.Substring(7); if (indiline.StartsWith("2 SURN")) indi.Surname = indiline.Substring(7); if (indiline.StartsWith("2 GIVN")) indi.Givenname = indiline.Substring(7); if (indiline.StartsWith("1 SEX")){ if(indiline.Substring(6).Trim().Equals("F")) indi.Sex = enums.Sex.Female; if(indiline.Substring(6).Trim().Equals("M")) indi.Sex = enums.Sex.Male; } if (indiline.StartsWith("2 DATE")) indi.DOB = indiline.Substring(7); } individuals.Add(indi.ID, indi); file.ReadLine(); //read date file.ReadLine(); //read time line = file.ReadLine(); } else if (line.EndsWith("FAM")) { Family fam = new Family(); fam.ID = line.Substring(2, line.Length - 5); String famline = ""; while (famline!=null && !famline.Trim().EndsWith("FAM")) { //1 DIV if (famline.StartsWith("1 HUSB")) fam.Husband = (Individual)individuals[famline.Substring(7)]; if (famline.StartsWith("1 WIFE")) fam.Wife = (Individual)individuals[famline.Substring(7)]; if (famline.StartsWith("1 CHIL")) fam.addChild((Individual)individuals[famline.Substring(7)]); if (famline.EndsWith("1 DIV")) { famline = file.ReadLine(); if (famline.StartsWith("2 DATE")) fam.DateDivorsed = famline.Substring(7); } if (famline.StartsWith("1 MARR")) { famline = file.ReadLine(); if (famline.StartsWith("2 DATE")) fam.DateMarried = famline.Substring(7); if (famline.StartsWith("2 PLAC")) fam.PlaceMarried = famline.Substring(7); } famline = file.ReadLine(); } families.Add(fam.ID, fam); line = famline; } else if (line.EndsWith("0 TRLR")) { donereading = true; } else { line = file.ReadLine(); } } else { donereading = true; } } file.Close(); }