private void DgCensus_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0 && dgCensus.CurrentRow != null && !CensusDate.VALUATIONROLLS.Contains(CensusDate)) { CensusIndividual ds = (CensusIndividual)dgCensus.CurrentRow.DataBoundItem; FamilyTree ft = FamilyTree.Instance; if (Control.ModifierKeys.Equals(Keys.Shift)) { Facts factForm = new Facts(ds); MainForm.DisposeDuplicateForms(factForm); factForm.Show(); } else { try { ft.SearchCensus(censusCountry, CensusDate.StartDate.Year, ds, cbCensusSearchProvider.SelectedIndex); } catch (CensusSearchException ex) { MessageBox.Show(ex.Message); } } } }
static void Main(string[] args) { if (args.Length == 0) { Console.WriteLine("Provide input file argument"); return; } // string filePath = Path.Combine(Directory.GetCurrentDirectory(), args[0]); string filePath = args[0]; if (!File.Exists(filePath)) { Console.WriteLine("File not found"); return; } familyTree = new FamilyTree(); familyTree.Initialize(); var lines = File.ReadLines(filePath); foreach (var line in lines) { string[] parts = line.Split(' '); string commandString = parts[0]; Command command = GetCommandEnum(commandString); ProcessCommand(command, parts); } }
static void Main(string[] args) { try { FamilyTree familyTree = new FamilyTree(); Console.WriteLine("Loading instructions from Test file 1.."); var commandList = ConvertFileToCommands("TestInput1.txt"); foreach (var command in commandList) { command.Execute(familyTree); } Console.WriteLine("Loading instructions from Test file 2.."); commandList = ConvertFileToCommands("TestInput2.txt"); foreach (var command in commandList) { command.Execute(familyTree); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public async Task <IActionResult> Edit(int id, FamilyTree familyTree) { if (id != familyTree.FamilyTreeId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.FamilyTrees.Update(familyTree); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FamilyTreeExists(familyTree.FamilyTreeId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } familyTree.UserId = Int32.Parse(User.FindFirstValue(ClaimTypes.NameIdentifier)); return(View(familyTree)); }
public CensusFamily(Family f, CensusDate censusDate) : base(f) { this.BaseFamily = f; FamilyTree ft = FamilyTree.Instance; this.CensusDate = censusDate; this.BestLocation = null; int position = 1; if (f.Wife != null) { this.Wife = new CensusIndividual(position++, f.Wife, this, CensusIndividual.WIFE); } if (f.Husband != null) { this.Husband = new CensusIndividual(position++, f.Husband, this, CensusIndividual.HUSBAND); } this.Children = new List <CensusIndividual>(); foreach (Individual child in f.Children) { CensusIndividual toAdd = new CensusIndividual(position++, child, this, CensusIndividual.CHILD); this.Children.Add(toAdd); } this.FamilyChildren = new List <CensusIndividual>(Children); // Family children is all children alive or dead at census date }
public async Task <IActionResult> Create([Bind("FamilyTreeId,FamilyTreeName,IsPublic,UserId")] FamilyTree familyTree) { var user = await _userManager.GetUserAsync(User); familyTree.UserId = user.Id; if (ModelState.IsValid) { _context.Add(familyTree); await _context.SaveChangesAsync(); var person = new Person() { FirstName = user.FirstName, LastName = user.LastName, DateOfBirth = user.DateOfBirth, Picture = user.GenderId == 1 ? "female-user-avatar.png" : "male-user-avatar.png", GenderId = user.GenderId, FamilyTreeId = familyTree.FamilyTreeId }; _context.Add(person); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(familyTree)); }
public LostCousinsReferral(Individual referee, bool onlyInCommon) { InitializeComponent(); Top += NativeMethods.TopTaskbarOffset; FamilyTree ft = FamilyTree.Instance; Text = $"Lost Cousins Referral for {referee}"; reportFormHelper = new ReportFormHelper(this, Text, dgLCReferrals, ResetTable, "Lost Cousins Referrals"); dgLCReferrals.AutoGenerateColumns = false; ExtensionMethods.DoubleBuffered(dgLCReferrals, true); CensusSettingsUI.CompactCensusRefChanged += new EventHandler(RefreshCensusReferences); Predicate <Individual> lostCousinsFact = new Predicate <Individual>(x => x.HasLostCousinsFact); List <Individual> lostCousinsFacts = ft.AllIndividuals.Filter(lostCousinsFact).ToList <Individual>(); referrals = new List <ExportReferrals>(); foreach (Individual ind in lostCousinsFacts) { List <Fact> indLCFacts = new List <Fact>(); indLCFacts.AddRange(ind.GetFacts(Fact.LOSTCOUSINS)); indLCFacts.AddRange(ind.GetFacts(Fact.LC_FTA)); foreach (Fact f in indLCFacts) { if ((onlyInCommon && ind.IsBloodDirect) || !onlyInCommon) { referrals.Add(new ExportReferrals(ind, f)); } } } reportFormHelper.LoadColumnLayout("LCReferralsColumns.xml"); tsRecords.Text = GetCountofRecords(); }
public static FamilyTree GetTree() { FamilyMember greg = new FamilyMember("Greg", Gender.Male), pam = new FamilyMember("Pam", Gender.Female), jeff = new FamilyMember("Jeff", Gender.Male), brent = new FamilyMember("Brent", Gender.Male), kyle = new FamilyMember("Kyle", Gender.Male), jaclyn = new FamilyMember("Jaclyn", Gender.Female), roxi = new FamilyMember("Roxi", Gender.Female), della = new FamilyMember("Della", Gender.Female), aura = new FamilyMember("Aura", Gender.Female); var tree = new FamilyTree(); tree.SetRoot(new Partnership(greg, pam), pam); var root = tree.Root; tree.AddChild(root, jeff); tree.AddChild(root, brent); tree.AddChild(root, kyle); tree.AddInLaw(jaclyn); tree.AddInLaw(aura); var brentJaclyn = tree.AddPartnership(brent, jaclyn); tree.AddChild(brentJaclyn, roxi); tree.AddChild(brentJaclyn, della); var jeffAura = tree.AddPartnership(jeff, aura); return(tree); }
public Census(CensusDate censusDate, bool censusDone) { InitializeComponent(); dgCensus.AutoGenerateColumns = false; ExtensionMethods.DoubleBuffered(dgCensus, true); ft = FamilyTree.Instance; reportFormHelper = new ReportFormHelper(this, "Census Report", dgCensus, ResetTable, "Census"); LostCousins = false; CensusDate = censusDate; censusCountry = CensusDate.Country; RecordCount = 0; CensusDone = censusDone; string defaultProvider = (string)Application.UserAppDataRegistry.GetValue("Default Search Provider"); if (defaultProvider == null) { defaultProvider = "FamilySearch"; } string defaultRegion = (string)Application.UserAppDataRegistry.GetValue("Default Region"); if (defaultRegion == null) { defaultRegion = ".co.uk"; } cbCensusSearchProvider.Text = defaultProvider; cbRegion.Text = defaultRegion; CensusSettingsUI.CompactCensusRefChanged += new EventHandler(RefreshCensusReferences); Top += NativeMethods.TopTaskbarOffset; }
public ColourCensusViewController(string country, int providerIndex, string censusRegion) : base("Census Research Suggestions", string.Empty) { Country = country; SetColumns(); CensusProviderIndex = providerIndex; CensusRegion = censusRegion; CensusProvider = FamilyTree.ProviderName(providerIndex); }
private static void PrintFamilyTree(FamilyTree tree) { Console.WriteLine($"{tree.Person.Name} {tree.Person.Birthday}"); Console.WriteLine("Parents:"); tree.Parents.ForEach(p => Console.WriteLine($"{p.Name} {p.Birthday}")); Console.WriteLine("Children:"); tree.Childrens.ForEach(c => Console.WriteLine($"{c.Name} {c.Birthday}")); }
public History() { Homeland = new Homeland(); FamilyTree = new FamilyTree(); ClassOriginStory = new ClassOrigin(); Drawback = new Drawback(); BirthCircumstance = new BirthCircumstance(); }
public FamilyTree CreateTree(TreeUser user) { FamilyTree tree = new FamilyTree(); user.FamilyTree = tree; _treeRepository.Insert(tree); return(tree); }
public FamilyTree Create() { FamilyTree familyTree = new FamilyTree(); familyTree.Person = person; return(familyTree); }
public FamilyTree CreateFamilyTree(string race) { var familyTree = new FamilyTree(); familyTree.Father = namer.CreateFullName(Gender.Male, race); familyTree.Mother = namer.CreateFullName(Gender.Female, race); return(familyTree); }
public Facts(FactSource source) : this() { allFacts = true; facts = FamilyTree.GetSourceDisplayFacts(source); Text = $"Facts Report for source: {source.ToString()}. Facts count: {facts.Count}"; SetupFacts(); //dgFacts.Columns["CensusReference"].Visible = true; Analytics.TrackAction(Analytics.FactsFormAction, Analytics.FactsSourceEvent); }
private static string ReadInputLines(Queue <string> queue, FamilyTree tree) { string input = ""; while ((input = Console.ReadLine()) != "End") { queue.Enqueue(input); } return(input); }
public static FamilyTree GetRootTree() { FamilyMember greg = new FamilyMember("Greg", Gender.Male), pam = new FamilyMember("Pam", Gender.Female); var tree = new FamilyTree(); tree.SetRoot(new Partnership(greg, pam), pam); var root = tree.Root; return(tree); }
void DgReportSheet_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { FamilyTree ft = FamilyTree.Instance; if (e.ColumnIndex >= birthColumnIndex && e.ColumnIndex <= burialColumnIndex) { DataGridViewCell cell = dgBMDReportSheet.Rows[e.RowIndex].Cells[e.ColumnIndex]; BMDColours value = (BMDColours)cell.Value; if (value != BMDColours.EXACT_DATE) { IDisplayColourBMD person = (IDisplayColourBMD)dgBMDReportSheet.Rows[e.RowIndex].DataBoundItem; Individual ind = ft.GetIndividual(person.IndividualID); if (e.ColumnIndex == birthColumnIndex || e.ColumnIndex == birthColumnIndex + 1) { ft.SearchBMD(FamilyTree.SearchType.BIRTH, ind, ind.BirthDate, cbBMDSearchProvider.SelectedIndex, cbRegion.Text, null); } else if (e.ColumnIndex >= birthColumnIndex + 2 && e.ColumnIndex <= birthColumnIndex + 4) { FactDate marriageDate = FactDate.UNKNOWN_DATE; Individual spouse = null; if (e.ColumnIndex == birthColumnIndex + 2) { marriageDate = ind.FirstMarriageDate; spouse = ind.FirstSpouse; } if (e.ColumnIndex == birthColumnIndex + 3) { marriageDate = ind.SecondMarriageDate; spouse = ind.SecondSpouse; } if (e.ColumnIndex == birthColumnIndex + 4) { marriageDate = ind.ThirdMarriageDate; spouse = ind.ThirdSpouse; } ft.SearchBMD(FamilyTree.SearchType.MARRIAGE, ind, marriageDate, cbBMDSearchProvider.SelectedIndex, cbRegion.Text, spouse); } else if (e.ColumnIndex == burialColumnIndex || e.ColumnIndex == burialColumnIndex - 1) { ft.SearchBMD(FamilyTree.SearchType.DEATH, ind, ind.DeathDate, cbBMDSearchProvider.SelectedIndex, cbRegion.Text, null); } } } else if (e.ColumnIndex >= 0) { string indID = (string)dgBMDReportSheet.CurrentRow.Cells["IndividualID"].Value; Individual ind = ft.GetIndividual(indID); Facts factForm = new Facts(ind); factForm.Show(); } } }
void AddAllFamilyMembersToolStripMenuItem_Click(object sender, EventArgs e) { Individual ind = dgIndividuals.CurrentRow.DataBoundItem as Individual; isLoading = true; foreach (Individual i in FamilyTree.GetFamily(ind)) { SelectIndividual(i); } isLoading = false; BuildMap(); }
public static void ReadFamilyRecord(FamilyTree gedcom, Family family, List <Models.TreeNode> children) { foreach (var child in children) { switch (child.Tag) { case "HUSB": if (child.HasValue) { var husband = gedcom.GetIndividual(child.GetTextValue()); if (husband != null) { family.Husband = husband; } } break; case "WIFE": if (child.HasValue) { var wife = gedcom.GetIndividual(child.GetTextValue()); if (wife != null) { family.Wife = wife; } } break; case "CHIL": if (child.HasValue) { var familyChildren = gedcom.GetIndividual(child.GetTextValue()); if (familyChildren != null) { if (family.Children == null) { family.Children = new List <Individual>(); } family.Children.Add(familyChildren); } } break; case "NCHI": if (child.HasValue) { family.NumberOfChildren = (int)child.GetInt32Value(); } break; } } }
private void CheckForSharedFacts(XmlNode node) { XmlNodeList list = node.SelectNodes("_SHAR"); foreach (XmlNode n in list) { string indref = n.Attributes["REF"].Value; string role = FamilyTree.GetText(n, "ROLE", false); if (role.Equals("Household Member")) { FamilyTree.Instance.AddSharedFact(indref, this); } } }
static void Main(string[] args) { string input = ""; Queue <string> queue = new Queue <string>(); FamilyTree tree = new FamilyTree(); string personTreeInput = Console.ReadLine(); input = ReadInputLines(queue, tree); FindPerson(queue, tree, personTreeInput); int count = 0; while (queue.Count >= count && queue.Count > 0) { string line = queue.Dequeue(); bool childrenFound = false; bool parentFound = false; string[] splitLine = line.Split(new string[] { " - " }, StringSplitOptions.RemoveEmptyEntries); if (splitLine.Length > 1) { childrenFound = splitLine[0] == tree.Person.Name || splitLine[0] == tree.Person.Birthday; parentFound = splitLine[1] == tree.Person.Name || splitLine[1] == tree.Person.Birthday; } if (childrenFound) { FindChildrenInfo(queue, tree, splitLine); } else if (parentFound) { FindParentInfo(queue, tree, splitLine); } if (!parentFound && !childrenFound) { queue.Enqueue(line); count++; } else { count = 0; } } PrintFamilyTree(tree); }
public FactSource(XmlNode node) { this.SourceID = node.Attributes["ID"].Value; this.SourceTitle = FamilyTree.GetText(node, "TITL", true); this.Publication = FamilyTree.GetText(node, "PUBL", true); this.Author = FamilyTree.GetText(node, "AUTH", true); this.SourceText = FamilyTree.GetText(node, "TEXT", true); this.SourceMedium = FamilyTree.GetText(node, "REPO/CALN/MEDI", true); if (this.SourceMedium.Length == 0) { this.SourceMedium = FamilyTree.GetText(node, "NOTE/CONC", true); } this.Facts = new List <Fact>(); }
private void CheckValidChildrenStatus(XmlNode node) { if (Comment.Length == 0) { Comment = FamilyTree.GetNotes(node); } if (Comment.IndexOf("ignore", StringComparison.OrdinalIgnoreCase) >= 0) { this.FactErrorLevel = FactError.IGNORE; return; } bool success = false; int total, alive, dead; total = alive = dead = 0; Match matcher = regexChildren1.Match(Comment); if (matcher.Success) { success = true; int.TryParse(matcher.Groups[1].ToString(), out total); int.TryParse(matcher.Groups[2].ToString(), out alive); int.TryParse(matcher.Groups[4].ToString(), out dead); } else { matcher = regexChildren2.Match(Comment); if (matcher.Success) { success = true; int.TryParse(matcher.Groups[1].ToString(), out total); int.TryParse(matcher.Groups[3].ToString(), out alive); int.TryParse(matcher.Groups[4].ToString(), out dead); } } if (success) { if (total == alive + dead) { return; } this.FactErrorMessage = "Children status total doesn't equal numbers alive plus numbers dead."; } else { this.FactErrorMessage = "Children status doesn't match valid pattern Total x, Alive y, Dead z"; } this.FactErrorNumber = (int)FamilyTree.Dataerror.CHILDRENSTATUS_TOTAL_MISMATCH; this.FactErrorLevel = FactError.ERROR; }
private void ChooseParentOccupations(FamilyTree familyTree, BirthCircumstance birthCircumstance) { var availableOccupations = occupations.Where(x => x.MatchAnyTags(birthCircumstance.ParentProfessions)).ToList(); if (availableOccupations.Empty()) { availableOccupations.Add(Occupation.Unemployed()); } var fatherOccupation = availableOccupations.ChooseOne(); var motherOccupation = availableOccupations.ChooseOne(); familyTree.Father.Add(fatherOccupation); familyTree.Mother.Add(motherOccupation); }
public ActionResult addNode(FamilyTree.Models.Node node) { if (node.Mother == "None") { node.Mother = null; } if (node.Father == "None") { node.Father = null; } db.Nodes.Add(node); db.SaveChanges(); string treeName = db.Trees.Where(x => x.Id == node.TreeId).ToList()[0].TreeName; return RedirectToAction("Tree", new { Id = treeName }); }
public static void Main(string[] args) { var targetPerson = Console.ReadLine(); FamilyTree.Create(); var information = new List <string>(); string info; while ((info = Console.ReadLine()) != "End") { information.Add(info); } var newMembers = new List <string>(information.Where(s => !s.Contains('-'))); foreach (var member in newMembers) { var parts = member.Split(' '); var birthDate = DateTime.ParseExact(parts.Last(), "d/M/yyyy", CultureInfo.InvariantCulture); var name = string.Join(" ", parts.Take(parts.Length - 1)); FamilyTree.AddMember(new Person(name, birthDate)); } FamilyTree.SetTargetMember(targetPerson); var relations = new List <string>(information.Where(s => s.Contains('-'))); foreach (var relation in relations) { FamilyTree.AddRelation(relation); } Console.WriteLine(FamilyTree.TargetMember); Console.WriteLine("Parents:"); Console.WriteLine(String.Join(Environment.NewLine, FamilyTree.TargetMember.FamilyInfo.Parents)); Console.WriteLine("Children"); Console.WriteLine(String.Join(Environment.NewLine, FamilyTree.TargetMember.FamilyInfo.Children)); }
static void Main(string[] args) { family = new FamilyTree(); Person person = GetPerson(Console.ReadLine()); family.AddToFamily(person); AddMoreToFamily(); DeleteIncompleteData(); Person extractedPerson = ExtractThisGuyFromFamily(person); Console.WriteLine(extractedPerson.ToString()); PrintAllParents(person); PrintAllChiildren(person); }
public FactSource(XmlNode node) { bool noteRead = false; SourceID = node.Attributes["ID"].Value; SourceTitle = FamilyTree.GetText(node, "TITL", true); Publication = FamilyTree.GetText(node, "PUBL", true); Author = FamilyTree.GetText(node, "AUTH", true); SourceText = FamilyTree.GetText(node, "TEXT", true); if (string.IsNullOrEmpty(SourceText)) { SourceText = FamilyTree.GetText(node, "NOTE", true); noteRead = true; } SourceMedium = FamilyTree.GetText(node, "REPO/CALN/MEDI", true); if (!noteRead && SourceMedium.Length == 0) { SourceMedium = FamilyTree.GetText(node, "NOTE/CONC", true); } Facts = new List <Fact>(); }
public FamilyTree GetFamilies() { FamilyTree christmasPickList = new FamilyTree(); PersonCollection milwaukeeGehredParents = new PersonCollection(new Person("Bob", "Gehred", new DateTime(1972, 7, 27), "21111111-2222-3333-4444-555555555555"), new Person("Angie", "Gehred", new DateTime(1971, 9, 26), "11111111-2222-3333-4444-555555555555")); PersonCollection milwaukeeGehredKids = new PersonCollection(); milwaukeeGehredKids.Add(new Person("Maxwell", "Gehred", new DateTime(2001, 9, 30), "31111111-2222-3333-4444-555555555555")); milwaukeeGehredKids.Add(new Person("Charlotte", "Gehred", new DateTime(2005, 4, 21), "41111111-2222-3333-4444-555555555555")); Family milwaukeeGehreds = new Family("milwaukeeGehreds", milwaukeeGehredParents, milwaukeeGehredKids); PersonCollection tosaGehredParents = new PersonCollection(new Person("John", "Gehred", new DateTime(1961, 2, 16), "13111111-2222-3333-4444-555555555555"), new Person("Ann", "Gehred", new DateTime(1961, 5, 17), "12111111-2222-3333-4444-555555555555")); PersonCollection tosaGehredKids = new PersonCollection(); tosaGehredKids.Add(new Person("Madeline", "Gehred", new DateTime(1994, 4, 12), "14111111-2222-3333-4444-555555555555")); tosaGehredKids.Add(new Person("Cecila", "Gehred", new DateTime(1997, 10, 12), "15111111-2222-3333-4444-555555555555")); Family tosaGehreds = new Family("tosaGehreds", tosaGehredParents, tosaGehredKids); christmasPickList.Add(milwaukeeGehreds); christmasPickList.Add(tosaGehreds); return christmasPickList; }
public bool RestoreDatabase(IProgress <string> outputText) { bool result = true; try { // finally check for updates //restoring = true; CheckDatabaseVersion(ProgramVersion); //restoring = false; FamilyTree ft = FamilyTree.Instance; if (ft.DataLoaded) { return(FamilyTree.LoadGeoLocationsFromDataBase(outputText)); } } catch (Exception) { result = false; } return(result); }
public ParentChildRule(FamilyTree family) { mFamily = family; }
public void TestFamilyTreeCompareShouldNotBeEqualBecauseFamilyNamesAreDifferent() { FamilyTree oneFamilyTree = new FamilyTree(); oneFamilyTree.Add(this.CreateTestGehredFamily()); FamilyTree twoFamilyTree = new FamilyTree(); twoFamilyTree.Add(this.CreateTosaGehredFamily()); bool actual = (oneFamilyTree != twoFamilyTree); Assert.IsTrue(actual); }
public ActionResult addTree(FamilyTree.Models.Trees model) { db.Trees.Add(model.add); db.SaveChanges(); return RedirectToAction("Index"); }
public void Push(FamilyTree ft) { FML_Name fm = new FML_Name(); fm.LastName = ft.LastName; fm.MiddleName = ft.MiddleName; fm.FirstName = ft.FirstName; stk.Push(fm); }
public SpouseRule(FamilyTree family) { mFamily = family; }
public KidListRuleProvider(FamilyTree family, XMasArchive archive, int years) { mFamily = family; mArchive = archive; mYearsBack = years; }
/**************************************************************************/ public Collection<FamilyTree> GetBack() { if (FT2.Count == 0) return null; FamilyTree f1 = new FamilyTree(); int parentID = FT2[0].ParentID; fm.Pop(); FT2.Clear(); if (parentID < 1) { FT2.Add(FT[0]); return FT2; } foreach (FamilyTree f in FT) if (f.ID == parentID) { f1 = f; break; } foreach (FamilyTree f in FT) if (f.ParentID == f1.ParentID) FT2.Add(f); return FT2; }
public void DoFML(FamilyTree ft) { stk = new Stack<FML_Name>(); Push(ft); }
protected FamilyTree CreateFamilyTree() { FamilyTree testFamilyTree = new FamilyTree(); testFamilyTree.Add(CreateMilwaukeeGehredFamily()); testFamilyTree.Add(CreateTosaGehredFamily()); return testFamilyTree; }
/*****************************************************************************************************/ protected void DoInsert_Click(object sender, EventArgs e) { int result = 0; string temp = ""; FamilyTree ft = new FamilyTree(); temp = InsertParentIDTextBox.Text; int.TryParse(temp, out result); ft.ParentID = result; ft.FirstName = InsertFirstNameTextBox.Text; ft.MiddleName = InsertMiddleNameTextBox.Text; ft.LastName = InsertLastNameTextBox.Text; temp = InsertBirthDateTextBox.Text; int.TryParse(temp, out result); ft.BirthDate = result; temp = InsertDeathDateTextBox.Text; int.TryParse(temp, out result); ft.DeathDate = result; string m_connectionString = ConfigurationManager.ConnectionStrings["connection_string"].ConnectionString; CustomAdapter ca = new CustomAdapter(); ca.UpdateFTRecord(m_connectionString, ft); }
public SiblingRule(FamilyTree family) { mFamily = family; }