/// <summary> /// Takes an datatable and an instance of the CRUD class and creates a list of peoples from the rows in datatable. /// Printing them out by calling on PrintListOfPersons. /// </summary> /// <param name="dt">Takes an DataTable as inparameter</param> /// <param name="crud">Takes an instance of Crud class as inparameter</param> /// <param name="removePerson">Optional! True if you are gonna use this for removing a person, else false</param> /// <param name="isAddParentChoice">Optional! True if you are gonna use this for adding a parent, else false</param> /// <param name="editPerson">Optional! True if you are gonna use this for editing a person, else false</param> /// <returns></returns> private int ListPerson(DataTable dt, Crud crud, bool removePerson = false, bool isAddParentChoice = false, bool editPerson = false) { /******************************************************************* * LISTPERSON() - PRIVATE *******************************************************************/ List <int> fullIdList = new List <int>(); List <Relative> persons = new List <Relative>(); foreach (DataRow row in dt.Rows) { persons.Add(crud.CreatePersonFromQuery(row)); fullIdList.Add(Convert.ToInt32(row["id"])); } return(PrintListOfPersons(persons, fullIdList, removePerson, isAddParentChoice, editPerson)); }