/**************************************************************************************************/ public List<Person> AddParents(Person p, PedigreeModel model) { List<Person> retval = new List<Person>(); int nextID = GetNewRelativeID(); Person newMom = new Person(this); newMom.HraState = RiskApps3.Model.HraObject.States.Ready; newMom.relativeID = nextID; newMom.motherID = 0; newMom.fatherID = 0; newMom.owningFHx = this; //p.Person_motherID = newMom.relativeID; p.motherID = newMom.relativeID; newMom.vitalStatus = "Alive"; newMom.gender = "Female"; newMom.relationship = "Other"; Relationship.SetRelationshipByParentType(GenderEnum.Female, Relationship.Parse(p.relationship), Bloodline.Parse(p.bloodline), out newMom.relationship, out newMom.relationshipOther, out newMom.bloodline); if (model != null) { foreach (PedigreeIndividual pi in model.individuals) { if (pi.HraPerson == p) { double x = pi.point.x; double y = pi.point.y - model.parameters.verticalSpacing; x += (model.parameters.horizontalSpacing / 2); newMom.x_position = model.displayXMax / x; newMom.y_position = model.displayYMax / y; newMom.x_norm = (int)(x - (model.displayXMax / 2)); newMom.y_norm = (int)(y - (model.displayYMax / 2)); break; } } } this.AddToList(newMom, new HraModelChangedEventArgs(null)); retval.Add(newMom); nextID = GetNewRelativeID(); Person newDad = new Person(this); newDad.HraState = RiskApps3.Model.HraObject.States.Ready; newDad.relativeID = nextID; newDad.motherID = 0; newDad.fatherID = 0; newDad.owningFHx = this; newDad.relationship = "Other"; //p.Person_fatherID = newDad.relativeID; p.fatherID = newDad.relativeID; newDad.vitalStatus = "Alive"; newDad.gender = "Male"; Relationship.SetRelationshipByParentType(GenderEnum.Male, Relationship.Parse(p.relationship), Bloodline.Parse(p.bloodline), out newDad.relationship, out newDad.relationshipOther, out newDad.bloodline); if (model != null) { foreach (PedigreeIndividual pi in model.individuals) { if (pi.HraPerson == p) { double x = pi.point.x; double y = pi.point.y - model.parameters.verticalSpacing; x -= (model.parameters.horizontalSpacing / 2); newDad.x_position = model.displayXMax / x; newDad.y_position = model.displayYMax / y; newDad.x_norm = (int)(x - (model.displayXMax / 2)); newDad.y_norm = (int)(y - (model.displayYMax / 2)); break; } } } this.AddToList(newDad, new HraModelChangedEventArgs(null)); retval.Add(newDad); HraModelChangedEventArgs args = new HraModelChangedEventArgs(null); args.updatedMembers.Add(p.GetMemberByName("motherID")); args.updatedMembers.Add(p.GetMemberByName("fatherID")); p.SignalModelChanged(args); return retval; }