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(); } }
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(); } }
public bool NameAvailable(Person per) { var pers = this._db.Query<Person>(n => n.Name == per.Name).Where(n => n != per); return pers.Any(); }
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; }
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; }
public AddPersonForm(Database db, Person oldPerson) { InitializeComponent(); this.oldPerson = oldPerson; this.db = db; }