コード例 #1
0
        private void OpenAddPeopleForm(object sender, RoutedEventArgs e)
        {


            AddPersonForm apf = new AddPersonForm(db,new Person());
            var pp = new Person() { Children = new List<IGeneticTreeNode>(), DateOfBirth = new DateTime() };
            apf.DataContext = pp;
            apf.ShowDialog();
            if (apf.DialogResult == true)
            {
                this.db.GetDatabaseInstance().Store(pp);
                LoadEntities();
            }
        }
コード例 #2
0
 private void OpenEditPeopleForm(object sender, RoutedEventArgs e)
 {
    
     var ppedit = (Person)dgrid.SelectedItem;
     var ppcopy = new Person() { Children = ppedit.Children, DateOfBirth = ppedit.DateOfBirth, DateOfDead = ppedit.DateOfDead, Name = ppedit.Name, Sex = ppedit.Sex };
     AddPersonForm apf = new AddPersonForm(db, ppedit);
     apf.DataContext = ppcopy;
     apf.Title = "Edycja osoby";
     apf.ShowDialog();
     if (apf.DialogResult == true)
     {
         ppedit.Name = ppcopy.Name;
         ppedit.Sex = ppcopy.Sex;
         ppedit.DateOfBirth = ppcopy.DateOfBirth;
         ppedit.DateOfDead = ppcopy.DateOfDead;
         db.GetDatabaseInstance().Store(ppedit);
         LoadEntities();
     }
 }
コード例 #3
0
        public bool NameAvailable(Person per)
        {
            var pers = this._db.Query<Person>(n => n.Name == per.Name).Where(n => n != per);

            return pers.Any();
        }
コード例 #4
0
        public bool ChangeDateOfDead(DateTime? newDate, IGeneticTreeNode person)
        {
            var parent = new Person()
            {
                DateOfBirth = person.DateOfBirth,
                DateOfDead = newDate,
            };

            if (person.Children != null)
            {
                if (person.Children.Any(child => !CheckChildRelation(child, parent)))
                {
                    return false;
                }
            }

            person.DateOfDead = newDate;
            return true;
        }
コード例 #5
0
        public bool ChangeDateOfBirth(IGeneticTreeNode person)
        {
            var parent = new Person()
            {
                DateOfBirth = person.DateOfBirth,
                DateOfDead = person.DateOfDead,
            };

            if (person.Children != null)
            {
                if (person.Children.Any(child => !CheckPartensDateOfBirth(parent, child)))
                {
                    return false;
                }
            }

            return true;
        }
コード例 #6
0
 public AddPersonForm(Database db, Person oldPerson)
 {
     InitializeComponent();
     this.oldPerson = oldPerson;
     this.db = db;
 }