示例#1
0
 private void btnSelectPartner_Click(object sender, EventArgs e)
 {
     var list = new PersonRepository().FindAll();
     var form = new SelectorUI<Person>(list);
     form.ShowDialog();
     var selectedItem = form.SelectedItem;
     if (selectedItem != null)
         this.PersonMarriage = new Marriage(this.Person, selectedItem);
     UpdateRelationshipsView();
 }
示例#2
0
        private void lnkSelectAndEditPerson_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            // first select the person:
            var persons = new PersonRepository().FindAll();
            var form = new GUI.SelectorUI<Person>(persons);
            form.ShowDialog();
            var selectedPerson = form.SelectedItem;

            // then edit this person:
            var personUI = new GUI.PersonUI(selectedPerson);
            personUI.Show();
        }
        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;
        }