internal void Show(FamilyTree familytree) { foreach (IPerson p in familytree.Tree) { Console.WriteLine(); Console.WriteLine($"Fullname - {p.Name} "); Console.WriteLine($"Year of birth - {p.Year} "); Console.WriteLine($"Wife(husband) - {p.Wifename} "); Console.WriteLine($"Family role - {p.MemberRole} "); Console.WriteLine("---------------------------------"); } Console.ReadKey(true); }
public void NewMember(FamilyTree familyTree, IMessage message) { bool cykle = true; int selectNumber = 0; while (cykle) { message.SendClientMessage("Выберете родственника"); ClientMessage.AllRelationsMessage(dictionary.relations); string num = Console.ReadLine(); Validation.validation(num, out cykle, out selectNumber, dictionary.relations, message); } var chooseFamilyMember = new Agregator(); chooseFamilyMember.Agregat(selectNumber, familyTree, message); return; }
internal void Agregat(int selectnumber, FamilyTree familyTree, IMessage message) { FamilyRol familyRol = (FamilyRol)selectnumber; var instance = new NewPeson(); switch (familyRol) { case FamilyRol.grandfather: NewPeson.CreateNewMember(out string name, out int year, out string wifename); MemberFamile = new Grandfather(name, year, wifename, "GrandFather"); familyTree.Tree.Add(MemberFamile); break; case FamilyRol.grandmother: NewPeson.CreateNewMember(out name, out year, out wifename); MemberFamile = new Grandmother(name, year, wifename, "GrandMother"); familyTree.Tree.Add(MemberFamile); break; case FamilyRol.mother: NewPeson.CreateNewMember(out name, out year, out wifename); MemberFamile = new Mother(name, year, wifename, "Mother"); familyTree.Tree.Add(MemberFamile); break; case FamilyRol.father: NewPeson.CreateNewMember(out name, out year, out wifename); MemberFamile = new Father(name, year, wifename, "Father"); familyTree.Tree.Add(MemberFamile); break; case FamilyRol.brother: NewPeson.CreateNewMember(out name, out year, out wifename); MemberFamile = new Brother(name, year, wifename, "Brother"); familyTree.Tree.Add(MemberFamile); break; case FamilyRol.sister: NewPeson.CreateNewMember(out name, out year, out wifename); MemberFamile = new Sister(name, year, wifename, "Sister"); familyTree.Tree.Add(MemberFamile); break; case FamilyRol.aunt: NewPeson.CreateNewMember(out name, out year, out wifename); MemberFamile = new Aunt(name, year, wifename, "Aunt"); familyTree.Tree.Add(MemberFamile); break; case FamilyRol.daughter: NewPeson.CreateNewMember(out name, out year, out wifename); MemberFamile = new Daughter(name, year, wifename, "Daughter"); familyTree.Tree.Add(MemberFamile); break; case FamilyRol.son: NewPeson.CreateNewMember(out name, out year, out wifename); MemberFamile = new Son(name, year, wifename, "Son"); familyTree.Tree.Add(MemberFamile); break; case FamilyRol.me: NewPeson.CreateNewMember(out name, out year, out wifename); MemberFamile = new Me(name, year, wifename, "Me"); familyTree.Tree.Add(MemberFamile); break; case FamilyRol.unkle: NewPeson.CreateNewMember(out name, out year, out wifename); MemberFamile = new Uncle(name, year, wifename, "Uncle"); familyTree.Tree.Add(MemberFamile); break; case FamilyRol.wife: NewPeson.CreateNewMember(out name, out year, out wifename); MemberFamile = new Wife(name, year, wifename, "Wife"); familyTree.Tree.Add(MemberFamile); break; } return; }
public Display() { FamilyTree = new FamilyTree(); Message = new ClientMessage(); ShowTree = new ShowTree(); }