Esempio n. 1
0
 private void btnSelectParents_Click(object sender, EventArgs e)
 {
     var list = new MarriageRepository().FindAll(fetchExtensions: true);
     var form = new SelectorUI<Marriage>(list);
     form.ShowDialog();
     var selectedItem = form.SelectedItem;
     if (selectedItem != null)
         this.ParentsMarriage = selectedItem;
     UpdateRelationshipsView();
 }
Esempio n. 2
0
 public Person FindPartner(Person person)
 {
     var marriage = new MarriageRepository().FindByPerson(person);
     if(marriage != null)
     {
         var partnerId = marriage.husband_id;
         if (partnerId == person.id)
             partnerId = marriage.wife_id;
         var partner = DB.Database.GetDatabase().FetchBy<Person>(sql => sql.Where(x => x.id.Equals(partnerId))).FirstOrDefault();
         return partner;
     }
     else
     {
         return null;
     }
 }
Esempio n. 3
0
        public Person FindPartner(Person person)
        {
            var marriage = new MarriageRepository().FindByPerson(person);

            if (marriage != null)
            {
                var partnerId = marriage.husband_id;
                if (partnerId == person.id)
                {
                    partnerId = marriage.wife_id;
                }
                var partner = DB.Database.GetDatabase().FetchBy <Person>(sql => sql.Where(x => x.id.Equals(partnerId))).FirstOrDefault();
                return(partner);
            }
            else
            {
                return(null);
            }
        }
        public string GetAllItemsAsJson()
        {
            var persons = new PersonRepository().FindAll();
            var marriages = new MarriageRepository().FindAll();
            var marriageSons = new MarriageSonRepository().FindAll();

            int counter = 0;
            var personsAsJs = GetPersonsAsJsNodes( persons, ref counter);
            var marriagesAsJs = GetMarriagesAsJsNodes(marriages, ref counter);

            var nodesAsJs = new List<string>();
            nodesAsJs.AddRange(personsAsJs.Select(x => x.Value.Item2));
            nodesAsJs.AddRange(marriagesAsJs.Select(x => x.Value.Item2));

            var linksAsJs = GetLinksAsJs(marriageSons, marriages, personsAsJs, marriagesAsJs);

            var fullJs = String.Format(@"{{""directed"": true, ""graph"": [], ""nodes"": [{0}] , ""links"": [{1}] , ""multigraph"": false}}",
                           String.Join(",\r\n", nodesAsJs),
                           String.Join(",\r\n", linksAsJs));
            return fullJs;
        }