private void buttonCreate_Click(object sender, EventArgs e) { string name = this.textBoxName.Text; int pcn = Convert.ToInt32(this.textBoxPCN.Text); int age = Convert.ToInt32(this.textBoxAge.Text); string country = this.textBoxCountry.Text; int salary = Convert.ToInt32(this.textBoxSalary.Text); listBoxAllPersons.Items.Add(name); listBoxAllPersons.SelectedIndex = listBoxAllPersons.Items.Count - 1; if (radioButtonPerson.Checked) { persons.Add(new Person(name, pcn, age)); LogPersonChange("CREATED PERSON :"); } else if (radioButtonStudent.Checked) { persons.Add(new Student(name, pcn, age, country)); LogPersonChange("CREATED STUDENT :"); } else { Teacher t = new Teacher(name, pcn, age, Function.JUNIOR_DOCENT, salary); persons.Add(t); LogPersonChange("CREATED TEACHER :"); t.SetRetirementListener(this); } }