private bool IsValidFamily() { Individual eldestChild = Children.OrderBy(x => x.BirthDate).FirstOrDefault(); if (MarriageDate.IsAfter(CensusDate) && (eldestChild == null || eldestChild.BirthDate.IsAfter(CensusDate))) { return(false); } if (FamilyID == Family.SOLOINDIVIDUAL || FamilyID == Family.PRE_MARRIAGE) { return(true); // allow solo individual families to be processed } // don't process family if either parent is under 16 //if(Husband != null) rtb.AppendText("Husband : " + Husband.getAge(censusDate) + "\n"); if (Husband != null && Husband.GetMaxAge(CensusDate) < 16) { return(false); } //if(Wife != null) rtb.AppendText("Wife : " + Wife.getAge(censusDate) + "\n"); if (Wife != null && Wife.GetMaxAge(CensusDate) < 16) { return(false); } return(true); }
public override string ToString() { Fact marriage = GetPreferredFact(Fact.MARRIAGE); if (marriage == null) { return(string.Empty); } if (marriage.Location.IsBlank) { return(MarriageDate.ToString()); } else { return(MarriageDate.ToString() + " at " + marriage.Location); } }
public Family(XmlNode node, IProgress <string> outputText) : this(string.Empty) { if (node != null) { XmlNode eHusband = node.SelectSingleNode("HUSB"); XmlNode eWife = node.SelectSingleNode("WIFE"); FamilyID = node.Attributes["ID"].Value; string husbandID = eHusband?.Attributes["REF"]?.Value; string wifeID = eWife?.Attributes["REF"]?.Value; Husband = ft.GetIndividual(husbandID); Wife = ft.GetIndividual(wifeID); if (Husband != null && Wife != null) { Wife.MarriedName = Husband.Surname; } if (Husband != null) { Husband.FamiliesAsSpouse.Add(this); } if (Wife != null) { Wife.FamiliesAsSpouse.Add(this); } // now iterate through child elements of eChildren // finding all individuals XmlNodeList list = node.SelectNodes("CHIL"); foreach (XmlNode n in list) { if (n.Attributes["REF"] != null) { Individual child = ft.GetIndividual(n.Attributes["REF"].Value); if (child != null) { XmlNode fatherNode = n.SelectSingleNode("_FREL"); XmlNode motherNode = n.SelectSingleNode("_MREL"); var father = ParentalRelationship.GetRelationshipType(fatherNode); var mother = ParentalRelationship.GetRelationshipType(motherNode); Children.Add(child); var parent = new ParentalRelationship(this, father, mother); child.FamiliesAsChild.Add(parent); AddParentAndChildrenFacts(child, Husband, father); AddParentAndChildrenFacts(child, Wife, mother); } else { outputText.Report($"Child not found in family: {FamilyRef}\n"); } } else { outputText.Report($"Child without a reference found in family: {FamilyRef}\n"); } } AddFacts(node, Fact.ANNULMENT, outputText); AddFacts(node, Fact.DIVORCE, outputText); AddFacts(node, Fact.DIVORCE_FILED, outputText); AddFacts(node, Fact.ENGAGEMENT, outputText); AddFacts(node, Fact.MARRIAGE, outputText); AddFacts(node, Fact.MARRIAGE_BANN, outputText); AddFacts(node, Fact.MARR_CONTRACT, outputText); AddFacts(node, Fact.MARR_LICENSE, outputText); AddFacts(node, Fact.MARR_SETTLEMENT, outputText); AddFacts(node, Fact.SEPARATION, outputText); AddFacts(node, Fact.CENSUS, outputText); AddFacts(node, Fact.CUSTOM_EVENT, outputText); AddFacts(node, Fact.CUSTOM_FACT, outputText); AddFacts(node, Fact.REFERENCE, outputText); AddFacts(node, Fact.SEALED_TO_SPOUSE, outputText); AddFacts(node, Fact.UNKNOWN, outputText); //TODO: need to think about family facts having AGE tags in GEDCOM if (HasGoodChildrenStatus) { CheckChildrenStatusCounts(); } if (MarriageDate.IsKnown && !MarriageDate.Overlaps(FactDate.SAME_SEX_MARRIAGE)) // check for wrongly set gender only if pre-dates same sex marriages { if (Husband != null && !Husband.IsMale) { Husband.QuestionGender(this, true); } if (Wife != null && Wife.IsMale) { Wife.QuestionGender(this, false); } } Children.ToList().Sort(new BirthDateComparer()); } }
private void ExecuteGenerateCertificate() { if (!ValidateFields()) { MessageBox.Show("Please Enter all the required fields, then generate certificate"); return; } CertificatePath = String.Empty; Thread.Sleep(400); string certificateName = "Certificate.pdf"; Document document = new Document(); FileStream fs = new FileStream(certificateName, FileMode.Create, FileAccess.Write); PdfWriter writer = PdfWriter.GetInstance(document, fs); document.Open(); PdfContentByte pdfContentByte = writer.DirectContent; int textDown = -50; if (CurrentMarriage.GroomPhoto == null && CurrentMarriage.BridePhoto == null) { textDown = 50; } Paragraph title = new Paragraph(); title.Alignment = Element.ALIGN_CENTER; title.Font = FontFactory.GetFont(FontFactory.TIMES_BOLD, 18f, Font.UNDERLINE, BaseColor.BLACK); title.Add("MARRIAGE CERTIFICATE"); ColumnText ct = new ColumnText(pdfContentByte); ct = new ColumnText(writer.DirectContent); ct.SetSimpleColumn(new Rectangle(30, 520 - textDown, 560, 30)); ct.AddElement(title); ct.Go(); BaseFont bf = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED); int column1LeftMargin = 120; int column2LeftMargin = 260; if (CurrentMarriage.GroomPhoto != null && CurrentMarriage.BridePhoto != null) { Image i = Image.GetInstance(CurrentMarriage.GroomPhoto); i.Alignment = Image.LEFT_ALIGN; i.ScaleToFit(94f, 144f); i.SetAbsolutePosition(200, 420); pdfContentByte.AddImage(i); i = Image.GetInstance(CurrentMarriage.BridePhoto); i.Alignment = Image.LEFT_ALIGN; i.ScaleToFit(94f, 144f); i.SetAbsolutePosition(310, 420); pdfContentByte.AddImage(i); } //GroomName = "Rashid MV"; //GroomFatherName = "Khader KM"; //GroomHouseName = "Rashid Manzil"; //GroomArea = "Kottakunnummal"; //GroomPincode = "673521"; //GroomPostOffice = "Iringal"; //GroomDistrict = "Kozhikkode"; //GroomState = "Kerala"; //GroomCountry = "India"; //BrideName = "Hiba Fahisa AV"; //BrideFatherName = "Asharaf AV"; //BrideHouseName = "Kulangarath Kuniyil"; //BrideArea = "Arakkilad"; //BridePincode = "675302"; //BridePostOffice = "Nadakkuthazhe"; //BrideDistrict = "Kozhikkode"; //BrideState = "Kerala"; //BrideCountry = "India"; //MarriagePlace = "Moorad"; Paragraph registation = new Paragraph("Reg.No : " + RegNo); registation.Font = FontFactory.GetFont(FontFactory.HELVETICA_BOLDOBLIQUE, 11f, BaseColor.BLACK); ct = new ColumnText(writer.DirectContent); ct.SetSimpleColumn(new Rectangle(column1LeftMargin, 436, 416, 30)); ct.AddElement(registation); ct.Go(); Paragraph groomDetailsLabels = new Paragraph("Name of Bridegroom :\n" + "Date of Birth :\n" + "Name of Father :\n" + "Permenant Address :"); groomDetailsLabels.Leading = 12; groomDetailsLabels.Font = FontFactory.GetFont(FontFactory.HELVETICA, 11f, BaseColor.BLACK); ct.SetSimpleColumn(new Rectangle(column1LeftMargin, 416, 416, 30)); ct.AddElement(groomDetailsLabels); ct.Go(); Chunk groomName = new Chunk(GroomName); groomName.Font = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 11f, BaseColor.BLACK); Paragraph groomDetails = new Paragraph(); groomDetails.Font = FontFactory.GetFont(FontFactory.HELVETICA, 11f, BaseColor.BLACK); groomDetails.Add(groomName); String details = "\n" + GroomDOB.ToShortDateString() + "\n" + GroomFatherName + "\n" + GroomHouseName + " [House],\n" + GroomArea + ", " + GroomPostOffice + ",\n" + GroomDistrict + ", " + GroomState + ",\n" + GroomCountry + " - " + GroomPincode; groomDetails.Add(details); groomDetails.Leading = 12; ct.SetSimpleColumn(new Rectangle(column2LeftMargin, 416, 416, 30)); ct.AddElement(groomDetails); ct.Go(); Paragraph brideDetailsLabels = new Paragraph("Name of Bride :\n" + "Date of Birth :\n" + "Name of Father :\n" + "Permenant Address :"); brideDetailsLabels.Leading = 12; brideDetailsLabels.Font = FontFactory.GetFont(FontFactory.HELVETICA, 11f, BaseColor.BLACK); ct.SetSimpleColumn(new Rectangle(column1LeftMargin, 326, 416, 30)); ct.AddElement(brideDetailsLabels); ct.Go(); Chunk brideName = new Chunk(BrideName); brideName.Font = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 11f, BaseColor.BLACK); Paragraph brideDetails = new Paragraph(); brideDetails.Font = FontFactory.GetFont(FontFactory.HELVETICA, 11f, BaseColor.BLACK); brideDetails.Add(brideName); details = "\n" + BrideDOB.ToShortDateString() + "\n" + BrideFatherName + "\n" + BrideHouseName + " [House],\n" + BrideArea + ", " + BridePostOffice + ",\n" + BrideDistrict + ", " + BrideState + ",\n" + BrideCountry + " - " + BridePincode; brideDetails.Add(details); brideDetails.Leading = 12; ct.SetSimpleColumn(new Rectangle(column2LeftMargin, 326, 416, 30)); ct.AddElement(brideDetails); ct.Go(); Paragraph placeDateLabels = new Paragraph("Place of Marriage :\n" + "Date of Marriage :\n"); placeDateLabels.Leading = 12; placeDateLabels.Font = FontFactory.GetFont(FontFactory.HELVETICA, 11f, BaseColor.BLACK); ct.SetSimpleColumn(new Rectangle(column1LeftMargin, 230, 416, 30)); ct.AddElement(placeDateLabels); ct.Go(); Paragraph placeDateDetails = new Paragraph(); placeDateDetails.Font = FontFactory.GetFont(FontFactory.HELVETICA, 11f, BaseColor.BLACK); details = MarriagePlace + "\n" + MarriageDate.ToShortDateString(); placeDateDetails.Add(details); placeDateDetails.Leading = 12; ct.SetSimpleColumn(new Rectangle(column2LeftMargin, 230, 416, 30)); ct.AddElement(placeDateDetails); ct.Go(); //pdfContentByte.SetColorFill(BaseColor.BLACK); //pdfContentByte.SetFontAndSize(bf, 12); Chunk masjidName = new Chunk("'" + MasjidName + "'"); masjidName.Font = FontFactory.GetFont(FontFactory.HELVETICA_OBLIQUE, 12f, BaseColor.BLACK); Paragraph content = new Paragraph(); content.SpacingBefore = 10; content.SpacingAfter = 10; content.Font = FontFactory.GetFont(FontFactory.HELVETICA, 12f, BaseColor.BLACK); string contentText1 = " Certify that the Marriage between the above mentioned persons was solemnised by Mahallu Khazi of "; string contentText2 = " in the presence of their friends and relatives according to the Islamic Shareeath Law."; content.Add(contentText1); content.Add(masjidName); content.Add(contentText2); content.Alignment = Element.ALIGN_JUSTIFIED; ct.SetSimpleColumn(new Rectangle(30, 210, 540, 50)); ct.AddElement(content); ct.Go(); Paragraph secretary = new Paragraph("SECRETARY"); secretary.Alignment = Element.ALIGN_RIGHT; secretary.Font = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 12f, BaseColor.BLACK); ct = new ColumnText(writer.DirectContent); ct.SetSimpleColumn(new Rectangle(30, 150, 540, 30)); ct.AddElement(secretary); ct.Go(); Paragraph place = new Paragraph("Place : " + Place + "\nDate : " + DateTime.Now.ToShortDateString()); place.Alignment = Element.ALIGN_LEFT; place.Font = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 12f, BaseColor.BLACK); ct = new ColumnText(writer.DirectContent); ct.SetSimpleColumn(new Rectangle(40, 150, 540, 30)); ct.AddElement(place); ct.Go(); document.Close(); fs.Close(); writer.Close(); String currentFolder = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath); CertificatePath = Path.Combine(currentFolder, "Certificate.pdf"); }
private void ExecuteGenerateCertificate1() { CertificatePath = String.Empty; Thread.Sleep(400); string certificateName = "Certificate.pdf"; Document document = new Document(); FileStream fs = new FileStream(certificateName, FileMode.Create, FileAccess.Write); PdfWriter writer = PdfWriter.GetInstance(document, fs); document.Open(); PdfContentByte pdfContentByte = writer.DirectContent; int textDown = 0; if (String.IsNullOrEmpty(GroomPhotoPath) && String.IsNullOrEmpty(GroomPhotoPath)) { textDown = 70; } Paragraph title = new Paragraph(); title.Alignment = Element.ALIGN_CENTER; title.Font = FontFactory.GetFont(FontFactory.TIMES_BOLD, 18f, Font.UNDERLINE, BaseColor.BLACK); title.Add("MARRIAGE CERTIFICATE"); ColumnText ct = new ColumnText(pdfContentByte); ct = new ColumnText(writer.DirectContent); ct.SetSimpleColumn(new Rectangle(30, 520 - textDown, 560, 30)); ct.AddElement(title); ct.Go(); BaseFont bf = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED); int column1LeftMargin = 120; int column2LeftMargin = 370; if (CurrentMarriage.GroomPhoto != null && CurrentMarriage.BridePhoto != null) { Image i = Image.GetInstance(CurrentMarriage.GroomPhoto); i.Alignment = Image.LEFT_ALIGN; i.ScaleToFit(94f, 144f); i.SetAbsolutePosition(200, 360); pdfContentByte.AddImage(i); i = Image.GetInstance(CurrentMarriage.BridePhoto); i.Alignment = Image.LEFT_ALIGN; i.ScaleToFit(94f, 144f); i.SetAbsolutePosition(310, 360); pdfContentByte.AddImage(i); } GroomName = "Rashid MV"; GroomFatherName = "Khader KM"; GroomHouseName = "Rashid Manzil"; GroomArea = "Kottakunnummal"; GroomPincode = "673521"; GroomPostOffice = "Iringal"; GroomDistrict = "Kozhikkode"; GroomState = "Kerala"; GroomCountry = "India"; BrideName = "Hiba Fahisa AV"; BrideFatherName = "Asharaf AV"; BrideHouseName = "Kulangarath Kuniyil"; BrideArea = "Arakkilad"; BridePincode = "675302"; BridePostOffice = "Nadakkuthazhe"; BrideDistrict = "Kozhikkode"; BrideState = "Kerala"; BrideCountry = "India"; MarriagePlace = "Moorad"; Paragraph groomName = new Paragraph(GroomName); groomName.Font = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 12f, BaseColor.BLACK); ct = new ColumnText(writer.DirectContent); ct.SetSimpleColumn(new Rectangle(column1LeftMargin, 356, 540, 30)); ct.AddElement(groomName); ct.Go(); Paragraph brideName = new Paragraph(BrideName); brideName.Font = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 12f, BaseColor.BLACK); ct = new ColumnText(writer.DirectContent); ct.SetSimpleColumn(new Rectangle(column2LeftMargin, 356, 540, 30)); ct.AddElement(brideName); ct.Go(); pdfContentByte.SetColorFill(BaseColor.DARK_GRAY); pdfContentByte.SetFontAndSize(bf, 12); pdfContentByte.BeginText(); pdfContentByte.ShowTextAligned(0, "S/o. " + GroomFatherName, column1LeftMargin, 324, 0); pdfContentByte.EndText(); pdfContentByte.BeginText(); pdfContentByte.ShowTextAligned(0, "D/o. " + BrideFatherName, column2LeftMargin, 324, 0); pdfContentByte.EndText(); pdfContentByte.BeginText(); pdfContentByte.ShowTextAligned(0, "Date of Birth: " + GroomDOB.ToShortDateString(), column1LeftMargin, 308, 0); pdfContentByte.EndText(); pdfContentByte.BeginText(); pdfContentByte.ShowTextAligned(0, "Date of Birth: " + BrideDOB.ToShortDateString(), column2LeftMargin, 308, 0); pdfContentByte.EndText(); pdfContentByte.BeginText(); pdfContentByte.ShowTextAligned(0, GroomHouseName + " [House],", column1LeftMargin, 292, 0); pdfContentByte.EndText(); pdfContentByte.BeginText(); pdfContentByte.ShowTextAligned(0, BrideHouseName + " [House],", column2LeftMargin, 292, 0); pdfContentByte.EndText(); pdfContentByte.BeginText(); pdfContentByte.ShowTextAligned(0, GroomArea + ",", column1LeftMargin, 276, 0); pdfContentByte.EndText(); pdfContentByte.BeginText(); pdfContentByte.ShowTextAligned(0, BrideArea + ",", column2LeftMargin, 276, 0); pdfContentByte.EndText(); pdfContentByte.BeginText(); pdfContentByte.ShowTextAligned(0, GroomPostOffice + " [Post],", column1LeftMargin, 260, 0); pdfContentByte.EndText(); pdfContentByte.BeginText(); pdfContentByte.ShowTextAligned(0, BridePostOffice + " [Post],", column2LeftMargin, 260, 0); pdfContentByte.EndText(); pdfContentByte.BeginText(); pdfContentByte.ShowTextAligned(0, GroomDistrict + " - " + GroomPincode + ",", column1LeftMargin, 244, 0); pdfContentByte.EndText(); pdfContentByte.BeginText(); pdfContentByte.ShowTextAligned(0, BrideDistrict + " - " + BridePincode + ",", column2LeftMargin, 244, 0); pdfContentByte.EndText(); pdfContentByte.BeginText(); pdfContentByte.ShowTextAligned(0, GroomState + ", " + GroomCountry, column1LeftMargin, 228, 0); pdfContentByte.EndText(); pdfContentByte.BeginText(); pdfContentByte.ShowTextAligned(0, BrideState + ", " + BrideCountry, column2LeftMargin, 228, 0); pdfContentByte.EndText(); Chunk dateOfMarriage = new Chunk("'" + MarriageDate.ToShortDateString() + "'"); dateOfMarriage.Font = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 12f, BaseColor.BLACK); Chunk placeOfMarriage = new Chunk("'" + MarriagePlace + "'"); placeOfMarriage.Font = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 12f, BaseColor.BLACK); Chunk masjidName = new Chunk("'" + MasjidName + "'"); masjidName.Font = FontFactory.GetFont(FontFactory.HELVETICA_BOLDOBLIQUE, 12f, BaseColor.BLACK); Paragraph content = new Paragraph(); content.SpacingBefore = 10; content.SpacingAfter = 10; content.Font = FontFactory.GetFont(FontFactory.HELVETICA, 12f, BaseColor.BLACK); string contentText1 = " Certify that the Marriage between the above mentioned persons was solemnised by Mahallu Khazi of "; string contentText2 = " in the presence of their friends and relatives on "; string contentText3 = " at "; string contentText4 = " according to the Islamic Shareeath Law."; content.Add(contentText1); content.Add(masjidName); content.Add(contentText2); content.Add(dateOfMarriage); content.Add(contentText3); content.Add(placeOfMarriage); content.Add(contentText4); content.Alignment = Element.ALIGN_JUSTIFIED; ct.SetSimpleColumn(new Rectangle(30, 200, 560, 50)); ct.AddElement(content); ct.Go(); Paragraph secretary = new Paragraph("SECRETARY"); secretary.Alignment = Element.ALIGN_RIGHT; secretary.Font = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 12f, BaseColor.BLACK); ct = new ColumnText(writer.DirectContent); ct.SetSimpleColumn(new Rectangle(30, 120, 540, 30)); ct.AddElement(secretary); ct.Go(); Paragraph place = new Paragraph("Place : " + Place + "\nDate : " + DateTime.Now.ToShortDateString()); place.Alignment = Element.ALIGN_LEFT; place.Font = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 12f, BaseColor.BLACK); ct = new ColumnText(writer.DirectContent); ct.SetSimpleColumn(new Rectangle(40, 120, 540, 30)); ct.AddElement(place); ct.Go(); document.Close(); fs.Close(); writer.Close(); String currentFolder = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath); CertificatePath = Path.Combine(currentFolder, "Certificate.pdf"); }