private void button4_Click(object sender, EventArgs e) { PersonListe testdatenListe = new PersonListe(); listSample.DisplayMember = "Vorname"; listSample.DataSource = testdatenListe.PersonenListe; comboBoxSample.DataSource = testdatenListe.PersonenListe; comboBoxSample.DisplayMember = "Vorname"; //Vorauswahl auf das oberste Element der ComboBox Liste comboBoxSample.SelectedIndex = 0; PersonListe testdatenListe1 = new PersonListe(); listSample2.DisplayMember = "KompletterName"; listSample2.DataSource = testdatenListe1.PersonenListe; PersonListe testdatenListe2 = new PersonListe(); comboBoxSample2.DataSource = testdatenListe2.PersonenListe; comboBoxSample2.DisplayMember = "Vorname"; //Vorauswahl auf das oberste Element der ComboBox Liste comboBoxSample2.SelectedIndex = 0; //Direkte Manipulation in der Liste (wenn DataSource nicht verwendet wird)! listBox5.Items.Add("weiterer Listeneintrag"); listBox5.Items.RemoveAt(0); }
public void Deserialize() { AbschlussListe.SetInstance(AbschlussListe); AdressListe.SetInstance(AdressListe); PersonListe.SetInstance(PersonListe); KursListe.SetInstance(KursListe); StudiengangListe.SetInstance(StudiengangListe); }
public object Clone() { Abschluss abschluss = (Abschluss)Abschluss.Clone(); SemesterListe semesterListe = (SemesterListe)SemesterListe.Clone(); PersonListe studentListe = (PersonListe)StudentListe.Clone(); return(new Studiengang(Name, abschluss, ECTS, semesterListe, studentListe)); }
public Studiengang(string name, Abschluss abschluss, int ects, SemesterListe semesterListe, PersonListe studentListe) { Name = name; Abschluss = abschluss; ECTS = ects; SemesterListe = semesterListe; StudentListe = studentListe; }
public Studiengang(string name, Abschluss abschluss, string ects, SemesterListe semesterListe, PersonListe studentListe) { Name = name; Abschluss = abschluss; if (int.TryParse(ects, out int result)) { ECTS = int.Parse(ects); } SemesterListe = semesterListe; StudentListe = studentListe; }
static void main(string[] args) { //Test av personliste PersonListe personListe = new PersonListe(); //Test personer Person p1 = new Person("John", "Doe", "Riverside Chapel", 27, 44223322); Person p2 = new Person("John", "Doe", "Riverside Chapel", 27, 44223322); Person p3 = new Person("Solid", "Snake", "Shadow Moses Island", 25, 14185); Person p4 = new Person("Nathan", "Drake", "Pirat`s Cove", 30, 1337); //Sjekker at det ikke legges til duplikater personListe.leggTil(p1); personListe.leggTil(p2); personListe.leggTil(p3); personListe.leggTil(p4); //Test av finnes funksjonen Console.WriteLine("Finnes Stian Eriksen: " + personListe.finnes("Stian", "Eriksen")); Console.WriteLine("Finnes Nathan Drake: " + personListe.finnes("Nathan", "Drake")); Console.WriteLine(personListe.getPerson(0).getInfo()); Console.WriteLine($"Antall i listen: {personListe.antall()}"); //Test av slett funksjonen personListe.slett("Crash", "Bandicoot"); personListe.slett("Nathan", "Drake"); Console.WriteLine($"Antall i listen: {personListe.antall()}"); Console.WriteLine("\n\n"); Console.WriteLine(personListe.printListe()); Console.ReadKey(); FilProgrammering fp = new FilProgrammering(); fp.lagFilOgMappe(); fp.sjekkBilderMappe(); Console.ReadKey(); Person pf1 = new Person("Nathan2", "Drake3", "Pirat`s Cove", 30, 1337); Person pf2 = new Person("Nathan3", "Drake3", "Pirat`s Cove", 30, 1337); Person pf3 = new Person("Nathan3", "Drake3", "Pirat`s Cove", 30, 1337); Person pf4 = new Person("Nathan4", "Drake4", "Pirat`s Cove", 30, 1337); personListe.leggTilFlere(pf1, pf2, pf3, pf4); Console.WriteLine($"Antall i listen: {personListe.antall()}"); Console.WriteLine("\n\n"); Console.WriteLine(personListe.printListe()); Console.ReadKey(); Calculator test = new Calculator(); Console.WriteLine(test.add(4, 5, 6, 7, 32, 6, 7)); Console.WriteLine(test.multiply(5, 3, 5)); Console.ReadKey(); Kunde kunde = new Kunde(pf1, 1, KundeType.Standard); Ordre ordre1 = new Ordre(120, 4, "Stol"); Ordre ordre2 = new Ordre(300, 1, "Bord"); Ordre ordre3 = new Ordre(100, 2, "Lampe"); kunde.leggTilOrdre(ordre1, ordre2, ordre3); kunde.printOrdre(); Console.ReadKey(); }